@ledvance/base 1.2.3 → 1.2.4
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
|
@@ -51,7 +51,7 @@ export declare function useGroupConfig<T>(): [T, (dps: any, newConfig: T) => Pro
|
|
|
51
51
|
* @param dpKey
|
|
52
52
|
*/
|
|
53
53
|
export declare function useGroupConfigFeature<GC, GCPT extends PropertyValueTypes<GC>>(key: keyof GC, dpKey?: string): [GCPT | undefined, (value: GCPT, dpValue: any, extraDps?: any, extraConfig?: any) => Promise<Result<any>>];
|
|
54
|
-
export declare function useFeatureHook<GC, T extends PropertyValueTypes<GC>>(featureKey: keyof GC, defValue: T, valueMapToDpValue?: (v: T) => any,
|
|
54
|
+
export declare function useFeatureHook<GC, T extends PropertyValueTypes<GC>>(featureKey: keyof GC, defValue: T, valueMapToDpValue?: (v: T) => any, getExtraDps?: (v: T) => any, getExtraConfig?: (v: T) => any): [T, (value: T) => Promise<Result<any>>];
|
|
55
55
|
export declare const useFanMaxSpeed: () => 3 | 20;
|
|
56
56
|
export declare const isUVCFanDevice: () => boolean;
|
|
57
57
|
export declare const ldvModules: import("@reduxjs/toolkit").Reducer<NativeProps, import("@reduxjs/toolkit").AnyAction>;
|
|
@@ -276,10 +276,18 @@ export function useGroupConfigFeature<GC, GCPT extends PropertyValueTypes<GC>>
|
|
|
276
276
|
return [groupConfig[key] as (GCPT | undefined), setGroupConfigFeature]
|
|
277
277
|
}
|
|
278
278
|
|
|
279
|
-
export function useFeatureHook<GC, T extends PropertyValueTypes<GC>>(
|
|
279
|
+
export function useFeatureHook<GC, T extends PropertyValueTypes<GC>>(
|
|
280
|
+
featureKey: keyof GC,
|
|
281
|
+
defValue: T,
|
|
282
|
+
valueMapToDpValue?: (v: T) => any,
|
|
283
|
+
getExtraDps?: (v: T) => any,
|
|
284
|
+
getExtraConfig?: (v: T) => any,
|
|
285
|
+
): [T, (value: T) => Promise<Result<any>>] {
|
|
280
286
|
const [featureHook, setFH] = useGroupConfigFeature<GC, T>(featureKey)
|
|
281
287
|
const setFeatureHook = useCallback(async (value: T) => {
|
|
282
288
|
const dpValue = valueMapToDpValue ? valueMapToDpValue(value) : value
|
|
289
|
+
const extraDps = getExtraDps ? getExtraDps(value) : undefined
|
|
290
|
+
const extraConfig = getExtraConfig ? getExtraConfig(value) : undefined
|
|
283
291
|
return await setFH(value, dpValue, extraDps, extraConfig)
|
|
284
292
|
}, [setFH])
|
|
285
293
|
return [featureHook || defValue, setFeatureHook]
|