From 7a08e59433a61aff49e0ef27686d93aa1e2c5d92 Mon Sep 17 00:00:00 2001 From: WangYing225 Date: Tue, 7 Jan 2025 15:40:51 +0800 Subject: [PATCH] =?UTF-8?q?=E9=92=88=E5=AF=B9xcomponent=E5=90=84=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E8=A1=A5=E5=85=85typeNode=E5=92=8CCAPI=E6=9E=84?= =?UTF-8?q?=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: WangYing225 Change-Id: I6f1f055c5330c3f05c600cbae5c7865ec3a42ff5 --- .../ark_component/src/ArkXComponent.ts | 455 ++++++----------- .../engine/arkComponent.js | 467 ++++++------------ .../arkts_native_api_impl_bridge.cpp | 64 --- .../arkts_native_xcomponent_bridge.cpp | 192 ------- .../arkts_native_xcomponent_bridge.h | 32 -- .../xcomponent/xcomponent_model_ng.cpp | 4 +- .../native/node/node_xcomponent_modifier.cpp | 12 +- .../interfaces/native/node/view_model.cpp | 12 + .../native/native_interface_xcomponent.cpp | 2 +- interfaces/native/native_node.h | 4 + interfaces/native/node/node_model.cpp | 7 +- interfaces/native/node/style_modifier.cpp | 23 +- 12 files changed, 360 insertions(+), 914 deletions(-) diff --git a/frameworks/bridge/declarative_frontend/ark_component/src/ArkXComponent.ts b/frameworks/bridge/declarative_frontend/ark_component/src/ArkXComponent.ts index cf96239b408..a3844ab2610 100644 --- a/frameworks/bridge/declarative_frontend/ark_component/src/ArkXComponent.ts +++ b/frameworks/bridge/declarative_frontend/ark_component/src/ArkXComponent.ts @@ -24,11 +24,16 @@ interface XComponentParam { class ArkXComponentComponent extends ArkComponent implements XComponentAttribute { _modifiersWithKeys: Map; nativePtr: KNode; + xComponentType: XComponentType = XComponentType.SURFACE; + libraryname?: string = undefined; constructor(nativePtr: KNode, classType?: ModifierType) { super(nativePtr, classType); } allowChildCount(): number { + if (this.xComponentType === XComponentType.COMPONENT) { + return undefined; + } return 0; } applyModifierPatch(): void { @@ -43,7 +48,9 @@ class ArkXComponentComponent extends ArkComponent implements XComponentAttribute }); } initialize(value: Object[]): this { - if (value[0]) { + if (!isUndefined(value[0]) && !isNull(value[0]) && isObject(value[0])) { + this.xComponentType = (value[0] as XComponentParam).type; + this.libraryname = (value[0] as XComponentParam).libraryname; modifierWithKey(this._modifiersWithKeys, XComponentInitializeModifier.identity, XComponentInitializeModifier, value[0] as XComponentParam); } @@ -103,18 +110,27 @@ class ArkXComponentComponent extends ArkComponent implements XComponentAttribute return this; } backgroundImage(src: ResourceStr, repeat?: ImageRepeat): this { + if (this.xComponentType !== XComponentType.NODE) { + return this; + } let arkBackgroundImage = new ArkBackgroundImage(); arkBackgroundImage.src = src; arkBackgroundImage.repeat = repeat; - modifierWithKey(this._modifiersWithKeys, XComponentBackgroundImageModifier.identity, XComponentBackgroundImageModifier, arkBackgroundImage); + modifierWithKey(this._modifiersWithKeys, BackgroundImageModifier.identity, BackgroundImageModifier, arkBackgroundImage); return this; } backgroundImageSize(value: SizeOptions | ImageSize): this { - modifierWithKey(this._modifiersWithKeys, XComponentBackgroundImageSizeModifier.identity, XComponentBackgroundImageSizeModifier, value); + if (this.xComponentType !== XComponentType.NODE) { + return this; + } + modifierWithKey(this._modifiersWithKeys, BackgroundImageSizeModifier.identity, BackgroundImageSizeModifier, value); return this; } backgroundImagePosition(value: Alignment | Position): this { - modifierWithKey(this._modifiersWithKeys, XComponentBackgroundImagePositionModifier.identity, XComponentBackgroundImagePositionModifier, value); + if (this.xComponentType !== XComponentType.NODE) { + return this; + } + modifierWithKey(this._modifiersWithKeys, BackgroundImagePositionModifier.identity, BackgroundImagePositionModifier, value); return this; } backgroundBlurStyle(value: BlurStyle, options?: BackgroundBlurStyleOptions): this { @@ -149,28 +165,49 @@ class ArkXComponentComponent extends ArkComponent implements XComponentAttribute throw new Error('Method not implemented.'); } onClick(event: (event: ClickEvent) => void): this { - throw new Error('Method not implemented.'); + if (this.xComponentType === XComponentType.NODE || isUndefined(this.libraryname)) { + modifierWithKey(this._modifiersWithKeys, OnClickModifier.identity, OnClickModifier, event); + } + return this; } onHover(event: (isHover: boolean, event: HoverEvent) => void): this { - throw new Error('Method not implemented.'); + if (this.xComponentType === XComponentType.NODE || isUndefined(this.libraryname)) { + modifierWithKey(this._modifiersWithKeys, OnHoverModifier.identity, OnHoverModifier, event); + } + return this; } hoverEffect(value: HoverEffect): this { throw new Error('Method not implemented.'); } onMouse(event: (event: MouseEvent) => void): this { - throw new Error('Method not implemented.'); + if (this.xComponentType === XComponentType.NODE || isUndefined(this.libraryname)) { + modifierWithKey(this._modifiersWithKeys, OnMouseModifier.identity, OnMouseModifier, event); + } + return this; } onTouch(event: (event: TouchEvent) => void): this { - throw new Error('Method not implemented.'); + if (this.xComponentType === XComponentType.NODE || isUndefined(this.libraryname)) { + modifierWithKey(this._modifiersWithKeys, OnTouchModifier.identity, OnTouchModifier, event); + } + return this; } onKeyEvent(event: (event: KeyEvent) => void): this { - throw new Error('Method not implemented.'); + if (this.xComponentType === XComponentType.NODE || isUndefined(this.libraryname)) { + modifierWithKey(this._modifiersWithKeys, OnKeyEventModifier.identity, OnKeyEventModifier, event); + } + return this; } onFocus(event: () => void): this { - throw new Error('Method not implemented.'); + if (this.xComponentType === XComponentType.NODE || isUndefined(this.libraryname)) { + modifierWithKey(this._modifiersWithKeys, OnFocusModifier.identity, OnFocusModifier, event); + } + return this; } onBlur(event: () => void): this { - throw new Error('Method not implemented.'); + if (this.xComponentType === XComponentType.NODE || isUndefined(this.libraryname)) { + modifierWithKey(this._modifiersWithKeys, OnBlurModifier.identity, OnBlurModifier, event); + } + return this; } tabIndex(index: number): this { throw new Error('Method not implemented.'); @@ -193,13 +230,22 @@ class ArkXComponentComponent extends ArkComponent implements XComponentAttribute parallelGesture(gesture: GestureType, mask?: GestureMask): this { throw new Error('Method not implemented.'); } - blur(value: number): this { - modifierWithKey(this._modifiersWithKeys, XComponentBlurModifier.identity, XComponentBlurModifier, value); + blur(value: number, options?: BlurOptions): this { + if (this.xComponentType !== XComponentType.NODE) { + return this; + } + let blur = new ArkBlurOptions(); + blur.value = value; + blur.options = options; + modifierWithKey(this._modifiersWithKeys, BlurModifier.identity, BlurModifier, blur); return this; } linearGradientBlur(value: number, options: LinearGradientBlurOptions): this { + if (this.xComponentType !== XComponentType.NODE) { + return this; + } if (isUndefined(value) || isNull(value) || isUndefined(options) || isNull(options)) { - modifierWithKey(this._modifiersWithKeys, XComponentLinearGradientBlurModifier.identity, XComponentLinearGradientBlurModifier, + modifierWithKey(this._modifiersWithKeys, LinearGradientBlurModifier.identity, LinearGradientBlurModifier, undefined); return this; } @@ -207,16 +253,32 @@ class ArkXComponentComponent extends ArkComponent implements XComponentAttribute arkLinearGradientBlur.blurRadius = value; arkLinearGradientBlur.fractionStops = options.fractionStops; arkLinearGradientBlur.direction = options.direction; - modifierWithKey(this._modifiersWithKeys, XComponentLinearGradientBlurModifier.identity, XComponentLinearGradientBlurModifier, + modifierWithKey(this._modifiersWithKeys, LinearGradientBlurModifier.identity, LinearGradientBlurModifier, arkLinearGradientBlur); return this; } brightness(value: number): this { - modifierWithKey(this._modifiersWithKeys, XComponentBrightnessModifier.identity, XComponentBrightnessModifier, value); + if (this.xComponentType !== XComponentType.NODE) { + return this; + } + if (!isNumber(value)) { + modifierWithKey(this._modifiersWithKeys, BrightnessModifier.identity, BrightnessModifier, undefined); + } + else { + modifierWithKey(this._modifiersWithKeys, BrightnessModifier.identity, BrightnessModifier, value); + } return this; } contrast(value: number): this { - modifierWithKey(this._modifiersWithKeys, XComponentContrastModifier.identity, XComponentContrastModifier, value); + if (this.xComponentType !== XComponentType.NODE) { + return this; + } + if (!isNumber(value)) { + modifierWithKey(this._modifiersWithKeys, ContrastModifier.identity, ContrastModifier, undefined); + } + else { + modifierWithKey(this._modifiersWithKeys, ContrastModifier.identity, ContrastModifier, value); + } return this; } grayscale(value: number): this { @@ -224,30 +286,71 @@ class ArkXComponentComponent extends ArkComponent implements XComponentAttribute return this; } colorBlend(value: string | Resource | Color): this { - modifierWithKey(this._modifiersWithKeys, XComponentColorBlendModifier.identity, XComponentColorBlendModifier, value); + if (this.xComponentType !== XComponentType.NODE) { + return this; + } + modifierWithKey(this._modifiersWithKeys, ColorBlendModifier.identity, ColorBlendModifier, value); return this; } saturate(value: number): this { - modifierWithKey(this._modifiersWithKeys, XComponentSaturateModifier.identity, XComponentSaturateModifier, value); + if (this.xComponentType !== XComponentType.NODE) { + return this; + } + if (!isNumber(value)) { + modifierWithKey(this._modifiersWithKeys, SaturateModifier.identity, SaturateModifier, undefined); + } + else { + modifierWithKey(this._modifiersWithKeys, SaturateModifier.identity, SaturateModifier, value); + } return this; } sepia(value: number): this { - modifierWithKey(this._modifiersWithKeys, XComponentSepiaModifier.identity, XComponentSepiaModifier, value); + if (this.xComponentType !== XComponentType.NODE) { + return this; + } + if (!isNumber(value)) { + modifierWithKey(this._modifiersWithKeys, SepiaModifier.identity, SepiaModifier, undefined); + } + else { + modifierWithKey(this._modifiersWithKeys, SepiaModifier.identity, SepiaModifier, value); + } return this; } - invert(value: number): this { - modifierWithKey(this._modifiersWithKeys, XComponentInvertModifier.identity, XComponentInvertModifier, value); + invert(value: number | InvertOptions): this { + if (this.xComponentType !== XComponentType.NODE) { + return this; + } + if (!isUndefined(value)) { + modifierWithKey(this._modifiersWithKeys, InvertModifier.identity, InvertModifier, value); + } + else { + modifierWithKey(this._modifiersWithKeys, InvertModifier.identity, InvertModifier, undefined); + } return this; } hueRotate(value: string | number): this { - modifierWithKey(this._modifiersWithKeys, XComponentHueRotateModifier.identity, XComponentHueRotateModifier, value); + if (this.xComponentType !== XComponentType.NODE) { + return this; + } + if (!isNumber(value) && !isString(value)) { + modifierWithKey(this._modifiersWithKeys, HueRotateModifier.identity, HueRotateModifier, undefined); + } + else { + modifierWithKey(this._modifiersWithKeys, HueRotateModifier.identity, HueRotateModifier, value); + } return this; } useEffect(value: boolean): this { throw new Error('Method not implemented.'); } - backdropBlur(value: number): this { - modifierWithKey(this._modifiersWithKeys, XComponentBackdropBlurModifier.identity, XComponentBackdropBlurModifier, value); + backdropBlur(value: number, options?: BlurOptions): this { + if (this.xComponentType !== XComponentType.NODE) { + return this; + } + let blur = new ArkBlurOptions(); + blur.value = value; + blur.options = options; + modifierWithKey(this._modifiersWithKeys, BackdropBlurModifier.identity, BackdropBlurModifier, blur); return this; } renderGroup(value: boolean): this { @@ -272,16 +375,28 @@ class ArkXComponentComponent extends ArkComponent implements XComponentAttribute throw new Error('Method not implemented.'); } onAppear(event: () => void): this { - throw new Error('Method not implemented.'); + if (this.xComponentType === XComponentType.NODE || isUndefined(this.libraryname)) { + modifierWithKey(this._modifiersWithKeys, OnAppearModifier.identity, OnAppearModifier, event); + } + return this; } onDisAppear(event: () => void): this { - throw new Error('Method not implemented.'); + if (this.xComponentType === XComponentType.NODE || isUndefined(this.libraryname)) { + modifierWithKey(this._modifiersWithKeys, OnDisappearModifier.identity, OnDisappearModifier, event); + } + return this; } - onAttach(event: () => void): this { - throw new Error('Method not implemented.'); + onAttach(callback: Callback): this { + if (this.xComponentType === XComponentType.NODE || isUndefined(this.libraryname)) { + modifierWithKey(this._modifiersWithKeys, OnAttachModifier.identity, OnAttachModifier, callback); + } + return this; } - onDetach(event: () => void): this { - throw new Error('Method not implemented.'); + onDetach(callback: Callback): this { + if (this.xComponentType === XComponentType.NODE || isUndefined(this.libraryname)) { + modifierWithKey(this._modifiersWithKeys, OnDetachModifier.identity, OnDetachModifier, callback); + } + return this; } onAreaChange(event: (oldValue: Area, newValue: Area) => void): this { throw new Error('Method not implemented.'); @@ -422,15 +537,24 @@ class ArkXComponentComponent extends ArkComponent implements XComponentAttribute throw new Error('Method not implemented.'); } sphericalEffect(value: number): this { - modifierWithKey(this._modifiersWithKeys, XComponentSphericalEffectModifier.identity, XComponentSphericalEffectModifier, value); + if (this.xComponentType !== XComponentType.NODE) { + return this; + } + modifierWithKey(this._modifiersWithKeys, SphericalEffectModifier.identity, SphericalEffectModifier, value); return this; } lightUpEffect(value: number): this { - modifierWithKey(this._modifiersWithKeys, XComponentLightUpEffectModifier.identity, XComponentLightUpEffectModifier, value); + if (this.xComponentType !== XComponentType.NODE) { + return this; + } + modifierWithKey(this._modifiersWithKeys, LightUpEffectModifier.identity, LightUpEffectModifier, value); return this; } pixelStretchEffect(options: PixelStretchEffectOptions): this { - modifierWithKey(this._modifiersWithKeys, XComponentPixelStretchEffectModifier.identity, XComponentPixelStretchEffectModifier, options); + if (this.xComponentType !== XComponentType.NODE) { + return this; + } + modifierWithKey(this._modifiersWithKeys, PixelStretchEffectModifier.identity, PixelStretchEffectModifier, options); return this; } keyboardShortcut(value: string | FunctionKey, keys: ModifierKey[], action?: () => void): this { @@ -552,97 +676,6 @@ class XComponentBackgroundColorModifier extends ModifierWithKey { } } -class XComponentBackgroundImageModifier extends ModifierWithKey { - constructor(value: ArkBackgroundImage) { - super(value); - } - static identity: Symbol = Symbol('xComponentBackgroundImage'); - applyPeer(node: KNode, reset: boolean): void { - if (reset) { - getUINativeModule().xComponent.resetBackgroundImage(node); - } else { - getUINativeModule().xComponent.setBackgroundImage(node, this.value.src, this.value.repeat); - } - } - - checkObjectDiff(): boolean { - return !((this.stageValue as ArkBackgroundImage).src === (this.value as ArkBackgroundImage).src && - (this.stageValue as ArkBackgroundImage).repeat === (this.value as ArkBackgroundImage).repeat); - } -} - -class XComponentBackgroundImageSizeModifier extends ModifierWithKey { - constructor(value: SizeOptions | ImageSize) { - super(value); - } - static identity: Symbol = Symbol('xComponentBackgroundImageSize'); - applyPeer(node: KNode, reset: boolean): void { - if (reset) { - getUINativeModule().xComponent.resetBackgroundImageSize(node); - } else { - if (isNumber(this.value)) { - getUINativeModule().xComponent.setBackgroundImageSize(node, this.value, undefined, undefined); - } else { - getUINativeModule().xComponent.setBackgroundImageSize(node, undefined, (this.value as SizeOptions)?.width, (this.value as SizeOptions)?.height); - } - } - } - checkObjectDiff(): boolean { - return !((this.value as SizeOptions).width === (this.stageValue as SizeOptions).width && - (this.value as SizeOptions).height === (this.stageValue as SizeOptions).height); - } -} - -class XComponentBackgroundImagePositionModifier extends ModifierWithKey { - constructor(value: Position | Alignment) { - super(value); - } - static identity: Symbol = Symbol('xComponentBackgroundImagePosition'); - applyPeer(node: KNode, reset: boolean): void { - if (reset) { - getUINativeModule().xComponent.resetBackgroundImagePosition(node); - } else { - if (isNumber(this.value)) { - getUINativeModule().xComponent.setBackgroundImagePosition(node, this.value, undefined, undefined); - } else { - getUINativeModule().xComponent.setBackgroundImagePosition(node, undefined, (this.value as Position)?.x, (this.value as Position)?.y); - } - } - } - checkObjectDiff(): boolean { - return !((this.value as Position)?.x === (this.stageValue as Position)?.x && - (this.value as Position)?.y === (this.stageValue as Position)?.y); - } -} - -class XComponentBlurModifier extends ModifierWithKey { - constructor(value: number) { - super(value); - } - static identity: Symbol = Symbol('xComponentBlur'); - applyPeer(node: KNode, reset: boolean): void { - if (reset) { - getUINativeModule().xComponent.resetBlur(node); - } else { - getUINativeModule().xComponent.setBlur(node, this.value); - } - } -} - -class XComponentBackdropBlurModifier extends ModifierWithKey { - constructor(value: number) { - super(value); - } - static identity: Symbol = Symbol('xComponentBackdropBlur'); - applyPeer(node: KNode, reset: boolean): void { - if (reset) { - getUINativeModule().xComponent.resetBackdropBlur(node); - } else { - getUINativeModule().xComponent.setBackdropBlur(node, this.value); - } - } -} - class XComponentGrayscaleModifier extends ModifierWithKey { constructor(value: number) { super(value); @@ -657,176 +690,6 @@ class XComponentGrayscaleModifier extends ModifierWithKey { } } -class XComponentBrightnessModifier extends ModifierWithKey { - constructor(value: number) { - super(value); - } - static identity: Symbol = Symbol('xComponentBrightness'); - applyPeer(node: KNode, reset: boolean): void { - if (reset) { - getUINativeModule().xComponent.resetBrightness(node); - } else { - getUINativeModule().xComponent.setBrightness(node, this.value); - } - } -} - -class XComponentSaturateModifier extends ModifierWithKey { - constructor(value: number) { - super(value); - } - static identity: Symbol = Symbol('xComponentSaturate'); - applyPeer(node: KNode, reset: boolean): void { - if (reset) { - getUINativeModule().xComponent.resetSaturate(node); - } else { - getUINativeModule().xComponent.setSaturate(node, this.value); - } - } -} - -class XComponentContrastModifier extends ModifierWithKey { - constructor(value: number) { - super(value); - } - static identity: Symbol = Symbol('xComponentContrast'); - applyPeer(node: KNode, reset: boolean): void { - if (reset) { - getUINativeModule().xComponent.resetContrast(node); - } else { - getUINativeModule().xComponent.setContrast(node, this.value); - } - } -} - -class XComponentInvertModifier extends ModifierWithKey { - constructor(value: number) { - super(value); - } - static identity: Symbol = Symbol('xComponentInvert'); - applyPeer(node: KNode, reset: boolean): void { - if (reset) { - getUINativeModule().xComponent.resetInvert(node); - } else { - getUINativeModule().xComponent.setInvert(node, this.value); - } - } -} - -class XComponentSepiaModifier extends ModifierWithKey { - constructor(value: number) { - super(value); - } - static identity: Symbol = Symbol('xComponentSepia'); - applyPeer(node: KNode, reset: boolean): void { - if (reset) { - getUINativeModule().xComponent.resetSepia(node); - } else { - getUINativeModule().xComponent.setSepia(node, this.value); - } - } -} - -class XComponentHueRotateModifier extends ModifierWithKey { - constructor(value: number | string) { - super(value); - } - static identity: Symbol = Symbol('xComponentHueRotate'); - applyPeer(node: KNode, reset: boolean): void { - if (reset) { - getUINativeModule().xComponent.resetHueRotate(node); - } else { - getUINativeModule().xComponent.setHueRotate(node, this.value); - } - } -} - -class XComponentColorBlendModifier extends ModifierWithKey { - constructor(value: Color | string | Resource) { - super(value); - } - static identity: Symbol = Symbol('xComponentColorBlend'); - applyPeer(node: KNode, reset: boolean): void { - if (reset) { - getUINativeModule().xComponent.resetColorBlend(node); - } else { - getUINativeModule().xComponent.setColorBlend(node, this.value); - } - } - - checkObjectDiff(): boolean { - return !isBaseOrResourceEqual(this.stageValue, this.value); - } -} - -class XComponentSphericalEffectModifier extends ModifierWithKey { - constructor(value: number) { - super(value); - } - static identity: Symbol = Symbol('xComponentSphericalEffect'); - applyPeer(node: KNode, reset: boolean): void { - if (reset) { - getUINativeModule().xComponent.resetSphericalEffect(node); - } else { - getUINativeModule().xComponent.setSphericalEffect(node, this.value); - } - } -} - -class XComponentLightUpEffectModifier extends ModifierWithKey { - constructor(value: number) { - super(value); - } - static identity: Symbol = Symbol('xComponentLightUpEffect'); - applyPeer(node: KNode, reset: boolean): void { - if (reset) { - getUINativeModule().xComponent.resetLightUpEffect(node); - } else { - getUINativeModule().xComponent.setLightUpEffect(node, this.value); - } - } -} - -class XComponentPixelStretchEffectModifier extends ModifierWithKey { - constructor(value: PixelStretchEffectOptions) { - super(value); - } - static identity: Symbol = Symbol('xComponentPixelStretchEffect'); - applyPeer(node: KNode, reset: boolean): void { - if (reset) { - getUINativeModule().xComponent.resetPixelStretchEffect(node); - } else { - getUINativeModule().xComponent.setPixelStretchEffect(node, - this.value.top, this.value.right, this.value.bottom, this.value.left); - } - } - - checkObjectDiff(): boolean { - return !((this.stageValue as PixelStretchEffectOptions).left === (this.value as PixelStretchEffectOptions).left && - (this.stageValue as PixelStretchEffectOptions).right === (this.value as PixelStretchEffectOptions).right && - (this.stageValue as PixelStretchEffectOptions).top === (this.value as PixelStretchEffectOptions).top && - (this.stageValue as PixelStretchEffectOptions).bottom === (this.value as PixelStretchEffectOptions).bottom); - } -} - -class XComponentLinearGradientBlurModifier extends ModifierWithKey { - constructor(value: ArkLinearGradientBlur) { - super(value); - } - static identity: Symbol = Symbol('xComponentlinearGradientBlur'); - applyPeer(node: KNode, reset: boolean): void { - if (reset) { - getUINativeModule().xComponent.resetLinearGradientBlur(node); - } else { - getUINativeModule().xComponent.setLinearGradientBlur(node, - this.value.blurRadius, this.value.fractionStops, this.value.direction); - } - } - checkObjectDiff(): boolean { - return !this.value.isEqual(this.stageValue); - } -} - class XComponentOnLoadModifier extends ModifierWithKey<(event?: object) => void> { constructor(value: (event?: object) => void) { super(value); @@ -939,4 +802,4 @@ class XComponentRenderFitModifier extends ModifierWithKey { getUINativeModule().xComponent.setRenderFit(node, this.value); } } -} \ No newline at end of file +} diff --git a/frameworks/bridge/declarative_frontend/engine/arkComponent.js b/frameworks/bridge/declarative_frontend/engine/arkComponent.js index 9b17d7072fd..49d9c102a9d 100755 --- a/frameworks/bridge/declarative_frontend/engine/arkComponent.js +++ b/frameworks/bridge/declarative_frontend/engine/arkComponent.js @@ -26851,10 +26851,15 @@ class ArkXComponentComponent extends ArkComponent { super(nativePtr, classType); } allowChildCount() { + if (this.xComponentType === XComponentType.COMPONENT) { + return undefined; + } return 0; } initialize(value) { - if (value[0]) { + if (!isUndefined(value[0]) && !isNull(value[0]) && isObject(value[0])) { + this.xComponentType = value[0].type; + this.libraryname = value[0].libraryname; modifierWithKey(this._modifiersWithKeys, XComponentInitializeModifier.identity, XComponentInitializeModifier, value[0]); } @@ -26924,18 +26929,27 @@ class ArkXComponentComponent extends ArkComponent { return this; } backgroundImage(src, repeat) { + if (this.xComponentType !== XComponentType.NODE) { + return this; + } let arkBackgroundImage = new ArkBackgroundImage(); arkBackgroundImage.src = src; arkBackgroundImage.repeat = repeat; - modifierWithKey(this._modifiersWithKeys, XComponentBackgroundImageModifier.identity, XComponentBackgroundImageModifier, arkBackgroundImage); + modifierWithKey(this._modifiersWithKeys, BackgroundImageModifier.identity, BackgroundImageModifier, arkBackgroundImage); return this; } backgroundImageSize(value) { - modifierWithKey(this._modifiersWithKeys, XComponentBackgroundImageSizeModifier.identity, XComponentBackgroundImageSizeModifier, value); + if (this.xComponentType !== XComponentType.NODE) { + return this; + } + modifierWithKey(this._modifiersWithKeys, BackgroundImageSizeModifier.identity, BackgroundImageSizeModifier, value); return this; } backgroundImagePosition(value) { - modifierWithKey(this._modifiersWithKeys, XComponentBackgroundImagePositionModifier.identity, XComponentBackgroundImagePositionModifier, value); + if (this.xComponentType !== XComponentType.NODE) { + return this; + } + modifierWithKey(this._modifiersWithKeys, BackgroundImagePositionModifier.identity, BackgroundImagePositionModifier, value); return this; } backgroundBlurStyle(value, options) { @@ -26970,28 +26984,49 @@ class ArkXComponentComponent extends ArkComponent { throw new Error('Method not implemented.'); } onClick(event) { - throw new Error('Method not implemented.'); + if (this.xComponentType === XComponentType.NODE || isUndefined(this.libraryname)) { + modifierWithKey(this._modifiersWithKeys, ClickModifier.identity, ClickModifier, event); + } + return this; } onHover(event) { - throw new Error('Method not implemented.'); + if (this.xComponentType === XComponentType.NODE || isUndefined(this.libraryname)) { + modifierWithKey(this._modifiersWithKeys, OnHoverModifier.identity, OnHoverModifier, event); + } + return this; } hoverEffect(value) { throw new Error('Method not implemented.'); } onMouse(event) { - throw new Error('Method not implemented.'); + if (this.xComponentType === XComponentType.NODE || isUndefined(this.libraryname)) { + modifierWithKey(this._modifiersWithKeys, OnMouseModifier.identity, OnMouseModifier, event); + } + return this; } onTouch(event) { - throw new Error('Method not implemented.'); + if (this.xComponentType === XComponentType.NODE || isUndefined(this.libraryname)) { + modifierWithKey(this._modifiersWithKeys, OnTouchModifier.identity, OnTouchModifier, event); + } + return this; } onKeyEvent(event) { - throw new Error('Method not implemented.'); + if (this.xComponentType === XComponentType.NODE || isUndefined(this.libraryname)) { + modifierWithKey(this._modifiersWithKeys, OnKeyEventModifier.identity, OnKeyEventModifier, event); + } + return this; } onFocus(event) { - throw new Error('Method not implemented.'); + if (this.xComponentType === XComponentType.NODE || isUndefined(this.libraryname)) { + modifierWithKey(this._modifiersWithKeys, OnFocusModifier.identity, OnFocusModifier, event); + } + return this; } onBlur(event) { - throw new Error('Method not implemented.'); + if (this.xComponentType === XComponentType.NODE || isUndefined(this.libraryname)) { + modifierWithKey(this._modifiersWithKeys, OnBlurModifier.identity, OnBlurModifier, event); + } + return this; } tabIndex(index) { throw new Error('Method not implemented.'); @@ -27014,59 +27049,125 @@ class ArkXComponentComponent extends ArkComponent { parallelGesture(gesture, mask) { throw new Error('Method not implemented.'); } - blur(value) { - modifierWithKey(this._modifiersWithKeys, XComponentBlurModifier.identity, XComponentBlurModifier, value); + blur(value, options) { + if (this.xComponentType !== XComponentType.NODE) { + return this; + } + let blur = new ArkBlurOptions(); + blur.value = value; + blur.options = options; + modifierWithKey(this._modifiersWithKeys, BlurModifier.identity, BlurModifier, blur); return this; } linearGradientBlur(value, options) { + if (this.xComponentType !== XComponentType.NODE) { + return this; + } if (isUndefined(value) || isNull(value) || isUndefined(options) || isNull(options)) { - modifierWithKey(this._modifiersWithKeys, XComponentLinearGradientBlurModifier.identity, XComponentLinearGradientBlurModifier, undefined); + modifierWithKey(this._modifiersWithKeys, LinearGradientBlurModifier.identity, LinearGradientBlurModifier, undefined); return this; } let arkLinearGradientBlur = new ArkLinearGradientBlur(); arkLinearGradientBlur.blurRadius = value; arkLinearGradientBlur.fractionStops = options.fractionStops; arkLinearGradientBlur.direction = options.direction; - modifierWithKey(this._modifiersWithKeys, XComponentLinearGradientBlurModifier.identity, XComponentLinearGradientBlurModifier, arkLinearGradientBlur); + modifierWithKey(this._modifiersWithKeys, LinearGradientBlurModifier.identity, LinearGradientBlurModifier, arkLinearGradientBlur); return this; } brightness(value) { - modifierWithKey(this._modifiersWithKeys, XComponentBrightnessModifier.identity, XComponentBrightnessModifier, value); + if (this.xComponentType !== XComponentType.NODE) { + return this; + } + if (!isNumber(value)) { + modifierWithKey(this._modifiersWithKeys, BrightnessModifier.identity, BrightnessModifier, undefined); + } + else { + modifierWithKey(this._modifiersWithKeys, BrightnessModifier.identity, BrightnessModifier, value); + } return this; } contrast(value) { - modifierWithKey(this._modifiersWithKeys, XComponentContrastModifier.identity, XComponentContrastModifier, value); + if (this.xComponentType !== XComponentType.NODE) { + return this; + } + if (!isNumber(value)) { + modifierWithKey(this._modifiersWithKeys, ContrastModifier.identity, ContrastModifier, undefined); + } + else { + modifierWithKey(this._modifiersWithKeys, ContrastModifier.identity, ContrastModifier, value); + } return this; } grayscale(value) { - modifierWithKey(this._modifiersWithKeys, XComponentGrayscaleModifier.identity, XComponentGrayscaleModifier, value); + modifierWithKey(this._modifiersWithKeys, GrayscaleModifier.identity, GrayscaleModifier, value); return this; } colorBlend(value) { - modifierWithKey(this._modifiersWithKeys, XComponentColorBlendModifier.identity, XComponentColorBlendModifier, value); + if (this.xComponentType !== XComponentType.NODE) { + return this; + } + modifierWithKey(this._modifiersWithKeys, ColorBlendModifier.identity, ColorBlendModifier, value); return this; } saturate(value) { - modifierWithKey(this._modifiersWithKeys, XComponentSaturateModifier.identity, XComponentSaturateModifier, value); + if (this.xComponentType !== XComponentType.NODE) { + return this; + } + if (!isNumber(value)) { + modifierWithKey(this._modifiersWithKeys, SaturateModifier.identity, SaturateModifier, undefined); + } + else { + modifierWithKey(this._modifiersWithKeys, SaturateModifier.identity, SaturateModifier, value); + } return this; } sepia(value) { - modifierWithKey(this._modifiersWithKeys, XComponentSepiaModifier.identity, XComponentSepiaModifier, value); + if (this.xComponentType !== XComponentType.NODE) { + return this; + } + if (!isNumber(value)) { + modifierWithKey(this._modifiersWithKeys, SepiaModifier.identity, SepiaModifier, undefined); + } + else { + modifierWithKey(this._modifiersWithKeys, SepiaModifier.identity, SepiaModifier, value); + } return this; } invert(value) { - modifierWithKey(this._modifiersWithKeys, XComponentInvertModifier.identity, XComponentInvertModifier, value); + if (this.xComponentType !== XComponentType.NODE) { + return this; + } + if (!isUndefined(value)) { + modifierWithKey(this._modifiersWithKeys, InvertModifier.identity, InvertModifier, value); + } + else { + modifierWithKey(this._modifiersWithKeys, InvertModifier.identity, InvertModifier, undefined); + } return this; } hueRotate(value) { - modifierWithKey(this._modifiersWithKeys, XComponentHueRotateModifier.identity, XComponentHueRotateModifier, value); + if (this.xComponentType !== XComponentType.NODE) { + return this; + } + if (!isNumber(value) && !isString(value)) { + modifierWithKey(this._modifiersWithKeys, HueRotateModifier.identity, HueRotateModifier, undefined); + } + else { + modifierWithKey(this._modifiersWithKeys, HueRotateModifier.identity, HueRotateModifier, value); + } return this; } useEffect(value) { throw new Error('Method not implemented.'); } - backdropBlur(value) { - modifierWithKey(this._modifiersWithKeys, XComponentBackdropBlurModifier.identity, XComponentBackdropBlurModifier, value); + backdropBlur(value, options) { + if (this.xComponentType !== XComponentType.NODE) { + return this; + } + let blur = new ArkBlurOptions(); + blur.value = value; + blur.options = options; + modifierWithKey(this._modifiersWithKeys, BackdropBlurModifier.identity, BackdropBlurModifier, blur); return this; } renderGroup(value) { @@ -27091,16 +27192,28 @@ class ArkXComponentComponent extends ArkComponent { throw new Error('Method not implemented.'); } onAppear(event) { - throw new Error('Method not implemented.'); + if (this.xComponentType === XComponentType.NODE || isUndefined(this.libraryname)) { + modifierWithKey(this._modifiersWithKeys, OnAppearModifier.identity, OnAppearModifier, event); + } + return this; } onDisAppear(event) { - throw new Error('Method not implemented.'); + if (this.xComponentType === XComponentType.NODE || isUndefined(this.libraryname)) { + modifierWithKey(this._modifiersWithKeys, OnDisappearModifier.identity, OnDisappearModifier, event); + } + return this; } - onAttach(event) { - throw new Error('Method not implemented.'); + onAttach(callback) { + if (this.xComponentType === XComponentType.NODE || isUndefined(this.libraryname)) { + modifierWithKey(this._modifiersWithKeys, OnAttachModifier.identity, OnAttachModifier, callback); + } + return this; } - onDetach(event) { - throw new Error('Method not implemented.'); + onDetach(callback) { + if (this.xComponentType === XComponentType.NODE || isUndefined(this.libraryname)) { + modifierWithKey(this._modifiersWithKeys, OnDetachModifier.identity, OnDetachModifier, callback); + } + return this; } onAreaChange(event) { throw new Error('Method not implemented.'); @@ -27230,15 +27343,24 @@ class ArkXComponentComponent extends ArkComponent { throw new Error('Method not implemented.'); } sphericalEffect(value) { - modifierWithKey(this._modifiersWithKeys, XComponentSphericalEffectModifier.identity, XComponentSphericalEffectModifier, value); + if (this.xComponentType !== XComponentType.NODE) { + return this; + } + modifierWithKey(this._modifiersWithKeys, SphericalEffectModifier.identity, SphericalEffectModifier, value); return this; } lightUpEffect(value) { - modifierWithKey(this._modifiersWithKeys, XComponentLightUpEffectModifier.identity, XComponentLightUpEffectModifier, value); + if (this.xComponentType !== XComponentType.NODE) { + return this; + } + modifierWithKey(this._modifiersWithKeys, LightUpEffectModifier.identity, LightUpEffectModifier, value); return this; } pixelStretchEffect(options) { - modifierWithKey(this._modifiersWithKeys, XComponentPixelStretchEffectModifier.identity, XComponentPixelStretchEffectModifier, options); + if (this.xComponentType !== XComponentType.NODE) { + return this; + } + modifierWithKey(this._modifiersWithKeys, PixelStretchEffectModifier.identity, PixelStretchEffectModifier, options); return this; } keyboardShortcut(value, keys, action) { @@ -27368,283 +27490,6 @@ class XComponentBackgroundColorModifier extends ModifierWithKey { } } XComponentBackgroundColorModifier.identity = Symbol('xComponentBackgroundColor'); -class XComponentBackgroundImageModifier extends ModifierWithKey { - constructor(value) { - super(value); - } - applyPeer(node, reset) { - if (reset) { - getUINativeModule().xComponent.resetBackgroundImage(node); - } - else { - getUINativeModule().xComponent.setBackgroundImage(node, this.value.src, this.value.repeat); - } - } - checkObjectDiff() { - return !(this.stageValue.src === this.value.src && - this.stageValue.repeat === this.value.repeat); - } -} -XComponentBackgroundImageModifier.identity = Symbol('xComponentBackgroundImage'); -class XComponentBackgroundImageSizeModifier extends ModifierWithKey { - constructor(value) { - super(value); - } - applyPeer(node, reset) { - let _a, _b; - if (reset) { - getUINativeModule().xComponent.resetBackgroundImageSize(node); - } - else { - if (isNumber(this.value)) { - getUINativeModule().xComponent.setBackgroundImageSize(node, this.value, undefined, undefined); - } - else { - getUINativeModule().xComponent.setBackgroundImageSize(node, undefined, (_a = this.value) === null || - _a === void 0 ? void 0 : _a.width, (_b = this.value) === null || _b === void 0 ? void 0 : _b.height); - } - } - } - checkObjectDiff() { - return !(this.value.width === this.stageValue.width && - this.value.height === this.stageValue.height); - } -} -XComponentBackgroundImageSizeModifier.identity = Symbol('xComponentBackgroundImageSize'); -class XComponentBackgroundImagePositionModifier extends ModifierWithKey { - constructor(value) { - super(value); - } - applyPeer(node, reset) { - let _a, _b; - if (reset) { - getUINativeModule().xComponent.resetBackgroundImagePosition(node); - } - else { - if (isNumber(this.value)) { - getUINativeModule().xComponent.setBackgroundImagePosition(node, this.value, undefined, undefined); - } - else { - getUINativeModule().xComponent.setBackgroundImagePosition(node, undefined, (_a = this.value) === null || - _a === void 0 ? void 0 : _a.x, (_b = this.value) === null || _b === void 0 ? void 0 : _b.y); - } - } - } - checkObjectDiff() { - let _a, _b, _c, _d; - return !(((_a = this.value) === null || _a === void 0 ? void 0 : _a.x) === ((_b = this.stageValue) === null || _b === void 0 ? void 0 : _b.x) && - ((_c = this.value) === null || _c === void 0 ? void 0 : _c.y) === ((_d = this.stageValue) === null || _d === void 0 ? void 0 : _d.y)); - } -} -XComponentBackgroundImagePositionModifier.identity = Symbol('xComponentBackgroundImagePosition'); -class XComponentBlurModifier extends ModifierWithKey { - constructor(value) { - super(value); - } - applyPeer(node, reset) { - if (reset) { - getUINativeModule().xComponent.resetBlur(node); - } - else { - getUINativeModule().xComponent.setBlur(node, this.value); - } - } -} -XComponentBlurModifier.identity = Symbol('xComponentBlur'); -class XComponentBackdropBlurModifier extends ModifierWithKey { - constructor(value) { - super(value); - } - applyPeer(node, reset) { - if (reset) { - getUINativeModule().xComponent.resetBackdropBlur(node); - } - else { - getUINativeModule().xComponent.setBackdropBlur(node, this.value); - } - } -} -XComponentBackdropBlurModifier.identity = Symbol('xComponentBackdropBlur'); -class XComponentGrayscaleModifier extends ModifierWithKey { - constructor(value) { - super(value); - } - applyPeer(node, reset) { - if (reset) { - getUINativeModule().xComponent.resetGrayscale(node); - } - else { - getUINativeModule().xComponent.setGrayscale(node, this.value); - } - } -} -XComponentGrayscaleModifier.identity = Symbol('xComponentGrayscale'); -class XComponentBrightnessModifier extends ModifierWithKey { - constructor(value) { - super(value); - } - applyPeer(node, reset) { - if (reset) { - getUINativeModule().xComponent.resetBrightness(node); - } - else { - getUINativeModule().xComponent.setBrightness(node, this.value); - } - } -} -XComponentBrightnessModifier.identity = Symbol('xComponentBrightness'); -class XComponentSaturateModifier extends ModifierWithKey { - constructor(value) { - super(value); - } - applyPeer(node, reset) { - if (reset) { - getUINativeModule().xComponent.resetSaturate(node); - } - else { - getUINativeModule().xComponent.setSaturate(node, this.value); - } - } -} -XComponentSaturateModifier.identity = Symbol('xComponentSaturate'); -class XComponentContrastModifier extends ModifierWithKey { - constructor(value) { - super(value); - } - applyPeer(node, reset) { - if (reset) { - getUINativeModule().xComponent.resetContrast(node); - } - else { - getUINativeModule().xComponent.setContrast(node, this.value); - } - } -} -XComponentContrastModifier.identity = Symbol('xComponentContrast'); -class XComponentInvertModifier extends ModifierWithKey { - constructor(value) { - super(value); - } - applyPeer(node, reset) { - if (reset) { - getUINativeModule().xComponent.resetInvert(node); - } - else { - getUINativeModule().xComponent.setInvert(node, this.value); - } - } -} -XComponentInvertModifier.identity = Symbol('xComponentInvert'); -class XComponentSepiaModifier extends ModifierWithKey { - constructor(value) { - super(value); - } - applyPeer(node, reset) { - if (reset) { - getUINativeModule().xComponent.resetSepia(node); - } - else { - getUINativeModule().xComponent.setSepia(node, this.value); - } - } -} -XComponentSepiaModifier.identity = Symbol('xComponentSepia'); -class XComponentHueRotateModifier extends ModifierWithKey { - constructor(value) { - super(value); - } - applyPeer(node, reset) { - if (reset) { - getUINativeModule().xComponent.resetHueRotate(node); - } - else { - getUINativeModule().xComponent.setHueRotate(node, this.value); - } - } -} -XComponentHueRotateModifier.identity = Symbol('xComponentHueRotate'); -class XComponentColorBlendModifier extends ModifierWithKey { - constructor(value) { - super(value); - } - applyPeer(node, reset) { - if (reset) { - getUINativeModule().xComponent.resetColorBlend(node); - } - else { - getUINativeModule().xComponent.setColorBlend(node, this.value); - } - } - checkObjectDiff() { - return !isBaseOrResourceEqual(this.stageValue, this.value); - } -} -XComponentColorBlendModifier.identity = Symbol('xComponentColorBlend'); -class XComponentSphericalEffectModifier extends ModifierWithKey { - constructor(value) { - super(value); - } - applyPeer(node, reset) { - if (reset) { - getUINativeModule().xComponent.resetSphericalEffect(node); - } - else { - getUINativeModule().xComponent.setSphericalEffect(node, this.value); - } - } -} -XComponentSphericalEffectModifier.identity = Symbol('xComponentSphericalEffect'); -class XComponentLightUpEffectModifier extends ModifierWithKey { - constructor(value) { - super(value); - } - applyPeer(node, reset) { - if (reset) { - getUINativeModule().xComponent.resetLightUpEffect(node); - } - else { - getUINativeModule().xComponent.setLightUpEffect(node, this.value); - } - } -} -XComponentLightUpEffectModifier.identity = Symbol('xComponentLightUpEffect'); -class XComponentPixelStretchEffectModifier extends ModifierWithKey { - constructor(value) { - super(value); - } - applyPeer(node, reset) { - if (reset) { - getUINativeModule().xComponent.resetPixelStretchEffect(node); - } - else { - getUINativeModule().xComponent.setPixelStretchEffect(node, this.value.top, this.value.right, this.value.bottom, this.value.left); - } - } - checkObjectDiff() { - return !(this.stageValue.left === this.value.left && - this.stageValue.right === this.value.right && - this.stageValue.top === this.value.top && - this.stageValue.bottom === this.value.bottom); - } -} -XComponentPixelStretchEffectModifier.identity = Symbol('xComponentPixelStretchEffect'); -class XComponentLinearGradientBlurModifier extends ModifierWithKey { - constructor(value) { - super(value); - } - applyPeer(node, reset) { - if (reset) { - getUINativeModule().xComponent.resetLinearGradientBlur(node); - } - else { - getUINativeModule().xComponent.setLinearGradientBlur(node, this.value.blurRadius, this.value.fractionStops, this.value.direction); - } - } - checkObjectDiff() { - return !this.value.isEqual(this.stageValue); - } -} -XComponentLinearGradientBlurModifier.identity = Symbol('xComponentlinearGradientBlur'); class XComponentOnLoadModifier extends ModifierWithKey { constructor(value) { super(value); diff --git a/frameworks/bridge/declarative_frontend/engine/jsi/nativeModule/arkts_native_api_impl_bridge.cpp b/frameworks/bridge/declarative_frontend/engine/jsi/nativeModule/arkts_native_api_impl_bridge.cpp index b1d4397571a..1caafd7f290 100644 --- a/frameworks/bridge/declarative_frontend/engine/jsi/nativeModule/arkts_native_api_impl_bridge.cpp +++ b/frameworks/bridge/declarative_frontend/engine/jsi/nativeModule/arkts_native_api_impl_bridge.cpp @@ -5566,74 +5566,10 @@ void ArkUINativeModule::RegisterXComponentAttributes(Local obj panda::FunctionRef::New(const_cast(vm), XComponentBridge::SetOpacity)); xComponent->Set(vm, panda::StringRef::NewFromUtf8(vm, "resetOpacity"), panda::FunctionRef::New(const_cast(vm), XComponentBridge::ResetOpacity)); - xComponent->Set(vm, panda::StringRef::NewFromUtf8(vm, "setBackgroundImage"), - panda::FunctionRef::New(const_cast(vm), XComponentBridge::SetBackgroundImage)); - xComponent->Set(vm, panda::StringRef::NewFromUtf8(vm, "resetBackgroundImage"), - panda::FunctionRef::New(const_cast(vm), XComponentBridge::ResetBackgroundImage)); - xComponent->Set(vm, panda::StringRef::NewFromUtf8(vm, "setBackgroundImageSize"), - panda::FunctionRef::New(const_cast(vm), XComponentBridge::SetBackgroundImageSize)); - xComponent->Set(vm, panda::StringRef::NewFromUtf8(vm, "resetBackgroundImageSize"), - panda::FunctionRef::New(const_cast(vm), XComponentBridge::ResetBackgroundImageSize)); - xComponent->Set(vm, panda::StringRef::NewFromUtf8(vm, "setBackgroundImagePosition"), - panda::FunctionRef::New(const_cast(vm), XComponentBridge::SetBackgroundImagePosition)); - xComponent->Set(vm, panda::StringRef::NewFromUtf8(vm, "resetBackgroundImagePosition"), - panda::FunctionRef::New(const_cast(vm), XComponentBridge::ResetBackgroundImagePosition)); - xComponent->Set(vm, panda::StringRef::NewFromUtf8(vm, "setBlur"), - panda::FunctionRef::New(const_cast(vm), XComponentBridge::SetBlur)); - xComponent->Set(vm, panda::StringRef::NewFromUtf8(vm, "resetBlur"), - panda::FunctionRef::New(const_cast(vm), XComponentBridge::ResetBlur)); - xComponent->Set(vm, panda::StringRef::NewFromUtf8(vm, "setBackdropBlur"), - panda::FunctionRef::New(const_cast(vm), XComponentBridge::SetBackdropBlur)); - xComponent->Set(vm, panda::StringRef::NewFromUtf8(vm, "resetBackdropBlur"), - panda::FunctionRef::New(const_cast(vm), XComponentBridge::ResetBackdropBlur)); xComponent->Set(vm, panda::StringRef::NewFromUtf8(vm, "setGrayscale"), panda::FunctionRef::New(const_cast(vm), XComponentBridge::SetGrayscale)); xComponent->Set(vm, panda::StringRef::NewFromUtf8(vm, "resetGrayscale"), panda::FunctionRef::New(const_cast(vm), XComponentBridge::ResetGrayscale)); - xComponent->Set(vm, panda::StringRef::NewFromUtf8(vm, "setBrightness"), - panda::FunctionRef::New(const_cast(vm), XComponentBridge::SetBrightness)); - xComponent->Set(vm, panda::StringRef::NewFromUtf8(vm, "resetBrightness"), - panda::FunctionRef::New(const_cast(vm), XComponentBridge::ResetBrightness)); - xComponent->Set(vm, panda::StringRef::NewFromUtf8(vm, "setSaturate"), - panda::FunctionRef::New(const_cast(vm), XComponentBridge::SetSaturate)); - xComponent->Set(vm, panda::StringRef::NewFromUtf8(vm, "resetSaturate"), - panda::FunctionRef::New(const_cast(vm), XComponentBridge::ResetSaturate)); - xComponent->Set(vm, panda::StringRef::NewFromUtf8(vm, "setContrast"), - panda::FunctionRef::New(const_cast(vm), XComponentBridge::SetContrast)); - xComponent->Set(vm, panda::StringRef::NewFromUtf8(vm, "resetContrast"), - panda::FunctionRef::New(const_cast(vm), XComponentBridge::ResetContrast)); - xComponent->Set(vm, panda::StringRef::NewFromUtf8(vm, "setInvert"), - panda::FunctionRef::New(const_cast(vm), XComponentBridge::SetInvert)); - xComponent->Set(vm, panda::StringRef::NewFromUtf8(vm, "resetInvert"), - panda::FunctionRef::New(const_cast(vm), XComponentBridge::ResetInvert)); - xComponent->Set(vm, panda::StringRef::NewFromUtf8(vm, "setSepia"), - panda::FunctionRef::New(const_cast(vm), XComponentBridge::SetSepia)); - xComponent->Set(vm, panda::StringRef::NewFromUtf8(vm, "resetSepia"), - panda::FunctionRef::New(const_cast(vm), XComponentBridge::ResetSepia)); - xComponent->Set(vm, panda::StringRef::NewFromUtf8(vm, "setHueRotate"), - panda::FunctionRef::New(const_cast(vm), XComponentBridge::SetHueRotate)); - xComponent->Set(vm, panda::StringRef::NewFromUtf8(vm, "resetHueRotate"), - panda::FunctionRef::New(const_cast(vm), XComponentBridge::ResetHueRotate)); - xComponent->Set(vm, panda::StringRef::NewFromUtf8(vm, "setColorBlend"), - panda::FunctionRef::New(const_cast(vm), XComponentBridge::SetSepia)); - xComponent->Set(vm, panda::StringRef::NewFromUtf8(vm, "resetColorBlend"), - panda::FunctionRef::New(const_cast(vm), XComponentBridge::ResetSepia)); - xComponent->Set(vm, panda::StringRef::NewFromUtf8(vm, "setSphericalEffect"), - panda::FunctionRef::New(const_cast(vm), XComponentBridge::SetSepia)); - xComponent->Set(vm, panda::StringRef::NewFromUtf8(vm, "resetSphericalEffect"), - panda::FunctionRef::New(const_cast(vm), XComponentBridge::ResetSepia)); - xComponent->Set(vm, panda::StringRef::NewFromUtf8(vm, "setLightUpEffect"), - panda::FunctionRef::New(const_cast(vm), XComponentBridge::SetSepia)); - xComponent->Set(vm, panda::StringRef::NewFromUtf8(vm, "resetLightUpEffect"), - panda::FunctionRef::New(const_cast(vm), XComponentBridge::ResetSepia)); - xComponent->Set(vm, panda::StringRef::NewFromUtf8(vm, "setPixelStretchEffect"), - panda::FunctionRef::New(const_cast(vm), XComponentBridge::SetSepia)); - xComponent->Set(vm, panda::StringRef::NewFromUtf8(vm, "resetPixelStretchEffect"), - panda::FunctionRef::New(const_cast(vm), XComponentBridge::ResetSepia)); - xComponent->Set(vm, panda::StringRef::NewFromUtf8(vm, "setLinearGradientBlur"), - panda::FunctionRef::New(const_cast(vm), XComponentBridge::SetSepia)); - xComponent->Set(vm, panda::StringRef::NewFromUtf8(vm, "resetLinearGradientBlur"), - panda::FunctionRef::New(const_cast(vm), XComponentBridge::ResetSepia)); xComponent->Set(vm, panda::StringRef::NewFromUtf8(vm, "setOnLoad"), panda::FunctionRef::New(const_cast(vm), XComponentBridge::SetOnLoad)); xComponent->Set(vm, panda::StringRef::NewFromUtf8(vm, "resetOnLoad"), diff --git a/frameworks/bridge/declarative_frontend/engine/jsi/nativeModule/arkts_native_xcomponent_bridge.cpp b/frameworks/bridge/declarative_frontend/engine/jsi/nativeModule/arkts_native_xcomponent_bridge.cpp index a1568aed0e8..72e7f6fd2e1 100644 --- a/frameworks/bridge/declarative_frontend/engine/jsi/nativeModule/arkts_native_xcomponent_bridge.cpp +++ b/frameworks/bridge/declarative_frontend/engine/jsi/nativeModule/arkts_native_xcomponent_bridge.cpp @@ -404,138 +404,6 @@ ArkUINativeModuleValue XComponentBridge::ResetOpacity(ArkUIRuntimeCallInfo *runt return panda::JSValueRef::Undefined(vm); } -ArkUINativeModuleValue XComponentBridge::SetLinearGradientBlur(ArkUIRuntimeCallInfo *runtimeCallInfo) -{ - EcmaVM* vm = runtimeCallInfo->GetVM(); - return panda::JSValueRef::Undefined(vm); -} - -ArkUINativeModuleValue XComponentBridge::ResetLinearGradientBlur(ArkUIRuntimeCallInfo *runtimeCallInfo) -{ - EcmaVM* vm = runtimeCallInfo->GetVM(); - return panda::JSValueRef::Undefined(vm); -} - -ArkUINativeModuleValue XComponentBridge::SetPixelStretchEffect(ArkUIRuntimeCallInfo *runtimeCallInfo) -{ - EcmaVM* vm = runtimeCallInfo->GetVM(); - return panda::JSValueRef::Undefined(vm); -} - -ArkUINativeModuleValue XComponentBridge::ResetPixelStretchEffect(ArkUIRuntimeCallInfo *runtimeCallInfo) -{ - EcmaVM* vm = runtimeCallInfo->GetVM(); - return panda::JSValueRef::Undefined(vm); -} - -ArkUINativeModuleValue XComponentBridge::SetLightUpEffect(ArkUIRuntimeCallInfo *runtimeCallInfo) -{ - EcmaVM* vm = runtimeCallInfo->GetVM(); - return panda::JSValueRef::Undefined(vm); -} - -ArkUINativeModuleValue XComponentBridge::ResetLightUpEffect(ArkUIRuntimeCallInfo *runtimeCallInfo) -{ - EcmaVM* vm = runtimeCallInfo->GetVM(); - return panda::JSValueRef::Undefined(vm); -} - -ArkUINativeModuleValue XComponentBridge::SetSphericalEffect(ArkUIRuntimeCallInfo *runtimeCallInfo) -{ - EcmaVM* vm = runtimeCallInfo->GetVM(); - return panda::JSValueRef::Undefined(vm); -} - -ArkUINativeModuleValue XComponentBridge::ResetSphericalEffect(ArkUIRuntimeCallInfo *runtimeCallInfo) -{ - EcmaVM* vm = runtimeCallInfo->GetVM(); - return panda::JSValueRef::Undefined(vm); -} - -ArkUINativeModuleValue XComponentBridge::SetColorBlend(ArkUIRuntimeCallInfo *runtimeCallInfo) -{ - EcmaVM* vm = runtimeCallInfo->GetVM(); - return panda::JSValueRef::Undefined(vm); -} - -ArkUINativeModuleValue XComponentBridge::ResetColorBlend(ArkUIRuntimeCallInfo *runtimeCallInfo) -{ - EcmaVM* vm = runtimeCallInfo->GetVM(); - return panda::JSValueRef::Undefined(vm); -} - -ArkUINativeModuleValue XComponentBridge::SetHueRotate(ArkUIRuntimeCallInfo *runtimeCallInfo) -{ - EcmaVM* vm = runtimeCallInfo->GetVM(); - return panda::JSValueRef::Undefined(vm); -} - -ArkUINativeModuleValue XComponentBridge::ResetHueRotate(ArkUIRuntimeCallInfo *runtimeCallInfo) -{ - EcmaVM* vm = runtimeCallInfo->GetVM(); - return panda::JSValueRef::Undefined(vm); -} - -ArkUINativeModuleValue XComponentBridge::SetSepia(ArkUIRuntimeCallInfo *runtimeCallInfo) -{ - EcmaVM* vm = runtimeCallInfo->GetVM(); - return panda::JSValueRef::Undefined(vm); -} - -ArkUINativeModuleValue XComponentBridge::ResetSepia(ArkUIRuntimeCallInfo *runtimeCallInfo) -{ - EcmaVM* vm = runtimeCallInfo->GetVM(); - return panda::JSValueRef::Undefined(vm); -} - -ArkUINativeModuleValue XComponentBridge::SetInvert(ArkUIRuntimeCallInfo *runtimeCallInfo) -{ - EcmaVM* vm = runtimeCallInfo->GetVM(); - return panda::JSValueRef::Undefined(vm); -} - -ArkUINativeModuleValue XComponentBridge::ResetInvert(ArkUIRuntimeCallInfo *runtimeCallInfo) -{ - EcmaVM* vm = runtimeCallInfo->GetVM(); - return panda::JSValueRef::Undefined(vm); -} - -ArkUINativeModuleValue XComponentBridge::SetContrast(ArkUIRuntimeCallInfo *runtimeCallInfo) -{ - EcmaVM* vm = runtimeCallInfo->GetVM(); - return panda::JSValueRef::Undefined(vm); -} - -ArkUINativeModuleValue XComponentBridge::ResetContrast(ArkUIRuntimeCallInfo *runtimeCallInfo) -{ - EcmaVM* vm = runtimeCallInfo->GetVM(); - return panda::JSValueRef::Undefined(vm); -} - -ArkUINativeModuleValue XComponentBridge::SetSaturate(ArkUIRuntimeCallInfo *runtimeCallInfo) -{ - EcmaVM* vm = runtimeCallInfo->GetVM(); - return panda::JSValueRef::Undefined(vm); -} - -ArkUINativeModuleValue XComponentBridge::ResetSaturate(ArkUIRuntimeCallInfo *runtimeCallInfo) -{ - EcmaVM* vm = runtimeCallInfo->GetVM(); - return panda::JSValueRef::Undefined(vm); -} - -ArkUINativeModuleValue XComponentBridge::SetBrightness(ArkUIRuntimeCallInfo *runtimeCallInfo) -{ - EcmaVM* vm = runtimeCallInfo->GetVM(); - return panda::JSValueRef::Undefined(vm); -} - -ArkUINativeModuleValue XComponentBridge::ResetBrightness(ArkUIRuntimeCallInfo *runtimeCallInfo) -{ - EcmaVM* vm = runtimeCallInfo->GetVM(); - return panda::JSValueRef::Undefined(vm); -} - ArkUINativeModuleValue XComponentBridge::SetGrayscale(ArkUIRuntimeCallInfo *runtimeCallInfo) { EcmaVM* vm = runtimeCallInfo->GetVM(); @@ -548,66 +416,6 @@ ArkUINativeModuleValue XComponentBridge::ResetGrayscale(ArkUIRuntimeCallInfo *ru return panda::JSValueRef::Undefined(vm); } -ArkUINativeModuleValue XComponentBridge::SetBackdropBlur(ArkUIRuntimeCallInfo *runtimeCallInfo) -{ - EcmaVM* vm = runtimeCallInfo->GetVM(); - return panda::JSValueRef::Undefined(vm); -} - -ArkUINativeModuleValue XComponentBridge::ResetBackdropBlur(ArkUIRuntimeCallInfo *runtimeCallInfo) -{ - EcmaVM* vm = runtimeCallInfo->GetVM(); - return panda::JSValueRef::Undefined(vm); -} - -ArkUINativeModuleValue XComponentBridge::SetBlur(ArkUIRuntimeCallInfo *runtimeCallInfo) -{ - EcmaVM* vm = runtimeCallInfo->GetVM(); - return panda::JSValueRef::Undefined(vm); -} - -ArkUINativeModuleValue XComponentBridge::ResetBlur(ArkUIRuntimeCallInfo *runtimeCallInfo) -{ - EcmaVM* vm = runtimeCallInfo->GetVM(); - return panda::JSValueRef::Undefined(vm); -} - -ArkUINativeModuleValue XComponentBridge::SetBackgroundImagePosition(ArkUIRuntimeCallInfo *runtimeCallInfo) -{ - EcmaVM* vm = runtimeCallInfo->GetVM(); - return panda::JSValueRef::Undefined(vm); -} - -ArkUINativeModuleValue XComponentBridge::ResetBackgroundImagePosition(ArkUIRuntimeCallInfo *runtimeCallInfo) -{ - EcmaVM* vm = runtimeCallInfo->GetVM(); - return panda::JSValueRef::Undefined(vm); -} - -ArkUINativeModuleValue XComponentBridge::SetBackgroundImageSize(ArkUIRuntimeCallInfo *runtimeCallInfo) -{ - EcmaVM* vm = runtimeCallInfo->GetVM(); - return panda::JSValueRef::Undefined(vm); -} - -ArkUINativeModuleValue XComponentBridge::ResetBackgroundImageSize(ArkUIRuntimeCallInfo *runtimeCallInfo) -{ - EcmaVM* vm = runtimeCallInfo->GetVM(); - return panda::JSValueRef::Undefined(vm); -} - -ArkUINativeModuleValue XComponentBridge::SetBackgroundImage(ArkUIRuntimeCallInfo *runtimeCallInfo) -{ - EcmaVM* vm = runtimeCallInfo->GetVM(); - return panda::JSValueRef::Undefined(vm); -} - -ArkUINativeModuleValue XComponentBridge::ResetBackgroundImage(ArkUIRuntimeCallInfo *runtimeCallInfo) -{ - EcmaVM* vm = runtimeCallInfo->GetVM(); - return panda::JSValueRef::Undefined(vm); -} - ArkUINativeModuleValue XComponentBridge::SetOnLoad(ArkUIRuntimeCallInfo *runtimeCallInfo) { EcmaVM* vm = runtimeCallInfo->GetVM(); diff --git a/frameworks/bridge/declarative_frontend/engine/jsi/nativeModule/arkts_native_xcomponent_bridge.h b/frameworks/bridge/declarative_frontend/engine/jsi/nativeModule/arkts_native_xcomponent_bridge.h index 16e5ce40768..7f24a4e4918 100644 --- a/frameworks/bridge/declarative_frontend/engine/jsi/nativeModule/arkts_native_xcomponent_bridge.h +++ b/frameworks/bridge/declarative_frontend/engine/jsi/nativeModule/arkts_native_xcomponent_bridge.h @@ -34,40 +34,8 @@ public: static ArkUINativeModuleValue ResetBackgroundColor(ArkUIRuntimeCallInfo* runtimeCallInfo); static ArkUINativeModuleValue SetOpacity(ArkUIRuntimeCallInfo* runtimeCallInfo); static ArkUINativeModuleValue ResetOpacity(ArkUIRuntimeCallInfo* runtimeCallInfo); - static ArkUINativeModuleValue SetBackgroundImage(ArkUIRuntimeCallInfo* runtimeCallInfo); - static ArkUINativeModuleValue ResetBackgroundImage(ArkUIRuntimeCallInfo* runtimeCallInfo); - static ArkUINativeModuleValue SetBackgroundImageSize(ArkUIRuntimeCallInfo* runtimeCallInfo); - static ArkUINativeModuleValue ResetBackgroundImageSize(ArkUIRuntimeCallInfo* runtimeCallInfo); - static ArkUINativeModuleValue SetBackgroundImagePosition(ArkUIRuntimeCallInfo* runtimeCallInfo); - static ArkUINativeModuleValue ResetBackgroundImagePosition(ArkUIRuntimeCallInfo* runtimeCallInfo); - static ArkUINativeModuleValue SetBlur(ArkUIRuntimeCallInfo* runtimeCallInfo); - static ArkUINativeModuleValue ResetBlur(ArkUIRuntimeCallInfo* runtimeCallInfo); - static ArkUINativeModuleValue SetBackdropBlur(ArkUIRuntimeCallInfo* runtimeCallInfo); - static ArkUINativeModuleValue ResetBackdropBlur(ArkUIRuntimeCallInfo* runtimeCallInfo); static ArkUINativeModuleValue SetGrayscale(ArkUIRuntimeCallInfo* runtimeCallInfo); static ArkUINativeModuleValue ResetGrayscale(ArkUIRuntimeCallInfo* runtimeCallInfo); - static ArkUINativeModuleValue SetBrightness(ArkUIRuntimeCallInfo* runtimeCallInfo); - static ArkUINativeModuleValue ResetBrightness(ArkUIRuntimeCallInfo* runtimeCallInfo); - static ArkUINativeModuleValue SetSaturate(ArkUIRuntimeCallInfo* runtimeCallInfo); - static ArkUINativeModuleValue ResetSaturate(ArkUIRuntimeCallInfo* runtimeCallInfo); - static ArkUINativeModuleValue SetContrast(ArkUIRuntimeCallInfo* runtimeCallInfo); - static ArkUINativeModuleValue ResetContrast(ArkUIRuntimeCallInfo* runtimeCallInfo); - static ArkUINativeModuleValue SetInvert(ArkUIRuntimeCallInfo* runtimeCallInfo); - static ArkUINativeModuleValue ResetInvert(ArkUIRuntimeCallInfo* runtimeCallInfo); - static ArkUINativeModuleValue SetSepia(ArkUIRuntimeCallInfo* runtimeCallInfo); - static ArkUINativeModuleValue ResetSepia(ArkUIRuntimeCallInfo* runtimeCallInfo); - static ArkUINativeModuleValue SetHueRotate(ArkUIRuntimeCallInfo* runtimeCallInfo); - static ArkUINativeModuleValue ResetHueRotate(ArkUIRuntimeCallInfo* runtimeCallInfo); - static ArkUINativeModuleValue SetColorBlend(ArkUIRuntimeCallInfo* runtimeCallInfo); - static ArkUINativeModuleValue ResetColorBlend(ArkUIRuntimeCallInfo* runtimeCallInfo); - static ArkUINativeModuleValue SetSphericalEffect(ArkUIRuntimeCallInfo* runtimeCallInfo); - static ArkUINativeModuleValue ResetSphericalEffect(ArkUIRuntimeCallInfo* runtimeCallInfo); - static ArkUINativeModuleValue SetLightUpEffect(ArkUIRuntimeCallInfo* runtimeCallInfo); - static ArkUINativeModuleValue ResetLightUpEffect(ArkUIRuntimeCallInfo* runtimeCallInfo); - static ArkUINativeModuleValue SetPixelStretchEffect(ArkUIRuntimeCallInfo* runtimeCallInfo); - static ArkUINativeModuleValue ResetPixelStretchEffect(ArkUIRuntimeCallInfo* runtimeCallInfo); - static ArkUINativeModuleValue SetLinearGradientBlur(ArkUIRuntimeCallInfo* runtimeCallInfo); - static ArkUINativeModuleValue ResetLinearGradientBlur(ArkUIRuntimeCallInfo* runtimeCallInfo); static ArkUINativeModuleValue SetOnLoad(ArkUIRuntimeCallInfo* runtimeCallInfo); static ArkUINativeModuleValue ResetOnLoad(ArkUIRuntimeCallInfo* runtimeCallInfo); static ArkUINativeModuleValue SetOnDestroy(ArkUIRuntimeCallInfo* runtimeCallInfo); diff --git a/frameworks/core/components_ng/pattern/xcomponent/xcomponent_model_ng.cpp b/frameworks/core/components_ng/pattern/xcomponent/xcomponent_model_ng.cpp index 41964af0cb9..fcb873390d6 100644 --- a/frameworks/core/components_ng/pattern/xcomponent/xcomponent_model_ng.cpp +++ b/frameworks/core/components_ng/pattern/xcomponent/xcomponent_model_ng.cpp @@ -336,7 +336,9 @@ RefPtr XComponentModelNG::CreateTypeNode(int32_t nodeId, ArkUI_XCompo } auto xcPattern = AceType::DynamicCast(frameNode->GetPattern()); CHECK_NULL_RETURN(xcPattern, nullptr); - xcPattern->SetImageAIOptions(params->aiOptions); + if (type == XComponentType::SURFACE || type == XComponentType::TEXTURE) { + xcPattern->SetImageAIOptions(params->aiOptions); + } return frameNode; } diff --git a/frameworks/core/interfaces/native/node/node_xcomponent_modifier.cpp b/frameworks/core/interfaces/native/node/node_xcomponent_modifier.cpp index 559495e9989..663eae67373 100644 --- a/frameworks/core/interfaces/native/node/node_xcomponent_modifier.cpp +++ b/frameworks/core/interfaces/native/node/node_xcomponent_modifier.cpp @@ -63,7 +63,8 @@ void SetXComponentOpacity(ArkUINodeHandle node, ArkUI_Float32 opacity) { auto *frameNode = reinterpret_cast(node); CHECK_NULL_VOID(frameNode); - if (!XComponentModelNG::IsTexture(frameNode)) { + auto type = XComponentModelNG::GetXComponentType(frameNode); + if (type == XComponentType::SURFACE || type == XComponentType::COMPONENT) { return; } if ((LessNotEqual(opacity, 0.0)) || opacity > 1) { @@ -76,7 +77,8 @@ void ResetXComponentOpacity(ArkUINodeHandle node) { auto* frameNode = reinterpret_cast(node); CHECK_NULL_VOID(frameNode); - if (!XComponentModelNG::IsTexture(frameNode)) { + auto type = XComponentModelNG::GetXComponentType(frameNode); + if (type == XComponentType::SURFACE || type == XComponentType::COMPONENT) { return; } ViewAbstract::SetOpacity(frameNode, 1.0f); @@ -215,6 +217,9 @@ void SetXComponentRenderFit(ArkUINodeHandle node, ArkUI_Int32 renderFitNumber) renderFit = static_cast(renderFitNumber); } auto type = XComponentModelNG::GetXComponentType(frameNode); + if (type == XComponentType::COMPONENT || type == XComponentType::NODE) { + return; + } if (type == XComponentType::TEXTURE) { ViewAbstract::SetRenderFit(frameNode, renderFit); return; @@ -227,6 +232,9 @@ void ResetXComponentRenderFit(ArkUINodeHandle node) auto* frameNode = reinterpret_cast(node); CHECK_NULL_VOID(frameNode); auto type = XComponentModelNG::GetXComponentType(frameNode); + if (type == XComponentType::COMPONENT || type == XComponentType::NODE) { + return; + } if (type == XComponentType::TEXTURE) { ViewAbstract::SetRenderFit(frameNode, RenderFit::RESIZE_FILL); return; diff --git a/frameworks/core/interfaces/native/node/view_model.cpp b/frameworks/core/interfaces/native/node/view_model.cpp index 84be70843dd..8b31cd54608 100644 --- a/frameworks/core/interfaces/native/node/view_model.cpp +++ b/frameworks/core/interfaces/native/node/view_model.cpp @@ -296,6 +296,13 @@ void* createXComponentNode(ArkUI_Int32 nodeId) return AceType::RawPtr(frameNode); } +void* createXComponentTextureNode(ArkUI_Int32 nodeId) +{ + auto frameNode = XComponentModelNG::CreateFrameNode(nodeId, "", XComponentType::TEXTURE, ""); + frameNode->IncRefCount(); + return AceType::RawPtr(frameNode); +} + void* createXComponentNodeWithParams(ArkUI_Int32 nodeId, const ArkUI_Params& params) { ArkUI_XComponent_Params* xcParams = (ArkUI_XComponent_Params*)(¶ms); @@ -682,6 +689,11 @@ static createArkUIFrameNode* createArkUIFrameNodes[] = { createMarqueeNode, createCheckBoxGroupNode, createRatingNode, +#ifdef XCOMPONENT_SUPPORTED + createXComponentTextureNode, +#else + nullptr, +#endif }; void* CreateNode(ArkUINodeType tag, ArkUI_Int32 nodeId) diff --git a/interfaces/native/native_interface_xcomponent.cpp b/interfaces/native/native_interface_xcomponent.cpp index 2df66257f1f..67b003b30ad 100644 --- a/interfaces/native/native_interface_xcomponent.cpp +++ b/interfaces/native/native_interface_xcomponent.cpp @@ -331,7 +331,7 @@ int32_t OH_NativeXComponent_GetTouchEventSourceType( OH_NativeXComponent* OH_NativeXComponent_GetNativeXComponent(ArkUI_NodeHandle node) { - if (node == nullptr || node->type != ARKUI_NODE_XCOMPONENT) { + if (node == nullptr || (node->type != ARKUI_NODE_XCOMPONENT && node->type != ARKUI_NODE_XCOMPONENT_TEXTURE)) { return nullptr; } auto nodeModifiers = OHOS::Ace::NodeModel::GetFullImpl()->getNodeModifiers(); diff --git a/interfaces/native/native_node.h b/interfaces/native/native_node.h index 8306f781010..075a2da2540 100644 --- a/interfaces/native/native_node.h +++ b/interfaces/native/native_node.h @@ -91,6 +91,10 @@ typedef enum { ARKUI_NODE_RADIO = 18, /** Frame-by-frame animation component. */ ARKUI_NODE_IMAGE_ANIMATOR = 19, + /** XComponent of type TEXTURE. + * @since 16 + */ + ARKUI_NODE_XCOMPONENT_TEXTURE, /** Check box group. * @since 16 */ diff --git a/interfaces/native/node/node_model.cpp b/interfaces/native/node/node_model.cpp index 5026b1ac51b..e51a81acea0 100644 --- a/interfaces/native/node/node_model.cpp +++ b/interfaces/native/node/node_model.cpp @@ -139,10 +139,9 @@ ArkUI_NodeHandle CreateNode(ArkUI_NodeType type) ARKUI_TOGGLE, ARKUI_LOADING_PROGRESS, ARKUI_TEXT_INPUT, ARKUI_TEXTAREA, ARKUI_BUTTON, ARKUI_PROGRESS, ARKUI_CHECKBOX, ARKUI_XCOMPONENT, ARKUI_DATE_PICKER, ARKUI_TIME_PICKER, ARKUI_TEXT_PICKER, ARKUI_CALENDAR_PICKER, ARKUI_SLIDER, ARKUI_RADIO, ARKUI_IMAGE_ANIMATOR, ARKUI_XCOMPONENT_TEXTURE, - ARKUI_CHECK_BOX_GROUP, ARKUI_STACK, ARKUI_SWIPER, - ARKUI_SCROLL, ARKUI_LIST, ARKUI_LIST_ITEM, ARKUI_LIST_ITEM_GROUP, ARKUI_COLUMN, ARKUI_ROW, ARKUI_FLEX, - ARKUI_REFRESH, ARKUI_WATER_FLOW, ARKUI_FLOW_ITEM, ARKUI_RELATIVE_CONTAINER, ARKUI_GRID, ARKUI_GRID_ITEM, - ARKUI_CUSTOM_SPAN }; + ARKUI_CHECK_BOX_GROUP, ARKUI_STACK, ARKUI_SWIPER, ARKUI_SCROLL, ARKUI_LIST, ARKUI_LIST_ITEM, + ARKUI_LIST_ITEM_GROUP, ARKUI_COLUMN, ARKUI_ROW, ARKUI_FLEX, ARKUI_REFRESH, ARKUI_WATER_FLOW, ARKUI_FLOW_ITEM, + ARKUI_RELATIVE_CONTAINER, ARKUI_GRID, ARKUI_GRID_ITEM, ARKUI_CUSTOM_SPAN }; // already check in entry point. uint32_t nodeType = type < MAX_NODE_SCOPE_NUM ? type : (type - MAX_NODE_SCOPE_NUM + BASIC_COMPONENT_NUM); const auto* impl = GetFullImpl(); diff --git a/interfaces/native/node/style_modifier.cpp b/interfaces/native/node/style_modifier.cpp index 35a15bcf5dc..07b2427003e 100644 --- a/interfaces/native/node/style_modifier.cpp +++ b/interfaces/native/node/style_modifier.cpp @@ -261,6 +261,7 @@ std::unordered_map ACCESSIBILITY_ROLE_CONVERT_PROPERTY_MA { static_cast(ARKUI_NODE_GRID), "Grid" }, { static_cast(ARKUI_NODE_GRID_ITEM), "GridItem" }, { static_cast(ARKUI_NODE_CUSTOM_SPAN), "CustomSpan" }, + { static_cast(ARKUI_NODE_XCOMPONENT_TEXTURE), "XComponentTexture" }, }; std::unordered_map ACCESSIBILITY_ROLE_CONVERT_NATIVE_MAP = { @@ -300,6 +301,7 @@ std::unordered_map ACCESSIBILITY_ROLE_CONVERT_NATIVE_MAP { "Grid", static_cast(ARKUI_NODE_GRID) }, { "GridItem", static_cast(ARKUI_NODE_GRID_ITEM) }, { "CustomSpan", static_cast(ARKUI_NODE_CUSTOM_SPAN) }, + { "XComponentTexture", static_cast(ARKUI_NODE_XCOMPONENT_TEXTURE) }, }; void ResetAttributeItem() @@ -14776,11 +14778,11 @@ int32_t SetNodeAttribute(ArkUI_NodeHandle node, ArkUI_NodeAttributeType type, co SetImageSpanAttribute, SetImageAttribute, SetToggleAttribute, SetLoadingProgressAttribute, SetTextInputAttribute, SetTextAreaAttribute, SetButtonAttribute, SetProgressAttribute, SetCheckboxAttribute, SetXComponentAttribute, SetDatePickerAttribute, SetTimePickerAttribute, SetTextPickerAttribute, - SetCalendarPickerAttribute, SetSliderAttribute, SetRadioAttribute, SetImageAnimatorAttribute, nullptr, - SetCheckboxGroupAttribute, SetStackAttribute, SetSwiperAttribute, - SetScrollAttribute, SetListAttribute, SetListItemAttribute, SetListItemGroupAttribute, SetColumnAttribute, - SetRowAttribute, SetFlexAttribute, SetRefreshAttribute, SetWaterFlowAttribute, nullptr, - SetRelativeContainerAttribute, SetGridAttribute }; + SetCalendarPickerAttribute, SetSliderAttribute, SetRadioAttribute, SetImageAnimatorAttribute, + SetXComponentAttribute, SetCheckboxGroupAttribute, SetStackAttribute, SetSwiperAttribute, SetScrollAttribute, + SetListAttribute, SetListItemAttribute, SetListItemGroupAttribute, SetColumnAttribute, SetRowAttribute, + SetFlexAttribute, SetRefreshAttribute, SetWaterFlowAttribute, nullptr, SetRelativeContainerAttribute, + SetGridAttribute }; int32_t subTypeClass = type / MAX_NODE_SCOPE_NUM; int32_t subTypeId = type % MAX_NODE_SCOPE_NUM; int32_t nodeSubTypeClass = @@ -14807,11 +14809,10 @@ const ArkUI_AttributeItem* GetNodeAttribute(ArkUI_NodeHandle node, ArkUI_NodeAtt GetImageSpanAttribute, GetImageAttribute, GetToggleAttribute, GetLoadingProgressAttribute, GetTextInputAttribute, GetTextAreaAttribute, GetButtonAttribute, GetProgressAttribute, GetCheckboxAttribute, GetXComponentAttribute, GetDatePickerAttribute, GetTimePickerAttribute, GetTextPickerAttribute, - GetCalendarPickerAttribute, GetSliderAttribute, GetRadioAttribute, GetImageAnimatorAttribute, nullptr, - GetCheckboxGroupAttribute, GetStackAttribute, - GetSwiperAttribute, GetScrollAttribute, GetListAttribute, nullptr, GetListItemGroupAttribute, - GetColumnAttribute, GetRowAttribute, GetFlexAttribute, GetRefreshAttribute, GetWaterFlowAttribute, nullptr, - GetRelativeContainerAttribute, GetGridAttribute }; + GetCalendarPickerAttribute, GetSliderAttribute, GetRadioAttribute, GetImageAnimatorAttribute, + GetXComponentAttribute, GetCheckboxGroupAttribute, GetStackAttribute, GetSwiperAttribute, GetScrollAttribute, + GetListAttribute, nullptr, GetListItemGroupAttribute, GetColumnAttribute, GetRowAttribute, GetFlexAttribute, + GetRefreshAttribute, GetWaterFlowAttribute, nullptr, GetRelativeContainerAttribute, GetGridAttribute }; int32_t subTypeClass = type / MAX_NODE_SCOPE_NUM; int32_t subTypeId = type % MAX_NODE_SCOPE_NUM; int32_t nodeSubTypeClass = @@ -14835,7 +14836,7 @@ int32_t ResetNodeAttribute(ArkUI_NodeHandle node, ArkUI_NodeAttributeType type) ResetTextInputAttribute, ResetTextAreaAttribute, ResetButtonAttribute, ResetProgressAttribute, ResetCheckboxAttribute, ResetXComponentAttribute, ResetDatePickerAttribute, ResetTimePickerAttribute, ResetTextPickerAttribute, ResetCalendarPickerAttribute, ResetSliderAttribute, ResetRadioAttribute, - ResetImageAnimatorAttribute, nullptr, ResetCheckboxGroupAttribute, + ResetImageAnimatorAttribute, ResetXComponentAttribute, ResetCheckboxGroupAttribute, ResetStackAttribute, ResetSwiperAttribute, ResetScrollAttribute, ResetListAttribute, ResetListItemAttribute, ResetListItemGroupAttribute, ResetColumnAttribute, ResetRowAttribute, ResetFlexAttribute, ResetRefreshAttribute, ResetWaterFlowAttribute, nullptr, ResetRelativeContainerAttribute, ResetGridAttribute }; -- Gitee