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 { RenderNode } from './RenderNode'; 23import { Size, Position, Edges, LengthMetrics, SizeT } from './Graphics'; 24import { DrawContext } from './Graphics'; 25import { ComponentContent } from './ComponentContent'; 26import { BusinessError } from '../@ohos.base'; 27 28/** 29 * Layout constraint, include the max size, the min size and the reference size for children to calculate percent. 30 * 31 * @interface LayoutConstraint 32 * @syscap SystemCapability.ArkUI.ArkUI.Full 33 * @crossplatform 34 * @atomicservice 35 * @since 12 36 */ 37declare interface LayoutConstraint { 38 /** 39 * MaxSize 40 * 41 * @type { Size } 42 * @syscap SystemCapability.ArkUI.ArkUI.Full 43 * @crossplatform 44 * @atomicservice 45 * @since 12 46 */ 47 maxSize: Size; 48 49 /** 50 * MinSize 51 * 52 * @type { Size } 53 * @syscap SystemCapability.ArkUI.ArkUI.Full 54 * @crossplatform 55 * @atomicservice 56 * @since 12 57 */ 58 minSize: Size; 59 60 /** 61 * PercentReference, if the size unit of the child nodes is percentage, then they use PercentReference to calculate 62 * the px size. 63 * 64 * @type { Size } 65 * @syscap SystemCapability.ArkUI.ArkUI.Full 66 * @crossplatform 67 * @atomicservice 68 * @since 12 69 */ 70 percentReference: Size; 71} 72 73/** 74 * Defines the cross-language options. 75 * 76 * @interface CrossLanguageOptions 77 * @syscap SystemCapability.ArkUI.ArkUI.Full 78 * @crossplatform 79 * @atomicservice 80 * @since 15 81 */ 82declare interface CrossLanguageOptions { 83 /** 84 * Defines if it enables setting attributes cross-language. Default value is false. 85 * 86 * @type { boolean } 87 * @syscap SystemCapability.ArkUI.ArkUI.Full 88 * @crossplatform 89 * @atomicservice 90 * @since 15 91 */ 92 attributeSetting?: boolean 93} 94 95/** 96 * Enum for the expand mode. 97 * 98 * @enum { number } 99 * @syscap SystemCapability.ArkUI.ArkUI.Full 100 * @crossplatform 101 * @atomicservice 102 * @since 15 103 */ 104export enum ExpandMode { 105 /** 106 * Do not expand the children of node. 107 * 108 * @syscap SystemCapability.ArkUI.ArkUI.Full 109 * @crossplatform 110 * @atomicservice 111 * @since 15 112 */ 113 NOT_EXPAND = 0, 114 115 /** 116 * Expand the children of node. 117 * 118 * @syscap SystemCapability.ArkUI.ArkUI.Full 119 * @crossplatform 120 * @atomicservice 121 * @since 15 122 */ 123 EXPAND = 1, 124 125 /** 126 * Expand the children of node if needed. 127 * 128 * @syscap SystemCapability.ArkUI.ArkUI.Full 129 * @crossplatform 130 * @atomicservice 131 * @since 15 132 */ 133 LAZY_EXPAND = 2, 134} 135 136/** 137 * Defines FrameNode. 138 * 139 * @syscap SystemCapability.ArkUI.ArkUI.Full 140 * @crossplatform 141 * @since 11 142 */ 143/** 144 * Defines FrameNode. 145 * 146 * @syscap SystemCapability.ArkUI.ArkUI.Full 147 * @crossplatform 148 * @atomicservice 149 * @since 12 150 */ 151export class FrameNode { 152 /** 153 * Constructor. 154 * 155 * @param { UIContext } uiContext - uiContext used to create the FrameNode 156 * @syscap SystemCapability.ArkUI.ArkUI.Full 157 * @crossplatform 158 * @since 11 159 */ 160 /** 161 * Constructor. 162 * 163 * @param { UIContext } uiContext - uiContext used to create the FrameNode 164 * @syscap SystemCapability.ArkUI.ArkUI.Full 165 * @crossplatform 166 * @atomicservice 167 * @since 12 168 */ 169 constructor(uiContext: UIContext); 170 171 /** 172 * Get the RenderNode in FrameNode. 173 * 174 * @returns { RenderNode | null } - Returns a RenderNode inside the FrameNode, or null if not contained. 175 * @syscap SystemCapability.ArkUI.ArkUI.Full 176 * @crossplatform 177 * @since 11 178 */ 179 /** 180 * Get the RenderNode in FrameNode. 181 * 182 * @returns { RenderNode | null } - Returns a RenderNode inside the FrameNode, or null if not contained. 183 * @syscap SystemCapability.ArkUI.ArkUI.Full 184 * @crossplatform 185 * @atomicservice 186 * @since 12 187 */ 188 getRenderNode(): RenderNode | null; 189 190 /** 191 * Return a flag to indicate whether the current FrameNode can be modified. Indicates whether the FrameNode supports appendChild, insertChildAfter, removeChild, clearChildren. 192 * 193 * @returns { boolean } - Returns true if the FrameNode can be modified, otherwise return false. 194 * @syscap SystemCapability.ArkUI.ArkUI.Full 195 * @crossplatform 196 * @atomicservice 197 * @since 12 198 */ 199 isModifiable(): boolean; 200 201 /** 202 * Add child to the end of the FrameNode's children. 203 * 204 * @param { FrameNode } node - The node will be added. 205 * @throws { BusinessError } 100021 - The FrameNode is not modifiable. 206 * @syscap SystemCapability.ArkUI.ArkUI.Full 207 * @crossplatform 208 * @atomicservice 209 * @since 12 210 */ 211 appendChild(node: FrameNode): void; 212 213 /** 214 * Add child to the current FrameNode. 215 * 216 * @param { FrameNode } child - The node will be added. 217 * @param { FrameNode | null } sibling - The new node is added after this node. When sibling is null, insert node as the first children of the node. 218 * @throws { BusinessError } 100021 - The FrameNode is not modifiable. 219 * @syscap SystemCapability.ArkUI.ArkUI.Full 220 * @crossplatform 221 * @atomicservice 222 * @since 12 223 */ 224 insertChildAfter(child: FrameNode, sibling: FrameNode | null): void; 225 226 /** 227 * Remove child from the current FrameNode. 228 * 229 * @param { FrameNode } node - The node will be removed. 230 * @throws { BusinessError } 100021 - The FrameNode is not modifiable. 231 * @syscap SystemCapability.ArkUI.ArkUI.Full 232 * @crossplatform 233 * @atomicservice 234 * @since 12 235 */ 236 removeChild(node: FrameNode): void; 237 238 /** 239 * Clear children of the current FrameNode. 240 * 241 * @throws { BusinessError } 100021 - The FrameNode is not modifiable. 242 * @syscap SystemCapability.ArkUI.ArkUI.Full 243 * @crossplatform 244 * @atomicservice 245 * @since 12 246 */ 247 clearChildren(): void; 248 249 /** 250 * Get a child of the current FrameNode by index. 251 * 252 * @param { number } index - The index of the desired node in the children of FrameNode. 253 * @returns { FrameNode | null } - Returns a FrameNode. When the required node does not exist, returns null. 254 * @syscap SystemCapability.ArkUI.ArkUI.Full 255 * @crossplatform 256 * @atomicservice 257 * @since 12 258 */ 259 getChild(index: number): FrameNode | null; 260 261 /** 262 * Get a child of the current FrameNode by index. 263 * 264 * @param { number } index - The index of the desired node in the children of FrameNode. 265 * @param { ExpandMode } expandMode - The expand mode. Default value is ExpandMode.EXPAND. 266 * @returns { FrameNode | null } - Returns a FrameNode. When the required node does not exist, returns null. 267 * @syscap SystemCapability.ArkUI.ArkUI.Full 268 * @crossplatform 269 * @atomicservice 270 * @since 15 271 */ 272 getChild(index: number, expandMode?: ExpandMode): FrameNode | null; 273 274 /** 275 * Get the index of the current FrameNode's first child node which is on the tree. 276 * 277 * @returns { number } - Returns the index of the current FrameNode's first child node which is on the tree. 278 * @syscap SystemCapability.ArkUI.ArkUI.Full 279 * @crossplatform 280 * @atomicservice 281 * @since 15 282 */ 283 getFirstChildIndexWithoutExpand(): number; 284 285 /** 286 * Get the index of the current FrameNode's last child node which is on the tree. 287 * 288 * @returns { number } - Returns the index of the current FrameNode's last child node which is on the tree. 289 * @syscap SystemCapability.ArkUI.ArkUI.Full 290 * @crossplatform 291 * @atomicservice 292 * @since 15 293 */ 294 getLastChildIndexWithoutExpand(): number; 295 296 /** 297 * Get the first child of the current FrameNode. 298 * 299 * @returns { FrameNode | null } - Returns a FrameNode, which is first child of the current FrameNode. If current FrameNode does not have child node, returns null. 300 * If current FrameNode does not have child node, returns null. 301 * @syscap SystemCapability.ArkUI.ArkUI.Full 302 * @crossplatform 303 * @atomicservice 304 * @since 12 305 */ 306 getFirstChild(): FrameNode | null; 307 308 /** 309 * Get the next sibling node of the current FrameNode. 310 * 311 * @returns { FrameNode | null } - Returns a FrameNode. If current FrameNode does not have next sibling node, returns null. 312 * @syscap SystemCapability.ArkUI.ArkUI.Full 313 * @crossplatform 314 * @atomicservice 315 * @since 12 316 */ 317 getNextSibling(): FrameNode | null; 318 319 /** 320 * Get the previous sibling node of the current FrameNode. 321 * 322 * @returns { FrameNode | null } - Returns a FrameNode. If current FrameNode does not have previous sibling node, returns null. 323 * @syscap SystemCapability.ArkUI.ArkUI.Full 324 * @crossplatform 325 * @atomicservice 326 * @since 12 327 */ 328 getPreviousSibling(): FrameNode | null; 329 330 /** 331 * Get the parent node of the current FrameNode. 332 * 333 * @returns { FrameNode | null } - Returns a FrameNode. If current FrameNode does not have parent node, returns null. 334 * @syscap SystemCapability.ArkUI.ArkUI.Full 335 * @crossplatform 336 * @atomicservice 337 * @since 12 338 */ 339 getParent(): FrameNode | null; 340 341 /** 342 * Get the children count of the current FrameNode. 343 * 344 * @returns { number } - Returns the number of the children of the current FrameNode. 345 * @syscap SystemCapability.ArkUI.ArkUI.Full 346 * @crossplatform 347 * @atomicservice 348 * @since 12 349 */ 350 getChildrenCount(): number; 351 352 /** 353 * Move node to the target Framenode as child. 354 * 355 * @param { FrameNode } targetParent - The target parent node. 356 * @param { number } index - The index which the node is moved to. If the value is a negative number or invalid, 357 * the node is moved to the end of the target parent node. Moves to the end of the target parent node by default. 358 * @throws { BusinessError } 100021 - The FrameNode is not modifiable. 359 * @syscap SystemCapability.ArkUI.ArkUI.Full 360 * @crossplatform 361 * @atomicservice 362 * @since 18 363 */ 364 moveTo(targetParent: FrameNode, index?: number): void; 365 366 /** 367 * Dispose the FrameNode immediately. 368 * 369 * @syscap SystemCapability.ArkUI.ArkUI.Full 370 * @crossplatform 371 * @atomicservice 372 * @since 12 373 */ 374 dispose(): void; 375 376 /** 377 * Get the position of the node relative to window. 378 * 379 * @returns { Position } - Returns position of the node relative to window. 380 * @syscap SystemCapability.ArkUI.ArkUI.Full 381 * @crossplatform 382 * @atomicservice 383 * @since 12 384 */ 385 getPositionToWindow(): Position; 386 387 /** 388 * Get the position of the node relative to its parent. 389 * 390 * @returns { Position } - Returns position of the node relative to its parent. 391 * @syscap SystemCapability.ArkUI.ArkUI.Full 392 * @crossplatform 393 * @atomicservice 394 * @since 12 395 */ 396 getPositionToParent(): Position; 397 398 /** 399 * Get the size of the FrameNode after measure, with unit PX. 400 * 401 * @returns { Size } - Returns the size of the FrameNode after measure, with unit PX. 402 * @syscap SystemCapability.ArkUI.ArkUI.Full 403 * @crossplatform 404 * @atomicservice 405 * @since 12 406 */ 407 getMeasuredSize(): Size; 408 409 /** 410 * Get the offset to the parent of the FrameNode after layout, with unit PX. 411 * 412 * @returns { Position } - Returns the offset to the parent of the FrameNode after layout, with unit PX. 413 * @syscap SystemCapability.ArkUI.ArkUI.Full 414 * @crossplatform 415 * @atomicservice 416 * @since 12 417 */ 418 getLayoutPosition(): Position; 419 420 /** 421 * Get the user config border width of the FrameNode. 422 * 423 * @returns { Edges<LengthMetrics> } - Returns the user config border width of the FrameNode. 424 * @syscap SystemCapability.ArkUI.ArkUI.Full 425 * @crossplatform 426 * @atomicservice 427 * @since 12 428 */ 429 getUserConfigBorderWidth(): Edges<LengthMetrics>; 430 431 /** 432 * Get the user config padding of the FrameNode. 433 * 434 * @returns { Edges<LengthMetrics> } - Returns the user config padding of the FrameNode. 435 * @syscap SystemCapability.ArkUI.ArkUI.Full 436 * @crossplatform 437 * @atomicservice 438 * @since 12 439 */ 440 getUserConfigPadding(): Edges<LengthMetrics>; 441 442 /** 443 * Get the user config margin of the FrameNode. 444 * 445 * @returns { Edges<LengthMetrics> } - Returns the user config margin of the FrameNode. 446 * @syscap SystemCapability.ArkUI.ArkUI.Full 447 * @crossplatform 448 * @atomicservice 449 * @since 12 450 */ 451 getUserConfigMargin(): Edges<LengthMetrics>; 452 453 /** 454 * Get the user config size of the FrameNode. 455 * 456 * @returns { SizeT<LengthMetrics> } - Returns the user config size of the FrameNode. 457 * @syscap SystemCapability.ArkUI.ArkUI.Full 458 * @crossplatform 459 * @atomicservice 460 * @since 12 461 */ 462 getUserConfigSize(): SizeT<LengthMetrics>; 463 464 /** 465 * Get the id of the FrameNode. 466 * 467 * @returns { string } - Returns the id of the FrameNode. 468 * @syscap SystemCapability.ArkUI.ArkUI.Full 469 * @crossplatform 470 * @atomicservice 471 * @since 12 472 */ 473 getId(): string; 474 475 /** 476 * Get the unique id of the FrameNode. 477 * 478 * @returns { number } - Returns the unique id of the FrameNode. 479 * @syscap SystemCapability.ArkUI.ArkUI.Full 480 * @crossplatform 481 * @atomicservice 482 * @since 12 483 */ 484 getUniqueId(): number; 485 486 /** 487 * Get the type of the FrameNode. The type is the name of component, for example, the nodeType of Button is "Button", 488 * and the nodeType of custom component is "__Common__". 489 * 490 * @returns { string } - Returns the type of the FrameNode. 491 * @syscap SystemCapability.ArkUI.ArkUI.Full 492 * @crossplatform 493 * @atomicservice 494 * @since 12 495 */ 496 getNodeType(): string; 497 498 /** 499 * Get the opacity of the FrameNode. 500 * 501 * @returns { number } - Returns the opacity of the FrameNode. 502 * @syscap SystemCapability.ArkUI.ArkUI.Full 503 * @crossplatform 504 * @atomicservice 505 * @since 12 506 */ 507 getOpacity(): number; 508 509 /** 510 * Get if the FrameNode is visible. 511 * 512 * @returns { boolean } - Returns if the FrameNode is visible. 513 * @syscap SystemCapability.ArkUI.ArkUI.Full 514 * @crossplatform 515 * @atomicservice 516 * @since 12 517 */ 518 isVisible(): boolean; 519 520 /** 521 * Get if the FrameNode is clip to frame. 522 * 523 * @returns { boolean } - Returns if the FrameNode is clip to frame. 524 * @syscap SystemCapability.ArkUI.ArkUI.Full 525 * @crossplatform 526 * @atomicservice 527 * @since 12 528 */ 529 isClipToFrame(): boolean; 530 531 /** 532 * Get if the FrameNode is attached to the root node tree. 533 * 534 * @returns { boolean } - Returns if the FrameNode is attached to the root node tree. 535 * @syscap SystemCapability.ArkUI.ArkUI.Full 536 * @crossplatform 537 * @atomicservice 538 * @since 12 539 */ 540 isAttached(): boolean; 541 542 /** 543 * Get the inspector information of the FrameNode. 544 * 545 * @returns { Object } - Returns the inspector information of the FrameNode. 546 * @syscap SystemCapability.ArkUI.ArkUI.Full 547 * @crossplatform 548 * @atomicservice 549 * @since 12 550 */ 551 getInspectorInfo(): Object; 552 553 /** 554 * * Get the custom property of the component corresponding to this FrameNode. 555 * 556 * @param { string } name - the name of the custom property. 557 * @returns { Object | undefined } - Returns the value of the custom property. 558 * @syscap SystemCapability.ArkUI.ArkUI.Full 559 * @crossplatform 560 * @atomicservice 561 * @since 12 562 */ 563 getCustomProperty(name: string): Object | undefined; 564 565 /** 566 * Set commonEvent response to the current FrameNode. 567 * 568 * @returns { UICommonEvent } - Returns a Object inside the FrameNode, which is used to set callbacks about different events. 569 * @syscap SystemCapability.ArkUI.ArkUI.Full 570 * @crossplatform 571 * @atomicservice 572 * @since 12 573 */ 574 get commonEvent(): UICommonEvent; 575 576 /** 577 * Get gestureEvent of the current FrameNode. 578 * 579 * @returns { UIGestureEvent } - Returns a Object inside the FrameNode, which is used to set callbacks about different gesture events. 580 * @syscap SystemCapability.ArkUI.ArkUI.Full 581 * @crossplatform 582 * @atomicservice 583 * @since 14 584 */ 585 get gestureEvent(): UIGestureEvent; 586 587 /** 588 * Get the CommonAttribute of the current FrameNode. 589 * 590 * @returns { CommonAttribute } - Returns the CommonAttribute which is used to modify the common attributes of the FrameNode. 591 * @syscap SystemCapability.ArkUI.ArkUI.Full 592 * @crossplatform 593 * @atomicservice 594 * @since 12 595 */ 596 get commonAttribute(): CommonAttribute; 597 598 /** 599 * Draw Method. Executed when the current FrameNode is rendering its content. 600 * 601 * @param { DrawContext } context - The DrawContext will be used when executed draw method. 602 * @syscap SystemCapability.ArkUI.ArkUI.Full 603 * @crossplatform 604 * @atomicservice 605 * @since 12 606 */ 607 onDraw?(context: DrawContext): void; 608 609 /** 610 * Method to measure the FrameNode and its content to determine the measured size. Use this method to override the 611 * default measure method when measuring the FrameNode. 612 * 613 * @param { LayoutConstraint } constraint - The layout constraint of the node, will be used when executed measure 614 * method. 615 * @syscap SystemCapability.ArkUI.ArkUI.Full 616 * @crossplatform 617 * @atomicservice 618 * @since 12 619 */ 620 onMeasure(constraint: LayoutConstraint): void; 621 622 /** 623 * Method to assign a position to the FrameNode and each of its children. Use this method to override the 624 * default layout method. 625 * 626 * @param { Position } position - The position of the node, will be used when executed layout method. 627 * @syscap SystemCapability.ArkUI.ArkUI.Full 628 * @crossplatform 629 * @atomicservice 630 * @since 12 631 */ 632 onLayout(position: Position): void; 633 634 /** 635 * Set the size of the FrameNode after measure, with unit PX. 636 * 637 * @param { Size } size - The size of the FrameNode after measure. 638 * @syscap SystemCapability.ArkUI.ArkUI.Full 639 * @crossplatform 640 * @atomicservice 641 * @since 12 642 */ 643 setMeasuredSize(size: Size): void; 644 645 /** 646 * Set the position to the parent of the FrameNode after layout, with unit PX. 647 * 648 * @param { Position } position - The position to the parent of the FrameNode after layout. 649 * @syscap SystemCapability.ArkUI.ArkUI.Full 650 * @crossplatform 651 * @atomicservice 652 * @since 12 653 */ 654 setLayoutPosition(position: Position): void; 655 656 /** 657 * This is called to find out how big the FrameNode should be. The parent node supplies constraint information. The 658 * actual measurement work of the FrameNode is performed in onMeasure or the default measure method. 659 * 660 * @param { LayoutConstraint } constraint - The layout constraint of the node, supplied by the parent node. 661 * @syscap SystemCapability.ArkUI.ArkUI.Full 662 * @crossplatform 663 * @atomicservice 664 * @since 12 665 */ 666 measure(constraint: LayoutConstraint): void; 667 668 /** 669 * This is called to assign position to the FrameNode and all of its descendants. The position is used to init 670 * the position of the frameNode, and the actual layout work of FrameNode is performed in onLayout or the default 671 * layout method. 672 * 673 * @param { Position } position - The position of the node, will be used when executed the layout method. 674 * @syscap SystemCapability.ArkUI.ArkUI.Full 675 * @crossplatform 676 * @atomicservice 677 * @since 12 678 */ 679 layout(position: Position): void; 680 681 /** 682 * Mark the frame node as need layout. 683 * 684 * @syscap SystemCapability.ArkUI.ArkUI.Full 685 * @crossplatform 686 * @atomicservice 687 * @since 12 688 */ 689 setNeedsLayout(): void; 690 691 /** 692 * Invalidate the RenderNode in the FrameNode, which will cause a re-render of the RenderNode. 693 * 694 * @syscap SystemCapability.ArkUI.ArkUI.Full 695 * @crossplatform 696 * @atomicservice 697 * @since 12 698 */ 699 invalidate(): void; 700 701 /** 702 * Get the position of the node relative to screen. 703 * 704 * @returns { Position } - Returns position of the node relative to screen. 705 * @syscap SystemCapability.ArkUI.ArkUI.Full 706 * @crossplatform 707 * @atomicservice 708 * @since 12 709 */ 710 getPositionToScreen(): Position; 711 712 /** 713 * Get the position of the node relative to window with transform. 714 * 715 * @returns { Position } - Returns position of the node relative to window with transform. 716 * @syscap SystemCapability.ArkUI.ArkUI.Full 717 * @crossplatform 718 * @atomicservice 719 * @since 12 720 */ 721 getPositionToWindowWithTransform(): Position; 722 723 /** 724 * Get the position of the node relative to its parent with transform. 725 * 726 * @returns { Position } - Returns position of the node relative to its parent with transform. 727 * @syscap SystemCapability.ArkUI.ArkUI.Full 728 * @crossplatform 729 * @atomicservice 730 * @since 12 731 */ 732 getPositionToParentWithTransform(): Position; 733 734 /** 735 * Get the position of the node relative to screen with transform. 736 * 737 * @returns { Position } - Returns position of the node relative to screen with transform. 738 * @syscap SystemCapability.ArkUI.ArkUI.Full 739 * @crossplatform 740 * @atomicservice 741 * @since 12 742 */ 743 getPositionToScreenWithTransform(): Position; 744 745 /** 746 * Detach from parent and dispose all child recursively. 747 * 748 * @syscap SystemCapability.ArkUI.ArkUI.Full 749 * @crossplatform 750 * @atomicservice 751 * @since 12 752 */ 753 disposeTree(): void; 754 755 /** 756 * Mount ComponentContent to FrameNode. 757 * 758 * @param { ComponentContent<T> } content - Newly added ComponentContent. 759 * @throws { BusinessError } 100021 - The FrameNode is not modifiable. 760 * @syscap SystemCapability.ArkUI.ArkUI.Full 761 * @crossplatform 762 * @atomicservice 763 * @since 12 764 */ 765 addComponentContent<T>(content: ComponentContent<T>): void; 766 767 /** 768 * Set the cross-language options of the target FrameNode. 769 * 770 * @param { CrossLanguageOptions } options - The cross-language options. 771 * @throws { BusinessError } 100022 - The FrameNode cannot be set whether to support cross-language common attribute setting. 772 * @syscap SystemCapability.ArkUI.ArkUI.Full 773 * @crossplatform 774 * @atomicservice 775 * @since 15 776 */ 777 setCrossLanguageOptions(options: CrossLanguageOptions): void; 778 779 /** 780 * Get the cross-language options of the target FrameNode. 781 * 782 * @returns { CrossLanguageOptions } - Returns the cross-language options of the target FrameNode. 783 * @syscap SystemCapability.ArkUI.ArkUI.Full 784 * @crossplatform 785 * @atomicservice 786 * @since 15 787 */ 788 getCrossLanguageOptions(): CrossLanguageOptions; 789 790 /** 791 * Recycle current FrameNode From JsFrameNode. 792 * 793 * @syscap SystemCapability.ArkUI.ArkUI.Full 794 * @crossplatform 795 * @atomicservice 796 * @since 18 797 */ 798 recycle(): void; 799 800 /** 801 * Reuse current FrameNode From JsFrameNode. 802 * 803 * @syscap SystemCapability.ArkUI.ArkUI.Full 804 * @crossplatform 805 * @atomicservice 806 * @since 18 807 */ 808 reuse(): void; 809} 810 811/** 812 * Used to define the FrameNode type. 813 * 814 * @extends FrameNode 815 * @interface TypedFrameNode 816 * @syscap SystemCapability.ArkUI.ArkUI.Full 817 * @crossplatform 818 * @atomicservice 819 * @since 12 820 */ 821export interface TypedFrameNode<C, T> extends FrameNode { 822 /** 823 * Initialize FrameNode. 824 * 825 * @type { C } 826 * @syscap SystemCapability.ArkUI.ArkUI.Full 827 * @crossplatform 828 * @atomicservice 829 * @since 12 830 */ 831 initialize: C; 832 /** 833 * Get attribute instance of FrameNode to set attributes. 834 * 835 * @type { T } 836 * @readonly 837 * @syscap SystemCapability.ArkUI.ArkUI.Full 838 * @crossplatform 839 * @atomicservice 840 * @since 12 841 */ 842 readonly attribute: T; 843} 844 845/** 846 * Provides methods to implement FrameNode. 847 * 848 * @namespace typeNode 849 * @syscap SystemCapability.ArkUI.ArkUI.Full 850 * @crossplatform 851 * @atomicservice 852 * @since 12 853 */ 854export namespace typeNode { 855 /** 856 * Define the FrameNode type for Text. 857 * 858 * @typedef { TypedFrameNode<TextInterface, TextAttribute> } Text 859 * @syscap SystemCapability.ArkUI.ArkUI.Full 860 * @crossplatform 861 * @atomicservice 862 * @since 12 863 */ 864 type Text = TypedFrameNode<TextInterface, TextAttribute>; 865 866 /** 867 * Create a FrameNode of Text type. 868 * 869 * @param { UIContext } context - uiContext used to create the FrameNode. 870 * @param { 'Text' } nodeType - node type. 871 * @returns { Text } - Return Text type FrameNode. 872 * @syscap SystemCapability.ArkUI.ArkUI.Full 873 * @atomicservice 874 * @since 12 875 */ 876 function createNode(context: UIContext, nodeType: 'Text'): Text; 877 878 /** 879 * Define the FrameNode type for Column. 880 * 881 * @typedef { TypedFrameNode<ColumnInterface, ColumnAttribute> } Column 882 * @syscap SystemCapability.ArkUI.ArkUI.Full 883 * @crossplatform 884 * @atomicservice 885 * @since 12 886 */ 887 type Column = TypedFrameNode<ColumnInterface, ColumnAttribute>; 888 889 /** 890 * Create a FrameNode of Column type. 891 * 892 * @param { UIContext } context - uiContext used to create the FrameNode. 893 * @param { 'Column' } nodeType - node type. 894 * @returns { Column } - Return Column type FrameNode. 895 * @syscap SystemCapability.ArkUI.ArkUI.Full 896 * @atomicservice 897 * @since 12 898 */ 899 function createNode(context: UIContext, nodeType: 'Column'): Column; 900 901 /** 902 * Define the FrameNode type for Row. 903 * 904 * @typedef { TypedFrameNode<RowInterface, RowAttribute> } Row 905 * @syscap SystemCapability.ArkUI.ArkUI.Full 906 * @crossplatform 907 * @atomicservice 908 * @since 12 909 */ 910 type Row = TypedFrameNode<RowInterface, RowAttribute>; 911 912 /** 913 * Create a FrameNode of Row type. 914 * 915 * @param { UIContext } context - uiContext used to create the FrameNode. 916 * @param { 'Row' } nodeType - node type. 917 * @returns { Row } - Return Row type FrameNode. 918 * @syscap SystemCapability.ArkUI.ArkUI.Full 919 * @atomicservice 920 * @since 12 921 */ 922 function createNode(context: UIContext, nodeType: 'Row'): Row; 923 924 /** 925 * Define the FrameNode type for Stack. 926 * 927 * @typedef { TypedFrameNode<StackInterface, StackAttribute> } Stack 928 * @syscap SystemCapability.ArkUI.ArkUI.Full 929 * @crossplatform 930 * @atomicservice 931 * @since 12 932 */ 933 type Stack = TypedFrameNode<StackInterface, StackAttribute>; 934 935 /** 936 * Create a FrameNode of Stack type. 937 * 938 * @param { UIContext } context - uiContext used to create the FrameNode. 939 * @param { 'Stack' } nodeType - node type. 940 * @returns { Stack } - Return Stack type FrameNode. 941 * @syscap SystemCapability.ArkUI.ArkUI.Full 942 * @atomicservice 943 * @since 12 944 */ 945 function createNode(context: UIContext, nodeType: 'Stack'): Stack; 946 947 /** 948 * Define the FrameNode type for GridRow. 949 * 950 * @typedef { TypedFrameNode<GridRowInterface, GridRowAttribute> } GridRow 951 * @syscap SystemCapability.ArkUI.ArkUI.Full 952 * @crossplatform 953 * @atomicservice 954 * @since 12 955 */ 956 type GridRow = TypedFrameNode<GridRowInterface, GridRowAttribute>; 957 958 /** 959 * Create a FrameNode of GridRow type. 960 * 961 * @param { UIContext } context - uiContext used to create the FrameNode. 962 * @param { 'GridRow' } nodeType - node type. 963 * @returns { GridRow } - Return GridRow type FrameNode. 964 * @syscap SystemCapability.ArkUI.ArkUI.Full 965 * @atomicservice 966 * @since 12 967 */ 968 function createNode(context: UIContext, nodeType: 'GridRow'): GridRow; 969 970 /** 971 * Define the FrameNode type for GridCol. 972 * 973 * @typedef { TypedFrameNode<GridColInterface, GridColAttribute> } GridCol 974 * @syscap SystemCapability.ArkUI.ArkUI.Full 975 * @crossplatform 976 * @atomicservice 977 * @since 12 978 */ 979 type GridCol = TypedFrameNode<GridColInterface, GridColAttribute>; 980 981 /** 982 * Create a FrameNode of GridCol type. 983 * 984 * @param { UIContext } context - uiContext used to create the FrameNode. 985 * @param { 'GridCol' } nodeType - node type. 986 * @returns { GridCol } - Return GridCol type FrameNode. 987 * @syscap SystemCapability.ArkUI.ArkUI.Full 988 * @atomicservice 989 * @since 12 990 */ 991 function createNode(context: UIContext, nodeType: 'GridCol'): GridCol; 992 993 /** 994 * Define the FrameNode type for Flex. 995 * 996 * @typedef { TypedFrameNode<FlexInterface, FlexAttribute> } Flex 997 * @syscap SystemCapability.ArkUI.ArkUI.Full 998 * @crossplatform 999 * @atomicservice 1000 * @since 12 1001 */ 1002 type Flex = TypedFrameNode<FlexInterface, FlexAttribute>; 1003 1004 /** 1005 * Create a FrameNode of Flex type. 1006 * 1007 * @param { UIContext } context - uiContext used to create the FrameNode. 1008 * @param { 'Flex' } nodeType - node type. 1009 * @returns { Flex } - Return Flex type FrameNode. 1010 * @syscap SystemCapability.ArkUI.ArkUI.Full 1011 * @atomicservice 1012 * @since 12 1013 */ 1014 function createNode(context: UIContext, nodeType: 'Flex'): Flex; 1015 1016 /** 1017 * Define the FrameNode type for Swiper. 1018 * 1019 * @typedef { TypedFrameNode<SwiperInterface, SwiperAttribute> } Swiper 1020 * @syscap SystemCapability.ArkUI.ArkUI.Full 1021 * @crossplatform 1022 * @atomicservice 1023 * @since 12 1024 */ 1025 type Swiper = TypedFrameNode<SwiperInterface, SwiperAttribute>; 1026 1027 /** 1028 * Create a FrameNode of Swiper type. 1029 * 1030 * @param { UIContext } context - uiContext used to create the FrameNode. 1031 * @param { 'Swiper' } nodeType - node type. 1032 * @returns { Swiper } - Return Swiper type FrameNode. 1033 * @syscap SystemCapability.ArkUI.ArkUI.Full 1034 * @atomicservice 1035 * @since 12 1036 */ 1037 function createNode(context: UIContext, nodeType: 'Swiper'): Swiper; 1038 1039 /** 1040 * Define the FrameNode type for Progress. 1041 * 1042 * @typedef { TypedFrameNode<ProgressInterface, ProgressAttribute> } Progress 1043 * @syscap SystemCapability.ArkUI.ArkUI.Full 1044 * @crossplatform 1045 * @atomicservice 1046 * @since 12 1047 */ 1048 type Progress = TypedFrameNode<ProgressInterface, ProgressAttribute>; 1049 1050 /** 1051 * Create a FrameNode of Progress type. 1052 * 1053 * @param { UIContext } context - uiContext used to create the FrameNode. 1054 * @param { 'Progress' } nodeType - node type. 1055 * @returns { Progress } - Return Progress type FrameNode. 1056 * @syscap SystemCapability.ArkUI.ArkUI.Full 1057 * @atomicservice 1058 * @since 12 1059 */ 1060 function createNode(context: UIContext, nodeType: 'Progress'): Progress; 1061 1062 /** 1063 * Define the FrameNode type for Scroll. 1064 * 1065 * @typedef { TypedFrameNode<ScrollInterface, ScrollAttribute> } Scroll 1066 * @syscap SystemCapability.ArkUI.ArkUI.Full 1067 * @crossplatform 1068 * @atomicservice 1069 * @since 12 1070 */ 1071 type Scroll = TypedFrameNode<ScrollInterface, ScrollAttribute>; 1072 1073 /** 1074 * Create a FrameNode of Scroll type. 1075 * 1076 * @param { UIContext } context - uiContext used to create the FrameNode. 1077 * @param { 'Scroll' } nodeType - node type. 1078 * @returns { Scroll } - Return Scroll type FrameNode. 1079 * @syscap SystemCapability.ArkUI.ArkUI.Full 1080 * @atomicservice 1081 * @since 12 1082 */ 1083 function createNode(context: UIContext, nodeType: 'Scroll'): Scroll; 1084 1085 /** 1086 * Get the attribute instance of FrameNode to set attributes. 1087 * 1088 * @param { FrameNode } node - the target FrameNode. 1089 * @param { 'Scroll' } nodeType - node type. 1090 * @returns { ScrollAttribute | undefined } - Return the attribute instance of FrameNode, and return undefined if it 1091 * does not exist. 1092 * @syscap SystemCapability.ArkUI.ArkUI.Full 1093 * @atomicservice 1094 * @since 15 1095 */ 1096 function getAttribute(node: FrameNode, nodeType: 'Scroll'): ScrollAttribute | undefined; 1097 1098 /** 1099 * Bind the controller of FrameNode. 1100 * 1101 * @param { FrameNode } node - the target FrameNode. 1102 * @param { Scroller } controller - the controller which is bind to the target FrameNode. 1103 * @param { 'Scroll' } nodeType - node type. 1104 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. the type of the node is error. 1105 * 2. the node is null or undefined. 1106 * @throws { BusinessError } 100021 - The FrameNode is not modifiable. 1107 * @syscap SystemCapability.ArkUI.ArkUI.Full 1108 * @atomicservice 1109 * @since 15 1110 */ 1111 function bindController(node: FrameNode, controller: Scroller, nodeType: 'Scroll'): void; 1112 1113 /** 1114 * Define the FrameNode type for RelativeContainer. 1115 * 1116 * @typedef { TypedFrameNode<RelativeContainerInterface, RelativeContainerAttribute> } RelativeContainer 1117 * @syscap SystemCapability.ArkUI.ArkUI.Full 1118 * @crossplatform 1119 * @atomicservice 1120 * @since 12 1121 */ 1122 type RelativeContainer = TypedFrameNode<RelativeContainerInterface, RelativeContainerAttribute>; 1123 1124 /** 1125 * Create a FrameNode of RelativeContainer type. 1126 * 1127 * @param { UIContext } context - uiContext used to create the FrameNode. 1128 * @param { 'RelativeContainer' } nodeType - node type. 1129 * @returns { RelativeContainer } - Return RelativeContainer type FrameNode. 1130 * @syscap SystemCapability.ArkUI.ArkUI.Full 1131 * @atomicservice 1132 * @since 12 1133 */ 1134 function createNode(context: UIContext, nodeType: 'RelativeContainer'): RelativeContainer; 1135 1136 /** 1137 * Define the FrameNode type for Divider. 1138 * 1139 * @typedef { TypedFrameNode<DividerInterface, DividerAttribute> } Divider 1140 * @syscap SystemCapability.ArkUI.ArkUI.Full 1141 * @crossplatform 1142 * @atomicservice 1143 * @since 12 1144 */ 1145 type Divider = TypedFrameNode<DividerInterface, DividerAttribute>; 1146 1147 /** 1148 * Create a FrameNode of Divider type. 1149 * 1150 * @param { UIContext } context - uiContext used to create the FrameNode. 1151 * @param { 'Divider' } nodeType - node type. 1152 * @returns { Divider } - Return Divider type FrameNode. 1153 * @syscap SystemCapability.ArkUI.ArkUI.Full 1154 * @atomicservice 1155 * @since 12 1156 */ 1157 function createNode(context: UIContext, nodeType: 'Divider'): Divider; 1158 1159 /** 1160 * Define the FrameNode type for LoadingProgress. 1161 * 1162 * @typedef { TypedFrameNode<LoadingProgressInterface, LoadingProgressAttribute> } LoadingProgress 1163 * @syscap SystemCapability.ArkUI.ArkUI.Full 1164 * @crossplatform 1165 * @atomicservice 1166 * @since 12 1167 */ 1168 type LoadingProgress = TypedFrameNode<LoadingProgressInterface, LoadingProgressAttribute>; 1169 1170 /** 1171 * Create a FrameNode of LoadingProgress type. 1172 * 1173 * @param { UIContext } context - uiContext used to create the FrameNode. 1174 * @param { 'LoadingProgress' } nodeType - node type. 1175 * @returns { LoadingProgress } - Return LoadingProgress type FrameNode. 1176 * @syscap SystemCapability.ArkUI.ArkUI.Full 1177 * @atomicservice 1178 * @since 12 1179 */ 1180 function createNode(context: UIContext, nodeType: 'LoadingProgress'): LoadingProgress; 1181 1182 /** 1183 * Define the FrameNode type for Search. 1184 * 1185 * @typedef { TypedFrameNode<SearchInterface, SearchAttribute> } Search 1186 * @syscap SystemCapability.ArkUI.ArkUI.Full 1187 * @crossplatform 1188 * @atomicservice 1189 * @since 12 1190 */ 1191 type Search = TypedFrameNode<SearchInterface, SearchAttribute>; 1192 1193 /** 1194 * Create a FrameNode of Search type. 1195 * 1196 * @param { UIContext } context - uiContext used to create the FrameNode. 1197 * @param { 'Search' } nodeType - node type. 1198 * @returns { Search } - Return Search type FrameNode. 1199 * @syscap SystemCapability.ArkUI.ArkUI.Full 1200 * @atomicservice 1201 * @since 12 1202 */ 1203 function createNode(context: UIContext, nodeType: 'Search'): Search; 1204 1205 /** 1206 * Define the FrameNode type for Blank. 1207 * 1208 * @typedef { TypedFrameNode<BlankInterface, BlankAttribute> } Blank 1209 * @syscap SystemCapability.ArkUI.ArkUI.Full 1210 * @crossplatform 1211 * @atomicservice 1212 * @since 12 1213 */ 1214 type Blank = TypedFrameNode<BlankInterface, BlankAttribute>; 1215 1216 /** 1217 * Create a FrameNode of Blank type. 1218 * 1219 * @param { UIContext } context - uiContext used to create the FrameNode. 1220 * @param { 'Blank' } nodeType - node type. 1221 * @returns { Blank } - Return Blank type FrameNode. 1222 * @syscap SystemCapability.ArkUI.ArkUI.Full 1223 * @atomicservice 1224 * @since 12 1225 */ 1226 function createNode(context: UIContext, nodeType: 'Blank'): Blank; 1227 1228 /** 1229 * Define the FrameNode type for Image. 1230 * 1231 * @typedef { TypedFrameNode<ImageInterface, ImageAttribute> } Image 1232 * @syscap SystemCapability.ArkUI.ArkUI.Full 1233 * @crossplatform 1234 * @atomicservice 1235 * @since 12 1236 */ 1237 type Image = TypedFrameNode<ImageInterface, ImageAttribute>; 1238 1239 /** 1240 * Create a FrameNode of Image type. 1241 * 1242 * @param { UIContext } context - uiContext used to create the FrameNode. 1243 * @param { 'Image' } nodeType - node type. 1244 * @returns { Image } - Return Image type FrameNode. 1245 * @syscap SystemCapability.ArkUI.ArkUI.Full 1246 * @atomicservice 1247 * @since 12 1248 */ 1249 function createNode(context: UIContext, nodeType: 'Image'): Image; 1250 1251 /** 1252 * Define the FrameNode type for List. 1253 * 1254 * @typedef { TypedFrameNode<ListInterface, ListAttribute> } List 1255 * @syscap SystemCapability.ArkUI.ArkUI.Full 1256 * @crossplatform 1257 * @atomicservice 1258 * @since 12 1259 */ 1260 type List = TypedFrameNode<ListInterface, ListAttribute>; 1261 1262 /** 1263 * Create a FrameNode of List type. 1264 * 1265 * @param { UIContext } context - uiContext used to create the FrameNode. 1266 * @param { 'List' } nodeType - node type. 1267 * @returns { List } - Return List type FrameNode. 1268 * @syscap SystemCapability.ArkUI.ArkUI.Full 1269 * @atomicservice 1270 * @since 12 1271 */ 1272 function createNode(context: UIContext, nodeType: 'List'): List; 1273 1274 /** 1275 * Define the FrameNode type for ListItem. 1276 * 1277 * @typedef { TypedFrameNode<ListItemInterface, ListItemAttribute> } ListItem 1278 * @syscap SystemCapability.ArkUI.ArkUI.Full 1279 * @crossplatform 1280 * @atomicservice 1281 * @since 12 1282 */ 1283 type ListItem = TypedFrameNode<ListItemInterface, ListItemAttribute>; 1284 1285 /** 1286 * Create a FrameNode of ListItem type. 1287 * 1288 * @param { UIContext } context - uiContext used to create the FrameNode. 1289 * @param { 'ListItem' } nodeType - node type. 1290 * @returns { ListItem } - Return ListItem type FrameNode. 1291 * @syscap SystemCapability.ArkUI.ArkUI.Full 1292 * @atomicservice 1293 * @since 12 1294 */ 1295 function createNode(context: UIContext, nodeType: 'ListItem'): ListItem; 1296 1297 /** 1298 * Define the FrameNode type for TextInput. 1299 * 1300 * @typedef { TypedFrameNode<TextInputInterface, TextInputAttribute> } TextInput 1301 * @syscap SystemCapability.ArkUI.ArkUI.Full 1302 * @crossplatform 1303 * @atomicservice 1304 * @since 12 1305 */ 1306 type TextInput = TypedFrameNode<TextInputInterface, TextInputAttribute>; 1307 1308 /** 1309 * Create a FrameNode of TextInput type. 1310 * 1311 * @param { UIContext } context - uiContext used to create the FrameNode. 1312 * @param { 'TextInput' } nodeType - node type. 1313 * @returns { TextInput } - Return TextInput type FrameNode. 1314 * @syscap SystemCapability.ArkUI.ArkUI.Full 1315 * @atomicservice 1316 * @since 12 1317 */ 1318 function createNode(context: UIContext, nodeType: 'TextInput'): TextInput; 1319 1320 /** 1321 * Define the FrameNode type for Button. 1322 * 1323 * @typedef { TypedFrameNode<ButtonInterface, ButtonAttribute> } Button 1324 * @syscap SystemCapability.ArkUI.ArkUI.Full 1325 * @crossplatform 1326 * @atomicservice 1327 * @since 12 1328 */ 1329 type Button = TypedFrameNode<ButtonInterface, ButtonAttribute>; 1330 1331 /** 1332 * Create a FrameNode of Button type. 1333 * 1334 * @param { UIContext } context - uiContext used to create the FrameNode. 1335 * @param { 'Button' } nodeType - node type. 1336 * @returns { Button } - Return Button type FrameNode. 1337 * @syscap SystemCapability.ArkUI.ArkUI.Full 1338 * @atomicservice 1339 * @since 12 1340 */ 1341 function createNode(context: UIContext, nodeType: 'Button'): Button; 1342 1343 /** 1344 * Define the FrameNode type for ListItemGroup. 1345 * 1346 * @typedef { TypedFrameNode<ListItemGroupInterface, ListItemGroupAttribute> } ListItemGroup 1347 * @syscap SystemCapability.ArkUI.ArkUI.Full 1348 * @crossplatform 1349 * @atomicservice 1350 * @since 12 1351 */ 1352 type ListItemGroup = TypedFrameNode<ListItemGroupInterface, ListItemGroupAttribute>; 1353 1354 /** 1355 * Create a FrameNode of ListItemGroup type. 1356 * 1357 * @param { UIContext } context - uiContext used to create the FrameNode. 1358 * @param { 'ListItemGroup' } nodeType - node type. 1359 * @returns { ListItemGroup } - Return ListItemGroup type FrameNode. 1360 * @syscap SystemCapability.ArkUI.ArkUI.Full 1361 * @atomicservice 1362 * @since 12 1363 */ 1364 function createNode(context: UIContext, nodeType: 'ListItemGroup'): ListItemGroup; 1365 1366 /** 1367 * Define the FrameNode type for WaterFlow. 1368 * 1369 * @typedef { TypedFrameNode<WaterFlowInterface, WaterFlowAttribute> } WaterFlow 1370 * @syscap SystemCapability.ArkUI.ArkUI.Full 1371 * @crossplatform 1372 * @atomicservice 1373 * @since 12 1374 */ 1375 type WaterFlow = TypedFrameNode<WaterFlowInterface, WaterFlowAttribute>; 1376 1377 /** 1378 * Create a FrameNode of WaterFlow type. 1379 * 1380 * @param { UIContext } context - uiContext used to create the FrameNode. 1381 * @param { 'WaterFlow' } nodeType - node type. 1382 * @returns { WaterFlow } - Return WaterFlow type FrameNode. 1383 * @syscap SystemCapability.ArkUI.ArkUI.Full 1384 * @atomicservice 1385 * @since 12 1386 */ 1387 function createNode(context: UIContext, nodeType: 'WaterFlow'): WaterFlow; 1388 1389 /** 1390 * Define the FrameNode type for FlowItem. 1391 * 1392 * @typedef { TypedFrameNode<FlowItemInterface, FlowItemAttribute> } FlowItem 1393 * @syscap SystemCapability.ArkUI.ArkUI.Full 1394 * @crossplatform 1395 * @atomicservice 1396 * @since 12 1397 */ 1398 type FlowItem = TypedFrameNode<FlowItemInterface, FlowItemAttribute>; 1399 1400 /** 1401 * Create a FrameNode of FlowItem type. 1402 * 1403 * @param { UIContext } context - uiContext used to create the FrameNode. 1404 * @param { 'FlowItem' } nodeType - node type. 1405 * @returns { FlowItem } - Return FlowItem type FrameNode. 1406 * @syscap SystemCapability.ArkUI.ArkUI.Full 1407 * @atomicservice 1408 * @since 12 1409 */ 1410 function createNode(context: UIContext, nodeType: 'FlowItem'): FlowItem; 1411 1412 /** 1413 * Define the FrameNode type for XComponent. 1414 * 1415 * @typedef { TypedFrameNode<XComponentInterface, XComponentAttribute> } XComponent 1416 * @syscap SystemCapability.ArkUI.ArkUI.Full 1417 * @crossplatform 1418 * @atomicservice 1419 * @since 12 1420 */ 1421 type XComponent = TypedFrameNode<XComponentInterface, XComponentAttribute>; 1422 1423 /** 1424 * Create a FrameNode of XComponent type. 1425 * 1426 * @param { UIContext } context - uiContext used to create the FrameNode. 1427 * @param { 'XComponent' } nodeType - node type. 1428 * @returns { XComponent } - Return XComponent type FrameNode. 1429 * @syscap SystemCapability.ArkUI.ArkUI.Full 1430 * @atomicservice 1431 * @since 12 1432 */ 1433 function createNode(context: UIContext, nodeType: 'XComponent'): XComponent; 1434 1435 /** 1436 * Create a FrameNode of XComponent type with options. 1437 * 1438 * @param { UIContext } context - uiContext used to create the FrameNode. 1439 * @param { 'XComponent' } nodeType - node type. 1440 * @param { XComponentOptions } options - initialization parameters. 1441 * @returns { XComponent } - Return XComponent type FrameNode. 1442 * @syscap SystemCapability.ArkUI.ArkUI.Full 1443 * @atomicservice 1444 * @since 12 1445 */ 1446 function createNode(context: UIContext, nodeType: 'XComponent', options: XComponentOptions): XComponent; 1447 1448 /** 1449 * Define the FrameNode type for Checkbox. 1450 * 1451 * @typedef { TypedFrameNode<CheckboxInterface, CheckboxAttribute> } Checkbox 1452 * @syscap SystemCapability.ArkUI.ArkUI.Full 1453 * @crossplatform 1454 * @atomicservice 1455 * @since 18 1456 */ 1457 type Checkbox = TypedFrameNode<CheckboxInterface, CheckboxAttribute>; 1458 1459 /** 1460 * Create a FrameNode of Checkbox type. 1461 * 1462 * @param { UIContext } context - uiContext used to create the FrameNode. 1463 * @param { 'Checkbox' } nodeType - node type. 1464 * @returns { Checkbox } - Return Checkbox type FrameNode. 1465 * @syscap SystemCapability.ArkUI.ArkUI.Full 1466 * @atomicservice 1467 * @since 18 1468 */ 1469 function createNode(context: UIContext, nodeType: 'Checkbox'): Checkbox; 1470 1471 /** 1472 * Define the FrameNode type for CheckboxGroup. 1473 * 1474 * @typedef { TypedFrameNode<CheckboxGroupInterface, CheckboxGroupAttribute> } CheckboxGroup 1475 * @syscap SystemCapability.ArkUI.ArkUI.Full 1476 * @crossplatform 1477 * @atomicservice 1478 * @since 18 1479 */ 1480 type CheckboxGroup = TypedFrameNode<CheckboxGroupInterface, CheckboxGroupAttribute>; 1481 1482 /** 1483 * Create a FrameNode of CheckboxGroup type. 1484 * 1485 * @param { UIContext } context - uiContext used to create the FrameNode. 1486 * @param { 'CheckboxGroup' } nodeType - node type. 1487 * @returns { CheckboxGroup } - Return CheckboxGroup type FrameNode. 1488 * @syscap SystemCapability.ArkUI.ArkUI.Full 1489 * @atomicservice 1490 * @since 18 1491 */ 1492 function createNode(context: UIContext, nodeType: 'CheckboxGroup'): CheckboxGroup; 1493 1494 /** 1495 * Define the FrameNode type for Radio. 1496 * 1497 * @typedef { TypedFrameNode<RadioInterface, RadioAttribute> } Radio 1498 * @syscap SystemCapability.ArkUI.ArkUI.Full 1499 * @crossplatform 1500 * @atomicservice 1501 * @since 18 1502 */ 1503 type Radio = TypedFrameNode<RadioInterface, RadioAttribute>; 1504 1505 /** 1506 * Create a FrameNode of Radio type. 1507 * 1508 * @param { UIContext } context - uiContext used to create the FrameNode. 1509 * @param { 'Radio' } nodeType - node type. 1510 * @returns { Radio } - Return Radio type FrameNode. 1511 * @syscap SystemCapability.ArkUI.ArkUI.Full 1512 * @atomicservice 1513 * @since 18 1514 */ 1515 function createNode(context: UIContext, nodeType: 'Radio'): Radio; 1516 1517 /** 1518 * Define the FrameNode type for Rating. 1519 * 1520 * @typedef { TypedFrameNode<RatingInterface, RatingAttribute> } Rating 1521 * @syscap SystemCapability.ArkUI.ArkUI.Full 1522 * @crossplatform 1523 * @atomicservice 1524 * @since 18 1525 */ 1526 type Rating = TypedFrameNode<RatingInterface, RatingAttribute>; 1527 1528 /** 1529 * Create a FrameNode of Rating type. 1530 * 1531 * @param { UIContext } context - uiContext used to create the FrameNode. 1532 * @param { 'Rating' } nodeType - node type. 1533 * @returns { Rating } - Return Rating type FrameNode. 1534 * @syscap SystemCapability.ArkUI.ArkUI.Full 1535 * @atomicservice 1536 * @since 18 1537 */ 1538 function createNode(context: UIContext, nodeType: 'Rating'): Rating; 1539 1540 /** 1541 * Define the FrameNode type for Select. 1542 * 1543 * @typedef { TypedFrameNode<SelectInterface, SelectAttribute> } Select 1544 * @syscap SystemCapability.ArkUI.ArkUI.Full 1545 * @crossplatform 1546 * @atomicservice 1547 * @since 18 1548 */ 1549 type Select = TypedFrameNode<SelectInterface, SelectAttribute>; 1550 1551 /** 1552 * Create a FrameNode of Select type. 1553 * 1554 * @param { UIContext } context - uiContext used to create the FrameNode. 1555 * @param { 'Select' } nodeType - node type. 1556 * @returns { Select } - Return Select type FrameNode. 1557 * @syscap SystemCapability.ArkUI.ArkUI.Full 1558 * @atomicservice 1559 * @since 18 1560 */ 1561 function createNode(context: UIContext, nodeType: 'Select'): Select; 1562 1563 /** 1564 * Define the FrameNode type for Slider. 1565 * 1566 * @typedef { TypedFrameNode<SliderInterface, SliderAttribute> } Slider 1567 * @syscap SystemCapability.ArkUI.ArkUI.Full 1568 * @crossplatform 1569 * @atomicservice 1570 * @since 18 1571 */ 1572 type Slider = TypedFrameNode<SliderInterface, SliderAttribute>; 1573 1574 /** 1575 * Create a FrameNode of Slider type. 1576 * 1577 * @param { UIContext } context - uiContext used to create the FrameNode. 1578 * @param { 'Slider' } nodeType - node type. 1579 * @returns { Slider } - Return Slider type FrameNode. 1580 * @syscap SystemCapability.ArkUI.ArkUI.Full 1581 * @atomicservice 1582 * @since 18 1583 */ 1584 function createNode(context: UIContext, nodeType: 'Slider'): Slider; 1585 1586 /** 1587 * Define the FrameNode type for Toggle. 1588 * 1589 * @typedef { TypedFrameNode<ToggleInterface, ToggleAttribute> } Toggle 1590 * @syscap SystemCapability.ArkUI.ArkUI.Full 1591 * @crossplatform 1592 * @atomicservice 1593 * @since 18 1594 */ 1595 type Toggle = TypedFrameNode<ToggleInterface, ToggleAttribute>; 1596 1597 /** 1598 * Create a FrameNode of Toggle type. 1599 * 1600 * @param { UIContext } context - uiContext used to create the FrameNode. 1601 * @param { 'Toggle' } nodeType - node type. 1602 * @param { ToggleOptions } options - ToggleOptions. 1603 * @returns { Toggle } - Return Toggle type FrameNode. 1604 * @syscap SystemCapability.ArkUI.ArkUI.Full 1605 * @atomicservice 1606 * @since 18 1607 */ 1608 function createNode(context: UIContext, nodeType: 'Toggle', options?: ToggleOptions): Toggle; 1609 1610 /** 1611 * Define the FrameNode type for Marquee. 1612 * 1613 * @typedef { TypedFrameNode<MarqueeInterface, MarqueeAttribute> } Marquee 1614 * @syscap SystemCapability.ArkUI.ArkUI.Full 1615 * @crossplatform 1616 * @atomicservice 1617 * @since 14 1618 */ 1619 type Marquee = TypedFrameNode<MarqueeInterface, MarqueeAttribute>; 1620 1621 /** 1622 * Create a FrameNode of Marquee type. 1623 * 1624 * @param { UIContext } context - uiContext used to create the FrameNode. 1625 * @param { 'Marquee' } nodeType - node type. 1626 * @returns { Marquee } - Return Marquee type FrameNode. 1627 * @syscap SystemCapability.ArkUI.ArkUI.Full 1628 * @atomicservice 1629 * @since 14 1630 */ 1631 function createNode(context: UIContext, nodeType: 'Marquee'): Marquee; 1632 1633 /** 1634 * Define the FrameNode type for TextArea. 1635 * 1636 * @typedef { TypedFrameNode<TextAreaInterface, TextAreaAttribute> } TextArea 1637 * @syscap SystemCapability.ArkUI.ArkUI.Full 1638 * @crossplatform 1639 * @atomicservice 1640 * @since 14 1641 */ 1642 type TextArea = TypedFrameNode<TextAreaInterface, TextAreaAttribute>; 1643 1644 /** 1645 * Create a FrameNode of TextArea type. 1646 * 1647 * @param { UIContext } context - uiContext used to create the FrameNode. 1648 * @param { 'TextArea' } nodeType - node type. 1649 * @returns { TextArea } - Return TextArea type FrameNode. 1650 * @syscap SystemCapability.ArkUI.ArkUI.Full 1651 * @atomicservice 1652 * @since 14 1653 */ 1654 function createNode(context: UIContext, nodeType: 'TextArea'): TextArea; 1655 1656 /** 1657 * Define the FrameNode type for SymbolGlyph. 1658 * 1659 * @typedef { TypedFrameNode<SymbolGlyphInterface, SymbolGlyphAttribute> } SymbolGlyph 1660 * @syscap SystemCapability.ArkUI.ArkUI.Full 1661 * @crossplatform 1662 * @atomicservice 1663 * @since 14 1664 */ 1665 type SymbolGlyph = TypedFrameNode<SymbolGlyphInterface, SymbolGlyphAttribute>; 1666 1667 /** 1668 * Create a FrameNode of SymbolGlyph type. 1669 * 1670 * @param { UIContext } context - uiContext used to create the FrameNode. 1671 * @param { 'SymbolGlyph' } nodeType - node type. 1672 * @returns { SymbolGlyph } - Return SymbolGlyph type FrameNode. 1673 * @syscap SystemCapability.ArkUI.ArkUI.Full 1674 * @atomicservice 1675 * @since 14 1676 */ 1677 function createNode(context: UIContext, nodeType: 'SymbolGlyph'): SymbolGlyph; 1678 1679 /** 1680 * Define the FrameNode type for QRCode. 1681 * 1682 * @typedef { TypedFrameNode<QRCodeInterface, QRCodeAttribute> } QRCode 1683 * @syscap SystemCapability.ArkUI.ArkUI.Full 1684 * @crossplatform 1685 * @atomicservice 1686 * @since 14 1687 */ 1688 type QRCode = TypedFrameNode<QRCodeInterface, QRCodeAttribute>; 1689 1690 /** 1691 * Create a FrameNode of QRCode type. 1692 * 1693 * @param { UIContext } context - uiContext used to create the FrameNode. 1694 * @param { 'QRCode' } nodeType - node type. 1695 * @returns { QRCode } - Return QRCode type FrameNode. 1696 * @syscap SystemCapability.ArkUI.ArkUI.Full 1697 * @atomicservice 1698 * @since 14 1699 */ 1700 function createNode(context: UIContext, nodeType: 'QRCode'): QRCode; 1701 1702 /** 1703 * Define the FrameNode type for Badge. 1704 * 1705 * @typedef { TypedFrameNode<BadgeInterface, BadgeAttribute> } Badge 1706 * @syscap SystemCapability.ArkUI.ArkUI.Full 1707 * @crossplatform 1708 * @atomicservice 1709 * @since 14 1710 */ 1711 type Badge = TypedFrameNode<BadgeInterface, BadgeAttribute>; 1712 1713 /** 1714 * Create a FrameNode of Badge type. 1715 * 1716 * @param { UIContext } context - uiContext used to create the FrameNode. 1717 * @param { 'Badge' } nodeType - node type. 1718 * @returns { Badge } - Return Badge type FrameNode. 1719 * @syscap SystemCapability.ArkUI.ArkUI.Full 1720 * @atomicservice 1721 * @since 14 1722 */ 1723 function createNode(context: UIContext, nodeType: 'Badge'): Badge; 1724 1725 /** 1726 * Define the FrameNode type for TextClock. 1727 * 1728 * @typedef { TypedFrameNode<TextClockInterface, TextClockAttribute> } TextClock 1729 * @syscap SystemCapability.ArkUI.ArkUI.Full 1730 * @crossplatform 1731 * @atomicservice 1732 * @since 14 1733 */ 1734 type TextClock = TypedFrameNode<TextClockInterface, TextClockAttribute>; 1735 1736 /** 1737 * Create a FrameNode of TextClock type. 1738 * 1739 * @param { UIContext } context - uiContext used to create the FrameNode. 1740 * @param { 'TextClock' } nodeType - node type. 1741 * @returns { TextClock } - Return TextClock type FrameNode. 1742 * @syscap SystemCapability.ArkUI.ArkUI.Full 1743 * @atomicservice 1744 * @since 14 1745 */ 1746 function createNode(context: UIContext, nodeType: 'TextClock'): TextClock; 1747 1748 /** 1749 * Define the FrameNode type for TextTimer. 1750 * 1751 * @typedef { TypedFrameNode<TextTimerInterface, TextTimerAttribute> } TextTimer 1752 * @syscap SystemCapability.ArkUI.ArkUI.Full 1753 * @crossplatform 1754 * @atomicservice 1755 * @since 14 1756 */ 1757 type TextTimer = TypedFrameNode<TextTimerInterface, TextTimerAttribute>; 1758 1759 /** 1760 * Create a FrameNode of TextTimer type. 1761 * 1762 * @param { UIContext } context - uiContext used to create the FrameNode. 1763 * @param { 'TextTimer' } nodeType - node type. 1764 * @returns { TextTimer } - Return TextTimer type FrameNode. 1765 * @syscap SystemCapability.ArkUI.ArkUI.Full 1766 * @atomicservice 1767 * @since 14 1768 */ 1769 function createNode(context: UIContext, nodeType: 'TextTimer'): TextTimer; 1770 1771 /** 1772 * Define the FrameNode type for Grid. 1773 * 1774 * @typedef { TypedFrameNode<GridInterface, GridAttribute> } Grid 1775 * @syscap SystemCapability.ArkUI.ArkUI.Full 1776 * @crossplatform 1777 * @atomicservice 1778 * @since 14 1779 */ 1780 type Grid = TypedFrameNode<GridInterface, GridAttribute>; 1781 1782 /** 1783 * Create a FrameNode of Grid type. 1784 * 1785 * @param { UIContext } context - uiContext used to create the FrameNode. 1786 * @param { 'Grid' } nodeType - node type. 1787 * @returns { Grid } - Return Grid type FrameNode. 1788 * @syscap SystemCapability.ArkUI.ArkUI.Full 1789 * @atomicservice 1790 * @since 14 1791 */ 1792 function createNode(context: UIContext, nodeType: 'Grid'): Grid; 1793 1794 /** 1795 * Define the FrameNode type for GridItem. 1796 * 1797 * @typedef { TypedFrameNode<GridItemInterface, GridItemAttribute> } GridItem 1798 * @syscap SystemCapability.ArkUI.ArkUI.Full 1799 * @crossplatform 1800 * @atomicservice 1801 * @since 14 1802 */ 1803 type GridItem = TypedFrameNode<GridItemInterface, GridItemAttribute>; 1804 1805 /** 1806 * Create a FrameNode of GridItem type. 1807 * 1808 * @param { UIContext } context - uiContext used to create the FrameNode. 1809 * @param { 'GridItem' } nodeType - node type. 1810 * @returns { GridItem } - Return GridItem type FrameNode. 1811 * @syscap SystemCapability.ArkUI.ArkUI.Full 1812 * @atomicservice 1813 * @since 14 1814 */ 1815 function createNode(context: UIContext, nodeType: 'GridItem'): GridItem; 1816} 1817 1818/** 1819 * Used for lazy loading of typeNode. 1820 * 1821 * @syscap SystemCapability.ArkUI.ArkUI.Full 1822 * @crossplatform 1823 * @atomicservice 1824 * @since 12 1825 */ 1826declare class NodeAdapter { 1827 /** 1828 * Constructor. 1829 * 1830 * @syscap SystemCapability.ArkUI.ArkUI.Full 1831 * @crossplatform 1832 * @atomicservice 1833 * @since 12 1834 */ 1835 constructor(); 1836 /** 1837 * Dispose the NodeAdapter immediately. 1838 * 1839 * @syscap SystemCapability.ArkUI.ArkUI.Full 1840 * @crossplatform 1841 * @atomicservice 1842 * @since 12 1843 */ 1844 dispose(): void; 1845 /** 1846 * Set the total number of node count. 1847 * 1848 * @param { number } count - The total number of node count. 1849 * @syscap SystemCapability.ArkUI.ArkUI.Full 1850 * @crossplatform 1851 * @atomicservice 1852 * @since 12 1853 */ 1854 set totalNodeCount(count: number); 1855 /** 1856 * Get the total number of node count. 1857 * 1858 * @returns { number } - Return the total number of node count. 1859 * @syscap SystemCapability.ArkUI.ArkUI.Full 1860 * @crossplatform 1861 * @atomicservice 1862 * @since 12 1863 */ 1864 get totalNodeCount(): number; 1865 /** 1866 * Define the operation of reloading all data. 1867 * 1868 * @syscap SystemCapability.ArkUI.ArkUI.Full 1869 * @crossplatform 1870 * @atomicservice 1871 * @since 12 1872 */ 1873 reloadAllItems(): void; 1874 /** 1875 * Define the data reload operation.Reload a specified amount of data starting from the index value. 1876 * 1877 * @param { number } start - Start loading index values for data. 1878 * @param { number } count - Load the number of data. 1879 * @syscap SystemCapability.ArkUI.ArkUI.Full 1880 * @crossplatform 1881 * @atomicservice 1882 * @since 12 1883 */ 1884 reloadItem(start: number, count: number): void; 1885 /** 1886 * Define data deletion operations.Delete a specified amount of data starting from the index value. 1887 * 1888 * @param { number } start - Start deleting index values for data. 1889 * @param { number } count - Delete the number of data. 1890 * @syscap SystemCapability.ArkUI.ArkUI.Full 1891 * @crossplatform 1892 * @atomicservice 1893 * @since 12 1894 */ 1895 removeItem(start: number, count: number): void; 1896 /** 1897 * Define data insertion operations.Insert a specified amount of data starting from the index value. 1898 * 1899 * @param { number } start - Start Insert index values for data. 1900 * @param { number } count - Insert the number of data. 1901 * @syscap SystemCapability.ArkUI.ArkUI.Full 1902 * @crossplatform 1903 * @atomicservice 1904 * @since 12 1905 */ 1906 insertItem(start: number, count: number): void; 1907 /** 1908 * Define data movement operations. Move data from the starting index to the ending index. 1909 * 1910 * @param { number } from - Starting index value. 1911 * @param { number } to - End index value. 1912 * @syscap SystemCapability.ArkUI.ArkUI.Full 1913 * @crossplatform 1914 * @atomicservice 1915 * @since 12 1916 */ 1917 moveItem(from: number, to: number): void; 1918 /** 1919 * Obtain all data results. 1920 * 1921 * @returns { Array<FrameNode> } - Return all valid FrameNode collections. 1922 * @syscap SystemCapability.ArkUI.ArkUI.Full 1923 * @crossplatform 1924 * @atomicservice 1925 * @since 12 1926 */ 1927 getAllAvailableItems(): Array<FrameNode>; 1928 /** 1929 * This callback will be triggered when a FrameNode is bound. 1930 * 1931 * @param { FrameNode } target - The bound FrameNode node. 1932 * @syscap SystemCapability.ArkUI.ArkUI.Full 1933 * @crossplatform 1934 * @atomicservice 1935 * @since 12 1936 */ 1937 onAttachToNode?(target: FrameNode): void; 1938 /** 1939 * This callback will be triggered when the binding is released. 1940 * 1941 * @syscap SystemCapability.ArkUI.ArkUI.Full 1942 * @crossplatform 1943 * @atomicservice 1944 * @since 12 1945 */ 1946 onDetachFromNode?(): void; 1947 /** 1948 * Call this callback when loading for the first time or when a new node slides in.Used to generate custom IDs, developers need to ensure the uniqueness of the IDs themselves. 1949 * 1950 * @param { number } index - Load the index value of the data. 1951 * @returns { number } - Returning the developer's custom ID requires the developer to ensure its uniqueness. 1952 * @syscap SystemCapability.ArkUI.ArkUI.Full 1953 * @crossplatform 1954 * @atomicservice 1955 * @since 12 1956 */ 1957 onGetChildId?(index: number): number; 1958 /** 1959 * Call this callback when loading for the first time or when a new node slides in. 1960 * 1961 * @param { number } index - Load the index value of the data. 1962 * @returns { FrameNode } - Returns the FrameNode node that loads the node. 1963 * @syscap SystemCapability.ArkUI.ArkUI.Full 1964 * @crossplatform 1965 * @atomicservice 1966 * @since 12 1967 */ 1968 onCreateChild?(index: number): FrameNode; 1969 /** 1970 * Called when the child node is about to be destroyed. 1971 * 1972 * @param { number } id - The child node ID that is about to be destroyed. 1973 * @param { FrameNode } node - The FrameNode node that is about to be destroyed. 1974 * @syscap SystemCapability.ArkUI.ArkUI.Full 1975 * @crossplatform 1976 * @atomicservice 1977 * @since 12 1978 */ 1979 onDisposeChild?(id: number, node: FrameNode): void; 1980 /** 1981 * Call this callback when reloading or reusing. 1982 * 1983 * @param { number } id - The index value of the reloaded data. 1984 * @param { FrameNode } node - Reused FrameNode nodes. 1985 * @syscap SystemCapability.ArkUI.ArkUI.Full 1986 * @crossplatform 1987 * @atomicservice 1988 * @since 12 1989 */ 1990 onUpdateChild?(id: number, node: FrameNode): void; 1991 /** 1992 * Add a NodeAdapter to bind to the node.A node can only be bound to one NodeAdapter. Binding failure returns false. 1993 * 1994 * @param { NodeAdapter } adapter - Define lazy loading classes. 1995 * @param { FrameNode } node - The bound FrameNode node. 1996 * @returns { boolean } Return the binding result. 1997 * @syscap SystemCapability.ArkUI.ArkUI.Full 1998 * @crossplatform 1999 * @atomicservice 2000 * @since 12 2001 */ 2002 static attachNodeAdapter(adapter: NodeAdapter, node: FrameNode): boolean; 2003 /** 2004 * Remove the bound NodeAdapter from the node.A node can only be bound to one NodeAdapter. 2005 * 2006 * @param { FrameNode } node - Unbind the FrameNode node. 2007 * @syscap SystemCapability.ArkUI.ArkUI.Full 2008 * @crossplatform 2009 * @atomicservice 2010 * @since 12 2011 */ 2012 static detachNodeAdapter(node: FrameNode): void; 2013}