1/* 2 * Copyright (c) 2021-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 21 22 23import { AsyncCallback } from './@ohos.base'; 24 25/** 26 * Define the display mode of all kind of dialog 27 * 28 * @enum { number } 29 * @syscap SystemCapability.ArkUI.ArkUI.Full 30 * @crossplatform 31 * @atomicservice 32 * @since 15 33 */ 34export enum LevelMode { 35 /** 36 * Display above all page levels. 37 * 38 * @syscap SystemCapability.ArkUI.ArkUI.Full 39 * @crossplatform 40 * @atomicservice 41 * @since 15 42 */ 43 OVERLAY = 0, 44 45 /** 46 * Display within the current page. 47 * 48 * @syscap SystemCapability.ArkUI.ArkUI.Full 49 * @crossplatform 50 * @atomicservice 51 * @since 15 52 */ 53 EMBEDDED = 1, 54} 55 56/** 57 * Define the immersive mode of all kind of dialog 58 * 59 * @enum { number } 60 * @syscap SystemCapability.ArkUI.ArkUI.Full 61 * @crossplatform 62 * @atomicservice 63 * @since 15 64 */ 65export enum ImmersiveMode { 66 /** 67 * Mask covering the parent node. 68 * 69 * @syscap SystemCapability.ArkUI.ArkUI.Full 70 * @crossplatform 71 * @atomicservice 72 * @since 15 73 */ 74 DEFAULT = 0, 75 76 /** 77 * Mask extend safe area includes status bar and navigation bar. 78 * 79 * @syscap SystemCapability.ArkUI.ArkUI.Full 80 * @crossplatform 81 * @atomicservice 82 * @since 15 83 */ 84 EXTEND = 1, 85} 86 87/** 88 * Defines level order. 89 * 90 * @syscap SystemCapability.ArkUI.ArkUI.Full 91 * @crossplatform 92 * @atomicservice 93 * @since 18 94 */ 95export class LevelOrder { 96 /** 97 * Generate valid level order. 98 * 99 * @param { number } order - Clamp order with mininum number -100000 and maximum number 100000. 100 * @returns { LevelOrder } the order object. 101 * @static 102 * @syscap SystemCapability.ArkUI.ArkUI.Full 103 * @crossplatform 104 * @atomicservice 105 * @since 18 106 */ 107 static clamp(order: number): LevelOrder; 108 109 /** 110 * Get the order from LevelOrder object. 111 * 112 * @returns { number } the order number. 113 * @syscap SystemCapability.ArkUI.ArkUI.Full 114 * @crossplatform 115 * @atomicservice 116 * @since 18 117 */ 118 getOrder(): number; 119} 120 121/** 122 * @namespace promptAction 123 * @syscap SystemCapability.ArkUI.ArkUI.Full 124 * @since 9 125 */ 126/** 127 * @namespace promptAction 128 * @syscap SystemCapability.ArkUI.ArkUI.Full 129 * @crossplatform 130 * @since 10 131 */ 132/** 133 * @namespace promptAction 134 * @syscap SystemCapability.ArkUI.ArkUI.Full 135 * @crossplatform 136 * @atomicservice 137 * @since 11 138 */ 139declare namespace promptAction { 140 /** 141 * @typedef ShowToastOptions 142 * @syscap SystemCapability.ArkUI.ArkUI.Full 143 * @since 9 144 */ 145 /** 146 * @typedef ShowToastOptions 147 * @syscap SystemCapability.ArkUI.ArkUI.Full 148 * @crossplatform 149 * @since 10 150 */ 151 /** 152 * @typedef ShowToastOptions 153 * @syscap SystemCapability.ArkUI.ArkUI.Full 154 * @crossplatform 155 * @atomicservice 156 * @since 11 157 */ 158 interface ShowToastOptions { 159 160 /** 161 * Text to display. 162 * 163 * @type { string | Resource } 164 * @syscap SystemCapability.ArkUI.ArkUI.Full 165 * @since 9 166 */ 167 /** 168 * Text to display. 169 * 170 * @type { string | Resource } 171 * @syscap SystemCapability.ArkUI.ArkUI.Full 172 * @crossplatform 173 * @since 10 174 */ 175 /** 176 * Text to display. 177 * 178 * @type { string | Resource } 179 * @syscap SystemCapability.ArkUI.ArkUI.Full 180 * @crossplatform 181 * @atomicservice 182 * @since 11 183 */ 184 message: string | Resource; 185 186 /** 187 * Duration of toast dialog box. The default value is 1500. 188 * The recommended value ranges from 1500ms to 10000ms. 189 * NOTE: A value less than 1500 is automatically changed to 1500. The maximum value is 10000ms. 190 * 191 * @type { ?number } 192 * @syscap SystemCapability.ArkUI.ArkUI.Full 193 * @since 9 194 */ 195 /** 196 * Duration of toast dialog box. The default value is 1500. 197 * The recommended value ranges from 1500ms to 10000ms. 198 * NOTE: A value less than 1500 is automatically changed to 1500. The maximum value is 10000ms. 199 * 200 * @type { ?number } 201 * @syscap SystemCapability.ArkUI.ArkUI.Full 202 * @crossplatform 203 * @since 10 204 */ 205 /** 206 * Duration of toast dialog box. The default value is 1500. 207 * The recommended value ranges from 1500ms to 10000ms. 208 * NOTE: A value less than 1500 is automatically changed to 1500. The maximum value is 10000ms. 209 * 210 * @type { ?number } 211 * @syscap SystemCapability.ArkUI.ArkUI.Full 212 * @crossplatform 213 * @atomicservice 214 * @since 11 215 */ 216 duration?: number; 217 218 /** 219 * The distance between toast dialog box and the bottom of screen. 220 * 221 * @type { ?(string | number) } 222 * @syscap SystemCapability.ArkUI.ArkUI.Full 223 * @since 9 224 */ 225 /** 226 * The distance between toast dialog box and the bottom of screen. 227 * 228 * @type { ?(string | number) } 229 * @syscap SystemCapability.ArkUI.ArkUI.Full 230 * @crossplatform 231 * @since 10 232 */ 233 /** 234 * The distance between toast dialog box and the bottom of screen. 235 * 236 * @type { ?(string | number) } 237 * @syscap SystemCapability.ArkUI.ArkUI.Full 238 * @crossplatform 239 * @atomicservice 240 * @since 11 241 */ 242 bottom?: string | number; 243 244 /** 245 * Determine the show mode of the toast. 246 * 247 * @type { ?ToastShowMode } 248 * @default ToastShowMode.DEFAULT 249 * @syscap SystemCapability.ArkUI.ArkUI.Full 250 * @since 11 251 */ 252 /** 253 * Determine the show mode of the toast. 254 * 255 * @type { ?ToastShowMode } 256 * @default ToastShowMode.DEFAULT 257 * @syscap SystemCapability.ArkUI.ArkUI.Full 258 * @crossplatform 259 * @atomicservice 260 * @since 12 261 */ 262 showMode?: ToastShowMode; 263 /** 264 * Defines the toast alignment of the screen. 265 * 266 * @type { ?Alignment } 267 * @syscap SystemCapability.ArkUI.ArkUI.Full 268 * @crossplatform 269 * @atomicservice 270 * @since 12 271 */ 272 alignment?: Alignment; 273 /** 274 * Defines the toast offset. 275 * 276 * @type { ?Offset } 277 * @syscap SystemCapability.ArkUI.ArkUI.Full 278 * @crossplatform 279 * @atomicservice 280 * @since 12 281 */ 282 offset?: Offset; 283 /** 284 * Background color of toast. 285 * 286 * @type { ?ResourceColor } 287 * @syscap SystemCapability.ArkUI.ArkUI.Full 288 * @crossplatform 289 * @atomicservice 290 * @since 12 291 */ 292 backgroundColor?: ResourceColor; 293 /** 294 * Text color of toast. 295 * 296 * @type { ?ResourceColor } 297 * @syscap SystemCapability.ArkUI.ArkUI.Full 298 * @crossplatform 299 * @atomicservice 300 * @since 12 301 */ 302 textColor?: ResourceColor; 303 /** 304 * Background blur Style of toast. 305 * 306 * @type { ?BlurStyle } 307 * @syscap SystemCapability.ArkUI.ArkUI.Full 308 * @crossplatform 309 * @atomicservice 310 * @since 12 311 */ 312 backgroundBlurStyle?: BlurStyle; 313 /** 314 * Shadow of toast. 315 * 316 * @type { ?(ShadowOptions | ShadowStyle) } 317 * @syscap SystemCapability.ArkUI.ArkUI.Full 318 * @crossplatform 319 * @atomicservice 320 * @since 12 321 */ 322 shadow?: ShadowOptions | ShadowStyle; 323 324 /** 325 * Define whether to respond to the hover mode. 326 * 327 * @type { ?boolean } 328 * @default false 329 * @syscap SystemCapability.ArkUI.ArkUI.Full 330 * @crossplatform 331 * @atomicservice 332 * @since 14 333 */ 334 enableHoverMode?: boolean; 335 336 /** 337 * Defines the toast's display area in hover mode. 338 * 339 * @type { ?HoverModeAreaType } 340 * @default HoverModeAreaType.BOTTOM_SCREEN 341 * @syscap SystemCapability.ArkUI.ArkUI.Full 342 * @crossplatform 343 * @atomicservice 344 * @since 14 345 */ 346 hoverModeArea?: HoverModeAreaType; 347 } 348 349 /** 350 * Enum for the toast showMode. 351 * 352 * @enum { number } 353 * @syscap SystemCapability.ArkUI.ArkUI.Full 354 * @since 11 355 */ 356 /** 357 * Enum for the toast showMode. 358 * 359 * @enum { number } 360 * @syscap SystemCapability.ArkUI.ArkUI.Full 361 * @crossplatform 362 * @atomicservice 363 * @since 12 364 */ 365 export enum ToastShowMode { 366 /** 367 * Toast shows in app. 368 * 369 * @syscap SystemCapability.ArkUI.ArkUI.Full 370 * @since 11 371 */ 372 /** 373 * Toast shows in app. 374 * 375 * @syscap SystemCapability.ArkUI.ArkUI.Full 376 * @crossplatform 377 * @atomicservice 378 * @since 12 379 */ 380 DEFAULT = 0, 381 382 /** 383 * Toast shows at the top. 384 * 385 * @syscap SystemCapability.ArkUI.ArkUI.Full 386 * @since 11 387 */ 388 /** 389 * Toast shows at the top. 390 * 391 * @syscap SystemCapability.ArkUI.ArkUI.Full 392 * @crossplatform 393 * @atomicservice 394 * @since 12 395 */ 396 TOP_MOST = 1, 397 398 /** 399 * Toast shows in SYSTEM_TOAST window. 400 * 401 * @syscap SystemCapability.ArkUI.ArkUI.Full 402 * @systemapi 403 * @since 12 404 */ 405 SYSTEM_TOP_MOST = 2 406 } 407 408 /** 409 * @typedef Button 410 * @syscap SystemCapability.ArkUI.ArkUI.Full 411 * @since 9 412 */ 413 /** 414 * @typedef Button 415 * @syscap SystemCapability.ArkUI.ArkUI.Full 416 * @crossplatform 417 * @since 10 418 */ 419 /** 420 * @typedef Button 421 * @syscap SystemCapability.ArkUI.ArkUI.Full 422 * @crossplatform 423 * @atomicservice 424 * @since 11 425 */ 426 interface Button { 427 428 /** 429 * The text displayed in the button. 430 * 431 * @type { string | Resource } 432 * @syscap SystemCapability.ArkUI.ArkUI.Full 433 * @since 9 434 */ 435 /** 436 * The text displayed in the button. 437 * 438 * @type { string | Resource } 439 * @syscap SystemCapability.ArkUI.ArkUI.Full 440 * @crossplatform 441 * @since 10 442 */ 443 /** 444 * The text displayed in the button. 445 * 446 * @type { string | Resource } 447 * @syscap SystemCapability.ArkUI.ArkUI.Full 448 * @crossplatform 449 * @atomicservice 450 * @since 11 451 */ 452 text: string | Resource; 453 454 /** 455 * The foreground color of button. 456 * 457 * @type { string | Resource } 458 * @syscap SystemCapability.ArkUI.ArkUI.Full 459 * @since 9 460 */ 461 /** 462 * The foreground color of button. 463 * 464 * @type { string | Resource } 465 * @syscap SystemCapability.ArkUI.ArkUI.Full 466 * @crossplatform 467 * @since 10 468 */ 469 /** 470 * The foreground color of button. 471 * 472 * @type { string | Resource } 473 * @syscap SystemCapability.ArkUI.ArkUI.Full 474 * @crossplatform 475 * @atomicservice 476 * @since 11 477 */ 478 color: string | Resource; 479 /** 480 * Define whether the button responds to Enter/Space key by default. 481 * 482 * @type { ?boolean } 483 * @syscap SystemCapability.ArkUI.ArkUI.Full 484 * @crossplatform 485 * @atomicservice 486 * @since 12 487 */ 488 primary?: boolean; 489 } 490 491 /** 492 * @typedef ShowDialogSuccessResponse 493 * @syscap SystemCapability.ArkUI.ArkUI.Full 494 * @since 9 495 */ 496 /** 497 * @typedef ShowDialogSuccessResponse 498 * @syscap SystemCapability.ArkUI.ArkUI.Full 499 * @crossplatform 500 * @since 10 501 */ 502 /** 503 * @typedef ShowDialogSuccessResponse 504 * @syscap SystemCapability.ArkUI.ArkUI.Full 505 * @crossplatform 506 * @atomicservice 507 * @since 11 508 */ 509 interface ShowDialogSuccessResponse { 510 511 /** 512 * Index of the selected button, starting from 0. 513 * 514 * @type { number } 515 * @syscap SystemCapability.ArkUI.ArkUI.Full 516 * @since 9 517 */ 518 /** 519 * Index of the selected button, starting from 0. 520 * 521 * @type { number } 522 * @syscap SystemCapability.ArkUI.ArkUI.Full 523 * @crossplatform 524 * @since 10 525 */ 526 /** 527 * Index of the selected button, starting from 0. 528 * 529 * @type { number } 530 * @syscap SystemCapability.ArkUI.ArkUI.Full 531 * @crossplatform 532 * @atomicservice 533 * @since 11 534 */ 535 index: number; 536 } 537 538 /** 539 * @typedef ShowDialogOptions 540 * @syscap SystemCapability.ArkUI.ArkUI.Full 541 * @since 9 542 */ 543 /** 544 * @typedef ShowDialogOptions 545 * @syscap SystemCapability.ArkUI.ArkUI.Full 546 * @crossplatform 547 * @since 10 548 */ 549 /** 550 * @typedef ShowDialogOptions 551 * @syscap SystemCapability.ArkUI.ArkUI.Full 552 * @crossplatform 553 * @atomicservice 554 * @since 11 555 */ 556 interface ShowDialogOptions { 557 558 /** 559 * Title of the text to display. 560 * 561 * @type { ?(string | Resource) } 562 * @syscap SystemCapability.ArkUI.ArkUI.Full 563 * @since 9 564 */ 565 /** 566 * Title of the text to display. 567 * 568 * @type { ?(string | Resource) } 569 * @syscap SystemCapability.ArkUI.ArkUI.Full 570 * @crossplatform 571 * @since 10 572 */ 573 /** 574 * Title of the text to display. 575 * 576 * @type { ?(string | Resource) } 577 * @syscap SystemCapability.ArkUI.ArkUI.Full 578 * @crossplatform 579 * @atomicservice 580 * @since 11 581 */ 582 title?: string | Resource; 583 584 /** 585 * Text body. 586 * 587 * @type { ?(string | Resource) } 588 * @syscap SystemCapability.ArkUI.ArkUI.Full 589 * @since 9 590 */ 591 /** 592 * Text body. 593 * 594 * @type { ?(string | Resource) } 595 * @syscap SystemCapability.ArkUI.ArkUI.Full 596 * @crossplatform 597 * @since 10 598 */ 599 /** 600 * Text body. 601 * 602 * @type { ?(string | Resource) } 603 * @syscap SystemCapability.ArkUI.ArkUI.Full 604 * @crossplatform 605 * @atomicservice 606 * @since 11 607 */ 608 message?: string | Resource; 609 610 /** 611 * Array of buttons in the dialog box. 612 * The array structure is {text:'button', color: '#666666'}. 613 * One to three buttons are supported. 614 * The first button is of the positiveButton type, the second is of the negativeButton type, and the third is of the neutralButton type. 615 * 616 * @type { ?Array<Button> } 617 * @syscap SystemCapability.ArkUI.ArkUI.Full 618 * @since 9 619 */ 620 /** 621 * Array of buttons in the dialog box. 622 * The array structure is {text:'button', color: '#666666'}. 623 * More than one buttons are supported. 624 * 625 * @type { ?Array<Button> } 626 * @syscap SystemCapability.ArkUI.ArkUI.Full 627 * @crossplatform 628 * @since 10 629 */ 630 /** 631 * Array of buttons in the dialog box. 632 * The array structure is {text:'button', color: '#666666'}. 633 * More than one buttons are supported. 634 * 635 * @type { ?Array<Button> } 636 * @syscap SystemCapability.ArkUI.ArkUI.Full 637 * @crossplatform 638 * @atomicservice 639 * @since 11 640 */ 641 buttons?: Array<Button>; 642 643 /** 644 * Mask Region of dialog. The size can't exceed the main window. 645 * 646 * @type { ?Rectangle } 647 * @syscap SystemCapability.ArkUI.ArkUI.Full 648 * @crossplatform 649 * @since 10 650 */ 651 /** 652 * Mask Region of dialog. The size can't exceed the main window. 653 * 654 * @type { ?Rectangle } 655 * @syscap SystemCapability.ArkUI.ArkUI.Full 656 * @crossplatform 657 * @atomicservice 658 * @since 11 659 */ 660 maskRect?: Rectangle; 661 662 /** 663 * Defines the dialog alignment of the screen. 664 * 665 * @type { ?DialogAlignment } 666 * @syscap SystemCapability.ArkUI.ArkUI.Full 667 * @crossplatform 668 * @since 10 669 */ 670 /** 671 * Defines the dialog alignment of the screen. 672 * 673 * @type { ?DialogAlignment } 674 * @syscap SystemCapability.ArkUI.ArkUI.Full 675 * @crossplatform 676 * @atomicservice 677 * @since 11 678 */ 679 alignment?: DialogAlignment; 680 681 /** 682 * Defines the dialog offset. 683 * 684 * @type { ?Offset } 685 * @syscap SystemCapability.ArkUI.ArkUI.Full 686 * @crossplatform 687 * @since 10 688 */ 689 /** 690 * Defines the dialog offset. 691 * 692 * @type { ?Offset } 693 * @syscap SystemCapability.ArkUI.ArkUI.Full 694 * @crossplatform 695 * @atomicservice 696 * @since 11 697 */ 698 offset?: Offset; 699 700 /** 701 * Whether to display in the sub window. 702 * 703 * @type { ?boolean } 704 * @default false 705 * @syscap SystemCapability.ArkUI.ArkUI.Full 706 * @crossplatform 707 * @since 11 708 */ 709 /** 710 * Whether to display in the sub window. 711 * 712 * @type { ?boolean } 713 * @default false 714 * @syscap SystemCapability.ArkUI.ArkUI.Full 715 * @crossplatform 716 * @atomicservice 717 * @since 12 718 */ 719 showInSubWindow?: boolean; 720 721 /** 722 * Whether it is a modal dialog 723 * @type { ?boolean } 724 * @default true 725 * @syscap SystemCapability.ArkUI.ArkUI.Full 726 * @crossplatform 727 * @since 11 728 */ 729 /** 730 * Whether it is a modal dialog 731 * @type { ?boolean } 732 * @default true 733 * @syscap SystemCapability.ArkUI.ArkUI.Full 734 * @crossplatform 735 * @atomicservice 736 * @since 12 737 */ 738 isModal?: boolean; 739 740 /** 741 * Defines the dialog's background color. 742 * 743 * @type { ?ResourceColor } 744 * @default Color.Transparent 745 * @syscap SystemCapability.ArkUI.ArkUI.Full 746 * @crossplatform 747 * @atomicservice 748 * @since 12 749 */ 750 backgroundColor?: ResourceColor; 751 752 /** 753 * Defines the dialog's background blur Style 754 * 755 * @type { ?BlurStyle } 756 * @default BlurStyle.COMPONENT_ULTRA_THICK 757 * @syscap SystemCapability.ArkUI.ArkUI.Full 758 * @crossplatform 759 * @atomicservice 760 * @since 12 761 */ 762 backgroundBlurStyle?: BlurStyle; 763 764 /** 765 * Defines the dialog's shadow. 766 * 767 * @type { ?(ShadowOptions | ShadowStyle) } 768 * @syscap SystemCapability.ArkUI.ArkUI.Full 769 * @crossplatform 770 * @atomicservice 771 * @since 12 772 */ 773 shadow?: ShadowOptions | ShadowStyle; 774 775 /** 776 * Defines whether to respond to the hover mode. 777 * 778 * @type { ?boolean } 779 * @default false 780 * @syscap SystemCapability.ArkUI.ArkUI.Full 781 * @crossplatform 782 * @atomicservice 783 * @since 14 784 */ 785 enableHoverMode?: boolean; 786 787 /** 788 * Defines the dialog's display area in hover mode. 789 * 790 * @type { ?HoverModeAreaType } 791 * @default HoverModeAreaType.BOTTOM_SCREEN 792 * @syscap SystemCapability.ArkUI.ArkUI.Full 793 * @crossplatform 794 * @atomicservice 795 * @since 14 796 */ 797 hoverModeArea?: HoverModeAreaType; 798 799 /** 800 * Determine the display level of the dialog. 801 * 802 * @type { ?LevelMode } 803 * @default LevelMode.OVERLAY 804 * @syscap SystemCapability.ArkUI.ArkUI.Full 805 * @crossplatform 806 * @atomicservice 807 * @since 15 808 */ 809 levelMode?: LevelMode; 810 811 /** 812 * The uniqueId of any node in the router or navigation page. 813 * 814 * @type { ?number } 815 * @syscap SystemCapability.ArkUI.ArkUI.Full 816 * @crossplatform 817 * @atomicservice 818 * @since 15 819 */ 820 levelUniqueId?: number; 821 822 /** 823 * Determine the immersive mode of the dialog. 824 * 825 * @type { ?ImmersiveMode } 826 * @default ImmersiveMode.DEFAULT 827 * @syscap SystemCapability.ArkUI.ArkUI.Full 828 * @crossplatform 829 * @atomicservice 830 * @since 15 831 */ 832 immersiveMode?: ImmersiveMode; 833 834 /** 835 * Determine the display order of the dialog. 836 * 837 * @type { ?LevelOrder } 838 * @default The value returns by LevelOrder.clamp(0) 839 * @syscap SystemCapability.ArkUI.ArkUI.Full 840 * @crossplatform 841 * @atomicservice 842 * @since 18 843 */ 844 levelOrder?: LevelOrder; 845 } 846 847 /** 848 * The class used to control common dialog. 849 * 850 * @syscap SystemCapability.ArkUI.ArkUI.Full 851 * @crossplatform 852 * @atomicservice 853 * @since 18 854 */ 855 class CommonController { 856 /** 857 * The constructor. 858 * 859 * @syscap SystemCapability.ArkUI.ArkUI.Full 860 * @crossplatform 861 * @atomicservice 862 * @since 18 863 */ 864 constructor(); 865 866 /** 867 * Close the corresponding common dialog. 868 * 869 * @syscap SystemCapability.ArkUI.ArkUI.Full 870 * @crossplatform 871 * @atomicservice 872 * @since 18 873 */ 874 close(): void; 875 } 876 877 /** 878 * The class used to control dialog. 879 * 880 * @extends CommonController 881 * @syscap SystemCapability.ArkUI.ArkUI.Full 882 * @crossplatform 883 * @atomicservice 884 * @since 18 885 */ 886 class DialogController extends CommonController {} 887 888 /** 889 * Dialog base options 890 * 891 * @typedef BaseDialogOptions 892 * @syscap SystemCapability.ArkUI.ArkUI.Full 893 * @crossplatform 894 * @since 11 895 */ 896 /** 897 * Dialog base options 898 * 899 * @typedef BaseDialogOptions 900 * @syscap SystemCapability.ArkUI.ArkUI.Full 901 * @crossplatform 902 * @atomicservice 903 * @since 12 904 */ 905 interface BaseDialogOptions { 906 /** 907 * Mask Region of dialog. The size can't exceed the main window. 908 * 909 * @type { ?Rectangle } 910 * @syscap SystemCapability.ArkUI.ArkUI.Full 911 * @crossplatform 912 * @since 11 913 */ 914 /** 915 * Mask Region of dialog. The size can't exceed the main window. 916 * 917 * @type { ?Rectangle } 918 * @syscap SystemCapability.ArkUI.ArkUI.Full 919 * @crossplatform 920 * @atomicservice 921 * @since 12 922 */ 923 maskRect?: Rectangle; 924 925 /** 926 * Defines the dialog alignment of the screen. 927 * 928 * @type { ?DialogAlignment } 929 * @syscap SystemCapability.ArkUI.ArkUI.Full 930 * @crossplatform 931 * @since 11 932 */ 933 /** 934 * Defines the dialog alignment of the screen. 935 * 936 * @type { ?DialogAlignment } 937 * @syscap SystemCapability.ArkUI.ArkUI.Full 938 * @crossplatform 939 * @atomicservice 940 * @since 12 941 */ 942 alignment?: DialogAlignment; 943 944 /** 945 * Defines the dialog offset. 946 * 947 * @type { ?Offset } 948 * @syscap SystemCapability.ArkUI.ArkUI.Full 949 * @crossplatform 950 * @since 11 951 */ 952 /** 953 * Defines the dialog offset. 954 * 955 * @type { ?Offset } 956 * @syscap SystemCapability.ArkUI.ArkUI.Full 957 * @crossplatform 958 * @atomicservice 959 * @since 12 960 */ 961 offset?: Offset; 962 963 /** 964 * Whether to display in the sub window. 965 * 966 * @type { ?boolean } 967 * @default false 968 * @syscap SystemCapability.ArkUI.ArkUI.Full 969 * @crossplatform 970 * @since 11 971 */ 972 /** 973 * Whether to display in the sub window. 974 * 975 * @type { ?boolean } 976 * @default false 977 * @syscap SystemCapability.ArkUI.ArkUI.Full 978 * @crossplatform 979 * @atomicservice 980 * @since 12 981 */ 982 showInSubWindow?: boolean; 983 984 /** 985 * Whether it is a modal dialog 986 * @type { ?boolean } 987 * @default true 988 * @syscap SystemCapability.ArkUI.ArkUI.Full 989 * @crossplatform 990 * @since 11 991 */ 992 /** 993 * Whether it is a modal dialog 994 * @type { ?boolean } 995 * @default true 996 * @syscap SystemCapability.ArkUI.ArkUI.Full 997 * @crossplatform 998 * @atomicservice 999 * @since 12 1000 */ 1001 isModal?: boolean; 1002 1003 /** 1004 * Allows users to click the mask layer to exit. 1005 * 1006 * @type { ?boolean } 1007 * @default true 1008 * @syscap SystemCapability.ArkUI.ArkUI.Full 1009 * @crossplatform 1010 * @atomicservice 1011 * @since 12 1012 */ 1013 autoCancel?: boolean; 1014 1015 /** 1016 * Transition parameters of opening/closing custom dialog. 1017 * 1018 * @type { ?TransitionEffect } 1019 * @syscap SystemCapability.ArkUI.ArkUI.Full 1020 * @crossplatform 1021 * @atomicservice 1022 * @since 12 1023 */ 1024 transition?: TransitionEffect; 1025 1026 /** 1027 * Defines custom dialog maskColor 1028 * 1029 * @type { ?ResourceColor } 1030 * @syscap SystemCapability.ArkUI.ArkUI.Full 1031 * @crossplatform 1032 * @atomicservice 1033 * @since 12 1034 */ 1035 maskColor?: ResourceColor; 1036 1037 /** 1038 * Callback function when the CustomDialog interactive dismiss. 1039 * 1040 * @type { ?Callback<DismissDialogAction> } 1041 * @syscap SystemCapability.ArkUI.ArkUI.Full 1042 * @crossplatform 1043 * @atomicservice 1044 * @since 12 1045 */ 1046 onWillDismiss?: Callback<DismissDialogAction>; 1047 1048 /** 1049 * Callback function when the dialog appears. 1050 * 1051 * @type { ?function } 1052 * @syscap SystemCapability.ArkUI.ArkUI.Full 1053 * @crossplatform 1054 * @atomicservice 1055 * @since 12 1056 */ 1057 onDidAppear?: () => void; 1058 1059 /** 1060 * Callback function when the dialog disappears. 1061 * 1062 * @type { ?function } 1063 * @syscap SystemCapability.ArkUI.ArkUI.Full 1064 * @crossplatform 1065 * @atomicservice 1066 * @since 12 1067 */ 1068 onDidDisappear?: () => void; 1069 1070 /** 1071 * Callback function before the dialog openAnimation starts. 1072 * 1073 * @type { ?function } 1074 * @syscap SystemCapability.ArkUI.ArkUI.Full 1075 * @crossplatform 1076 * @atomicservice 1077 * @since 12 1078 */ 1079 onWillAppear?: () => void; 1080 1081 /** 1082 * Callback function before the dialog closeAnimation starts. 1083 * 1084 * @type { ?function } 1085 * @syscap SystemCapability.ArkUI.ArkUI.Full 1086 * @crossplatform 1087 * @atomicservice 1088 * @since 12 1089 */ 1090 onWillDisappear?: () => void; 1091 1092 /** 1093 * Defines the customDialog's keyboard avoid mode 1094 * 1095 * @type { ?KeyboardAvoidMode } 1096 * @default KeyboardAvoidMode.DEFAULT 1097 * @syscap SystemCapability.ArkUI.ArkUI.Full 1098 * @crossplatform 1099 * @atomicservice 1100 * @since 12 1101 */ 1102 keyboardAvoidMode?: KeyboardAvoidMode; 1103 1104 /** 1105 * Defines whether to respond to the hover mode. 1106 * 1107 * @type { ?boolean } 1108 * @default false 1109 * @syscap SystemCapability.ArkUI.ArkUI.Full 1110 * @crossplatform 1111 * @atomicservice 1112 * @since 14 1113 */ 1114 enableHoverMode?: boolean; 1115 1116 /** 1117 * Defines the dialog's display area in hover mode. 1118 * 1119 * @type { ?HoverModeAreaType } 1120 * @default HoverModeAreaType.BOTTOM_SCREEN 1121 * @syscap SystemCapability.ArkUI.ArkUI.Full 1122 * @crossplatform 1123 * @atomicservice 1124 * @since 14 1125 */ 1126 hoverModeArea?: HoverModeAreaType; 1127 1128 /** 1129 * Defines the distance between the customDialog and system keyboard. 1130 * 1131 * @type { ?LengthMetrics } 1132 * @syscap SystemCapability.ArkUI.ArkUI.Full 1133 * @crossplatform 1134 * @atomicservice 1135 * @since 15 1136 */ 1137 keyboardAvoidDistance?: LengthMetrics; 1138 1139 /** 1140 * Determine the display level of the dialog. 1141 * 1142 * @type { ?LevelMode } 1143 * @default LevelMode.OVERLAY 1144 * @syscap SystemCapability.ArkUI.ArkUI.Full 1145 * @crossplatform 1146 * @atomicservice 1147 * @since 15 1148 */ 1149 levelMode?: LevelMode; 1150 1151 /** 1152 * The uniqueId of any node in the router or navigation page. 1153 * 1154 * @type { ?number } 1155 * @syscap SystemCapability.ArkUI.ArkUI.Full 1156 * @crossplatform 1157 * @atomicservice 1158 * @since 15 1159 */ 1160 levelUniqueId?: number; 1161 1162 /** 1163 * Determine the immersive mode of the dialog. 1164 * 1165 * @type { ?ImmersiveMode } 1166 * @default ImmersiveMode.DEFAULT 1167 * @syscap SystemCapability.ArkUI.ArkUI.Full 1168 * @crossplatform 1169 * @atomicservice 1170 * @since 15 1171 */ 1172 immersiveMode?: ImmersiveMode; 1173 1174 /** 1175 * Determine the display order of the dialog. 1176 * 1177 * @type { ?LevelOrder } 1178 * @default The value returns by LevelOrder.clamp(0) 1179 * @syscap SystemCapability.ArkUI.ArkUI.Full 1180 * @crossplatform 1181 * @atomicservice 1182 * @since 18 1183 */ 1184 levelOrder?: LevelOrder; 1185 } 1186 1187 /** 1188 * Dialog's custom content options 1189 * 1190 * @extends BaseDialogOptions 1191 * @interface CustomDialogOptions 1192 * @syscap SystemCapability.ArkUI.ArkUI.Full 1193 * @crossplatform 1194 * @since 11 1195 */ 1196 /** 1197 * Dialog's custom content options 1198 * 1199 * @extends BaseDialogOptions 1200 * @interface CustomDialogOptions 1201 * @syscap SystemCapability.ArkUI.ArkUI.Full 1202 * @crossplatform 1203 * @atomicservice 1204 * @since 12 1205 */ 1206 interface CustomDialogOptions extends BaseDialogOptions { 1207 /** 1208 * Allow developer custom dialog's content. 1209 * 1210 * @type { CustomBuilder } 1211 * @syscap SystemCapability.ArkUI.ArkUI.Full 1212 * @crossplatform 1213 * @since 11 1214 */ 1215 /** 1216 * Allow developer custom dialog's content. 1217 * 1218 * @type { CustomBuilder } 1219 * @syscap SystemCapability.ArkUI.ArkUI.Full 1220 * @crossplatform 1221 * @atomicservice 1222 * @since 12 1223 */ 1224 builder: CustomBuilder; 1225 1226 /** 1227 * Defines the custom dialog's background color. 1228 * 1229 * @type { ?ResourceColor } 1230 * @syscap SystemCapability.ArkUI.ArkUI.Full 1231 * @crossplatform 1232 * @atomicservice 1233 * @since 12 1234 */ 1235 backgroundColor?: ResourceColor; 1236 1237 /** 1238 * Defines the custom dialog's corner radius. 1239 * 1240 * @type { ?(Dimension | BorderRadiuses) } 1241 * @syscap SystemCapability.ArkUI.ArkUI.Full 1242 * @crossplatform 1243 * @atomicservice 1244 * @since 12 1245 */ 1246 cornerRadius?: Dimension | BorderRadiuses; 1247 1248 /** 1249 * Defines the custom dialog's width. 1250 * 1251 * @type { ?Dimension } 1252 * @syscap SystemCapability.ArkUI.ArkUI.Full 1253 * @crossplatform 1254 * @atomicservice 1255 * @since 12 1256 */ 1257 width?: Dimension; 1258 1259 /** 1260 * Defines the custom dialog's height. 1261 * 1262 * @type { ?Dimension } 1263 * @syscap SystemCapability.ArkUI.ArkUI.Full 1264 * @crossplatform 1265 * @atomicservice 1266 * @since 12 1267 */ 1268 height?: Dimension; 1269 1270 /** 1271 * Defines the custom dialog's border width. 1272 * 1273 * @type { ?(Dimension | EdgeWidths) } 1274 * @syscap SystemCapability.ArkUI.ArkUI.Full 1275 * @crossplatform 1276 * @atomicservice 1277 * @since 12 1278 */ 1279 borderWidth?: Dimension | EdgeWidths; 1280 1281 /** 1282 * Defines the custom dialog's border color. 1283 * 1284 * @type { ?(ResourceColor | EdgeColors) } 1285 * @syscap SystemCapability.ArkUI.ArkUI.Full 1286 * @crossplatform 1287 * @atomicservice 1288 * @since 12 1289 */ 1290 borderColor?: ResourceColor | EdgeColors; 1291 1292 /** 1293 * Defines the custom dialog's border style. 1294 * 1295 * @type { ?(BorderStyle | EdgeStyles) } 1296 * @syscap SystemCapability.ArkUI.ArkUI.Full 1297 * @crossplatform 1298 * @atomicservice 1299 * @since 12 1300 */ 1301 borderStyle?: BorderStyle | EdgeStyles; 1302 1303 /** 1304 * Defines the custom dialog's shadow. 1305 * 1306 * @type { ?(ShadowOptions | ShadowStyle) } 1307 * @syscap SystemCapability.ArkUI.ArkUI.Full 1308 * @crossplatform 1309 * @atomicservice 1310 * @since 12 1311 */ 1312 shadow?: ShadowOptions | ShadowStyle; 1313 1314 /** 1315 * Defines the customDialog's background blur Style 1316 * 1317 * @type { ?BlurStyle } 1318 * @default BlurStyle.COMPONENT_ULTRA_THICK 1319 * @syscap SystemCapability.ArkUI.ArkUI.Full 1320 * @crossplatform 1321 * @atomicservice 1322 * @since 12 1323 */ 1324 backgroundBlurStyle?: BlurStyle; 1325 } 1326 1327 /** 1328 * Corner radius type of DialogOptions. 1329 * 1330 * @typedef { Dimension | BorderRadiuses } DialogOptionsCornerRadius 1331 * @syscap SystemCapability.ArkUI.ArkUI.Full 1332 * @crossplatform 1333 * @atomicservice 1334 * @since 18 1335 */ 1336 declare type DialogOptionsCornerRadius = Dimension | BorderRadiuses; 1337 1338 /** 1339 * Border width type of DialogOptions. 1340 * 1341 * @typedef { Dimension | EdgeWidths } DialogOptionsBorderWidth 1342 * @syscap SystemCapability.ArkUI.ArkUI.Full 1343 * @crossplatform 1344 * @atomicservice 1345 * @since 18 1346 */ 1347 declare type DialogOptionsBorderWidth = Dimension | EdgeWidths; 1348 1349 /** 1350 * Border color type of DialogOptions. 1351 * 1352 * @typedef { ResourceColor | EdgeColors } DialogOptionsBorderColor 1353 * @syscap SystemCapability.ArkUI.ArkUI.Full 1354 * @crossplatform 1355 * @atomicservice 1356 * @since 18 1357 */ 1358 declare type DialogOptionsBorderColor = ResourceColor | EdgeColors; 1359 1360 /** 1361 * Border style type of DialogOptions. 1362 * 1363 * @typedef { BorderStyle | EdgeStyles } DialogOptionsBorderStyle 1364 * @syscap SystemCapability.ArkUI.ArkUI.Full 1365 * @crossplatform 1366 * @atomicservice 1367 * @since 18 1368 */ 1369 declare type DialogOptionsBorderStyle = BorderStyle | EdgeStyles; 1370 1371 /** 1372 * Shadow type of DialogOptions. 1373 * 1374 * @typedef { ShadowOptions | ShadowStyle } DialogOptionsShadow 1375 * @syscap SystemCapability.ArkUI.ArkUI.Full 1376 * @crossplatform 1377 * @atomicservice 1378 * @since 18 1379 */ 1380 declare type DialogOptionsShadow = ShadowOptions | ShadowStyle; 1381 1382 /** 1383 * Dialog options 1384 * 1385 * @extends BaseDialogOptions 1386 * @typedef DialogOptions 1387 * @syscap SystemCapability.ArkUI.ArkUI.Full 1388 * @crossplatform 1389 * @atomicservice 1390 * @since 18 1391 */ 1392 interface DialogOptions extends BaseDialogOptions { 1393 /** 1394 * Defines the dialog's background color. 1395 * 1396 * @type { ?ResourceColor } 1397 * @syscap SystemCapability.ArkUI.ArkUI.Full 1398 * @crossplatform 1399 * @atomicservice 1400 * @since 18 1401 */ 1402 backgroundColor?: ResourceColor; 1403 1404 /** 1405 * Defines the dialog's corner radius. 1406 * 1407 * @type { ?DialogOptionsCornerRadius } 1408 * @syscap SystemCapability.ArkUI.ArkUI.Full 1409 * @crossplatform 1410 * @atomicservice 1411 * @since 18 1412 */ 1413 cornerRadius?: DialogOptionsCornerRadius; 1414 1415 /** 1416 * Defines the dialog's width. 1417 * 1418 * @type { ?Dimension } 1419 * @syscap SystemCapability.ArkUI.ArkUI.Full 1420 * @crossplatform 1421 * @atomicservice 1422 * @since 18 1423 */ 1424 width?: Dimension; 1425 1426 /** 1427 * Defines the dialog's height. 1428 * 1429 * @type { ?Dimension } 1430 * @syscap SystemCapability.ArkUI.ArkUI.Full 1431 * @crossplatform 1432 * @atomicservice 1433 * @since 18 1434 */ 1435 height?: Dimension; 1436 1437 /** 1438 * Defines the dialog's border width. 1439 * 1440 * @type { ?DialogOptionsBorderWidth } 1441 * @syscap SystemCapability.ArkUI.ArkUI.Full 1442 * @crossplatform 1443 * @atomicservice 1444 * @since 18 1445 */ 1446 borderWidth?: DialogOptionsBorderWidth; 1447 1448 /** 1449 * Defines the dialog's border color. 1450 * 1451 * @type { ?DialogOptionsBorderColor } 1452 * @syscap SystemCapability.ArkUI.ArkUI.Full 1453 * @crossplatform 1454 * @atomicservice 1455 * @since 18 1456 */ 1457 borderColor?: DialogOptionsBorderColor; 1458 1459 /** 1460 * Defines the dialog's border style. 1461 * 1462 * @type { ?DialogOptionsBorderStyle } 1463 * @syscap SystemCapability.ArkUI.ArkUI.Full 1464 * @crossplatform 1465 * @atomicservice 1466 * @since 18 1467 */ 1468 borderStyle?: DialogOptionsBorderStyle; 1469 1470 /** 1471 * Defines the dialog's shadow. 1472 * 1473 * @type { ?DialogOptionsShadow } 1474 * @syscap SystemCapability.ArkUI.ArkUI.Full 1475 * @crossplatform 1476 * @atomicservice 1477 * @since 18 1478 */ 1479 shadow?: DialogOptionsShadow; 1480 1481 /** 1482 * Defines the dialog's background blur Style 1483 * 1484 * @type { ?BlurStyle } 1485 * @default BlurStyle.COMPONENT_ULTRA_THICK 1486 * @syscap SystemCapability.ArkUI.ArkUI.Full 1487 * @crossplatform 1488 * @atomicservice 1489 * @since 18 1490 */ 1491 backgroundBlurStyle?: BlurStyle; 1492 } 1493 1494 /** 1495 * @typedef ActionMenuSuccessResponse 1496 * @syscap SystemCapability.ArkUI.ArkUI.Full 1497 * @since 9 1498 */ 1499 /** 1500 * @typedef ActionMenuSuccessResponse 1501 * @syscap SystemCapability.ArkUI.ArkUI.Full 1502 * @crossplatform 1503 * @since 10 1504 */ 1505 /** 1506 * @typedef ActionMenuSuccessResponse 1507 * @syscap SystemCapability.ArkUI.ArkUI.Full 1508 * @crossplatform 1509 * @atomicservice 1510 * @since 11 1511 */ 1512 interface ActionMenuSuccessResponse { 1513 /** 1514 * Index of the selected button, starting from 0. 1515 * 1516 * @type { number } 1517 * @syscap SystemCapability.ArkUI.ArkUI.Full 1518 * @since 9 1519 */ 1520 /** 1521 * Index of the selected button, starting from 0. 1522 * 1523 * @type { number } 1524 * @syscap SystemCapability.ArkUI.ArkUI.Full 1525 * @crossplatform 1526 * @since 10 1527 */ 1528 /** 1529 * Index of the selected button, starting from 0. 1530 * 1531 * @type { number } 1532 * @syscap SystemCapability.ArkUI.ArkUI.Full 1533 * @crossplatform 1534 * @atomicservice 1535 * @since 11 1536 */ 1537 index: number; 1538 } 1539 1540 /** 1541 * @typedef ActionMenuOptions 1542 * @syscap SystemCapability.ArkUI.ArkUI.Full 1543 * @since 9 1544 */ 1545 /** 1546 * @typedef ActionMenuOptions 1547 * @syscap SystemCapability.ArkUI.ArkUI.Full 1548 * @crossplatform 1549 * @since 10 1550 */ 1551 /** 1552 * @typedef ActionMenuOptions 1553 * @syscap SystemCapability.ArkUI.ArkUI.Full 1554 * @crossplatform 1555 * @atomicservice 1556 * @since 11 1557 */ 1558 interface ActionMenuOptions { 1559 /** 1560 * Title of the text to display. 1561 * 1562 * @type { ?(string | Resource) } 1563 * @syscap SystemCapability.ArkUI.ArkUI.Full 1564 * @since 9 1565 */ 1566 /** 1567 * Title of the text to display. 1568 * 1569 * @type { ?(string | Resource) } 1570 * @syscap SystemCapability.ArkUI.ArkUI.Full 1571 * @crossplatform 1572 * @since 10 1573 */ 1574 /** 1575 * Title of the text to display. 1576 * 1577 * @type { ?(string | Resource) } 1578 * @syscap SystemCapability.ArkUI.ArkUI.Full 1579 * @crossplatform 1580 * @atomicservice 1581 * @since 11 1582 */ 1583 title?: string | Resource; 1584 1585 /** 1586 * Array of buttons in the dialog box. 1587 * The array structure is {text:'button', color: '#666666'}. 1588 * One to six buttons are supported. 1589 * 1590 * @type { [Button, Button?, Button?, Button?, Button?, Button?] } 1591 * @syscap SystemCapability.ArkUI.ArkUI.Full 1592 * @since 9 1593 */ 1594 /** 1595 * Array of buttons in the dialog box. 1596 * The array structure is {text:'button', color: '#666666'}. 1597 * One to six buttons are supported. 1598 * 1599 * @type { [Button, Button?, Button?, Button?, Button?, Button?] } 1600 * @syscap SystemCapability.ArkUI.ArkUI.Full 1601 * @crossplatform 1602 * @since 10 1603 */ 1604 /** 1605 * Array of buttons in the dialog box. 1606 * The array structure is {text:'button', color: '#666666'}. 1607 * One to six buttons are supported. 1608 * 1609 * @type { [Button, Button?, Button?, Button?, Button?, Button?] } 1610 * @syscap SystemCapability.ArkUI.ArkUI.Full 1611 * @crossplatform 1612 * @atomicservice 1613 * @since 11 1614 */ 1615 buttons: [Button, Button?, Button?, Button?, Button?, Button?]; 1616 1617 /** 1618 * Whether to display in the sub window. 1619 * 1620 * @type { ?boolean } 1621 * @default false 1622 * @syscap SystemCapability.ArkUI.ArkUI.Full 1623 * @crossplatform 1624 * @since 11 1625 */ 1626 /** 1627 * Whether to display in the sub window. 1628 * 1629 * @type { ?boolean } 1630 * @default false 1631 * @syscap SystemCapability.ArkUI.ArkUI.Full 1632 * @crossplatform 1633 * @atomicservice 1634 * @since 12 1635 */ 1636 showInSubWindow?: boolean; 1637 1638 /** 1639 * Whether it is a modal dialog 1640 * @type { ?boolean } 1641 * @default true 1642 * @syscap SystemCapability.ArkUI.ArkUI.Full 1643 * @crossplatform 1644 * @since 11 1645 */ 1646 /** 1647 * Whether it is a modal dialog 1648 * @type { ?boolean } 1649 * @default true 1650 * @syscap SystemCapability.ArkUI.ArkUI.Full 1651 * @crossplatform 1652 * @atomicservice 1653 * @since 12 1654 */ 1655 isModal?: boolean; 1656 1657 /** 1658 * Determine the display level of the dialog. 1659 * 1660 * @type { ?LevelMode } 1661 * @default LevelMode.OVERLAY 1662 * @syscap SystemCapability.ArkUI.ArkUI.Full 1663 * @crossplatform 1664 * @atomicservice 1665 * @since 15 1666 */ 1667 levelMode?: LevelMode; 1668 1669 /** 1670 * The uniqueId of any node in the router or navigation page. 1671 * 1672 * @type { ?number } 1673 * @syscap SystemCapability.ArkUI.ArkUI.Full 1674 * @crossplatform 1675 * @atomicservice 1676 * @since 15 1677 */ 1678 levelUniqueId?: number; 1679 1680 /** 1681 * Determine the immersive mode of the dialog. 1682 * 1683 * @type { ?ImmersiveMode } 1684 * @default ImmersiveMode.DEFAULT 1685 * @syscap SystemCapability.ArkUI.ArkUI.Full 1686 * @crossplatform 1687 * @atomicservice 1688 * @since 15 1689 */ 1690 immersiveMode?: ImmersiveMode; 1691 } 1692 1693 /** 1694 * Displays the notification text. 1695 * 1696 * @param { ShowToastOptions } options - Options. 1697 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1698 * <br> 1. Mandatory parameters are left unspecified. 1699 * <br> 2. Incorrect parameters types. 1700 * <br> 3. Parameter verification failed. 1701 * @throws { BusinessError } 100001 - Internal error. 1702 * @syscap SystemCapability.ArkUI.ArkUI.Full 1703 * @since 9 1704 */ 1705 /** 1706 * Displays the notification text. 1707 * 1708 * @param { ShowToastOptions } options - Options. 1709 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1710 * <br> 1. Mandatory parameters are left unspecified. 1711 * <br> 2. Incorrect parameters types. 1712 * <br> 3. Parameter verification failed. 1713 * @throws { BusinessError } 100001 - Internal error. 1714 * @syscap SystemCapability.ArkUI.ArkUI.Full 1715 * @crossplatform 1716 * @since 10 1717 */ 1718 /** 1719 * Displays the notification text. 1720 * 1721 * @param { ShowToastOptions } options - Options. 1722 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1723 * <br> 1. Mandatory parameters are left unspecified. 1724 * <br> 2. Incorrect parameters types. 1725 * <br> 3. Parameter verification failed. 1726 * @throws { BusinessError } 100001 - Internal error. 1727 * @syscap SystemCapability.ArkUI.ArkUI.Full 1728 * @crossplatform 1729 * @atomicservice 1730 * @since 11 1731 * @deprecated since 18 1732 * @useinstead ohos.arkui.UIContext.PromptAction#showToast 1733 */ 1734 function showToast(options: ShowToastOptions): void; 1735 1736 /** 1737 * Displays the notification text. 1738 * 1739 * @param { ShowToastOptions } options - Options. 1740 * @returns { Promise<number> } return the toast id that will be used by closeToast. 1741 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1742 * <br> 1. Mandatory parameters are left unspecified. 1743 * <br> 2. Incorrect parameters types. 1744 * <br> 3. Parameter verification failed. 1745 * @throws { BusinessError } 100001 - Internal error. 1746 * @syscap SystemCapability.ArkUI.ArkUI.Full 1747 * @crossplatform 1748 * @atomicservice 1749 * @since 18 1750 */ 1751 function openToast(options: ShowToastOptions): Promise<number>; 1752 1753 /** 1754 * Close the notification text. 1755 * 1756 * @param { number } toastId - the toast id that returned by openToast. 1757 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1758 * <br> 1. Mandatory parameters are left unspecified. 1759 * <br> 2. Incorrect parameters types. 1760 * <br> 3. Parameter verification failed. 1761 * @throws { BusinessError } 100001 - Internal error. 1762 * @syscap SystemCapability.ArkUI.ArkUI.Full 1763 * @crossplatform 1764 * @atomicservice 1765 * @since 18 1766 */ 1767 function closeToast(toastId: number): void; 1768 1769 /** 1770 * Displays the dialog box. 1771 * 1772 * @param { ShowDialogOptions } options - Options. 1773 * @param { AsyncCallback<ShowDialogSuccessResponse> } callback - the callback of showDialog. 1774 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1775 * <br> 1. Mandatory parameters are left unspecified. 1776 * <br> 2. Incorrect parameters types. 1777 * <br> 3. Parameter verification failed. 1778 * @throws { BusinessError } 100001 - Internal error. 1779 * @syscap SystemCapability.ArkUI.ArkUI.Full 1780 * @since 9 1781 */ 1782 /** 1783 * Displays the dialog box. 1784 * 1785 * @param { ShowDialogOptions } options - Options. 1786 * @param { AsyncCallback<ShowDialogSuccessResponse> } callback - the callback of showDialog. 1787 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1788 * <br> 1. Mandatory parameters are left unspecified. 1789 * <br> 2. Incorrect parameters types. 1790 * <br> 3. Parameter verification failed. 1791 * @throws { BusinessError } 100001 - Internal error. 1792 * @syscap SystemCapability.ArkUI.ArkUI.Full 1793 * @crossplatform 1794 * @since 10 1795 */ 1796 /** 1797 * Displays the dialog box. 1798 * 1799 * @param { ShowDialogOptions } options - Options. 1800 * @param { AsyncCallback<ShowDialogSuccessResponse> } callback - the callback of showDialog. 1801 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1802 * <br> 1. Mandatory parameters are left unspecified. 1803 * <br> 2. Incorrect parameters types. 1804 * <br> 3. Parameter verification failed. 1805 * @throws { BusinessError } 100001 - Internal error. 1806 * @syscap SystemCapability.ArkUI.ArkUI.Full 1807 * @crossplatform 1808 * @atomicservice 1809 * @since 11 1810 * @deprecated since 18 1811 * @useinstead ohos.arkui.UIContext.PromptAction#showDialog 1812 */ 1813 function showDialog(options: ShowDialogOptions, callback: AsyncCallback<ShowDialogSuccessResponse>): void; 1814 1815 /** 1816 * Displays the dialog box. 1817 * 1818 * @param { ShowDialogOptions } options - Options. 1819 * @returns { Promise<ShowDialogSuccessResponse> } the promise returned by the function. 1820 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1821 * <br> 1. Mandatory parameters are left unspecified. 1822 * <br> 2. Incorrect parameters types. 1823 * <br> 3. Parameter verification failed. 1824 * @throws { BusinessError } 100001 - Internal error. 1825 * @syscap SystemCapability.ArkUI.ArkUI.Full 1826 * @since 9 1827 */ 1828 /** 1829 * Displays the dialog box. 1830 * 1831 * @param { ShowDialogOptions } options - Options. 1832 * @returns { Promise<ShowDialogSuccessResponse> } the promise returned by the function. 1833 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1834 * <br> 1. Mandatory parameters are left unspecified. 1835 * <br> 2. Incorrect parameters types. 1836 * <br> 3. Parameter verification failed. 1837 * @throws { BusinessError } 100001 - Internal error. 1838 * @syscap SystemCapability.ArkUI.ArkUI.Full 1839 * @crossplatform 1840 * @since 10 1841 */ 1842 /** 1843 * Displays the dialog box. 1844 * 1845 * @param { ShowDialogOptions } options - Options. 1846 * @returns { Promise<ShowDialogSuccessResponse> } the promise returned by the function. 1847 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1848 * <br> 1. Mandatory parameters are left unspecified. 1849 * <br> 2. Incorrect parameters types. 1850 * <br> 3. Parameter verification failed. 1851 * @throws { BusinessError } 100001 - Internal error. 1852 * @syscap SystemCapability.ArkUI.ArkUI.Full 1853 * @crossplatform 1854 * @atomicservice 1855 * @since 11 1856 * @deprecated since 18 1857 * @useinstead ohos.arkui.UIContext.PromptAction#showDialog 1858 */ 1859 function showDialog(options: ShowDialogOptions): Promise<ShowDialogSuccessResponse>; 1860 1861 /** 1862 * Open the custom dialog. 1863 * 1864 * @param { CustomDialogOptions } options - Options. 1865 * @returns { Promise<number> } return the dialog id that will be used by closeCustomDialog. 1866 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1867 * <br> 1. Mandatory parameters are left unspecified. 1868 * <br> 2. Incorrect parameters types. 1869 * <br> 3. Parameter verification failed. 1870 * @throws { BusinessError } 100001 - Internal error. 1871 * @syscap SystemCapability.ArkUI.ArkUI.Full 1872 * @crossplatform 1873 * @since 11 1874 */ 1875 /** 1876 * Open the custom dialog. 1877 * 1878 * @param { CustomDialogOptions } options - Options. 1879 * @returns { Promise<number> } return the dialog id that will be used by closeCustomDialog. 1880 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1881 * <br> 1. Mandatory parameters are left unspecified. 1882 * <br> 2. Incorrect parameters types. 1883 * <br> 3. Parameter verification failed. 1884 * @throws { BusinessError } 100001 - Internal error. 1885 * @syscap SystemCapability.ArkUI.ArkUI.Full 1886 * @crossplatform 1887 * @atomicservice 1888 * @since 12 1889 * @deprecated since 18 1890 * @useinstead ohos.arkui.UIContext.PromptAction#openCustomDialog 1891 */ 1892 function openCustomDialog(options: CustomDialogOptions): Promise<number>; 1893 1894 /** 1895 * Close the custom dialog. 1896 * 1897 * @param { number } dialogId - the dialog id that returned by openCustomDialog. 1898 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1899 * <br> 1. Mandatory parameters are left unspecified. 1900 * <br> 2. Incorrect parameters types. 1901 * <br> 3. Parameter verification failed. 1902 * @throws { BusinessError } 100001 - Internal error. 1903 * @syscap SystemCapability.ArkUI.ArkUI.Full 1904 * @crossplatform 1905 * @since 11 1906 */ 1907 /** 1908 * Close the custom dialog. 1909 * 1910 * @param { number } dialogId - the dialog id that returned by openCustomDialog. 1911 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1912 * <br> 1. Mandatory parameters are left unspecified. 1913 * <br> 2. Incorrect parameters types. 1914 * <br> 3. Parameter verification failed. 1915 * @throws { BusinessError } 100001 - Internal error. 1916 * @syscap SystemCapability.ArkUI.ArkUI.Full 1917 * @crossplatform 1918 * @atomicservice 1919 * @since 12 1920 * @deprecated since 18 1921 * @useinstead ohos.arkui.UIContext.PromptAction#closeCustomDialog 1922 */ 1923 function closeCustomDialog(dialogId: number): void; 1924 1925 /** 1926 * Displays the menu. 1927 * 1928 * @param { ActionMenuOptions } options - Options. 1929 * @param { AsyncCallback<ActionMenuSuccessResponse> } callback - the callback of showActionMenu. 1930 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1931 * <br> 1. Mandatory parameters are left unspecified. 1932 * <br> 2. Incorrect parameters types. 1933 * <br> 3. Parameter verification failed. 1934 * @throws { BusinessError } 100001 - Internal error. 1935 * @syscap SystemCapability.ArkUI.ArkUI.Full 1936 * @since 9 1937 */ 1938 /** 1939 * Displays the menu. 1940 * 1941 * @param { ActionMenuOptions } options - Options. 1942 * @param { AsyncCallback<ActionMenuSuccessResponse> } callback - the callback of showActionMenu. 1943 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1944 * <br> 1. Mandatory parameters are left unspecified. 1945 * <br> 2. Incorrect parameters types. 1946 * <br> 3. Parameter verification failed. 1947 * @throws { BusinessError } 100001 - Internal error. 1948 * @syscap SystemCapability.ArkUI.ArkUI.Full 1949 * @crossplatform 1950 * @since 10 1951 */ 1952 /** 1953 * Displays the menu. 1954 * 1955 * @param { ActionMenuOptions } options - Options. 1956 * @param { AsyncCallback<ActionMenuSuccessResponse> } callback - the callback of showActionMenu. 1957 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1958 * <br> 1. Mandatory parameters are left unspecified. 1959 * <br> 2. Incorrect parameters types. 1960 * <br> 3. Parameter verification failed. 1961 * @throws { BusinessError } 100001 - Internal error. 1962 * @syscap SystemCapability.ArkUI.ArkUI.Full 1963 * @crossplatform 1964 * @atomicservice 1965 * @since 11 1966 * @deprecated since 18 1967 * @useinstead ohos.arkui.UIContext.PromptAction#showActionMenu 1968 */ 1969 function showActionMenu(options: ActionMenuOptions, callback: AsyncCallback<ActionMenuSuccessResponse>): void; 1970 1971 /** 1972 * Displays the dialog box. 1973 * 1974 * @param { ActionMenuOptions } options - Options. 1975 * @returns { Promise<ActionMenuSuccessResponse> } the promise returned by the function. 1976 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1977 * <br> 1. Mandatory parameters are left unspecified. 1978 * <br> 2. Incorrect parameters types. 1979 * <br> 3. Parameter verification failed. 1980 * @throws { BusinessError } 100001 - Internal error. 1981 * @syscap SystemCapability.ArkUI.ArkUI.Full 1982 * @since 9 1983 */ 1984 /** 1985 * Displays the dialog box. 1986 * 1987 * @param { ActionMenuOptions } options - Options. 1988 * @returns { Promise<ActionMenuSuccessResponse> } the promise returned by the function. 1989 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1990 * <br> 1. Mandatory parameters are left unspecified. 1991 * <br> 2. Incorrect parameters types. 1992 * <br> 3. Parameter verification failed. 1993 * @throws { BusinessError } 100001 - Internal error. 1994 * @syscap SystemCapability.ArkUI.ArkUI.Full 1995 * @crossplatform 1996 * @since 10 1997 */ 1998 /** 1999 * Displays the dialog box. 2000 * 2001 * @param { ActionMenuOptions } options - Options. 2002 * @returns { Promise<ActionMenuSuccessResponse> } the promise returned by the function. 2003 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2004 * <br> 1. Mandatory parameters are left unspecified. 2005 * <br> 2. Incorrect parameters types. 2006 * <br> 3. Parameter verification failed. 2007 * @throws { BusinessError } 100001 - Internal error. 2008 * @syscap SystemCapability.ArkUI.ArkUI.Full 2009 * @crossplatform 2010 * @atomicservice 2011 * @since 11 2012 * @deprecated since 18 2013 * @useinstead ohos.arkui.UIContext.PromptAction#showActionMenu 2014 */ 2015 function showActionMenu(options: ActionMenuOptions): Promise<ActionMenuSuccessResponse>; 2016} 2017 2018/** 2019 * Component dialog dismiss action. 2020 * 2021 * @interface DismissDialogAction 2022 * @syscap SystemCapability.ArkUI.ArkUI.Full 2023 * @crossplatform 2024 * @atomicservice 2025 * @since 12 2026 */ 2027declare interface DismissDialogAction { 2028 /** 2029 * Defines dialog dismiss function. 2030 * 2031 * @type { Callback<void> } 2032 * @syscap SystemCapability.ArkUI.ArkUI.Full 2033 * @crossplatform 2034 * @atomicservice 2035 * @since 12 2036 */ 2037 dismiss: Callback<void>; 2038 2039 /** 2040 * Dismiss reason type. 2041 * 2042 * @type { DismissReason } 2043 * @syscap SystemCapability.ArkUI.ArkUI.Full 2044 * @crossplatform 2045 * @atomicservice 2046 * @since 12 2047 */ 2048 reason: DismissReason; 2049} 2050 2051export default promptAction; 2052