From 1fd28d519917dc1731e56d02eaacd1c0c6e54986 Mon Sep 17 00:00:00 2001 From: chenbenzhi Date: Tue, 17 Jun 2025 10:40:24 +0800 Subject: [PATCH] arkts1.2 support makeobserved/getTarget Signed-off-by: chenbenzhi --- api/@ohos.arkui.stateManagement.d.ets | 3 +- api/arkui/stateManagement/decorator.d.ets | 5 --- api/arkui/stateManagement/utils.d.ets | 51 +++++++++++++++++++++++ 3 files changed, 53 insertions(+), 6 deletions(-) create mode 100644 api/arkui/stateManagement/utils.d.ets diff --git a/api/@ohos.arkui.stateManagement.d.ets b/api/@ohos.arkui.stateManagement.d.ets index 02653fb237..c269289b27 100644 --- a/api/@ohos.arkui.stateManagement.d.ets +++ b/api/@ohos.arkui.stateManagement.d.ets @@ -22,4 +22,5 @@ export * from './arkui/stateManagement/decorator'; export * from './arkui/stateManagement/runtime'; export * from './arkui/stateManagement/storage/appStorage'; -export * from './arkui/stateManagement/storage/localStorage'; \ No newline at end of file +export * from './arkui/stateManagement/storage/localStorage'; +export * from './arkui/stateManagement/utils'; \ No newline at end of file diff --git a/api/arkui/stateManagement/decorator.d.ets b/api/arkui/stateManagement/decorator.d.ets index fd7219e092..a626dc9e89 100644 --- a/api/arkui/stateManagement/decorator.d.ets +++ b/api/arkui/stateManagement/decorator.d.ets @@ -77,11 +77,6 @@ export declare @interface Watch { @Retention({policy: "SOURCE"}) export declare @interface Require {}; -export declare class UIUtils { - static getTarget(source: T): T; - static makeObserved(source: T): T; -} - export declare interface IDecoratedVariable { readonly varName: string; } diff --git a/api/arkui/stateManagement/utils.d.ets b/api/arkui/stateManagement/utils.d.ets new file mode 100644 index 0000000000..a764b6d316 --- /dev/null +++ b/api/arkui/stateManagement/utils.d.ets @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkUI + * @arkts 1.2 + */ + +/** + * UIUtils is a state management tool class for operating the observed data. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare class UIUtils { + /** + * Get raw object from the Object, like builtin type, objectLiteral. + * If input parameter is a regular Object without proxy, return Object itself. + * + * @param { T } source input source Object data. + * @returns { T } raw object. + * @static + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + static getTarget(source: T): T; + + /** + * Make non-observed data into observed data. + * Support builtin type and objectLiteral. + * + * @param { T } source input source object data. + * @returns { T } proxy object from the source object data. + * @static + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + static makeObserved(source: T): T; +} \ No newline at end of file -- Gitee