diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/CommonModifier.ts b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/CommonModifier.ts index a5c8f24d419129e7903106e2a793c6100204a897..24b4f3cb23fb3ad061d19c5e02d12118f45f9819 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/CommonModifier.ts +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/CommonModifier.ts @@ -22,4 +22,18 @@ export class CommonModifier extends CommonMethodModifier implements CommonAttri applyFocusedAttribute(instance: CommonAttribute) : void {} applyDisabledAttribute(instance: CommonAttribute) : void {} applySelectedAttribute(instance: CommonAttribute) : void {} + onlyHaveNormalFunc(): boolean { + const applyPressedAttribute1 = ( Type.of(this) as ClassType).getMethodByName("applyPressedAttribute"); + const applyPressedAttribute2 = (Type.from() as ClassType).getMethodByName("applyPressedAttribute"); + const applyFocusedAttribute1 = ( Type.of(this) as ClassType).getMethodByName("applyFocusedAttribute"); + const applyFocusedAttribute2 = (Type.from() as ClassType).getMethodByName("applyFocusedAttribute"); + const applyDisabledAttribute1 = ( Type.of(this) as ClassType).getMethodByName("applyDisabledAttribute"); + const applyDisabledAttribute2 = (Type.from() as ClassType).getMethodByName("applyDisabledAttribute"); + const applySelectedAttribute1 = ( Type.of(this) as ClassType).getMethodByName("applySelectedAttribute"); + const applySelectedAttribute2 = (Type.from() as ClassType).getMethodByName("applySelectedAttribute"); + return applyPressedAttribute1.toString() === applyPressedAttribute2.toString() && + applyFocusedAttribute1.toString() === applyFocusedAttribute2.toString() && + applyDisabledAttribute1.toString() === applyDisabledAttribute2.toString() && + applySelectedAttribute1.toString() === applySelectedAttribute2.toString(); + } } \ No newline at end of file diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/common.ts b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/common.ts index 721a06f345259c67d1805c1a77bf1d39b82f57a3..8e7490eb3d913168802e30a05be5bab33f9ab53c 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/common.ts +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/common.ts @@ -13126,6 +13126,25 @@ export interface AttributeModifier { applyFocusedAttribute(instance: T) : void {} applyDisabledAttribute(instance: T) : void {} applySelectedAttribute(instance: T) : void {} + onlyHaveNormalFunc(): boolean { + const applyPressedAttribute1 = this.getMethodByName('applyPressedAttribute', (Type.of(this) as ClassType)); + const applyFocusedAttribute1 = this.getMethodByName('applyFocusedAttribute', (Type.of(this) as ClassType)); + const applyDisabledAttribute1 = this.getMethodByName('applyDisabledAttribute', (Type.of(this) as ClassType)); + const applySelectedAttribute1 = this.getMethodByName('applySelectedAttribute', (Type.of(this) as ClassType)); + return applyPressedAttribute1 == undefined && + applyFocusedAttribute1 == undefined && + applyDisabledAttribute1 == undefined && + applyDisabledAttribute1 == undefined; + } + getMethodByName(name: string, interfaceType : ClassType): Method | undefined { + for (let methodIdx = 0; methodIdx < interfaceType.getMethodsNum(); ++methodIdx) { + const method = interfaceType.getMethod(methodIdx) + if (method.getName() == name && !method.isStatic()) { + return method; + } + } + return undefined; + } } export interface Type_CommonMethod_linearGradient_value { diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/handwritten/modifiers/ArkCommonModifier.ts b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/handwritten/modifiers/ArkCommonModifier.ts index 9e96e0081a5517efc8a540c19e5c894dc5c1ed96..5d1840b48768ed5541ee49f532defdeaa50c8850 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/handwritten/modifiers/ArkCommonModifier.ts +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/handwritten/modifiers/ArkCommonModifier.ts @@ -2040,17 +2040,19 @@ export function applyAttributeModifierNoCommonMethod