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 * The information of sheet. 23 * 24 * @interface SheetInfo 25 * @syscap SystemCapability.ArkUI.ArkUI.Full 26 * @since 8 27 */ 28/** 29 * The information of sheet. 30 * 31 * @interface SheetInfo 32 * @syscap SystemCapability.ArkUI.ArkUI.Full 33 * @crossplatform 34 * @since 10 35 */ 36/** 37 * The information of sheet. 38 * 39 * @interface SheetInfo 40 * @syscap SystemCapability.ArkUI.ArkUI.Full 41 * @crossplatform 42 * @atomicservice 43 * @since 11 44 */ 45interface SheetInfo { 46 /** 47 * Title Properties 48 * 49 * @type { string | Resource } 50 * @syscap SystemCapability.ArkUI.ArkUI.Full 51 * @since 8 52 */ 53 /** 54 * Title Properties 55 * 56 * @type { string | Resource } 57 * @syscap SystemCapability.ArkUI.ArkUI.Full 58 * @crossplatform 59 * @since 10 60 */ 61 /** 62 * Title Properties 63 * 64 * @type { string | Resource } 65 * @syscap SystemCapability.ArkUI.ArkUI.Full 66 * @crossplatform 67 * @atomicservice 68 * @since 11 69 */ 70 title: string | Resource; 71 72 /** 73 * Icon Properties. 74 * 75 * @type { ?(string | Resource) } 76 * @syscap SystemCapability.ArkUI.ArkUI.Full 77 * @since 8 78 */ 79 /** 80 * Icon Properties. 81 * 82 * @type { ?(string | Resource) } 83 * @syscap SystemCapability.ArkUI.ArkUI.Full 84 * @crossplatform 85 * @since 10 86 */ 87 /** 88 * Icon Properties. 89 * 90 * @type { ?(string | Resource) } 91 * @syscap SystemCapability.ArkUI.ArkUI.Full 92 * @crossplatform 93 * @atomicservice 94 * @since 11 95 */ 96 icon?: string | Resource; 97 98 /** 99 * Callback method after the operation. 100 * 101 * @type { function } 102 * @syscap SystemCapability.ArkUI.ArkUI.Full 103 * @since 8 104 */ 105 /** 106 * Callback method after the operation. 107 * 108 * @type { function } 109 * @syscap SystemCapability.ArkUI.ArkUI.Full 110 * @crossplatform 111 * @since 10 112 */ 113 /** 114 * Callback method after the operation. 115 * 116 * @type { function } 117 * @syscap SystemCapability.ArkUI.ArkUI.Full 118 * @crossplatform 119 * @atomicservice 120 * @since 11 121 */ 122 /** 123 * Callback method after the operation. 124 * 125 * @type { VoidCallback } 126 * @syscap SystemCapability.ArkUI.ArkUI.Full 127 * @crossplatform 128 * @atomicservice 129 * @since 13 130 */ 131 action: VoidCallback; 132} 133 134/** 135 * Component dialog dismiss action. 136 * 137 * @interface DismissDialogAction 138 * @syscap SystemCapability.ArkUI.ArkUI.Full 139 * @crossplatform 140 * @atomicservice 141 * @since 12 142 */ 143declare interface DismissDialogAction { 144 /** 145 * Defines dialog dismiss function. 146 * 147 * @type { Callback<void> } 148 * @syscap SystemCapability.ArkUI.ArkUI.Full 149 * @crossplatform 150 * @atomicservice 151 * @since 12 152 */ 153 dismiss: Callback<void>; 154 155 /** 156 * Dismiss reason type. 157 * 158 * @type { DismissReason } 159 * @syscap SystemCapability.ArkUI.ArkUI.Full 160 * @crossplatform 161 * @atomicservice 162 * @since 12 163 */ 164 reason: DismissReason; 165} 166 167/** 168 * Base button params used for ActionSheet. 169 * 170 * @interface ActionSheetButtonOptions 171 * @syscap SystemCapability.ArkUI.ArkUI.Full 172 * @crossplatform 173 * @atomicservice 174 * @since 13 175 */ 176interface ActionSheetButtonOptions { 177 /** 178 * Enable switch of confirmation button 179 * @type { ?boolean } 180 * @default true 181 * @syscap SystemCapability.ArkUI.ArkUI.Full 182 * @crossplatform 183 * @since 10 184 */ 185 /** 186 * Enable switch of confirmation button 187 * @type { ?boolean } 188 * @default true 189 * @syscap SystemCapability.ArkUI.ArkUI.Full 190 * @crossplatform 191 * @atomicservice 192 * @since 11 193 */ 194 enabled?: boolean; 195 196 /** 197 * Default focus switch of confirmation button 198 * @type { ?boolean } 199 * @default false 200 * @syscap SystemCapability.ArkUI.ArkUI.Full 201 * @crossplatform 202 * @since 10 203 */ 204 /** 205 * Default focus switch of confirmation button 206 * @type { ?boolean } 207 * @default false 208 * @syscap SystemCapability.ArkUI.ArkUI.Full 209 * @crossplatform 210 * @atomicservice 211 * @since 11 212 */ 213 defaultFocus?: boolean; 214 215 /** 216 * Style of confirmation button. 217 * @type { ?DialogButtonStyle } 218 * @default DialogButtonStyle.DEFAULT 219 * @syscap SystemCapability.ArkUI.ArkUI.Full 220 * @crossplatform 221 * @since 10 222 */ 223 /** 224 * Style of confirmation button. 225 * @type { ?DialogButtonStyle } 226 * @default DialogButtonStyle.DEFAULT 227 * @syscap SystemCapability.ArkUI.ArkUI.Full 228 * @crossplatform 229 * @atomicservice 230 * @since 11 231 */ 232 style?: DialogButtonStyle; 233 234 /** 235 * Text content of the confirmation button. 236 * 237 * @type { string | Resource } 238 * @syscap SystemCapability.ArkUI.ArkUI.Full 239 * @since 8 240 */ 241 /** 242 * Text content of the confirmation button. 243 * 244 * @type { string | Resource } 245 * @syscap SystemCapability.ArkUI.ArkUI.Full 246 * @crossplatform 247 * @since 10 248 */ 249 /** 250 * Text content of the confirmation button. 251 * 252 * @type { string | Resource } 253 * @syscap SystemCapability.ArkUI.ArkUI.Full 254 * @crossplatform 255 * @atomicservice 256 * @since 11 257 */ 258 value: string | Resource; 259 260 /** 261 * Method executed by the callback. 262 * 263 * @type { function } 264 * @syscap SystemCapability.ArkUI.ArkUI.Full 265 * @since 8 266 */ 267 /** 268 * Method executed by the callback. 269 * 270 * @type { function } 271 * @syscap SystemCapability.ArkUI.ArkUI.Full 272 * @crossplatform 273 * @since 10 274 */ 275 /** 276 * Method executed by the callback. 277 * 278 * @type { function } 279 * @syscap SystemCapability.ArkUI.ArkUI.Full 280 * @crossplatform 281 * @atomicservice 282 * @since 11 283 */ 284 /** 285 * Method executed by the callback. 286 * 287 * @type { VoidCallback } 288 * @syscap SystemCapability.ArkUI.ArkUI.Full 289 * @crossplatform 290 * @atomicservice 291 * @since 13 292 */ 293 action: VoidCallback; 294} 295 296/** 297 * ActionSheet offset. 298 * 299 * @interface ActionSheetOffset 300 * @syscap SystemCapability.ArkUI.ArkUI.Full 301 * @crossplatform 302 * @atomicservice 303 * @since 13 304 */ 305interface ActionSheetOffset { 306 /** 307 * Dx of the pop-up window relative to the alignment position. 308 * 309 * @type { number | string | Resource } 310 * @syscap SystemCapability.ArkUI.ArkUI.Full 311 * @crossplatform 312 * @atomicservice 313 * @since 13 314 */ 315 dx: number | string | Resource; 316 /** 317 * Dy of the pop-up window relative to the alignment position. 318 * 319 * @type { number | string | Resource } 320 * @syscap SystemCapability.ArkUI.ArkUI.Full 321 * @crossplatform 322 * @atomicservice 323 * @since 13 324 */ 325 dy: number | string | Resource; 326} 327 328/** 329 * The options of ActionSheet. 330 * 331 * @interface ActionSheetOptions 332 * @syscap SystemCapability.ArkUI.ArkUI.Full 333 * @since 8 334 */ 335/** 336 * The options of ActionSheet. 337 * 338 * @interface ActionSheetOptions 339 * @syscap SystemCapability.ArkUI.ArkUI.Full 340 * @crossplatform 341 * @since 10 342 */ 343/** 344 * The options of ActionSheet. 345 * 346 * @interface ActionSheetOptions 347 * @syscap SystemCapability.ArkUI.ArkUI.Full 348 * @crossplatform 349 * @atomicservice 350 * @since 11 351 */ 352interface ActionSheetOptions 353{ 354 /** 355 * Title Properties 356 * 357 * @type { string | Resource } 358 * @syscap SystemCapability.ArkUI.ArkUI.Full 359 * @since 8 360 */ 361 /** 362 * Title Properties 363 * 364 * @type { string | Resource } 365 * @syscap SystemCapability.ArkUI.ArkUI.Full 366 * @crossplatform 367 * @since 10 368 */ 369 /** 370 * Title Properties 371 * 372 * @type { string | Resource } 373 * @syscap SystemCapability.ArkUI.ArkUI.Full 374 * @crossplatform 375 * @atomicservice 376 * @since 11 377 */ 378 title: string | Resource; 379 380 /** 381 * Subtitle Properties 382 * @type { ?ResourceStr } 383 * @syscap SystemCapability.ArkUI.ArkUI.Full 384 * @crossplatform 385 * @since 10 386 */ 387 /** 388 * Subtitle Properties 389 * @type { ?ResourceStr } 390 * @syscap SystemCapability.ArkUI.ArkUI.Full 391 * @crossplatform 392 * @atomicservice 393 * @since 11 394 */ 395 subtitle?: ResourceStr; 396 397 /** 398 * message Properties 399 * 400 * @type { string | Resource } 401 * @syscap SystemCapability.ArkUI.ArkUI.Full 402 * @since 8 403 */ 404 /** 405 * message Properties 406 * 407 * @type { string | Resource } 408 * @syscap SystemCapability.ArkUI.ArkUI.Full 409 * @crossplatform 410 * @since 10 411 */ 412 /** 413 * message Properties 414 * 415 * @type { string | Resource } 416 * @syscap SystemCapability.ArkUI.ArkUI.Full 417 * @crossplatform 418 * @atomicservice 419 * @since 11 420 */ 421 message: string | Resource; 422 423 /** 424 * Invoke the commit function. 425 * 426 * @type { ?object } 427 * @syscap SystemCapability.ArkUI.ArkUI.Full 428 * @since 8 429 */ 430 /** 431 * Invoke the commit function. 432 * 433 * @type { ?object } 434 * @syscap SystemCapability.ArkUI.ArkUI.Full 435 * @crossplatform 436 * @since 10 437 */ 438 /** 439 * Invoke the commit function. 440 * 441 * @type { ?object } 442 * @syscap SystemCapability.ArkUI.ArkUI.Full 443 * @crossplatform 444 * @atomicservice 445 * @since 11 446 */ 447 /** 448 * Invoke the commit function. 449 * 450 * @type { ?ActionSheetButtonOptions } 451 * @syscap SystemCapability.ArkUI.ArkUI.Full 452 * @crossplatform 453 * @atomicservice 454 * @since 13 455 */ 456 confirm?: ActionSheetButtonOptions; 457 458 /** 459 * Execute Cancel Function. 460 * 461 * @type { ?function } 462 * @syscap SystemCapability.ArkUI.ArkUI.Full 463 * @since 8 464 */ 465 /** 466 * Execute Cancel Function. 467 * 468 * @type { ?function } 469 * @syscap SystemCapability.ArkUI.ArkUI.Full 470 * @crossplatform 471 * @since 10 472 */ 473 /** 474 * Execute Cancel Function. 475 * 476 * @type { ?function } 477 * @syscap SystemCapability.ArkUI.ArkUI.Full 478 * @crossplatform 479 * @atomicservice 480 * @since 11 481 */ 482 /** 483 * Execute Cancel Function. 484 * 485 * @type { ?VoidCallback } 486 * @syscap SystemCapability.ArkUI.ArkUI.Full 487 * @crossplatform 488 * @atomicservice 489 * @since 13 490 */ 491 cancel?: VoidCallback; 492 493 /** 494 * The Array of sheets 495 * 496 * @type { Array<SheetInfo> } 497 * @syscap SystemCapability.ArkUI.ArkUI.Full 498 * @since 8 499 */ 500 /** 501 * The Array of sheets 502 * 503 * @type { Array<SheetInfo> } 504 * @syscap SystemCapability.ArkUI.ArkUI.Full 505 * @crossplatform 506 * @since 10 507 */ 508 /** 509 * The Array of sheets 510 * 511 * @type { Array<SheetInfo> } 512 * @syscap SystemCapability.ArkUI.ArkUI.Full 513 * @crossplatform 514 * @atomicservice 515 * @since 11 516 */ 517 sheets: Array<SheetInfo>; 518 519 /** 520 * Allows users to click the mask layer to exit. 521 * 522 * @type { ?boolean } 523 * @syscap SystemCapability.ArkUI.ArkUI.Full 524 * @since 8 525 */ 526 /** 527 * Allows users to click the mask layer to exit. 528 * 529 * @type { ?boolean } 530 * @syscap SystemCapability.ArkUI.ArkUI.Full 531 * @crossplatform 532 * @since 10 533 */ 534 /** 535 * Allows users to click the mask layer to exit. 536 * 537 * @type { ?boolean } 538 * @syscap SystemCapability.ArkUI.ArkUI.Full 539 * @crossplatform 540 * @atomicservice 541 * @since 11 542 */ 543 autoCancel?: boolean; 544 545 /** 546 * Alignment in the vertical direction. 547 * 548 * @type { ?DialogAlignment } 549 * @syscap SystemCapability.ArkUI.ArkUI.Full 550 * @since 8 551 */ 552 /** 553 * Alignment in the vertical direction. 554 * 555 * @type { ?DialogAlignment } 556 * @syscap SystemCapability.ArkUI.ArkUI.Full 557 * @crossplatform 558 * @since 10 559 */ 560 /** 561 * Alignment in the vertical direction. 562 * 563 * @type { ?DialogAlignment } 564 * @syscap SystemCapability.ArkUI.ArkUI.Full 565 * @crossplatform 566 * @atomicservice 567 * @since 11 568 */ 569 alignment?: DialogAlignment; 570 571 /** 572 * Offset of the pop-up window relative to the alignment position. 573 * 574 * @type { ?object } 575 * @syscap SystemCapability.ArkUI.ArkUI.Full 576 * @since 8 577 */ 578 /** 579 * Offset of the pop-up window relative to the alignment position. 580 * 581 * @type { ?object } 582 * @syscap SystemCapability.ArkUI.ArkUI.Full 583 * @crossplatform 584 * @since 10 585 */ 586 /** 587 * Offset of the pop-up window relative to the alignment position. 588 * 589 * @type { ?object } 590 * @syscap SystemCapability.ArkUI.ArkUI.Full 591 * @crossplatform 592 * @atomicservice 593 * @since 11 594 */ 595 /** 596 * Offset of the pop-up window relative to the alignment position. 597 * 598 * @type { ?ActionSheetOffset } 599 * @syscap SystemCapability.ArkUI.ArkUI.Full 600 * @crossplatform 601 * @atomicservice 602 * @since 13 603 */ 604 offset?: ActionSheetOffset; 605 606 /** 607 * Mask Region of dialog. The size cannot exceed the main window. 608 * 609 * @type { ?Rectangle } 610 * @syscap SystemCapability.ArkUI.ArkUI.Full 611 * @crossplatform 612 * @since 10 613 */ 614 /** 615 * Mask Region of dialog. The size cannot exceed the main window. 616 * 617 * @type { ?Rectangle } 618 * @syscap SystemCapability.ArkUI.ArkUI.Full 619 * @crossplatform 620 * @atomicservice 621 * @since 11 622 */ 623 maskRect?: Rectangle; 624 625 /** 626 * Whether to display in the sub window. 627 * 628 * @type { ?boolean } 629 * @default false 630 * @syscap SystemCapability.ArkUI.ArkUI.Full 631 * @crossplatform 632 * @since 11 633 */ 634 /** 635 * Whether to display in the sub window. 636 * 637 * @type { ?boolean } 638 * @default false 639 * @syscap SystemCapability.ArkUI.ArkUI.Full 640 * @crossplatform 641 * @atomicservice 642 * @since 12 643 */ 644 showInSubWindow?: boolean; 645 646 /** 647 * Whether it is a modal dialog 648 * @type { ?boolean } 649 * @default true 650 * @syscap SystemCapability.ArkUI.ArkUI.Full 651 * @crossplatform 652 * @since 11 653 */ 654 /** 655 * Whether it is a modal dialog 656 * @type { ?boolean } 657 * @default true 658 * @syscap SystemCapability.ArkUI.ArkUI.Full 659 * @crossplatform 660 * @atomicservice 661 * @since 12 662 */ 663 isModal?: boolean; 664 665 /** 666 * Defines the actionSheet's background color 667 * 668 * @type { ?ResourceColor } 669 * @default Color.Transparent 670 * @syscap SystemCapability.ArkUI.ArkUI.Full 671 * @crossplatform 672 * @since 11 673 */ 674 /** 675 * Defines the actionSheet's background color 676 * 677 * @type { ?ResourceColor } 678 * @default Color.Transparent 679 * @syscap SystemCapability.ArkUI.ArkUI.Full 680 * @crossplatform 681 * @atomicservice 682 * @since 12 683 */ 684 backgroundColor?: ResourceColor; 685 686 /** 687 * Defines the actionSheet's background blur Style 688 * 689 * @type { ?BlurStyle } 690 * @default BlurStyle.COMPONENT_ULTRA_THICK 691 * @syscap SystemCapability.ArkUI.ArkUI.Full 692 * @crossplatform 693 * @since 11 694 */ 695 /** 696 * Defines the actionSheet's background blur Style 697 * 698 * @type { ?BlurStyle } 699 * @default BlurStyle.COMPONENT_ULTRA_THICK 700 * @syscap SystemCapability.ArkUI.ArkUI.Full 701 * @crossplatform 702 * @atomicservice 703 * @since 12 704 */ 705 backgroundBlurStyle?: BlurStyle; 706 707 /** 708 * Callback function when the actionSheet interactive dismiss 709 * 710 * @type { ?Callback<DismissDialogAction> } 711 * @syscap SystemCapability.ArkUI.ArkUI.Full 712 * @crossplatform 713 * @atomicservice 714 * @since 12 715 */ 716 onWillDismiss?: Callback<DismissDialogAction>; 717 718 /** 719 * Transition parameters of opening/closing ActionSheet. 720 * 721 * @type { ?TransitionEffect } 722 * @syscap SystemCapability.ArkUI.ArkUI.Full 723 * @crossplatform 724 * @atomicservice 725 * @since 12 726 */ 727 transition?: TransitionEffect; 728 729 /** 730 * Defines the actionSheet's corner radius. 731 * 732 * @type { ?(Dimension | BorderRadiuses | LocalizedBorderRadiuses) } 733 * @syscap SystemCapability.ArkUI.ArkUI.Full 734 * @crossplatform 735 * @atomicservice 736 * @since 12 737 */ 738 cornerRadius?: Dimension | BorderRadiuses | LocalizedBorderRadiuses; 739 740 /** 741 * Defines the actionSheet's width. 742 * 743 * @type { ?Dimension } 744 * @syscap SystemCapability.ArkUI.ArkUI.Full 745 * @crossplatform 746 * @atomicservice 747 * @since 12 748 */ 749 width?: Dimension; 750 751 /** 752 * Defines the actionSheet's height. 753 * 754 * @type { ?Dimension } 755 * @syscap SystemCapability.ArkUI.ArkUI.Full 756 * @crossplatform 757 * @atomicservice 758 * @since 12 759 */ 760 height?: Dimension; 761 762 /** 763 * Defines the actionSheet's border width. 764 * 765 * @type { ?(Dimension | EdgeWidths | LocalizedEdgeWidths) } 766 * @syscap SystemCapability.ArkUI.ArkUI.Full 767 * @crossplatform 768 * @atomicservice 769 * @since 12 770 */ 771 borderWidth?: Dimension | EdgeWidths | LocalizedEdgeWidths; 772 773 /** 774 * Defines the actionSheet's border color. 775 * 776 * @type { ?(ResourceColor | EdgeColors | LocalizedEdgeColors) } 777 * @syscap SystemCapability.ArkUI.ArkUI.Full 778 * @crossplatform 779 * @atomicservice 780 * @since 12 781 */ 782 borderColor?: ResourceColor | EdgeColors | LocalizedEdgeColors; 783 784 /** 785 * Defines the actionSheet's border style. 786 * 787 * @type { ?(BorderStyle | EdgeStyles) } 788 * @syscap SystemCapability.ArkUI.ArkUI.Full 789 * @crossplatform 790 * @atomicservice 791 * @since 12 792 */ 793 borderStyle?: BorderStyle | EdgeStyles; 794 795 /** 796 * Defines the actionSheet's shadow. 797 * 798 * @type { ?(ShadowOptions | ShadowStyle) } 799 * @syscap SystemCapability.ArkUI.ArkUI.Full 800 * @crossplatform 801 * @atomicservice 802 * @since 12 803 */ 804 shadow?: ShadowOptions | ShadowStyle; 805 806 /** 807 * Defines whether to respond to the hover mode. 808 * 809 * @type { ?boolean } 810 * @default false 811 * @syscap SystemCapability.ArkUI.ArkUI.Full 812 * @crossplatform 813 * @atomicservice 814 * @since 13 815 */ 816 enableHoverMode?: boolean; 817 818 /** 819 * Defines the actionSheet's display area in hover mode. 820 * 821 * @type { ?HoverModeAreaType } 822 * @default HoverModeAreaType.BOTTOM_SCREEN 823 * @syscap SystemCapability.ArkUI.ArkUI.Full 824 * @crossplatform 825 * @atomicservice 826 * @since 13 827 */ 828 hoverModeArea?: HoverModeAreaType; 829} 830 831/** 832 * Declare the ActionSheet 833 * 834 * @syscap SystemCapability.ArkUI.ArkUI.Full 835 * @since 8 836 */ 837/** 838 * Declare the ActionSheet 839 * 840 * @syscap SystemCapability.ArkUI.ArkUI.Full 841 * @crossplatform 842 * @since 10 843 */ 844/** 845 * Declare the ActionSheet 846 * 847 * @syscap SystemCapability.ArkUI.ArkUI.Full 848 * @crossplatform 849 * @atomicservice 850 * @since 11 851 */ 852declare class ActionSheet { 853 /** 854 * Invoking method display. 855 * 856 * @param { ActionSheetOptions } value 857 * @syscap SystemCapability.ArkUI.ArkUI.Full 858 * @since 8 859 */ 860 /** 861 * Invoking method display. 862 * 863 * @param { ActionSheetOptions } value 864 * @syscap SystemCapability.ArkUI.ArkUI.Full 865 * @crossplatform 866 * @since 10 867 */ 868 /** 869 * Invoking method display. 870 * 871 * @param { ActionSheetOptions } value 872 * @syscap SystemCapability.ArkUI.ArkUI.Full 873 * @crossplatform 874 * @atomicservice 875 * @since 11 876 */ 877 static show(value: ActionSheetOptions); 878} 879