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