diff --git a/api/arkui/BuilderNode.d.ts b/api/arkui/BuilderNode.d.ts index ce6ba03d624dc60dfaa14cc266870352e0920123..85b8baf93998369b59d038255af96142c80be47a 100644 --- a/api/arkui/BuilderNode.d.ts +++ b/api/arkui/BuilderNode.d.ts @@ -727,4 +727,199 @@ export declare class BuilderNode { * @arkts 1.2 */ updateConfiguration(): void; - } \ No newline at end of file + } + + /** + * 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/ComponentContent.d.ts b/api/arkui/ComponentContent.d.ts index 95200a415269c443afba6bf10ee085def27bbc9b..6bb09df313dc23507484c7c2121e8a1703859d25 100644 --- a/api/arkui/ComponentContent.d.ts +++ b/api/arkui/ComponentContent.d.ts @@ -267,3 +267,90 @@ export declare class ComponentContent extends Content { */ updateConfiguration(): void; } + +/** + * 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