1/* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file 18 * @kit ArkUI 19 */ 20 21import { UIContext } from '../@ohos.arkui.UIContext'; 22import { FrameNode } from './FrameNode'; 23import { Size } from './Graphics'; 24/*** if arkts 1.2 */ 25import { TouchEvent } from './component/common'; 26import { WrappedBuilder, CustomBuilder, CustomBuilderT } from './component/builder'; 27/*** endif */ 28 29/** 30 * Render type of the node using for indicating that 31 * if the node will be shown on the display or rendered to a texture 32 * 33 * @enum { number } Render type 34 * @syscap SystemCapability.ArkUI.ArkUI.Full 35 * @crossplatform 36 * @since 11 37 */ 38/** 39 * Render type of the node using for indicating that 40 * if the node will be shown on the display or rendered to a texture 41 * 42 * <p><strong>NOTE</strong>: 43 * <br>Currently, the <em>RENDER_TYPE_TEXTURE</em> type takes effect only for the XComponentNode and the BuilderNode 44 * <br>holding a component tree whose root node is a custom component. 45 * <br>In the case of BuilderNode, the following custom components that function as the root node support texture export: 46 * <br>Badge, Blank, Button, CanvasGradient, CanvasPattern, CanvasRenderingContext2D, Canvas, CheckboxGroup, Checkbox, 47 * <br>Circle, ColumnSplit, Column, ContainerSpan, Counter, DataPanel, Divider, Ellipse, Flex, Gauge, Hyperlink, 48 * <br>ImageBitmap, ImageData, Image, Line, LoadingProgress, Marquee, Matrix2D, OffscreenCanvasRenderingContext2D, 49 * <br>OffscreenCanvas, Path2D, Path, PatternLock, Polygon, Polyline, Progress, QRCode, Radio, Rating, Rect, 50 * <br>RelativeContainer, RowSplit, Row, Shape, Slider, Span, Stack, TextArea, TextClock, TextInput, TextTimer, Text, 51 * <br>Toggle, Video (without support for full-screen playback), Web, XComponent 52 * <br>The following components support texture export since API version 12: DatePicker, ForEach, Grid, IfElse, 53 * <br>LazyForEach, List, Scroll, Swiper, TimePicker, @Component decorated custom components, NodeContainer, 54 * <br>and FrameNode and RenderNode mounted to a NodeContainer. 55 * </p> 56 57For details, see Rendering and Drawing Video and Button Components at the Same Layer. 58 * 59 * @enum { number } Render type 60 * @syscap SystemCapability.ArkUI.ArkUI.Full 61 * @crossplatform 62 * @atomicservice 63 * @since arkts {'1.1':'12','1.2':'20'} 64 * @arkts 1.1&1.2 65 */ 66export declare enum NodeRenderType { 67 /** 68 * Display type.The node will be shown on the display. 69 * 70 * @syscap SystemCapability.ArkUI.ArkUI.Full 71 * @crossplatform 72 * @since 11 73 */ 74 /** 75 * Display type.The node will be shown on the display. 76 * 77 * @syscap SystemCapability.ArkUI.ArkUI.Full 78 * @crossplatform 79 * @atomicservice 80 * @since arkts {'1.1':'12','1.2':'20'} 81 * @arkts 1.1&1.2 82 */ 83 RENDER_TYPE_DISPLAY = 0, 84 85 /** 86 * Exporting texture type.The node will be render to a texture. 87 * 88 * @syscap SystemCapability.ArkUI.ArkUI.Full 89 * @since 11 90 */ 91 /** 92 * Exporting texture type.The node will be render to a texture. 93 * 94 * @syscap SystemCapability.ArkUI.ArkUI.Full 95 * @atomicservice 96 * @since arkts {'1.1':'12','1.2':'20'} 97 * @arkts 1.1&1.2 98 */ 99 RENDER_TYPE_TEXTURE = 1, 100} 101 102/** 103 * RenderOptions info. 104 * 105 * @interface RenderOptions 106 * @syscap SystemCapability.ArkUI.ArkUI.Full 107 * @crossplatform 108 * @since 11 109 */ 110/** 111 * RenderOptions info. 112 * 113 * @interface RenderOptions 114 * @syscap SystemCapability.ArkUI.ArkUI.Full 115 * @crossplatform 116 * @atomicservice 117 * @since arkts {'1.1':'12','1.2':'20'} 118 * @arkts 1.1&1.2 119 */ 120export interface RenderOptions { 121 /** 122 * The ideal size of the node. 123 * @type { ?Size } selfIdealSize - The ideal size of the node 124 * @syscap SystemCapability.ArkUI.ArkUI.Full 125 * @crossplatform 126 * @since 11 127 */ 128 /** 129 * The ideal size of the node. 130 * @type { ?Size } selfIdealSize - The ideal size of the node 131 * @syscap SystemCapability.ArkUI.ArkUI.Full 132 * @crossplatform 133 * @atomicservice 134 * @since arkts {'1.1':'12','1.2':'20'} 135 * @arkts 1.1&1.2 136 */ 137 selfIdealSize?: Size; 138 139 /** 140 * Render type of the node. 141 * @type { ?NodeRenderType } type - Render type of the node 142 * @syscap SystemCapability.ArkUI.ArkUI.Full 143 * @since 11 144 */ 145 /** 146 * Render type of the node. 147 * @type { ?NodeRenderType } type - Render type of the node 148 * @syscap SystemCapability.ArkUI.ArkUI.Full 149 * @atomicservice 150 * @since arkts {'1.1':'12','1.2':'20'} 151 * @arkts 1.1&1.2 152 */ 153 type?: NodeRenderType; 154 155 /** 156 * The surfaceId of a texture consumer 157 * @type { ?string } surfaceId - surfaceId of a consumer who can receive the texture of the Node 158 * @syscap SystemCapability.ArkUI.ArkUI.Full 159 * @since 11 160 */ 161 /** 162 * The surfaceId of a texture consumer 163 * Generally, the texture receiver is an OH_NativeImage instance. 164 * @type { ?string } surfaceId - surfaceId of a consumer who can receive the texture of the Node 165 * @syscap SystemCapability.ArkUI.ArkUI.Full 166 * @atomicservice 167 * @since arkts {'1.1':'12','1.2':'20'} 168 * @arkts 1.1&1.2 169 */ 170 surfaceId?: string; 171} 172 173 174/** 175 * BuildOptions info. 176 * 177 * @interface BuildOptions 178 * @syscap SystemCapability.ArkUI.ArkUI.Full 179 * @crossplatform 180 * @atomicservice 181 * @since arkts {'1.1':'12','1.2':'20'} 182 * @arkts 1.1&1.2 183 */ 184export interface BuildOptions { 185 186 /** 187 * Build type of the Builder. 188 * @type { ?boolean } nestingBuilderSupported - Build type of the Builder. 189 * Indicates whether support the type that WrappedBuilder contains builder used different params. 190 * The value false means that the input arguments for @Builder are consistent, and true means the opposite. 191 * @default false 192 * @syscap SystemCapability.ArkUI.ArkUI.Full 193 * @crossplatform 194 * @atomicservice 195 * @since arkts {'1.1':'12','1.2':'20'} 196 * @arkts 1.1&1.2 197 */ 198 nestingBuilderSupported?: boolean; 199 200 /** 201 * The LocalStorage of the Builder. 202 * @type { ?LocalStorage } localStorage - The LocalStorage of the Builder. 203 * 204 * @syscap SystemCapability.ArkUI.ArkUI.Full 205 * @crossplatform 206 * @atomicservice 207 * @since 20 208 */ 209 localStorage?: LocalStorage; 210 211 /** 212 * Whether support the inner Consume connect to the outside Provide. 213 * @type { ?boolean } 214 * enableProvideConsumeCrossing - Indicates whether support the inner Consume 215 * connect to the outside Provide. 216 * @syscap SystemCapability.ArkUI.ArkUI.Full 217 * @crossplatform 218 * @atomicservice 219 * @since 20 220 */ 221 enableProvideConsumeCrossing?: boolean; 222} 223 224/** 225 * Defines the event type used for posting. 226 * 227 * @typedef { TouchEvent | MouseEvent | AxisEvent } InputEventType 228 * @syscap SystemCapability.ArkUI.ArkUI.Full 229 * @crossplatform 230 * @atomicservice 231 * @since 20 232 */ 233declare type InputEventType = TouchEvent | MouseEvent | AxisEvent; 234 235/** 236 * Defines BuilderNode. 237 * Implements a BuilderNode, which can create a component tree through the stateless UI method @Builder and hold the 238 * root node of the component tree. A BuilderNode cannot be defined as a state variable. The FrameNode held in the 239 * BuilderNode is only used to mount the BuilderNode to other FrameNodes as a child node. Undefined behavior may occur 240 * if you set attributes or perform operations on subnodes of the FrameNode held by the BuilderNode. Therefore, after 241 * you have obtained a RenderNode through the getFrameNode method of the BuilderNode and the getRenderNode method of the 242 * FrameNode, avoid setting the attributes or operating the subnodes through APIs of the RenderNode. 243 * 244 * @syscap SystemCapability.ArkUI.ArkUI.Full 245 * @crossplatform 246 * @since 11 247 */ 248/** 249 * Defines BuilderNode. 250 * Implements a BuilderNode, which can create a component tree through the stateless UI method @Builder and hold the 251 * root node of the component tree. A BuilderNode cannot be defined as a state variable. The FrameNode held in the 252 * BuilderNode is only used to mount the BuilderNode to other FrameNodes as a child node. Undefined behavior may occur 253 * if you set attributes or perform operations on subnodes of the FrameNode held by the BuilderNode. Therefore, after 254 * you have obtained a RenderNode through the getFrameNode method of the BuilderNode and the getRenderNode method of the 255 * FrameNode, avoid setting the attributes or operating the subnodes through APIs of the RenderNode. 256 * 257 * @syscap SystemCapability.ArkUI.ArkUI.Full 258 * @crossplatform 259 * @atomicservice 260 * @since 12 261 */ 262export class BuilderNode<Args extends Object[]> { 263 /** 264 * Constructor. 265 * When the content generated by the BuilderNode is embedded in another RenderNode for display, that is, the 266 * RenderNode corresponding to the BuilderNode is mounted to another RenderNode for display, selfIdealSize in 267 * RenderOptions must be explicitly specified. If selfIdealSize is not set, the node in the builder follows the 268 * default parent component layout constraint [0, 0], which means that the size of the root node of the subtree in 269 * BuilderNode is [0, 0]. 270 * 271 * <p><strong>Note:</strong> 272 * <br>The input parameter for uiContext must be a valid value, that is, the UI context must be correct. If an invalid 273 * <br>value is passed in or if no value is specified, creation will fail. 274 * </p> 275 * 276 * @param { UIContext } uiContext - uiContext used to create the BuilderNode 277 * @param { RenderOptions } options - Render options of the Builder Node 278 * @syscap SystemCapability.ArkUI.ArkUI.Full 279 * @crossplatform 280 * @since 11 281 */ 282 /** 283 * Constructor. 284 * When the content generated by the BuilderNode is embedded in another RenderNode for display, that is, the 285 * RenderNode corresponding to the BuilderNode is mounted to another RenderNode for display, selfIdealSize in 286 * RenderOptions must be explicitly specified. If selfIdealSize is not set, the node in the builder follows the 287 * default parent component layout constraint [0, 0], which means that the size of the root node of the subtree in 288 * BuilderNode is [0, 0]. 289 * 290 * <p><strong>Note:</strong> 291 * <br>The input parameter for uiContext must be a valid value, that is, the UI context must be correct. If an invalid 292 * <br>value is passed in or if no value is specified, creation will fail. 293 * </p> 294 * 295 * @param { UIContext } uiContext - uiContext used to create the BuilderNode 296 * @param { RenderOptions } options - Render options of the Builder Node 297 * @syscap SystemCapability.ArkUI.ArkUI.Full 298 * @crossplatform 299 * @atomicservice 300 * @since arkts {'1.1':'12','1.2':'20'} 301 * @arkts 1.1&1.2 302 */ 303 constructor(uiContext: UIContext, options?: RenderOptions); 304 305 /** 306 * Build the BuilderNode with the builder. 307 * Creates a component tree based on the passed object and holds the root node of the component tree. The stateless UI 308 * method @Builder has at most one root node. Custom components are allowed. Yet, the custom components cannot use 309 * decorators, such as @Reusable, @Link, @Provide, and @Consume, for state synchronization with the page to which the 310 * BuilderNode is mounted. Since API version 12, custom components can receive LocalStorage instances. You can use 311 * LocalStorage related decorators such as @LocalStorageProp and @LocalStorageLink by passing LocalStorage instances. 312 * 313 * <p><strong>Note:</strong> 314 * <br>When nesting @Builder, ensure that the input objects for the inner and outer @Builder methods are consistent. 315 * <br>The outermost @Builder supports only one input argument. 316 * <br>To operate objects in a BuilderNode, ensure that the reference to the BuilderNode is not garbage collected. 317 * <br>Once a BuilderNode object is collected by the virtual machine, its FrameNode and RenderNode objects will also 318 * <br>be dereferenced from the backend nodes. This means that any FrameNode objects obtained from a BuilderNode will 319 * <br>no longer correspond to any actual node if the BuilderNode is garbage collected. 320 * </p> 321 * 322 * @param { WrappedBuilder<Args> } builder - Defined the builder will be called to build the node. 323 * @param { Object } arg - Defined the args will be used in the builder. 324 * @syscap SystemCapability.ArkUI.ArkUI.Full 325 * @crossplatform 326 * @since 11 327 */ 328 /** 329 * Build the BuilderNode with the builder. 330 * Creates a component tree based on the passed object and holds the root node of the component tree. The stateless UI 331 * method @Builder has at most one root node. Custom components are allowed. Yet, the custom components cannot use 332 * decorators, such as @Reusable, @Link, @Provide, and @Consume, for state synchronization with the page to which the 333 * BuilderNode is mounted. Since API version 12, custom components can receive LocalStorage instances. You can use 334 * LocalStorage related decorators such as @LocalStorageProp and @LocalStorageLink by passing LocalStorage instances. 335 * 336 * <p><strong>Note:</strong> 337 * <br>When nesting @Builder, ensure that the input objects for the inner and outer @Builder methods are consistent. 338 * <br>The outermost @Builder supports only one input argument. 339 * <br>To operate objects in a BuilderNode, ensure that the reference to the BuilderNode is not garbage collected. 340 * <br>Once a BuilderNode object is collected by the virtual machine, its FrameNode and RenderNode objects will also 341 * <br>be dereferenced from the backend nodes. This means that any FrameNode objects obtained from a BuilderNode will 342 * <br>no longer correspond to any actual node if the BuilderNode is garbage collected. 343 * </p> 344 * 345 * @param { WrappedBuilder<Args> } builder - Defined the builder will be called to build the node. 346 * @param { Object } arg - Defined the args will be used in the builder. 347 * Only one input argument is supported, and the type of the input argument must be consistent with the type defined 348 * by @Builder. 349 * @syscap SystemCapability.ArkUI.ArkUI.Full 350 * @crossplatform 351 * @atomicservice 352 * @since arkts {'1.1':'12','1.2':'20'} 353 * @arkts 1.1&1.2 354 */ 355 build(builder: WrappedBuilder<Args>, arg?: Object): void; 356 357 /** 358 * Build the BuilderNode with the builder.Support the type that WrappedBuilder contains builder used different params. 359 * Creates a component tree based on the passed object and holds the root node of the component tree. The stateless UI 360 * method @Builder has at most one root node. Custom components are allowed. Yet, the custom components cannot use 361 * decorators, such as @Reusable, @Link, @Provide, and @Consume, for state synchronization with the current page. 362 * Since API version 12, custom components can receive LocalStorage instances. You can use LocalStorage related 363 * decorators such as @LocalStorageProp and @LocalStorageLink by passing LocalStorage instances. 364 * 365 * <p><strong>Note:</strong> 366 * <br>For details about the creation and update using @Builder, see @Builder. 367 * <br>The outermost @Builder supports only one input argument. 368 * </p> 369 * 370 * @param { WrappedBuilder<Args> } builder - Defined the builder will be called to build the node. 371 * @param { Object } arg - Defined the args will be used in the builder. 372 * Only one input argument is supported, and the type of the input argument must be consistent with the type defined 373 * by @Builder. 374 * @param { BuildOptions } options - Defined the options will be used when build. 375 * @syscap SystemCapability.ArkUI.ArkUI.Full 376 * @crossplatform 377 * @atomicservice 378 * @since arkts {'1.1':'12','1.2':'20'} 379 * @arkts 1.1&1.2 380 */ 381 build(builder: WrappedBuilder<Args>, arg: Object, options: BuildOptions): void; 382 383 /** 384 * Update the BuilderNode based on the provided parameters. 385 * Updates this BuilderNode based on the provided parameter, which is of the same type as the input parameter passed 386 * to the build API. 387 * To call this API on a custom component, the variable used in the component must be defined as the @Prop type. 388 * 389 * @param { Object } arg - Parameters used to update the BuilderNode, which must match the types required by the builder bound to the BuilderNode. 390 * @syscap SystemCapability.ArkUI.ArkUI.Full 391 * @crossplatform 392 * @since 11 393 */ 394 /** 395 * Update the BuilderNode based on the provided parameters. 396 * Updates this BuilderNode based on the provided parameter, which is of the same type as the input parameter passed 397 * to the build API. 398 * To call this API on a custom component, the variable used in the component must be defined as the @Prop type. 399 * 400 * @param { Object } arg - Parameters used to update the BuilderNode, which must match the types required by the builder bound to the BuilderNode. 401 * @syscap SystemCapability.ArkUI.ArkUI.Full 402 * @crossplatform 403 * @atomicservice 404 * @since arkts {'1.1':'12','1.2':'20'} 405 * @arkts 1.1&1.2 406 */ 407 update(arg: Object): void; 408 409 /** 410 * Get the FrameNode in BuilderNode. 411 * The FrameNode is generated only after the BuilderNode executes the build operation. 412 * 413 * @returns { FrameNode | null } - Returns a FrameNode inside the BuilderNode, or null if not contained. 414 * @syscap SystemCapability.ArkUI.ArkUI.Full 415 * @crossplatform 416 * @since 11 417 */ 418 /** 419 * Get the FrameNode in BuilderNode. 420 * The FrameNode is generated only after the BuilderNode executes the build operation. 421 * 422 * @returns { FrameNode | null } - Returns a FrameNode inside the BuilderNode, or null if not contained. 423 * @syscap SystemCapability.ArkUI.ArkUI.Full 424 * @crossplatform 425 * @atomicservice 426 * @since arkts {'1.1':'12','1.2':'20'} 427 * @arkts 1.1&1.2 428 */ 429 getFrameNode(): FrameNode | null; 430 431 /** 432 * Dispatch touchEvent to targetNode. 433 * postTouchEvent dispatches the event from a middle node in the component tree downwards. To ensure the event is 434 * dispatched correctly, it needs to be transformed into the coordinate system of the parent component, as shown in 435 * the figure below. 436 * OffsetA indicates the offset of the BuildNode relative to the parent component. You can obtain this offset by 437 * calling getPositionToParent in the FrameNode. OffsetB indicates the offset of the touch point relative to the 438 * BuildNode. You can obtain this offset from the TouchEvent object. OffsetC is the sum of OffsetA and OffsetB. It 439 * represents the final offset that you need to pass to postTouchEvent. 440 * 441 * <p><strong>Note:</strong> 442 * <br>The coordinates you pass in need to be converted to pixel values (px). If the BuilderNode has any affine 443 * <br>transformations applied to it, they must be taken into account and combined with the touch event coordinates. 444 * <br>In Webview, coordinate system transformations are already handled internally, so you can directly dispatch the 445 * <br>touch event without additional adjustments. 446 * <br>The postTouchEvent API can be called only once for the same timestamp. 447 * <br>UIExtensionComponent is not supported. 448 * </p> 449 * 450 * @param { TouchEvent } event - The touchEvent which will be sent to the targetNode. 451 * @returns { boolean } - Returns true if the TouchEvent has been successfully posted to the targetNode, false otherwise. 452 * If the event does not hit the expected component, ensure the following: 453 * 1. The coordinate system has been correctly transformed 454 * 2. The component is in an interactive state. 455 * 3. The event has been bound to the component. 456 * @syscap SystemCapability.ArkUI.ArkUI.Full 457 * @crossplatform 458 * @since 11 459 */ 460 /** 461 * Dispatch touchEvent to targetNode. 462 * postTouchEvent dispatches the event from a middle node in the component tree downwards. To ensure the event is 463 * dispatched correctly, it needs to be transformed into the coordinate system of the parent component, as shown in 464 * the figure below. 465 * OffsetA indicates the offset of the BuildNode relative to the parent component. You can obtain this offset by 466 * calling getPositionToParent in the FrameNode. OffsetB indicates the offset of the touch point relative to the 467 * BuildNode. You can obtain this offset from the TouchEvent object. OffsetC is the sum of OffsetA and OffsetB. It 468 * represents the final offset that you need to pass to postTouchEvent. 469 * 470 * <p><strong>Note:</strong> 471 * <br>The coordinates you pass in need to be converted to pixel values (px). If the BuilderNode has any affine 472 * <br>transformations applied to it, they must be taken into account and combined with the touch event coordinates. 473 * <br>In Webview, coordinate system transformations are already handled internally, so you can directly dispatch the 474 * <br>touch event without additional adjustments. 475 * <br>The postTouchEvent API can be called only once for the same timestamp. 476 * <br>UIExtensionComponent is not supported. 477 * </p> 478 * 479 * @param { TouchEvent } event - The touchEvent which will be sent to the targetNode. 480 * @returns { boolean } - Returns true if the TouchEvent has been successfully posted to the targetNode, false otherwise. 481 * If the event does not hit the expected component, ensure the following: 482 * 1. The coordinate system has been correctly transformed 483 * 2. The component is in an interactive state. 484 * 3. The event has been bound to the component. 485 * @syscap SystemCapability.ArkUI.ArkUI.Full 486 * @crossplatform 487 * @atomicservice 488 * @since arkts {'1.1':'12','1.2':'20'} 489 * @arkts 1.1&1.2 490 */ 491 postTouchEvent(event: TouchEvent): boolean; 492 493 /** 494 * Dispose the BuilderNode immediately. 495 * Calling dispose on a BuilderNode object breaks its reference to the backend entity node, and also simultaneously 496 * severs the references of its contained FrameNode and RenderNode to their respective entity nodes. 497 * 498 * <p><strong>Note:</strong> 499 * <br>Calling dispose on a BuilderNode object breaks its reference to the backend entity node, and also 500 * <br>simultaneously severs the references of its contained FrameNode and RenderNode to their respective entity nodes. 501 * <br>If the frontend object BuilderNode cannot be released, memory leaks may occur. To avoid this, be sure to call 502 * <br>dispose on the BuilderNode when you no longer need it. This reduces the complexity of reference relationships 503 * <br>and lowers the risk of memory leaks. 504 * </p> 505 * 506 * @syscap SystemCapability.ArkUI.ArkUI.Full 507 * @crossplatform 508 * @atomicservice 509 * @since arkts {'1.1':'12','1.2':'20'} 510 * @arkts 1.1&1.2 511 */ 512 dispose(): void; 513 514 /** 515 * Reuse the BuilderNode based on the provided parameters. 516 * 517 * @param { Object } [param] - Parameters for reusing BuilderNode. 518 * It is of the same type as the parameter passed to the build API. 519 * @syscap SystemCapability.ArkUI.ArkUI.Full 520 * @crossplatform 521 * @atomicservice 522 * @since arkts {'1.1':'12','1.2':'20'} 523 * @arkts 1.1&1.2 524 */ 525 reuse(param?: Object): void; 526 527 /** 528 * Recycle the BuilderNode. 529 * 530 * @syscap SystemCapability.ArkUI.ArkUI.Full 531 * @crossplatform 532 * @atomicservice 533 * @since 12 534 */ 535 recycle(): void; 536 537 /** 538 * Notify BuilderNode to update the configuration to trigger a reload of the BuilderNode. 539 * 540 * <p><strong>Note:</strong> 541 * <br>The updateConfiguration API is used to instruct an object to update, with the system environment used for the 542 * <br>update being determined by the changes in the application's current system environment. 543 * </p> 544 * 545 * @syscap SystemCapability.ArkUI.ArkUI.Full 546 * @crossplatform 547 * @atomicservice 548 * @since 12 549 */ 550 updateConfiguration(): void; 551 552 /** 553 * Dispatch event to targetNode. 554 * 555 * @param { InputEventType } event - The event which will be sent to the targetNode. 556 * @returns { boolean } - Returns true if the eventhas been successfully posted to the targetNode, 557 * false otherwise. 558 * @syscap SystemCapability.ArkUI.ArkUI.Full 559 * @atomicservice 560 * @since 20 561 */ 562 postInputEvent(event: InputEventType): boolean; 563 564 /** 565 * Set if the BuilderNode inherits the freezing policy of the parent CustomComponent, ComponentContent, or BuilderNode. 566 * 567 * @param { boolean } enabled - If the BuilderNode inherits the freezing policy of the parent CustomComponent, ComponentContent, or BuilderNode. 568 * @syscap SystemCapability.ArkUI.ArkUI.Full 569 * @crossplatform 570 * @atomicservice 571 * @since 20 572 */ 573 inheritFreezeOptions(enabled: boolean): void; 574 575 /** 576 * Get if the node is disposed. 577 * 578 * @returns { boolean } - Returns true if the node is disposed, false otherwise. 579 * @syscap SystemCapability.ArkUI.ArkUI.Full 580 * @crossplatform 581 * @atomicservice 582 * @since 20 583 */ 584 isDisposed(): boolean; 585} 586 587/** 588 * Defines BuilderNode. 589 * 590 * @syscap SystemCapability.ArkUI.ArkUI.Full 591 * @crossplatform 592 * @atomicservice 593 * @since 20 594 * @arkts 1.2 595 */ 596export declare class BuilderNode<T = undefined> { 597 /** 598 * Constructor. 599 * 600 * @param { UIContext } uiContext - uiContext used to create the BuilderNode 601 * @param { RenderOptions } [options] - Render options of the Builder Node 602 * @syscap SystemCapability.ArkUI.ArkUI.Full 603 * @crossplatform 604 * @atomicservice 605 * @since 20 606 * @arkts 1.2 607 */ 608 constructor(uiContext: UIContext, options?: RenderOptions); 609 610 /** 611 * Build the BuilderNode with the builder. 612 * 613 * @param { WrappedBuilder<CustomBuilder> } builder - Defined the builder will be called to build the node. 614 * @syscap SystemCapability.ArkUI.ArkUI.Full 615 * @crossplatform 616 * @atomicservice 617 * @since 20 618 * @arkts 1.2 619 */ 620 build(builder: WrappedBuilder<CustomBuilder>): void; 621 622 /** 623 * Build the BuilderNode with the builder. 624 * 625 * @param { WrappedBuilder<CustomBuilderT<T>> } builder - Defined the builder will be called to build the node. 626 * @param { T } arg - Defined the args will be used in the builder. 627 * @syscap SystemCapability.ArkUI.ArkUI.Full 628 * @crossplatform 629 * @atomicservice 630 * @since 20 631 * @arkts 1.2 632 */ 633 build(builder: WrappedBuilder<CustomBuilderT<T>>, arg: T): void; 634 635 /** 636 * Build the BuilderNode with the builder.Support the type that WrappedBuilder contains builder used different params. 637 * 638 * @param { WrappedBuilder<CustomBuilderT<T>> } builder - Defined the builder will be called to build the node. 639 * @param { T } arg - Defined the args will be used in the builder. 640 * @param { BuildOptions } options - Defined the options will be used when build. 641 * @syscap SystemCapability.ArkUI.ArkUI.Full 642 * @crossplatform 643 * @atomicservice 644 * @since 20 645 * @arkts 1.2 646 */ 647 build(builder: WrappedBuilder<CustomBuilderT<T>>, arg: T, options: BuildOptions): void; 648 649 /** 650 * Update the BuilderNode based on the provided parameters. 651 * 652 * @param { T } arg - Parameters used to update the BuilderNode, which must match the types required by the builder bound to the BuilderNode. 653 * @syscap SystemCapability.ArkUI.ArkUI.Full 654 * @crossplatform 655 * @atomicservice 656 * @since 20 657 * @arkts 1.2 658 */ 659 update(arg: T): void; 660 661 /** 662 * Get the FrameNode in BuilderNode. 663 * 664 * @returns { FrameNode | null } - Returns a FrameNode inside the BuilderNode, or null if not contained. 665 * @syscap SystemCapability.ArkUI.ArkUI.Full 666 * @crossplatform 667 * @atomicservice 668 * @since 20 669 * @arkts 1.2 670 */ 671 getFrameNode(): FrameNode | null; 672 673 /** 674 * Dispatch touchEvent to targetNode. 675 * 676 * @param { TouchEvent } event - The touchEvent which will be sent to the targetNode. 677 * @returns { boolean } - Returns true if the TouchEvent has been successfully posted to the targetNode, false otherwise. 678 * @syscap SystemCapability.ArkUI.ArkUI.Full 679 * @crossplatform 680 * @atomicservice 681 * @since 20 682 * @arkts 1.2 683 */ 684 postTouchEvent(event: TouchEvent): boolean; 685 686 /** 687 * Dispose the BuilderNode immediately. 688 * 689 * @syscap SystemCapability.ArkUI.ArkUI.Full 690 * @crossplatform 691 * @atomicservice 692 * @since 20 693 * @arkts 1.2 694 */ 695 dispose(): void; 696 697 /** 698 * Reuse the BuilderNode based on the provided parameters. 699 * 700 * @param { Record<string,NullishType> } [param] - Parameters for reusing BuilderNode. 701 * @syscap SystemCapability.ArkUI.ArkUI.Full 702 * @crossplatform 703 * @atomicservice 704 * @since 20 705 * @arkts 1.2 706 */ 707 reuse(param?: Record<string, NullishType>): void; 708 709 /** 710 * Recycle the BuilderNode. 711 * 712 * @syscap SystemCapability.ArkUI.ArkUI.Full 713 * @crossplatform 714 * @atomicservice 715 * @since 20 716 * @arkts 1.2 717 */ 718 recycle(): void; 719 720 /** 721 * Notify BuilderNode to update the configuration to trigger a reload of the BuilderNode. 722 * 723 * @syscap SystemCapability.ArkUI.ArkUI.Full 724 * @crossplatform 725 * @atomicservice 726 * @since 20 727 * @arkts 1.2 728 */ 729 updateConfiguration(): void; 730 }