diff --git a/api/arkui/BuilderNode.d.ts b/api/arkui/BuilderNode.d.ts index 382f2c75f2be2bf20706ab4de8b12b75bec49454..7014d1281d97b11e5c84ab7263889a859e5fc25b 100644 --- a/api/arkui/BuilderNode.d.ts +++ b/api/arkui/BuilderNode.d.ts @@ -551,3 +551,198 @@ export class BuilderNode { */ isDisposed(): boolean; } + +/** + * Defines BuilderNodeEx. + * Implements a BuilderNode, which can create a component tree through the stateless UI method @Builder and hold the + * root node of the component tree. A BuilderNode cannot be defined as a state variable. The FrameNode held in the + * BuilderNode is only used to mount the BuilderNode to other FrameNodes as a child node. Undefined behavior may occur + * if you set attributes or perform operations on subnodes of the FrameNode held by the BuilderNode. Therefore, after + * you have obtained a RenderNode through the getFrameNode method of the BuilderNode and the getRenderNode method of the + * FrameNode, avoid setting the attributes or operating the subnodes through APIs of the RenderNode. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 22 + */ +export class BuilderNode2 { +/** + * Constructor. + * When the content generated by the BuilderNode is embedded in another RenderNode for display, that is, the + * RenderNode corresponding to the BuilderNode is mounted to another RenderNode for display, selfIdealSize in + * RenderOptions must be explicitly specified. If selfIdealSize is not set, the node in the builder follows the + * default parent component layout constraint [0, 0], which means that the size of the root node of the subtree in + * BuilderNode is [0, 0]. + * + *

Note: + *
The input parameter for uiContext must be a valid value, that is, the UI context must be correct. If an invalid + *
value is passed in or if no value is specified, creation will fail. + *

+ * + * @param { UIContext } uiContext - uiContext used to create the BuilderNode + * @param { ?RenderOptions } options - Render options of the Builder Node + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 22 + */ + constructor(uiContext: UIContext, options?: RenderOptions); +/** + * Build the BuilderNode with the builder.Support the type that WrappedBuilder contains builder used different params. + * Creates a component tree based on the passed object and holds the root node of the component tree. The stateless UI + * method @Builder has at most one root node. Custom components are allowed. Yet, the custom components cannot use + * decorators, such as @Reusable, @Link, @Provide, and @Consume, for state synchronization with the current page. + * Custom components can receive LocalStorage instances. You can use LocalStorage related + * decorators such as @LocalStorageProp and @LocalStorageLink by passing LocalStorage instances. + * + *

Note: + *
For details about the creation and update using @Builder, see @Builder. + *
The outermost @Builder supports only one input argument. + *

+ * + * @param { WrappedBuilder } builder - Defined the builder will be called to build the node. + * @param { BuildOptions } options - Defined the options will be used when build. + * @param { Args } args - Defined the args will be used in the builder. The type of the input argument + * must be consistent with the type defined by @Builder. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 22 + */ + build(builder: WrappedBuilder, options: BuilderOptions, ...args: Args): void; + /** + * Get the FrameNode in BuilderNode. + * The FrameNode is generated only after the BuilderNode executes the build operation. + * + * @returns { FrameNode | null } - Returns a FrameNode inside the BuilderNode, or null if not contained. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 22 + */ + getFrameNode(): FrameNode | null; + + /** + * Dispatch touchEvent to targetNode. + * postTouchEvent dispatches the event from a middle node in the component tree downwards. To ensure the event is + * dispatched correctly, it needs to be transformed into the coordinate system of the parent component, as shown in + * the figure below. + * OffsetA indicates the offset of the BuildNode relative to the parent component. You can obtain this offset by + * calling getPositionToParent in the FrameNode. OffsetB indicates the offset of the touch point relative to the + * BuildNode. You can obtain this offset from the TouchEvent object. OffsetC is the sum of OffsetA and OffsetB. It + * represents the final offset that you need to pass to postTouchEvent. + * + *

Note: + *
The coordinates you pass in need to be converted to pixel values (px). If the BuilderNode has any affine + *
transformations applied to it, they must be taken into account and combined with the touch event coordinates. + *
In Webview, coordinate system transformations are already handled internally, so you can directly dispatch the + *
touch event without additional adjustments. + *
The postTouchEvent API can be called only once for the same timestamp. + *
UIExtensionComponent is not supported. + *

+ * + * @param { TouchEvent } event - The touchEvent which will be sent to the targetNode. + * @returns { boolean } - Returns true if the TouchEvent has been successfully posted to the targetNode, false otherwise. + * If the event does not hit the expected component, ensure the following: + * 1. The coordinate system has been correctly transformed + * 2. The component is in an interactive state. + * 3. The event has been bound to the component. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 22 + */ + postTouchEvent(event: TouchEvent): boolean; + + /** + * Dispose the BuilderNode immediately. + * Calling dispose on a BuilderNode object breaks its reference to the backend entity node, and also simultaneously + * severs the references of its contained FrameNode and RenderNode to their respective entity nodes. + * + *

Note: + *
Calling dispose on a BuilderNode object breaks its reference to the backend entity node, and also + *
simultaneously severs the references of its contained FrameNode and RenderNode to their respective entity nodes. + *
If the frontend object BuilderNode cannot be released, memory leaks may occur. To avoid this, be sure to call + *
dispose on the BuilderNode when you no longer need it. This reduces the complexity of reference relationships + *
and lowers the risk of memory leaks. + *

+ * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 22 + */ + dispose(): void; + + /** + * Reuse the BuilderNode based on the provided parameters. + * + * @param { Object } [param] - Parameters for reusing BuilderNode. + * It is of the same type as the parameter passed to the build API. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 22 + */ + reuse(param?: Object): void; + + /** + * Recycle the BuilderNode. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 22 + */ + recycle(): void; + + /** + * Notify BuilderNode to update the configuration to trigger a reload of the BuilderNode. + * + *

Note: + *
The updateConfiguration API is used to instruct an object to update, with the system environment used for the + *
update being determined by the changes in the application's current system environment. + *

+ * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 22 + */ + updateConfiguration(): void; + + /** + * Dispatch mouse event to targetNode. + * + * @param { InputEventType } event - The event which will be sent to the targetNode. + * @returns { boolean } - Returns true if the event has been successfully posted to the targetNode, + * false otherwise. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 22 + */ + postInputEvent(event: InputEventType): boolean; + + /** + * Set if the BuilderNode inherits the freezing policy of the parent CustomComponent, ComponentContent, or BuilderNode. + * + * @param { boolean } enabled - If the BuilderNode inherits the freezing policy of the parent CustomComponent, ComponentContent, or BuilderNode. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 22 + */ + inheritFreezeOptions(enabled: boolean): void; + + /** + * Get if the node is disposed. + * + * @returns { boolean } - Returns true if the node is disposed, false otherwise. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 22 + */ + isDisposed(): boolean; +} \ No newline at end of file diff --git a/api/arkui/BuilderNode.static.d.ets b/api/arkui/BuilderNode.static.d.ets index b688a382483a2fb55f10e564988d67fc9c7e716e..22eec97c6e160c0f7cbe92ed76e8e510cf17e94f 100644 --- a/api/arkui/BuilderNode.static.d.ets +++ b/api/arkui/BuilderNode.static.d.ets @@ -252,3 +252,110 @@ export declare class BuilderNode { * @since 20 */ declare type InputEventType = TouchEvent | MouseEvent | AxisEvent; + +/** + * Defines BuilderNodeEx. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 22 + */ +export declare class BuilderNode2 { + /** + * Constructor. + * + * @param { UIContext } uiContext - uiContext used to create the BuilderNode + * @param { ?RenderOptions } [options] - Render options of the Builder Node + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 22 + */ + constructor(uiContext: UIContext, options?: RenderOptions); + /** + * Build the BuilderNode with the builder. + * + * @param { @Builder (() => void) } builder - Defined the builder will be called to build the node. + * @param { ?BuildOptions } [options] - Defined the options will be used when build. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 22 + */ + build(builder: @Builder (() => void), options?: BuilderOptions): void; + /** + * Get the FrameNode in BuilderNode. + * + * @returns { FrameNode | null } - Returns a FrameNode inside the BuilderNode, or null if not contained. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 22 + */ + getFrameNode(): FrameNode | null; + + /** + * Dispatch touchEvent to targetNode. + * + * @param { TouchEvent } event - The touchEvent which will be sent to the targetNode. + * @returns { boolean } - Returns true if the TouchEvent has been successfully posted to the targetNode, false otherwise. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 22 + */ + postTouchEvent(event: TouchEvent): boolean; + + /** + * Dispose the BuilderNode immediately. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 22 + */ + dispose(): void; + + /** + * Reuse the BuilderNode based on the provided parameters. + * + * @param { RecordData } [param] - Parameters for reusing BuilderNode. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 22 + */ + reuse(param?: RecordData): void; + + /** + * Recycle the BuilderNode. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 22 + */ + recycle(): void; + + /** + * Notify BuilderNode to update the configuration to trigger a reload of the BuilderNode. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 22 + */ + updateConfiguration(): void; + + /** + * Get if the BuilderNode is disposed. + * + * @returns { boolean } - Returns true if the BuilderNode is disposed, false otherwise. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 22 + */ + isDisposed(): boolean; + + /** + * Dispatch the event to targetNode. + * + * @param { InputEventType } event - The event which will be sent to the targetNode. + * @returns { boolean } - Returns true if the event has been successfully posted to the targetNode, + * false otherwise. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 22 + */ + postInputEvent(event: InputEventType): boolean; + + /** + * Set if the BuilderNode inherits the freezing policy of the parent CustomComponent, ComponentContent, or BuilderNode. + * + * @param { boolean } enabled - If the BuilderNode inherits the freezing policy of the parent CustomComponent, ComponentContent, or BuilderNode. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 22 + */ + inheritFreezeOptions(enabled: boolean): void; +} diff --git a/api/arkui/ComponentContent.d.ts b/api/arkui/ComponentContent.d.ts index e4f39cfbf76bcd4c5fa5d1348889a6e09e1e39a4..4b25f5eb9ca0ab2849cc478e75e2dbcfe9e85a3f 100644 --- a/api/arkui/ComponentContent.d.ts +++ b/api/arkui/ComponentContent.d.ts @@ -147,4 +147,91 @@ export class ComponentContent extends Content { * @since 20 */ isDisposed(): boolean; +} + +/** + * Defines ComponentContentEx. + * + * @extends Content + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ +export class ComponentContentEx extends Content { + /** + * Constructor. + * + * @param { UIContext } uiContext - uiContext used to create the ComponentContent + * @param { WrappedBuilder } builder - Defined the builder will be called to build ComponentContent. + * @param { BuildOptions } options - Defined the options will be used when build. + * @param { T } args - Parameters used to update the ComponentContentEx. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 22 + */ + constructor(uiContext: UIContext, builder: WrappedBuilder, options: BuildOptions, ...args: T); + /** + * Reuse the ComponentContent based on the provided parameters. + * + * @param { Object } [param] - Parameters for reusing ComponentContent. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 22 + */ + reuse(param?: Object): void; + + /** + * Recycle the ComponentContent. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 22 + */ + recycle(): void; + + /** + * Dispose the ComponentContent immediately. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 22 + */ + dispose(): void; + + /** + * Notify ComponentContent to update the configuration to trigger a reload of the ComponentContent. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 22 + */ + updateConfiguration(): void; + + /** + * Set if the ComponentContent inherits the freezing policy of the parent CustomComponent, ComponentContent, or BuilderNode. + * + * @param { boolean } enabled - If the ComponentContent inherits the freezing policy of the parent CustomComponent, ComponentContent, or BuilderNode. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 22 + */ + inheritFreezeOptions(enabled: boolean): void; + + /** + * Get if the ComponentContent is disposed. + * + * @returns { boolean } - Returns true if the ComponentContent is disposed, false otherwise. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 22 + */ + isDisposed(): boolean; } \ No newline at end of file diff --git a/api/arkui/ComponentContent.static.d.ets b/api/arkui/ComponentContent.static.d.ets index 1143847e3c13de735b69693e6b623e4589a226e0..b84e6a738a6bbde50a395b454aded41162820f03 100644 --- a/api/arkui/ComponentContent.static.d.ets +++ b/api/arkui/ComponentContent.static.d.ets @@ -121,3 +121,64 @@ export declare class ComponentContent extends ComponentContentBas */ updateConfiguration(): void; } + +/** + * Defines ComponentContentEx. + * + * @extends ComponentContentBase + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 22 + */ +export declare class ComponentContentEx extends ComponentContentBase { + /** + * Constructor. + * + * @param { UIContext } uiContext - uiContext used to create the ComponentContent + * @param { @Builder (() => void) } builder - Defined the builder will be called to build ComponentContent. + * @param { ?BuildOptions } [options] - Defined the options will be used when build. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 22 + */ + constructor(uiContext: UIContext, builder: @Builder (() => void), options?: BuildOptions); + /** + * Reuse the ComponentContent based on the provided parameters. + * + * @param { RecordData } [param] - Parameters for reusing ComponentContent. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 22 + */ + reuse(param?: RecordData): void; + + /** + * Recycle the ComponentContent. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 22 + */ + recycle(): void; + + /** + * Dispose the ComponentContent immediately. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 22 + */ + dispose(): void; + + /** + * Get if the ComponentContent is disposed. + * + * @returns { boolean } - Returns true if the ComponentContent is disposed, false otherwise. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 22 + */ + isDisposed(): boolean; + + /** + * Notify ComponentContent to update the configuration to trigger a reload of the ComponentContent. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 22 + */ + updateConfiguration(): void; +} \ No newline at end of file