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 * @namespace promptAction 27 * @syscap SystemCapability.ArkUI.ArkUI.Full 28 * @since 9 29 */ 30/** 31 * @namespace promptAction 32 * @syscap SystemCapability.ArkUI.ArkUI.Full 33 * @crossplatform 34 * @since 10 35 */ 36/** 37 * @namespace promptAction 38 * @syscap SystemCapability.ArkUI.ArkUI.Full 39 * @crossplatform 40 * @atomicservice 41 * @since 11 42 */ 43declare namespace promptAction { 44 /** 45 * @typedef ShowToastOptions 46 * @syscap SystemCapability.ArkUI.ArkUI.Full 47 * @since 9 48 */ 49 /** 50 * @typedef ShowToastOptions 51 * @syscap SystemCapability.ArkUI.ArkUI.Full 52 * @crossplatform 53 * @since 10 54 */ 55 /** 56 * @typedef ShowToastOptions 57 * @syscap SystemCapability.ArkUI.ArkUI.Full 58 * @crossplatform 59 * @atomicservice 60 * @since 11 61 */ 62 interface ShowToastOptions { 63 64 /** 65 * Text to display. 66 * 67 * @type { string | Resource } 68 * @syscap SystemCapability.ArkUI.ArkUI.Full 69 * @since 9 70 */ 71 /** 72 * Text to display. 73 * 74 * @type { string | Resource } 75 * @syscap SystemCapability.ArkUI.ArkUI.Full 76 * @crossplatform 77 * @since 10 78 */ 79 /** 80 * Text to display. 81 * 82 * @type { string | Resource } 83 * @syscap SystemCapability.ArkUI.ArkUI.Full 84 * @crossplatform 85 * @atomicservice 86 * @since 11 87 */ 88 message: string | Resource; 89 90 /** 91 * Duration of toast dialog box. The default value is 1500. 92 * The recommended value ranges from 1500ms to 10000ms. 93 * NOTE: A value less than 1500 is automatically changed to 1500. The maximum value is 10000ms. 94 * 95 * @type { ?number } 96 * @syscap SystemCapability.ArkUI.ArkUI.Full 97 * @since 9 98 */ 99 /** 100 * Duration of toast dialog box. The default value is 1500. 101 * The recommended value ranges from 1500ms to 10000ms. 102 * NOTE: A value less than 1500 is automatically changed to 1500. The maximum value is 10000ms. 103 * 104 * @type { ?number } 105 * @syscap SystemCapability.ArkUI.ArkUI.Full 106 * @crossplatform 107 * @since 10 108 */ 109 /** 110 * Duration of toast dialog box. The default value is 1500. 111 * The recommended value ranges from 1500ms to 10000ms. 112 * NOTE: A value less than 1500 is automatically changed to 1500. The maximum value is 10000ms. 113 * 114 * @type { ?number } 115 * @syscap SystemCapability.ArkUI.ArkUI.Full 116 * @crossplatform 117 * @atomicservice 118 * @since 11 119 */ 120 duration?: number; 121 122 /** 123 * The distance between toast dialog box and the bottom of screen. 124 * 125 * @type { ?(string | number) } 126 * @syscap SystemCapability.ArkUI.ArkUI.Full 127 * @since 9 128 */ 129 /** 130 * The distance between toast dialog box and the bottom of screen. 131 * 132 * @type { ?(string | number) } 133 * @syscap SystemCapability.ArkUI.ArkUI.Full 134 * @crossplatform 135 * @since 10 136 */ 137 /** 138 * The distance between toast dialog box and the bottom of screen. 139 * 140 * @type { ?(string | number) } 141 * @syscap SystemCapability.ArkUI.ArkUI.Full 142 * @crossplatform 143 * @atomicservice 144 * @since 11 145 */ 146 bottom?: string | number; 147 148 /** 149 * Determine the show mode of the toast. 150 * 151 * @type { ?ToastShowMode } 152 * @default ToastShowMode.DEFAULT 153 * @syscap SystemCapability.ArkUI.ArkUI.Full 154 * @since 11 155 */ 156 /** 157 * Determine the show mode of the toast. 158 * 159 * @type { ?ToastShowMode } 160 * @default ToastShowMode.DEFAULT 161 * @syscap SystemCapability.ArkUI.ArkUI.Full 162 * @crossplatform 163 * @atomicservice 164 * @since 12 165 */ 166 showMode?: ToastShowMode; 167 /** 168 * Defines the toast alignment of the screen. 169 * 170 * @type { ?Alignment } 171 * @syscap SystemCapability.ArkUI.ArkUI.Full 172 * @crossplatform 173 * @atomicservice 174 * @since 12 175 */ 176 alignment?: Alignment; 177 /** 178 * Defines the toast offset. 179 * 180 * @type { ?Offset } 181 * @syscap SystemCapability.ArkUI.ArkUI.Full 182 * @crossplatform 183 * @atomicservice 184 * @since 12 185 */ 186 offset?: Offset; 187 /** 188 * Background color of toast. 189 * 190 * @type { ?ResourceColor } 191 * @syscap SystemCapability.ArkUI.ArkUI.Full 192 * @crossplatform 193 * @atomicservice 194 * @since 12 195 */ 196 backgroundColor?: ResourceColor; 197 /** 198 * Text color of toast. 199 * 200 * @type { ?ResourceColor } 201 * @syscap SystemCapability.ArkUI.ArkUI.Full 202 * @crossplatform 203 * @atomicservice 204 * @since 12 205 */ 206 textColor?: ResourceColor; 207 /** 208 * Background blur Style of toast. 209 * 210 * @type { ?BlurStyle } 211 * @syscap SystemCapability.ArkUI.ArkUI.Full 212 * @crossplatform 213 * @atomicservice 214 * @since 12 215 */ 216 backgroundBlurStyle?: BlurStyle; 217 /** 218 * Shadow of toast. 219 * 220 * @type { ?(ShadowOptions | ShadowStyle) } 221 * @syscap SystemCapability.ArkUI.ArkUI.Full 222 * @crossplatform 223 * @atomicservice 224 * @since 12 225 */ 226 shadow?: ShadowOptions | ShadowStyle; 227 } 228 229 /** 230 * Enum for the toast showMode. 231 * 232 * @enum { number } 233 * @syscap SystemCapability.ArkUI.ArkUI.Full 234 * @since 11 235 */ 236 /** 237 * Enum for the toast showMode. 238 * 239 * @enum { number } 240 * @syscap SystemCapability.ArkUI.ArkUI.Full 241 * @crossplatform 242 * @atomicservice 243 * @since 12 244 */ 245 export enum ToastShowMode { 246 /** 247 * Toast shows in app. 248 * 249 * @syscap SystemCapability.ArkUI.ArkUI.Full 250 * @since 11 251 */ 252 /** 253 * Toast shows in app. 254 * 255 * @syscap SystemCapability.ArkUI.ArkUI.Full 256 * @crossplatform 257 * @atomicservice 258 * @since 12 259 */ 260 DEFAULT = 0, 261 262 /** 263 * Toast shows at the top. 264 * 265 * @syscap SystemCapability.ArkUI.ArkUI.Full 266 * @since 11 267 */ 268 /** 269 * Toast shows at the top. 270 * 271 * @syscap SystemCapability.ArkUI.ArkUI.Full 272 * @crossplatform 273 * @atomicservice 274 * @since 12 275 */ 276 TOP_MOST = 1, 277 278 /** 279 * Toast shows in SYSTEM_TOAST window. 280 * 281 * @syscap SystemCapability.ArkUI.ArkUI.Full 282 * @systemapi 283 * @since 12 284 */ 285 SYSTEM_TOP_MOST = 2 286 } 287 288 /** 289 * @typedef Button 290 * @syscap SystemCapability.ArkUI.ArkUI.Full 291 * @since 9 292 */ 293 /** 294 * @typedef Button 295 * @syscap SystemCapability.ArkUI.ArkUI.Full 296 * @crossplatform 297 * @since 10 298 */ 299 /** 300 * @typedef Button 301 * @syscap SystemCapability.ArkUI.ArkUI.Full 302 * @crossplatform 303 * @atomicservice 304 * @since 11 305 */ 306 interface Button { 307 308 /** 309 * The text displayed in the button. 310 * 311 * @type { string | Resource } 312 * @syscap SystemCapability.ArkUI.ArkUI.Full 313 * @since 9 314 */ 315 /** 316 * The text displayed in the button. 317 * 318 * @type { string | Resource } 319 * @syscap SystemCapability.ArkUI.ArkUI.Full 320 * @crossplatform 321 * @since 10 322 */ 323 /** 324 * The text displayed in the button. 325 * 326 * @type { string | Resource } 327 * @syscap SystemCapability.ArkUI.ArkUI.Full 328 * @crossplatform 329 * @atomicservice 330 * @since 11 331 */ 332 text: string | Resource; 333 334 /** 335 * The foreground color of button. 336 * 337 * @type { string | Resource } 338 * @syscap SystemCapability.ArkUI.ArkUI.Full 339 * @since 9 340 */ 341 /** 342 * The foreground color of button. 343 * 344 * @type { string | Resource } 345 * @syscap SystemCapability.ArkUI.ArkUI.Full 346 * @crossplatform 347 * @since 10 348 */ 349 /** 350 * The foreground color of button. 351 * 352 * @type { string | Resource } 353 * @syscap SystemCapability.ArkUI.ArkUI.Full 354 * @crossplatform 355 * @atomicservice 356 * @since 11 357 */ 358 color: string | Resource; 359 /** 360 * Define whether the button responds to Enter/Space key by default. 361 * 362 * @type { ?boolean } 363 * @syscap SystemCapability.ArkUI.ArkUI.Full 364 * @crossplatform 365 * @atomicservice 366 * @since 12 367 */ 368 primary?: boolean; 369 } 370 371 /** 372 * @typedef ShowDialogSuccessResponse 373 * @syscap SystemCapability.ArkUI.ArkUI.Full 374 * @since 9 375 */ 376 /** 377 * @typedef ShowDialogSuccessResponse 378 * @syscap SystemCapability.ArkUI.ArkUI.Full 379 * @crossplatform 380 * @since 10 381 */ 382 /** 383 * @typedef ShowDialogSuccessResponse 384 * @syscap SystemCapability.ArkUI.ArkUI.Full 385 * @crossplatform 386 * @atomicservice 387 * @since 11 388 */ 389 interface ShowDialogSuccessResponse { 390 391 /** 392 * Index of the selected button, starting from 0. 393 * 394 * @type { number } 395 * @syscap SystemCapability.ArkUI.ArkUI.Full 396 * @since 9 397 */ 398 /** 399 * Index of the selected button, starting from 0. 400 * 401 * @type { number } 402 * @syscap SystemCapability.ArkUI.ArkUI.Full 403 * @crossplatform 404 * @since 10 405 */ 406 /** 407 * Index of the selected button, starting from 0. 408 * 409 * @type { number } 410 * @syscap SystemCapability.ArkUI.ArkUI.Full 411 * @crossplatform 412 * @atomicservice 413 * @since 11 414 */ 415 index: number; 416 } 417 418 /** 419 * @typedef ShowDialogOptions 420 * @syscap SystemCapability.ArkUI.ArkUI.Full 421 * @since 9 422 */ 423 /** 424 * @typedef ShowDialogOptions 425 * @syscap SystemCapability.ArkUI.ArkUI.Full 426 * @crossplatform 427 * @since 10 428 */ 429 /** 430 * @typedef ShowDialogOptions 431 * @syscap SystemCapability.ArkUI.ArkUI.Full 432 * @crossplatform 433 * @atomicservice 434 * @since 11 435 */ 436 interface ShowDialogOptions { 437 438 /** 439 * Title of the text to display. 440 * 441 * @type { ?(string | Resource) } 442 * @syscap SystemCapability.ArkUI.ArkUI.Full 443 * @since 9 444 */ 445 /** 446 * Title of the text to display. 447 * 448 * @type { ?(string | Resource) } 449 * @syscap SystemCapability.ArkUI.ArkUI.Full 450 * @crossplatform 451 * @since 10 452 */ 453 /** 454 * Title of the text to display. 455 * 456 * @type { ?(string | Resource) } 457 * @syscap SystemCapability.ArkUI.ArkUI.Full 458 * @crossplatform 459 * @atomicservice 460 * @since 11 461 */ 462 title?: string | Resource; 463 464 /** 465 * Text body. 466 * 467 * @type { ?(string | Resource) } 468 * @syscap SystemCapability.ArkUI.ArkUI.Full 469 * @since 9 470 */ 471 /** 472 * Text body. 473 * 474 * @type { ?(string | Resource) } 475 * @syscap SystemCapability.ArkUI.ArkUI.Full 476 * @crossplatform 477 * @since 10 478 */ 479 /** 480 * Text body. 481 * 482 * @type { ?(string | Resource) } 483 * @syscap SystemCapability.ArkUI.ArkUI.Full 484 * @crossplatform 485 * @atomicservice 486 * @since 11 487 */ 488 message?: string | Resource; 489 490 /** 491 * Array of buttons in the dialog box. 492 * The array structure is {text:'button', color: '#666666'}. 493 * One to three buttons are supported. 494 * The first button is of the positiveButton type, the second is of the negativeButton type, and the third is of the neutralButton type. 495 * 496 * @type { ?Array<Button> } 497 * @syscap SystemCapability.ArkUI.ArkUI.Full 498 * @since 9 499 */ 500 /** 501 * Array of buttons in the dialog box. 502 * The array structure is {text:'button', color: '#666666'}. 503 * More than one buttons are supported. 504 * 505 * @type { ?Array<Button> } 506 * @syscap SystemCapability.ArkUI.ArkUI.Full 507 * @crossplatform 508 * @since 10 509 */ 510 /** 511 * Array of buttons in the dialog box. 512 * The array structure is {text:'button', color: '#666666'}. 513 * More than one buttons are supported. 514 * 515 * @type { ?Array<Button> } 516 * @syscap SystemCapability.ArkUI.ArkUI.Full 517 * @crossplatform 518 * @atomicservice 519 * @since 11 520 */ 521 buttons?: Array<Button>; 522 523 /** 524 * Mask Region of dialog. The size can't exceed the main window. 525 * 526 * @type { ?Rectangle } 527 * @syscap SystemCapability.ArkUI.ArkUI.Full 528 * @crossplatform 529 * @since 10 530 */ 531 /** 532 * Mask Region of dialog. The size can't exceed the main window. 533 * 534 * @type { ?Rectangle } 535 * @syscap SystemCapability.ArkUI.ArkUI.Full 536 * @crossplatform 537 * @atomicservice 538 * @since 11 539 */ 540 maskRect?: Rectangle; 541 542 /** 543 * Defines the dialog alignment of the screen. 544 * 545 * @type { ?DialogAlignment } 546 * @syscap SystemCapability.ArkUI.ArkUI.Full 547 * @crossplatform 548 * @since 10 549 */ 550 /** 551 * Defines the dialog alignment of the screen. 552 * 553 * @type { ?DialogAlignment } 554 * @syscap SystemCapability.ArkUI.ArkUI.Full 555 * @crossplatform 556 * @atomicservice 557 * @since 11 558 */ 559 alignment?: DialogAlignment; 560 561 /** 562 * Defines the dialog offset. 563 * 564 * @type { ?Offset } 565 * @syscap SystemCapability.ArkUI.ArkUI.Full 566 * @crossplatform 567 * @since 10 568 */ 569 /** 570 * Defines the dialog offset. 571 * 572 * @type { ?Offset } 573 * @syscap SystemCapability.ArkUI.ArkUI.Full 574 * @crossplatform 575 * @atomicservice 576 * @since 11 577 */ 578 offset?: Offset; 579 580 /** 581 * Whether to display in the sub window. 582 * 583 * @type { ?boolean } 584 * @default false 585 * @syscap SystemCapability.ArkUI.ArkUI.Full 586 * @crossplatform 587 * @since 11 588 */ 589 /** 590 * Whether to display in the sub window. 591 * 592 * @type { ?boolean } 593 * @default false 594 * @syscap SystemCapability.ArkUI.ArkUI.Full 595 * @crossplatform 596 * @atomicservice 597 * @since 12 598 */ 599 showInSubWindow?: boolean; 600 601 /** 602 * Whether it is a modal dialog 603 * @type { ?boolean } 604 * @default true 605 * @syscap SystemCapability.ArkUI.ArkUI.Full 606 * @crossplatform 607 * @since 11 608 */ 609 /** 610 * Whether it is a modal dialog 611 * @type { ?boolean } 612 * @default true 613 * @syscap SystemCapability.ArkUI.ArkUI.Full 614 * @crossplatform 615 * @atomicservice 616 * @since 12 617 */ 618 isModal?: boolean; 619 620 /** 621 * Defines the dialog's background color. 622 * 623 * @type { ?ResourceColor } 624 * @default Color.Transparent 625 * @syscap SystemCapability.ArkUI.ArkUI.Full 626 * @crossplatform 627 * @atomicservice 628 * @since 12 629 */ 630 backgroundColor?: ResourceColor; 631 632 /** 633 * Defines the dialog's background blur Style 634 * 635 * @type { ?BlurStyle } 636 * @default BlurStyle.COMPONENT_ULTRA_THICK 637 * @syscap SystemCapability.ArkUI.ArkUI.Full 638 * @crossplatform 639 * @atomicservice 640 * @since 12 641 */ 642 backgroundBlurStyle?: BlurStyle; 643 644 /** 645 * Defines the dialog's shadow. 646 * 647 * @type { ?(ShadowOptions | ShadowStyle) } 648 * @syscap SystemCapability.ArkUI.ArkUI.Full 649 * @crossplatform 650 * @atomicservice 651 * @since 12 652 */ 653 shadow?: ShadowOptions | ShadowStyle; 654 } 655 656 /** 657 * Dialog base options 658 * 659 * @typedef BaseDialogOptions 660 * @syscap SystemCapability.ArkUI.ArkUI.Full 661 * @crossplatform 662 * @since 11 663 */ 664 /** 665 * Dialog base options 666 * 667 * @typedef BaseDialogOptions 668 * @syscap SystemCapability.ArkUI.ArkUI.Full 669 * @crossplatform 670 * @atomicservice 671 * @since 12 672 */ 673 interface BaseDialogOptions { 674 /** 675 * Mask Region of dialog. The size can't exceed the main window. 676 * 677 * @type { ?Rectangle } 678 * @syscap SystemCapability.ArkUI.ArkUI.Full 679 * @crossplatform 680 * @since 11 681 */ 682 /** 683 * Mask Region of dialog. The size can't exceed the main window. 684 * 685 * @type { ?Rectangle } 686 * @syscap SystemCapability.ArkUI.ArkUI.Full 687 * @crossplatform 688 * @atomicservice 689 * @since 12 690 */ 691 maskRect?: Rectangle; 692 693 /** 694 * Defines the dialog alignment of the screen. 695 * 696 * @type { ?DialogAlignment } 697 * @syscap SystemCapability.ArkUI.ArkUI.Full 698 * @crossplatform 699 * @since 11 700 */ 701 /** 702 * Defines the dialog alignment of the screen. 703 * 704 * @type { ?DialogAlignment } 705 * @syscap SystemCapability.ArkUI.ArkUI.Full 706 * @crossplatform 707 * @atomicservice 708 * @since 12 709 */ 710 alignment?: DialogAlignment; 711 712 /** 713 * Defines the dialog offset. 714 * 715 * @type { ?Offset } 716 * @syscap SystemCapability.ArkUI.ArkUI.Full 717 * @crossplatform 718 * @since 11 719 */ 720 /** 721 * Defines the dialog offset. 722 * 723 * @type { ?Offset } 724 * @syscap SystemCapability.ArkUI.ArkUI.Full 725 * @crossplatform 726 * @atomicservice 727 * @since 12 728 */ 729 offset?: Offset; 730 731 /** 732 * Whether to display in the sub window. 733 * 734 * @type { ?boolean } 735 * @default false 736 * @syscap SystemCapability.ArkUI.ArkUI.Full 737 * @crossplatform 738 * @since 11 739 */ 740 /** 741 * Whether to display in the sub window. 742 * 743 * @type { ?boolean } 744 * @default false 745 * @syscap SystemCapability.ArkUI.ArkUI.Full 746 * @crossplatform 747 * @atomicservice 748 * @since 12 749 */ 750 showInSubWindow?: boolean; 751 752 /** 753 * Whether it is a modal dialog 754 * @type { ?boolean } 755 * @default true 756 * @syscap SystemCapability.ArkUI.ArkUI.Full 757 * @crossplatform 758 * @since 11 759 */ 760 /** 761 * Whether it is a modal dialog 762 * @type { ?boolean } 763 * @default true 764 * @syscap SystemCapability.ArkUI.ArkUI.Full 765 * @crossplatform 766 * @atomicservice 767 * @since 12 768 */ 769 isModal?: boolean; 770 771 /** 772 * Allows users to click the mask layer to exit. 773 * 774 * @type { ?boolean } 775 * @default true 776 * @syscap SystemCapability.ArkUI.ArkUI.Full 777 * @crossplatform 778 * @atomicservice 779 * @since 12 780 */ 781 autoCancel?: boolean; 782 783 /** 784 * Transition parameters of opening/closing custom dialog. 785 * 786 * @type { ?TransitionEffect } 787 * @syscap SystemCapability.ArkUI.ArkUI.Full 788 * @crossplatform 789 * @atomicservice 790 * @since 12 791 */ 792 transition?: TransitionEffect; 793 794 /** 795 * Defines custom dialog maskColor 796 * 797 * @type { ?ResourceColor } 798 * @syscap SystemCapability.ArkUI.ArkUI.Full 799 * @crossplatform 800 * @atomicservice 801 * @since 12 802 */ 803 maskColor?: ResourceColor; 804 805 /** 806 * Callback function when the CustomDialog interactive dismiss. 807 * 808 * @type { ?Callback<DismissDialogAction> } 809 * @syscap SystemCapability.ArkUI.ArkUI.Full 810 * @crossplatform 811 * @atomicservice 812 * @since 12 813 */ 814 onWillDismiss?: Callback<DismissDialogAction>; 815 816 /** 817 * Callback function when the dialog appears. 818 * 819 * @type { ?function } 820 * @syscap SystemCapability.ArkUI.ArkUI.Full 821 * @crossplatform 822 * @atomicservice 823 * @since 12 824 */ 825 onDidAppear?: () => void; 826 827 /** 828 * Callback function when the dialog disappears. 829 * 830 * @type { ?function } 831 * @syscap SystemCapability.ArkUI.ArkUI.Full 832 * @crossplatform 833 * @atomicservice 834 * @since 12 835 */ 836 onDidDisappear?: () => void; 837 838 /** 839 * Callback function before the dialog openAnimation starts. 840 * 841 * @type { ?function } 842 * @syscap SystemCapability.ArkUI.ArkUI.Full 843 * @crossplatform 844 * @atomicservice 845 * @since 12 846 */ 847 onWillAppear?: () => void; 848 849 /** 850 * Callback function before the dialog closeAnimation starts. 851 * 852 * @type { ?function } 853 * @syscap SystemCapability.ArkUI.ArkUI.Full 854 * @crossplatform 855 * @atomicservice 856 * @since 12 857 */ 858 onWillDisappear?: () => void; 859 860 /** 861 * Defines the customDialog's keyboard avoid mode 862 * 863 * @type { ?KeyboardAvoidMode } 864 * @default KeyboardAvoidMode.DEFAULT 865 * @syscap SystemCapability.ArkUI.ArkUI.Full 866 * @crossplatform 867 * @atomicservice 868 * @since 12 869 */ 870 keyboardAvoidMode?: KeyboardAvoidMode; 871 } 872 873 /** 874 * Dialog's custom content options 875 * 876 * @interface CustomDialogOptions 877 * @syscap SystemCapability.ArkUI.ArkUI.Full 878 * @crossplatform 879 * @since 11 880 */ 881 /** 882 * Dialog's custom content options 883 * 884 * @interface CustomDialogOptions 885 * @syscap SystemCapability.ArkUI.ArkUI.Full 886 * @crossplatform 887 * @atomicservice 888 * @since 12 889 */ 890 interface CustomDialogOptions extends BaseDialogOptions { 891 /** 892 * Allow developer custom dialog's content. 893 * 894 * @type { CustomBuilder } 895 * @syscap SystemCapability.ArkUI.ArkUI.Full 896 * @crossplatform 897 * @since 11 898 */ 899 /** 900 * Allow developer custom dialog's content. 901 * 902 * @type { CustomBuilder } 903 * @syscap SystemCapability.ArkUI.ArkUI.Full 904 * @crossplatform 905 * @atomicservice 906 * @since 12 907 */ 908 builder: CustomBuilder; 909 910 /** 911 * Defines the custom dialog's background color. 912 * 913 * @type { ?ResourceColor } 914 * @syscap SystemCapability.ArkUI.ArkUI.Full 915 * @crossplatform 916 * @atomicservice 917 * @since 12 918 */ 919 backgroundColor?: ResourceColor; 920 921 /** 922 * Defines the custom dialog's corner radius. 923 * 924 * @type { ?(Dimension | BorderRadiuses) } 925 * @syscap SystemCapability.ArkUI.ArkUI.Full 926 * @crossplatform 927 * @atomicservice 928 * @since 12 929 */ 930 cornerRadius?: Dimension | BorderRadiuses; 931 932 /** 933 * Defines the custom dialog's width. 934 * 935 * @type { ?Dimension } 936 * @syscap SystemCapability.ArkUI.ArkUI.Full 937 * @crossplatform 938 * @atomicservice 939 * @since 12 940 */ 941 width?: Dimension; 942 943 /** 944 * Defines the custom dialog's height. 945 * 946 * @type { ?Dimension } 947 * @syscap SystemCapability.ArkUI.ArkUI.Full 948 * @crossplatform 949 * @atomicservice 950 * @since 12 951 */ 952 height?: Dimension; 953 954 /** 955 * Defines the custom dialog's border width. 956 * 957 * @type { ?(Dimension | EdgeWidths) } 958 * @syscap SystemCapability.ArkUI.ArkUI.Full 959 * @crossplatform 960 * @atomicservice 961 * @since 12 962 */ 963 borderWidth?: Dimension | EdgeWidths; 964 965 /** 966 * Defines the custom dialog's border color. 967 * 968 * @type { ?(ResourceColor | EdgeColors) } 969 * @syscap SystemCapability.ArkUI.ArkUI.Full 970 * @crossplatform 971 * @atomicservice 972 * @since 12 973 */ 974 borderColor?: ResourceColor | EdgeColors; 975 976 /** 977 * Defines the custom dialog's border style. 978 * 979 * @type { ?(BorderStyle | EdgeStyles) } 980 * @syscap SystemCapability.ArkUI.ArkUI.Full 981 * @crossplatform 982 * @atomicservice 983 * @since 12 984 */ 985 borderStyle?: BorderStyle | EdgeStyles; 986 987 /** 988 * Defines the custom dialog's shadow. 989 * 990 * @type { ?(ShadowOptions | ShadowStyle) } 991 * @syscap SystemCapability.ArkUI.ArkUI.Full 992 * @crossplatform 993 * @atomicservice 994 * @since 12 995 */ 996 shadow?: ShadowOptions | ShadowStyle; 997 998 /** 999 * Defines the customDialog's background blur Style 1000 * 1001 * @type { ?BlurStyle } 1002 * @default BlurStyle.COMPONENT_ULTRA_THICK 1003 * @syscap SystemCapability.ArkUI.ArkUI.Full 1004 * @crossplatform 1005 * @atomicservice 1006 * @since 12 1007 */ 1008 backgroundBlurStyle?: BlurStyle; 1009 } 1010 1011 /** 1012 * @typedef ActionMenuSuccessResponse 1013 * @syscap SystemCapability.ArkUI.ArkUI.Full 1014 * @since 9 1015 */ 1016 /** 1017 * @typedef ActionMenuSuccessResponse 1018 * @syscap SystemCapability.ArkUI.ArkUI.Full 1019 * @crossplatform 1020 * @since 10 1021 */ 1022 /** 1023 * @typedef ActionMenuSuccessResponse 1024 * @syscap SystemCapability.ArkUI.ArkUI.Full 1025 * @crossplatform 1026 * @atomicservice 1027 * @since 11 1028 */ 1029 interface ActionMenuSuccessResponse { 1030 /** 1031 * Index of the selected button, starting from 0. 1032 * 1033 * @type { number } 1034 * @syscap SystemCapability.ArkUI.ArkUI.Full 1035 * @since 9 1036 */ 1037 /** 1038 * Index of the selected button, starting from 0. 1039 * 1040 * @type { number } 1041 * @syscap SystemCapability.ArkUI.ArkUI.Full 1042 * @crossplatform 1043 * @since 10 1044 */ 1045 /** 1046 * Index of the selected button, starting from 0. 1047 * 1048 * @type { number } 1049 * @syscap SystemCapability.ArkUI.ArkUI.Full 1050 * @crossplatform 1051 * @atomicservice 1052 * @since 11 1053 */ 1054 index: number; 1055 } 1056 1057 /** 1058 * @typedef ActionMenuOptions 1059 * @syscap SystemCapability.ArkUI.ArkUI.Full 1060 * @since 9 1061 */ 1062 /** 1063 * @typedef ActionMenuOptions 1064 * @syscap SystemCapability.ArkUI.ArkUI.Full 1065 * @crossplatform 1066 * @since 10 1067 */ 1068 /** 1069 * @typedef ActionMenuOptions 1070 * @syscap SystemCapability.ArkUI.ArkUI.Full 1071 * @crossplatform 1072 * @atomicservice 1073 * @since 11 1074 */ 1075 interface ActionMenuOptions { 1076 /** 1077 * Title of the text to display. 1078 * 1079 * @type { ?(string | Resource) } 1080 * @syscap SystemCapability.ArkUI.ArkUI.Full 1081 * @since 9 1082 */ 1083 /** 1084 * Title of the text to display. 1085 * 1086 * @type { ?(string | Resource) } 1087 * @syscap SystemCapability.ArkUI.ArkUI.Full 1088 * @crossplatform 1089 * @since 10 1090 */ 1091 /** 1092 * Title of the text to display. 1093 * 1094 * @type { ?(string | Resource) } 1095 * @syscap SystemCapability.ArkUI.ArkUI.Full 1096 * @crossplatform 1097 * @atomicservice 1098 * @since 11 1099 */ 1100 title?: string | Resource; 1101 1102 /** 1103 * Array of buttons in the dialog box. 1104 * The array structure is {text:'button', color: '#666666'}. 1105 * One to six buttons are supported. 1106 * 1107 * @type { [Button, Button?, Button?, Button?, Button?, Button?] } 1108 * @syscap SystemCapability.ArkUI.ArkUI.Full 1109 * @since 9 1110 */ 1111 /** 1112 * Array of buttons in the dialog box. 1113 * The array structure is {text:'button', color: '#666666'}. 1114 * One to six buttons are supported. 1115 * 1116 * @type { [Button, Button?, Button?, Button?, Button?, Button?] } 1117 * @syscap SystemCapability.ArkUI.ArkUI.Full 1118 * @crossplatform 1119 * @since 10 1120 */ 1121 /** 1122 * Array of buttons in the dialog box. 1123 * The array structure is {text:'button', color: '#666666'}. 1124 * One to six buttons are supported. 1125 * 1126 * @type { [Button, Button?, Button?, Button?, Button?, Button?] } 1127 * @syscap SystemCapability.ArkUI.ArkUI.Full 1128 * @crossplatform 1129 * @atomicservice 1130 * @since 11 1131 */ 1132 buttons: [Button, Button?, Button?, Button?, Button?, Button?]; 1133 1134 /** 1135 * Whether to display in the sub window. 1136 * 1137 * @type { ?boolean } 1138 * @default false 1139 * @syscap SystemCapability.ArkUI.ArkUI.Full 1140 * @crossplatform 1141 * @since 11 1142 */ 1143 /** 1144 * Whether to display in the sub window. 1145 * 1146 * @type { ?boolean } 1147 * @default false 1148 * @syscap SystemCapability.ArkUI.ArkUI.Full 1149 * @crossplatform 1150 * @atomicservice 1151 * @since 12 1152 */ 1153 showInSubWindow?: boolean; 1154 1155 /** 1156 * Whether it is a modal dialog 1157 * @type { ?boolean } 1158 * @default true 1159 * @syscap SystemCapability.ArkUI.ArkUI.Full 1160 * @crossplatform 1161 * @since 11 1162 */ 1163 /** 1164 * Whether it is a modal dialog 1165 * @type { ?boolean } 1166 * @default true 1167 * @syscap SystemCapability.ArkUI.ArkUI.Full 1168 * @crossplatform 1169 * @atomicservice 1170 * @since 12 1171 */ 1172 isModal?: boolean; 1173 } 1174 1175 /** 1176 * Displays the notification text. 1177 * 1178 * @param { ShowToastOptions } options - Options. 1179 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1180 * <br> 1. Mandatory parameters are left unspecified. 1181 * <br> 2. Incorrect parameters types. 1182 * <br> 3. Parameter verification failed. 1183 * @throws { BusinessError } 100001 - Internal error. 1184 * @syscap SystemCapability.ArkUI.ArkUI.Full 1185 * @since 9 1186 */ 1187 /** 1188 * Displays the notification text. 1189 * 1190 * @param { ShowToastOptions } options - Options. 1191 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1192 * <br> 1. Mandatory parameters are left unspecified. 1193 * <br> 2. Incorrect parameters types. 1194 * <br> 3. Parameter verification failed. 1195 * @throws { BusinessError } 100001 - Internal error. 1196 * @syscap SystemCapability.ArkUI.ArkUI.Full 1197 * @crossplatform 1198 * @since 10 1199 */ 1200 /** 1201 * Displays the notification text. 1202 * 1203 * @param { ShowToastOptions } options - Options. 1204 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1205 * <br> 1. Mandatory parameters are left unspecified. 1206 * <br> 2. Incorrect parameters types. 1207 * <br> 3. Parameter verification failed. 1208 * @throws { BusinessError } 100001 - Internal error. 1209 * @syscap SystemCapability.ArkUI.ArkUI.Full 1210 * @crossplatform 1211 * @atomicservice 1212 * @since 11 1213 */ 1214 function showToast(options: ShowToastOptions): void; 1215 1216 /** 1217 * Displays the dialog box. 1218 * 1219 * @param { ShowDialogOptions } options - Options. 1220 * @param { AsyncCallback<ShowDialogSuccessResponse> } callback - the callback of showDialog. 1221 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1222 * <br> 1. Mandatory parameters are left unspecified. 1223 * <br> 2. Incorrect parameters types. 1224 * <br> 3. Parameter verification failed. 1225 * @throws { BusinessError } 100001 - Internal error. 1226 * @syscap SystemCapability.ArkUI.ArkUI.Full 1227 * @since 9 1228 */ 1229 /** 1230 * Displays the dialog box. 1231 * 1232 * @param { ShowDialogOptions } options - Options. 1233 * @param { AsyncCallback<ShowDialogSuccessResponse> } callback - the callback of showDialog. 1234 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1235 * <br> 1. Mandatory parameters are left unspecified. 1236 * <br> 2. Incorrect parameters types. 1237 * <br> 3. Parameter verification failed. 1238 * @throws { BusinessError } 100001 - Internal error. 1239 * @syscap SystemCapability.ArkUI.ArkUI.Full 1240 * @crossplatform 1241 * @since 10 1242 */ 1243 /** 1244 * Displays the dialog box. 1245 * 1246 * @param { ShowDialogOptions } options - Options. 1247 * @param { AsyncCallback<ShowDialogSuccessResponse> } callback - the callback of showDialog. 1248 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1249 * <br> 1. Mandatory parameters are left unspecified. 1250 * <br> 2. Incorrect parameters types. 1251 * <br> 3. Parameter verification failed. 1252 * @throws { BusinessError } 100001 - Internal error. 1253 * @syscap SystemCapability.ArkUI.ArkUI.Full 1254 * @crossplatform 1255 * @atomicservice 1256 * @since 11 1257 */ 1258 function showDialog(options: ShowDialogOptions, callback: AsyncCallback<ShowDialogSuccessResponse>): void; 1259 1260 /** 1261 * Displays the dialog box. 1262 * 1263 * @param { ShowDialogOptions } options - Options. 1264 * @returns { Promise<ShowDialogSuccessResponse> } the promise returned by the function. 1265 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1266 * <br> 1. Mandatory parameters are left unspecified. 1267 * <br> 2. Incorrect parameters types. 1268 * <br> 3. Parameter verification failed. 1269 * @throws { BusinessError } 100001 - Internal error. 1270 * @syscap SystemCapability.ArkUI.ArkUI.Full 1271 * @since 9 1272 */ 1273 /** 1274 * Displays the dialog box. 1275 * 1276 * @param { ShowDialogOptions } options - Options. 1277 * @returns { Promise<ShowDialogSuccessResponse> } the promise returned by the function. 1278 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1279 * <br> 1. Mandatory parameters are left unspecified. 1280 * <br> 2. Incorrect parameters types. 1281 * <br> 3. Parameter verification failed. 1282 * @throws { BusinessError } 100001 - Internal error. 1283 * @syscap SystemCapability.ArkUI.ArkUI.Full 1284 * @crossplatform 1285 * @since 10 1286 */ 1287 /** 1288 * Displays the dialog box. 1289 * 1290 * @param { ShowDialogOptions } options - Options. 1291 * @returns { Promise<ShowDialogSuccessResponse> } the promise returned by the function. 1292 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1293 * <br> 1. Mandatory parameters are left unspecified. 1294 * <br> 2. Incorrect parameters types. 1295 * <br> 3. Parameter verification failed. 1296 * @throws { BusinessError } 100001 - Internal error. 1297 * @syscap SystemCapability.ArkUI.ArkUI.Full 1298 * @crossplatform 1299 * @atomicservice 1300 * @since 11 1301 */ 1302 function showDialog(options: ShowDialogOptions): Promise<ShowDialogSuccessResponse>; 1303 1304 /** 1305 * Open the custom dialog. 1306 * 1307 * @param { CustomDialogOptions } options - Options. 1308 * @returns { Promise<number> } return the dialog id that will be used by closeCustomDialog. 1309 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1310 * <br> 1. Mandatory parameters are left unspecified. 1311 * <br> 2. Incorrect parameters types. 1312 * <br> 3. Parameter verification failed. 1313 * @throws { BusinessError } 100001 - Internal error. 1314 * @syscap SystemCapability.ArkUI.ArkUI.Full 1315 * @crossplatform 1316 * @since 11 1317 */ 1318 /** 1319 * Open the custom dialog. 1320 * 1321 * @param { CustomDialogOptions } options - Options. 1322 * @returns { Promise<number> } return the dialog id that will be used by closeCustomDialog. 1323 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1324 * <br> 1. Mandatory parameters are left unspecified. 1325 * <br> 2. Incorrect parameters types. 1326 * <br> 3. Parameter verification failed. 1327 * @throws { BusinessError } 100001 - Internal error. 1328 * @syscap SystemCapability.ArkUI.ArkUI.Full 1329 * @crossplatform 1330 * @atomicservice 1331 * @since 12 1332 */ 1333 function openCustomDialog(options: CustomDialogOptions): Promise<number>; 1334 1335 /** 1336 * Close the custom dialog. 1337 * 1338 * @param { number } dialogId - the dialog id that returned by openCustomDialog. 1339 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1340 * <br> 1. Mandatory parameters are left unspecified. 1341 * <br> 2. Incorrect parameters types. 1342 * <br> 3. Parameter verification failed. 1343 * @throws { BusinessError } 100001 - Internal error. 1344 * @syscap SystemCapability.ArkUI.ArkUI.Full 1345 * @crossplatform 1346 * @since 11 1347 */ 1348 /** 1349 * Close the custom dialog. 1350 * 1351 * @param { number } dialogId - the dialog id that returned by openCustomDialog. 1352 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1353 * <br> 1. Mandatory parameters are left unspecified. 1354 * <br> 2. Incorrect parameters types. 1355 * <br> 3. Parameter verification failed. 1356 * @throws { BusinessError } 100001 - Internal error. 1357 * @syscap SystemCapability.ArkUI.ArkUI.Full 1358 * @crossplatform 1359 * @atomicservice 1360 * @since 12 1361 */ 1362 function closeCustomDialog(dialogId: number): void; 1363 1364 /** 1365 * Displays the menu. 1366 * 1367 * @param { ActionMenuOptions } options - Options. 1368 * @param { AsyncCallback<ActionMenuSuccessResponse> } callback - the callback of showActionMenu. 1369 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1370 * <br> 1. Mandatory parameters are left unspecified. 1371 * <br> 2. Incorrect parameters types. 1372 * <br> 3. Parameter verification failed. 1373 * @throws { BusinessError } 100001 - Internal error. 1374 * @syscap SystemCapability.ArkUI.ArkUI.Full 1375 * @since 9 1376 */ 1377 /** 1378 * Displays the menu. 1379 * 1380 * @param { ActionMenuOptions } options - Options. 1381 * @param { AsyncCallback<ActionMenuSuccessResponse> } callback - the callback of showActionMenu. 1382 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1383 * <br> 1. Mandatory parameters are left unspecified. 1384 * <br> 2. Incorrect parameters types. 1385 * <br> 3. Parameter verification failed. 1386 * @throws { BusinessError } 100001 - Internal error. 1387 * @syscap SystemCapability.ArkUI.ArkUI.Full 1388 * @crossplatform 1389 * @since 10 1390 */ 1391 /** 1392 * Displays the menu. 1393 * 1394 * @param { ActionMenuOptions } options - Options. 1395 * @param { AsyncCallback<ActionMenuSuccessResponse> } callback - the callback of showActionMenu. 1396 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1397 * <br> 1. Mandatory parameters are left unspecified. 1398 * <br> 2. Incorrect parameters types. 1399 * <br> 3. Parameter verification failed. 1400 * @throws { BusinessError } 100001 - Internal error. 1401 * @syscap SystemCapability.ArkUI.ArkUI.Full 1402 * @crossplatform 1403 * @atomicservice 1404 * @since 11 1405 */ 1406 function showActionMenu(options: ActionMenuOptions, callback: AsyncCallback<ActionMenuSuccessResponse>): void; 1407 1408 /** 1409 * Displays the dialog box. 1410 * 1411 * @param { ActionMenuOptions } options - Options. 1412 * @returns { Promise<ActionMenuSuccessResponse> } the promise returned by the function. 1413 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1414 * <br> 1. Mandatory parameters are left unspecified. 1415 * <br> 2. Incorrect parameters types. 1416 * <br> 3. Parameter verification failed. 1417 * @throws { BusinessError } 100001 - Internal error. 1418 * @syscap SystemCapability.ArkUI.ArkUI.Full 1419 * @since 9 1420 */ 1421 /** 1422 * Displays the dialog box. 1423 * 1424 * @param { ActionMenuOptions } options - Options. 1425 * @returns { Promise<ActionMenuSuccessResponse> } the promise returned by the function. 1426 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1427 * <br> 1. Mandatory parameters are left unspecified. 1428 * <br> 2. Incorrect parameters types. 1429 * <br> 3. Parameter verification failed. 1430 * @throws { BusinessError } 100001 - Internal error. 1431 * @syscap SystemCapability.ArkUI.ArkUI.Full 1432 * @crossplatform 1433 * @since 10 1434 */ 1435 /** 1436 * Displays the dialog box. 1437 * 1438 * @param { ActionMenuOptions } options - Options. 1439 * @returns { Promise<ActionMenuSuccessResponse> } the promise returned by the function. 1440 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1441 * <br> 1. Mandatory parameters are left unspecified. 1442 * <br> 2. Incorrect parameters types. 1443 * <br> 3. Parameter verification failed. 1444 * @throws { BusinessError } 100001 - Internal error. 1445 * @syscap SystemCapability.ArkUI.ArkUI.Full 1446 * @crossplatform 1447 * @atomicservice 1448 * @since 11 1449 */ 1450 function showActionMenu(options: ActionMenuOptions): Promise<ActionMenuSuccessResponse>; 1451} 1452 1453/** 1454 * Component dialog dismiss action. 1455 * 1456 * @interface DismissDialogAction 1457 * @syscap SystemCapability.ArkUI.ArkUI.Full 1458 * @crossplatform 1459 * @atomicservice 1460 * @since 12 1461 */ 1462declare interface DismissDialogAction { 1463 /** 1464 * Defines dialog dismiss function. 1465 * 1466 * @type { Callback<void> } 1467 * @syscap SystemCapability.ArkUI.ArkUI.Full 1468 * @crossplatform 1469 * @atomicservice 1470 * @since 12 1471 */ 1472 dismiss: Callback<void>; 1473 1474 /** 1475 * Dismiss reason type. 1476 * 1477 * @type { DismissReason } 1478 * @syscap SystemCapability.ArkUI.ArkUI.Full 1479 * @crossplatform 1480 * @atomicservice 1481 * @since 12 1482 */ 1483 reason: DismissReason; 1484} 1485 1486export default promptAction; 1487