From 05a1c07d8620c75f186a0b109695a63bed1369b3 Mon Sep 17 00:00:00 2001 From: wujinhui Date: Mon, 16 Jun 2025 16:25:26 +0800 Subject: [PATCH] =?UTF-8?q?attribute=20modifier=20=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wujinhui --- api/@internal/component/ets/common.d.ts | 67 +--------------- api/@ohos.arkui.modifier.d.ts | 3 +- ...eUpdater.d.ets => AttributeModifier.d.ets} | 80 +++++++------------ api/arkui/AttributeUpdater.d.ts | 4 +- api/arkui/CommonModifier.d.ets | 34 -------- api/arkui/CommonModifier.d.ts | 43 ++++------ 6 files changed, 52 insertions(+), 179 deletions(-) rename api/arkui/{AttributeUpdater.d.ets => AttributeModifier.d.ets} (40%) delete mode 100644 api/arkui/CommonModifier.d.ets diff --git a/api/@internal/component/ets/common.d.ts b/api/@internal/component/ets/common.d.ts index 3e1493d29c..09f0202168 100644 --- a/api/@internal/component/ets/common.d.ts +++ b/api/@internal/component/ets/common.d.ts @@ -20088,78 +20088,15 @@ declare interface AttributeModifier { applySelectedAttribute?(instance: T) : void; } - /** - * Defines the attribute modifier. - * - * @interface AttributeModifier + * Export AttributeModifier. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform - * @atomicservice * @since 20 * @arkts 1.2 */ -declare interface AttributeModifier { - - - /** - * Defines the normal update attribute function. - * - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - applyNormalAttribute?:(instance: T) => void; - - - /** - * Defines the pressed update attribute function. - * - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - applyPressedAttribute?:(instance: T) => void; - - /** - * Defines the focused update attribute function. - * - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - applyFocusedAttribute?:(instance: T) => void; - - - /** - * Defines the disabled update attribute function. - * - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - applyDisabledAttribute?:(instance: T) => void; +export { AttributeModifier } from '../arkui/AttributeModifier'; - - /** - * Defines the selected update attribute function. - * - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - applySelectedAttribute?:(instance: T) => void; -} /** * Defines the content modifier. * diff --git a/api/@ohos.arkui.modifier.d.ts b/api/@ohos.arkui.modifier.d.ts index 859cb2db73..808bc16b68 100644 --- a/api/@ohos.arkui.modifier.d.ts +++ b/api/@ohos.arkui.modifier.d.ts @@ -584,7 +584,8 @@ export { WaterFlowModifier } from './arkui/WaterFlowModifier'; * Export AttributeUpdater, which is used to update attributes to native side. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ export { AttributeUpdater } from './arkui/AttributeUpdater'; diff --git a/api/arkui/AttributeUpdater.d.ets b/api/arkui/AttributeModifier.d.ets similarity index 40% rename from api/arkui/AttributeUpdater.d.ets rename to api/arkui/AttributeModifier.d.ets index 73d63dec00..57fc12f8d4 100644 --- a/api/arkui/AttributeUpdater.d.ets +++ b/api/arkui/AttributeModifier.d.ets @@ -1,10 +1,10 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-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 + * 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, @@ -12,93 +12,69 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - /** - * @file Defines a modifier which can update attributes to native side. + * @file * @kit ArkUI + * @arkts 1.2 */ +declare interface AttributeModifier { -import { AttributeModifier } from './component/common' - -/** - * function that returns a default param of AttributeUpdater. - * - * @typedef { function } Initializer - * @returns { T } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 12 - */ -export type Initializer = () => T; - -/** - * Defines a modifier which can update attributes to native side. - * - * @implements AttributeModifier - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 12 - */ -export declare class AttributeUpdater> implements AttributeModifier { /** * Defines the normal update attribute function. * - * @param { T } instance * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since 12 + * @since 20 + * @arkts 1.2 */ - applyNormalAttribute: undefined | ((instance: T) => void); - applyPressedAttribute: undefined | ((instance: T) => void); - applyFocusedAttribute: undefined | ((instance: T) => void); - applyDisabledAttribute: undefined | ((instance: T) => void); - applySelectedAttribute: undefined | ((instance: T) => void); + applyNormalAttribute(instance: T) : void {} + /** - * Defines a function for initialization. + * Defines the pressed update attribute function. * - * @param { T } instance * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since 12 + * @since 20 + * @arkts 1.2 */ - initializeModifier(instance: T): void; + applyPressedAttribute(instance: T) : void {} /** - * Get attribute of the modifier. + * Defines the focused update attribute function. * - * @returns { T | undefined } The attribute of the modifier. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since 12 + * @since 20 + * @arkts 1.2 */ - get attribute(): T | undefined; + applyFocusedAttribute(instance: T) : void {} + /** - * Used to update constructor params. + * Defines the disabled update attribute function. * - * @type { C } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since 12 + * @since 20 + * @arkts 1.2 */ - updateConstructorParams: C; + applyDisabledAttribute(instance: T) : void {} + /** - * Defines a function executed when component changed. + * Defines the selected update attribute function. * - * @param { T } component * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since 12 + * @since 20 + * @arkts 1.2 */ - onComponentChanged(component: T): void; -} + applySelectedAttribute(instance: T) : void {} +} \ No newline at end of file diff --git a/api/arkui/AttributeUpdater.d.ts b/api/arkui/AttributeUpdater.d.ts index 749b995ed2..2af168ed89 100644 --- a/api/arkui/AttributeUpdater.d.ts +++ b/api/arkui/AttributeUpdater.d.ts @@ -17,7 +17,9 @@ * @file Defines a modifier which can update attributes to native side. * @kit ArkUI */ - +/*** if arkts 1.2 */ +import { AttributeModifier } from "./component/common"; +/*** endif */ /** * function that returns a default param of AttributeUpdater. * diff --git a/api/arkui/CommonModifier.d.ets b/api/arkui/CommonModifier.d.ets deleted file mode 100644 index 14994f1d25..0000000000 --- a/api/arkui/CommonModifier.d.ets +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2024 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 - */ - - -/** - * Defines Common Modifier - * - * @extends CommonAttribute - * @implements AttributeModifier - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @atomicservice - * @since 12 -*/ -export declare class CommonModifier { - - -} diff --git a/api/arkui/CommonModifier.d.ts b/api/arkui/CommonModifier.d.ts index 061bb41d39..639d85b848 100644 --- a/api/arkui/CommonModifier.d.ts +++ b/api/arkui/CommonModifier.d.ts @@ -17,19 +17,10 @@ * @file * @kit ArkUI */ + /*** if arkts 1.2 */ +import { AttributeModifier } from "./component/common"; +/*** endif */ - - -/** - * Defines Common Modifier - * - * @extends CommonAttribute - * @implements AttributeModifier - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @atomicservice - * @since arkts{'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 -*/ /** * Defines Common Modifier * @@ -38,8 +29,7 @@ * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since 20 - * @arkts 1.1&1.2 + * @since 12 */ export declare class CommonModifier extends CommonAttribute implements AttributeModifier { @@ -53,16 +43,17 @@ export declare class CommonModifier extends CommonAttribute implements Attribute * @since 12 */ applyNormalAttribute?(instance: CommonAttribute): void; - - /** - * Defines the normal update attribute function. - * - * @param { CommonAttribute } instance - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - applyNormalAttribute(instance: CommonAttribute): void; } + +/** + * Defines Common Modifier + * + * @extends CommonAttribute + * @implements AttributeModifier + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 +*/ +export declare class CommonModifier implements CommonAttribute, AttributeModifier { } \ No newline at end of file -- Gitee