@ledvance/base 1.1.87 → 1.1.89

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/base",
5
5
  "pid": [],
6
6
  "uiid": "",
7
- "version": "1.1.87",
7
+ "version": "1.1.89",
8
8
  "scripts": {},
9
9
  "dependencies": {
10
10
  "@reduxjs/toolkit": "^1.8.6",
@@ -52,6 +52,9 @@ export declare class NativeApi {
52
52
  static deleteDevice(deviceId: string, isReset: boolean): Promise<NativeResult<any>>;
53
53
  static renameDevice(deviceId: string, name: string): Promise<NativeResult<any>>;
54
54
  static toDeviceSettingsPage(deviceId: string, isGroup?: boolean): void;
55
+ static toRoutinesPage(params: {
56
+ backTitle: string;
57
+ }): void;
55
58
  static putJson(deviceId: string, featureType: string, json: string): Promise<Result<any>>;
56
59
  static getJson(deviceId: string, featureType: string): Promise<Result<any>>;
57
60
  static groupControl(tyGroupId: number, dps: string, config: string): Promise<Result<any>>;
package/src/api/native.ts CHANGED
@@ -21,6 +21,7 @@ interface LDVDevicePanelManager {
21
21
  putFeature: (deviceId: string, featureId: string, value: any, callback: (res: NativeResult<string>) => void) => void
22
22
  getGroupDevices: (tyGroupId: number) => Promise<NativeResult<string>>
23
23
  getSystemTimeFormat: () => Promise<number>
24
+ getMicrophoneAccess: (res:any) => Promise<Result<any>>
24
25
  }
25
26
 
26
27
  export enum UADeviceCategory {
@@ -350,3 +351,15 @@ export const getSystemTimeFormat = async (): Promise<number> => {
350
351
  return 24
351
352
  }
352
353
  }
354
+
355
+ export const getMicrophoneAccess: () => Promise<boolean> = () => {
356
+ return new Promise((resolve, _reject) => {
357
+ devicePanel.getMicrophoneAccess(res => {
358
+ const haveAuthority = (typeof res?.data === 'string') ? !!res?.data && JSON.parse(res?.data)?.haveAuthority : res?.data?.haveAuthority
359
+ if(!res.result || (res.result && haveAuthority !== 'granted')){
360
+ resolve(false)
361
+ }
362
+ resolve(true)
363
+ })
364
+ })
365
+ }
@@ -1,2 +1,3 @@
1
+ export declare const nativeEventEmitter: import("react-native").EventEmitter;
1
2
  export declare const addListener: (store: any) => void;
2
3
  export declare const removeListener: () => void;
@@ -2,6 +2,8 @@ export interface ColorAdjustViewProps {
2
2
  h: number;
3
3
  s: number;
4
4
  v: number;
5
+ minBrightness?: number;
6
+ reserveSV?: boolean;
5
7
  onHSVChange?: (h: number, s: number, v: number) => void;
6
8
  onHSVChangeComplete: (h: number, s: number, v: number) => void;
7
9
  }
@@ -1,6 +1,7 @@
1
1
  export interface ColorTempAdjustViewProps {
2
2
  colorTemp: number;
3
3
  brightness: number;
4
+ minBrightness?: number;
4
5
  isSupportTemperature: boolean;
5
6
  isSupportBrightness: boolean;
6
7
  onCCTChange?: (cct: number) => void;
@@ -0,0 +1,38 @@
1
+ export declare type Node = {
2
+ color: string;
3
+ backgroundColor?: string;
4
+ };
5
+ interface DrawToolViewProps {
6
+ switchLed?: boolean;
7
+ showEnable?: boolean;
8
+ setEnable: (enable: boolean) => void;
9
+ adjustType?: number;
10
+ setAdjustType: (type: number) => void;
11
+ stripStyle?: 'ONLY_LINE' | 'WITH_BEAD';
12
+ nodes: Node[];
13
+ fixCount?: number;
14
+ nodeTouch: (idx: number) => void;
15
+ fingerUp: (idxList: string) => void;
16
+ hideLightView?: boolean;
17
+ isSupportColor?: boolean;
18
+ isSupportTemperature?: boolean;
19
+ isSupportBrightness?: boolean;
20
+ isColorMode?: boolean;
21
+ setIsColorMode: (isColorMode: boolean) => void;
22
+ h: number;
23
+ s: number;
24
+ v: number;
25
+ onHSVChange: (h: number, s: number, v: number) => void;
26
+ onHSVChangeComplete: (h: number, s: number, v: number) => void;
27
+ temperature: number;
28
+ brightness: number;
29
+ onCCTChange: (cct: number) => void;
30
+ onCCTChangeComplete: (cct: number) => void;
31
+ onBrightnessChange: (brightness: number) => void;
32
+ onBrightnessChangeComplete: (brightness: number) => void;
33
+ hideLedNum?: boolean;
34
+ ledNum?: number;
35
+ setLedNum: (num: number) => void;
36
+ }
37
+ declare const DrawToolView: (props: DrawToolViewProps) => JSX.Element;
38
+ export default DrawToolView;
@@ -1,6 +1,6 @@
1
1
  import { ImageStyle, StyleProp, TextStyle, ViewProps } from 'react-native';
2
2
  interface InfoTextProps extends ViewProps {
3
- icon: string;
3
+ icon: string | number;
4
4
  text: string;
5
5
  contentColor?: string;
6
6
  iconStyle?: StyleProp<ImageStyle>;
@@ -1,13 +1,10 @@
1
+ import React from 'react';
1
2
  import { ColorAdjustViewProps } from './ColorAdjustView';
2
3
  import { ColorTempAdjustViewProps } from './ColorTempAdjustView';
3
4
  interface LampConfigViewProps extends ColorAdjustViewProps, ColorTempAdjustViewProps {
4
- isRGBWLamp: boolean;
5
- isRGBLamp: boolean;
6
- isOnlyRGBLamp: boolean;
7
- isTWLamp: boolean;
8
- isDIMLamp: boolean;
9
5
  isColorMode: boolean;
6
+ isSupportColor: boolean;
10
7
  setIsColorMode: (isColorMode: boolean) => void;
11
8
  }
12
- declare const LampAdjustView: (props: LampConfigViewProps) => JSX.Element;
13
- export default LampAdjustView;
9
+ declare const _default: React.MemoExoticComponent<(props: LampConfigViewProps) => JSX.Element>;
10
+ export default _default;
@@ -2,12 +2,12 @@ import { ReactNode } from 'react';
2
2
  import { ViewStyle } from 'react-native';
3
3
  interface SegmentedItem {
4
4
  label: ReactNode;
5
- value: string;
5
+ value: string | number;
6
6
  }
7
7
  interface SegmentedProps {
8
8
  value?: string | number;
9
9
  options?: SegmentedItem[];
10
- onChange?: (v: string) => void;
10
+ onChange?: (v: string | number) => void;
11
11
  style?: ViewStyle;
12
12
  }
13
13
  declare const Segmented: (props: SegmentedProps) => JSX.Element;
@@ -0,0 +1,17 @@
1
+ import React from "react";
2
+ import { StyleProp, ViewStyle } from "react-native";
3
+ export interface StepperProps {
4
+ value: number | string;
5
+ stepValue?: number;
6
+ min?: number;
7
+ max?: number;
8
+ editable?: boolean;
9
+ selectionColor?: string;
10
+ onValueChange?: ((value: number) => void);
11
+ disabled?: boolean;
12
+ style?: StyleProp<ViewStyle>;
13
+ buttonStyle?: StyleProp<ViewStyle>;
14
+ inputStyle?: StyleProp<ViewStyle>;
15
+ }
16
+ declare const _default: React.MemoExoticComponent<(props: StepperProps) => JSX.Element>;
17
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const StripLightView: any;
2
+ export default StripLightView;
@@ -6,6 +6,7 @@ interface LdvPickerViewProps {
6
6
  setMinute: (string: any) => void;
7
7
  style?: StyleProp<ViewStyle> | undefined;
8
8
  unit?: string[];
9
+ minutesStep?: number;
9
10
  }
10
11
  declare const LdvPickerView: (props: LdvPickerViewProps) => JSX.Element;
11
12
  export default LdvPickerView;
@@ -1,10 +1,10 @@
1
1
  import _ from 'lodash'
2
- import React, {Component} from 'react'
3
- import {Provider} from 'react-redux'
4
- import {DevInfo, DpValue, Theme, TYSdk} from 'tuya-panel-kit'
5
- import {actions, store} from './models'
6
- import {addListener, removeListener} from 'api/nativeEventEmitter'
7
- import {NativeApi} from 'api/native'
2
+ import React, { Component } from 'react'
3
+ import { Provider } from 'react-redux'
4
+ import { DevInfo, DpValue, Theme, TYSdk } from 'tuya-panel-kit'
5
+ import { actions, store } from './models'
6
+ import { addListener, removeListener } from 'api/nativeEventEmitter'
7
+ import { NativeApi } from 'api/native'
8
8
  import {
9
9
  DeviceInfo,
10
10
  NativeProps,
@@ -12,7 +12,7 @@ import {
12
12
  setNativeProps,
13
13
  UAGroupInfo,
14
14
  } from './models/modules/NativePropsSlice'
15
- import {DpSchema, GlobalParams} from './models/GlobalParams'
15
+ import { DpSchema, GlobalParams } from './models/GlobalParams'
16
16
  import Connect from './components/connect'
17
17
 
18
18
  interface Props {
@@ -51,7 +51,7 @@ const theme = {
51
51
  */
52
52
  const composeLayout = (component: React.ComponentType) => {
53
53
  const NavigatorLayout = component
54
- const {dispatch} = store
54
+ const { dispatch } = store
55
55
 
56
56
  addListener(store)
57
57
 
@@ -124,7 +124,7 @@ const composeLayout = (component: React.ComponentType) => {
124
124
  const nativeProps: NativeProps = {
125
125
  deviceInfo: {
126
126
  devId: ldvDevInfo.devId,
127
- dps: {...dps, ...JSON.parse(ldvDevInfo.dps)},
127
+ dps: { ...dps, ...JSON.parse(ldvDevInfo.dps) },
128
128
  pId: ldvDevInfo.pId,
129
129
  },
130
130
  uaGroupInfo: {
@@ -134,7 +134,7 @@ const composeLayout = (component: React.ComponentType) => {
134
134
  config: {},
135
135
  },
136
136
  familyName: ldvDevInfo.familyName,
137
- role: ldvDevInfo.role
137
+ role: ldvDevInfo.role,
138
138
  }
139
139
  NativeApi.showObj(nativeProps)
140
140
  console.log('Redux 初始数据:', JSON.stringify(nativeProps))
@@ -154,12 +154,14 @@ const composeLayout = (component: React.ComponentType) => {
154
154
  },
155
155
  uaGroupInfo: {
156
156
  tyGroupId: uaGroupInfo.tyGroupId,
157
- dps: {...dps, ...JSON.parse(uaGroupInfo.dps)},
157
+ dps: { ...dps, ...JSON.parse(uaGroupInfo.dps) },
158
158
  pId: uaGroupInfo.pId,
159
- config: JSON.parse(uaGroupInfo.config || '{}'),
159
+ config: {
160
+ ...JSON.parse(uaGroupInfo.config || '{}'),
161
+ },
160
162
  },
161
163
  familyName: uaGroupInfo.familyName,
162
- role: uaGroupInfo.role
164
+ role: uaGroupInfo.role,
163
165
  }
164
166
  NativeApi.showObj(nativeProps)
165
167
  console.log('Redux 初始数据:', JSON.stringify(nativeProps))
@@ -191,7 +193,7 @@ const composeLayout = (component: React.ComponentType) => {
191
193
  <Provider store={store}>
192
194
  <Theme theme={theme}>
193
195
  <Connect mapStateToProps={_.identity}>
194
- {({mapStateToProps, ...props}: { mapStateToProps: any; [_: string]: any }) => {
196
+ {({ mapStateToProps, ...props }: { mapStateToProps: any; [_: string]: any }) => {
195
197
  return <NavigatorLayout {...props} />
196
198
  }}
197
199
  </Connect>