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 * Defines the options of CustomDialogController. 23 * 24 * @interface CustomDialogControllerOptions 25 * @syscap SystemCapability.ArkUI.ArkUI.Full 26 * @since 7 27 */ 28/** 29 * Defines the options of CustomDialogController. 30 * 31 * @interface CustomDialogControllerOptions 32 * @syscap SystemCapability.ArkUI.ArkUI.Full 33 * @crossplatform 34 * @since 10 35 */ 36/** 37 * Defines the options of CustomDialogController. 38 * 39 * @interface CustomDialogControllerOptions 40 * @syscap SystemCapability.ArkUI.ArkUI.Full 41 * @crossplatform 42 * @atomicservice 43 * @since 11 44 */ 45declare interface CustomDialogControllerOptions { 46 /** 47 * Custom builder function. 48 * 49 * @type { any } 50 * @syscap SystemCapability.ArkUI.ArkUI.Full 51 * @since 7 52 */ 53 /** 54 * Custom builder function. 55 * 56 * @type { any } 57 * @syscap SystemCapability.ArkUI.ArkUI.Full 58 * @crossplatform 59 * @since 10 60 */ 61 /** 62 * Custom builder function. 63 * 64 * @type { any } 65 * @syscap SystemCapability.ArkUI.ArkUI.Full 66 * @crossplatform 67 * @atomicservice 68 * @since 11 69 */ 70 builder: any; 71 72 /** 73 * Defines the cancel function. 74 * 75 * @type { ?function } 76 * @syscap SystemCapability.ArkUI.ArkUI.Full 77 * @since 7 78 */ 79 /** 80 * Defines the cancel function. 81 * 82 * @type { ?function } 83 * @syscap SystemCapability.ArkUI.ArkUI.Full 84 * @crossplatform 85 * @since 10 86 */ 87 /** 88 * Defines the cancel function. 89 * 90 * @type { ?function } 91 * @syscap SystemCapability.ArkUI.ArkUI.Full 92 * @crossplatform 93 * @atomicservice 94 * @since 11 95 */ 96 cancel?: () => void; 97 98 /** 99 * Defines if use auto cancel when click on the outside of the dialog. 100 * 101 * @type { ?boolean } 102 * @syscap SystemCapability.ArkUI.ArkUI.Full 103 * @since 7 104 */ 105 /** 106 * Defines if use auto cancel when click on the outside of the dialog. 107 * 108 * @type { ?boolean } 109 * @syscap SystemCapability.ArkUI.ArkUI.Full 110 * @crossplatform 111 * @since 10 112 */ 113 /** 114 * Defines if use auto cancel when click on the outside of the dialog. 115 * 116 * @type { ?boolean } 117 * @syscap SystemCapability.ArkUI.ArkUI.Full 118 * @crossplatform 119 * @atomicservice 120 * @since 11 121 */ 122 autoCancel?: boolean; 123 124 /** 125 * Defines the dialog alignment of the screen. 126 * 127 * @type { ?DialogAlignment } 128 * @syscap SystemCapability.ArkUI.ArkUI.Full 129 * @since 7 130 */ 131 /** 132 * Defines the dialog alignment of the screen. 133 * 134 * @type { ?DialogAlignment } 135 * @syscap SystemCapability.ArkUI.ArkUI.Full 136 * @crossplatform 137 * @since 10 138 */ 139 /** 140 * Defines the dialog alignment of the screen. 141 * 142 * @type { ?DialogAlignment } 143 * @syscap SystemCapability.ArkUI.ArkUI.Full 144 * @crossplatform 145 * @atomicservice 146 * @since 11 147 */ 148 alignment?: DialogAlignment; 149 150 /** 151 * Defines the dialog offset. 152 * 153 * @type { ?Offset } 154 * @syscap SystemCapability.ArkUI.ArkUI.Full 155 * @since 7 156 */ 157 /** 158 * Defines the dialog offset. 159 * 160 * @type { ?Offset } 161 * @syscap SystemCapability.ArkUI.ArkUI.Full 162 * @crossplatform 163 * @since 10 164 */ 165 /** 166 * Defines the dialog offset. 167 * 168 * @type { ?Offset } 169 * @syscap SystemCapability.ArkUI.ArkUI.Full 170 * @crossplatform 171 * @atomicservice 172 * @since 11 173 */ 174 offset?: Offset; 175 176 /** 177 * Defines if use custom style. 178 * 179 * @type { ?boolean } 180 * @syscap SystemCapability.ArkUI.ArkUI.Full 181 * @since 7 182 */ 183 /** 184 * Defines if use custom style. 185 * 186 * @type { ?boolean } 187 * @syscap SystemCapability.ArkUI.ArkUI.Full 188 * @crossplatform 189 * @since 10 190 */ 191 /** 192 * Defines if use custom style. 193 * 194 * @type { ?boolean } 195 * @syscap SystemCapability.ArkUI.ArkUI.Full 196 * @crossplatform 197 * @atomicservice 198 * @since 11 199 */ 200 customStyle?: boolean; 201 202 /** 203 * Grid count of dialog. 204 * 205 * @type { ?number } 206 * @syscap SystemCapability.ArkUI.ArkUI.Full 207 * @since 8 208 */ 209 /** 210 * Grid count of dialog. 211 * 212 * @type { ?number } 213 * @syscap SystemCapability.ArkUI.ArkUI.Full 214 * @crossplatform 215 * @since 10 216 */ 217 /** 218 * Grid count of dialog. 219 * 220 * @type { ?number } 221 * @syscap SystemCapability.ArkUI.ArkUI.Full 222 * @crossplatform 223 * @atomicservice 224 * @since 11 225 */ 226 gridCount?: number; 227 228 /** 229 * Mask color of dialog. 230 * 231 * @type { ?ResourceColor } 232 * @syscap SystemCapability.ArkUI.ArkUI.Full 233 * @crossplatform 234 * @since 10 235 */ 236 /** 237 * Mask color of dialog. 238 * 239 * @type { ?ResourceColor } 240 * @syscap SystemCapability.ArkUI.ArkUI.Full 241 * @crossplatform 242 * @atomicservice 243 * @since 11 244 */ 245 maskColor?: ResourceColor; 246 247 /** 248 * Mask Region of dialog. The size cannot exceed the main window. 249 * 250 * @type { ?Rectangle } 251 * @syscap SystemCapability.ArkUI.ArkUI.Full 252 * @crossplatform 253 * @since 10 254 */ 255 /** 256 * Mask Region of dialog. The size cannot exceed the main window. 257 * 258 * @type { ?Rectangle } 259 * @syscap SystemCapability.ArkUI.ArkUI.Full 260 * @crossplatform 261 * @atomicservice 262 * @since 11 263 */ 264 maskRect?: Rectangle; 265 266 /** 267 * Animation parameters of dialog opening. 268 * 269 * @type { ?AnimateParam } 270 * @syscap SystemCapability.ArkUI.ArkUI.Full 271 * @crossplatform 272 * @since 10 273 */ 274 /** 275 * Animation parameters of dialog opening. 276 * 277 * @type { ?AnimateParam } 278 * @syscap SystemCapability.ArkUI.ArkUI.Full 279 * @crossplatform 280 * @atomicservice 281 * @since 11 282 */ 283 openAnimation?: AnimateParam; 284 285 /** 286 * Animation parameters of dialog closing. 287 * 288 * @type { ?AnimateParam } 289 * @syscap SystemCapability.ArkUI.ArkUI.Full 290 * @crossplatform 291 * @since 10 292 */ 293 /** 294 * Animation parameters of dialog closing. 295 * 296 * @type { ?AnimateParam } 297 * @syscap SystemCapability.ArkUI.ArkUI.Full 298 * @crossplatform 299 * @atomicservice 300 * @since 11 301 */ 302 closeAnimation?: AnimateParam; 303 304 /** 305 * Whether to display in the sub window. 306 * 307 * @type { ?boolean } 308 * @syscap SystemCapability.ArkUI.ArkUI.Full 309 * @crossplatform 310 * @since 10 311 */ 312 /** 313 * Whether to display in the sub window. 314 * 315 * @type { ?boolean } 316 * @default false 317 * @syscap SystemCapability.ArkUI.ArkUI.Full 318 * @crossplatform 319 * @atomicservice 320 * @since 11 321 */ 322 showInSubWindow?: boolean; 323 324 /** 325 * Background color of dialog. 326 * 327 * @type { ?ResourceColor } 328 * @syscap SystemCapability.ArkUI.ArkUI.Full 329 * @crossplatform 330 * @since 10 331 */ 332 /** 333 * Background color of dialog. 334 * 335 * @type { ?ResourceColor } 336 * @syscap SystemCapability.ArkUI.ArkUI.Full 337 * @crossplatform 338 * @atomicservice 339 * @since 11 340 */ 341 backgroundColor?: ResourceColor; 342 343 /** 344 * Corner radius of dialog. 345 * 346 * @type { ?(Dimension | BorderRadiuses) } 347 * @syscap SystemCapability.ArkUI.ArkUI.Full 348 * @crossplatform 349 * @since 10 350 */ 351 /** 352 * Corner radius of dialog. 353 * 354 * @type { ?(Dimension | BorderRadiuses) } 355 * @syscap SystemCapability.ArkUI.ArkUI.Full 356 * @crossplatform 357 * @atomicservice 358 * @since 11 359 */ 360 cornerRadius?: Dimension | BorderRadiuses; 361 362 /** 363 * Whether it is a modal dialog 364 * @type { ?boolean } 365 * @default true 366 * @syscap SystemCapability.ArkUI.ArkUI.Full 367 * @crossplatform 368 * @since 11 369 */ 370 /** 371 * Whether it is a modal dialog 372 * @type { ?boolean } 373 * @default true 374 * @syscap SystemCapability.ArkUI.ArkUI.Full 375 * @crossplatform 376 * @atomicservice 377 * @since 12 378 */ 379 isModal?: boolean; 380 381 /** 382 * Callback function when the CustomDialog interactive dismiss. 383 * 384 * @type { ?Callback<DismissDialogAction> } 385 * @syscap SystemCapability.ArkUI.ArkUI.Full 386 * @crossplatform 387 * @atomicservice 388 * @since 12 389 */ 390 onWillDismiss?: Callback<DismissDialogAction>; 391 392 /** 393 * Defines the custom dialog's width. 394 * 395 * @type { ?Dimension } 396 * @syscap SystemCapability.ArkUI.ArkUI.Full 397 * @crossplatform 398 * @atomicservice 399 * @since 12 400 */ 401 width?: Dimension; 402 403 /** 404 * Defines the custom dialog's height. 405 * 406 * @type { ?Dimension } 407 * @syscap SystemCapability.ArkUI.ArkUI.Full 408 * @crossplatform 409 * @atomicservice 410 * @since 12 411 */ 412 height?: Dimension; 413 414 /** 415 * Defines the custom dialog's border width. 416 * 417 * @type { ?(Dimension | EdgeWidths) } 418 * @syscap SystemCapability.ArkUI.ArkUI.Full 419 * @crossplatform 420 * @atomicservice 421 * @since 12 422 */ 423 borderWidth?: Dimension | EdgeWidths; 424 425 /** 426 * Defines the custom dialog's border color. 427 * 428 * @type { ?(ResourceColor | EdgeColors) } 429 * @syscap SystemCapability.ArkUI.ArkUI.Full 430 * @crossplatform 431 * @atomicservice 432 * @since 12 433 */ 434 borderColor?: ResourceColor | EdgeColors; 435 436 /** 437 * Defines the custom dialog's border style. 438 * 439 * @type { ?(BorderStyle | EdgeStyles) } 440 * @syscap SystemCapability.ArkUI.ArkUI.Full 441 * @crossplatform 442 * @atomicservice 443 * @since 12 444 */ 445 borderStyle?: BorderStyle | EdgeStyles; 446 447 /** 448 * Defines the custom dialog's shadow. 449 * 450 * @type { ?(ShadowOptions | ShadowStyle) } 451 * @syscap SystemCapability.ArkUI.ArkUI.Full 452 * @crossplatform 453 * @atomicservice 454 * @since 12 455 */ 456 shadow?: ShadowOptions | ShadowStyle; 457 458 /** 459 * Defines the customDialog's background blur Style 460 * 461 * @type { ?BlurStyle } 462 * @default BlurStyle.COMPONENT_ULTRA_THICK 463 * @syscap SystemCapability.ArkUI.ArkUI.Full 464 * @crossplatform 465 * @atomicservice 466 * @since 12 467 */ 468 backgroundBlurStyle?: BlurStyle; 469 470 /** 471 * Defines the customDialog's keyboard avoid mode 472 * 473 * @type { ?KeyboardAvoidMode } 474 * @default KeyboardAvoidMode.DEFAULT 475 * @syscap SystemCapability.ArkUI.ArkUI.Full 476 * @crossplatform 477 * @atomicservice 478 * @since 12 479 */ 480 keyboardAvoidMode?: KeyboardAvoidMode; 481 482 /** 483 * Defines whether to respond to the hover mode. 484 * 485 * @type { ?boolean } 486 * @default false 487 * @syscap SystemCapability.ArkUI.ArkUI.Full 488 * @crossplatform 489 * @atomicservice 490 * @since 14 491 */ 492 enableHoverMode?: boolean; 493 494 /** 495 * Defines the customDialog's display area in hover mode. 496 * 497 * @type { ?HoverModeAreaType } 498 * @default HoverModeAreaType.BOTTOM_SCREEN 499 * @syscap SystemCapability.ArkUI.ArkUI.Full 500 * @crossplatform 501 * @atomicservice 502 * @since 14 503 */ 504 hoverModeArea?: HoverModeAreaType; 505 506 /** 507 * Defines the distance between the customDialog and system keyboard. 508 * 509 * @type { ?LengthMetrics } 510 * @syscap SystemCapability.ArkUI.ArkUI.Full 511 * @crossplatform 512 * @atomicservice 513 * @since 15 514 */ 515 keyboardAvoidDistance?: LengthMetrics; 516 517 /** 518 * Determine the display level of the dialog. 519 * 520 * @type { ?LevelMode } 521 * @default LevelMode.OVERLAY 522 * @syscap SystemCapability.ArkUI.ArkUI.Full 523 * @crossplatform 524 * @atomicservice 525 * @since 15 526 */ 527 levelMode?: LevelMode; 528 529 /** 530 * The uniqueId of any node in the router or navigation page. 531 * 532 * @type { ?number } 533 * @syscap SystemCapability.ArkUI.ArkUI.Full 534 * @crossplatform 535 * @atomicservice 536 * @since 15 537 */ 538 levelUniqueId?: number; 539 540 /** 541 * Determine the immersive mode of the dialog. 542 * 543 * @type { ?ImmersiveMode } 544 * @default ImmersiveMode.DEFAULT 545 * @syscap SystemCapability.ArkUI.ArkUI.Full 546 * @crossplatform 547 * @atomicservice 548 * @since 15 549 */ 550 immersiveMode?: ImmersiveMode; 551} 552 553/** 554 * Component dialog dismiss action. 555 * 556 * @interface DismissDialogAction 557 * @syscap SystemCapability.ArkUI.ArkUI.Full 558 * @crossplatform 559 * @atomicservice 560 * @since 12 561 */ 562declare interface DismissDialogAction { 563 /** 564 * Defines dialog dismiss function 565 * 566 * @type { Callback<void> } 567 * @syscap SystemCapability.ArkUI.ArkUI.Full 568 * @crossplatform 569 * @atomicservice 570 * @since 12 571 */ 572 dismiss: Callback<void>; 573 574 /** 575 * Dismiss reason type. 576 * 577 * @type { DismissReason } 578 * @syscap SystemCapability.ArkUI.ArkUI.Full 579 * @crossplatform 580 * @atomicservice 581 * @since 12 582 */ 583 reason: DismissReason; 584} 585 586/** 587 * Use the CustomDialogController class to display the custom pop-up window. 588 * 589 * @syscap SystemCapability.ArkUI.ArkUI.Full 590 * @since 7 591 */ 592/** 593 * Use the CustomDialogController class to display the custom pop-up window. 594 * 595 * @syscap SystemCapability.ArkUI.ArkUI.Full 596 * @crossplatform 597 * @since 10 598 */ 599/** 600 * Use the CustomDialogController class to display the custom pop-up window. 601 * 602 * @syscap SystemCapability.ArkUI.ArkUI.Full 603 * @crossplatform 604 * @atomicservice 605 * @since 11 606 */ 607declare class CustomDialogController { 608 /** 609 * The constructor transfers parameter settings. 610 * 611 * @param { CustomDialogControllerOptions } value 612 * @syscap SystemCapability.ArkUI.ArkUI.Full 613 * @since 7 614 */ 615 /** 616 * The constructor transfers parameter settings. 617 * 618 * @param { CustomDialogControllerOptions } value 619 * @syscap SystemCapability.ArkUI.ArkUI.Full 620 * @crossplatform 621 * @since 10 622 */ 623 /** 624 * The constructor transfers parameter settings. 625 * 626 * @param { CustomDialogControllerOptions } value 627 * @syscap SystemCapability.ArkUI.ArkUI.Full 628 * @crossplatform 629 * @atomicservice 630 * @since 11 631 */ 632 constructor(value: CustomDialogControllerOptions); 633 634 /** 635 * Display the content of the customized pop-up window. If the content has been displayed, it does not take effect. 636 * 637 * @syscap SystemCapability.ArkUI.ArkUI.Full 638 * @since 7 639 */ 640 /** 641 * Display the content of the customized pop-up window. If the content has been displayed, it does not take effect. 642 * 643 * @syscap SystemCapability.ArkUI.ArkUI.Full 644 * @crossplatform 645 * @since 10 646 */ 647 /** 648 * Display the content of the customized pop-up window. If the content has been displayed, it does not take effect. 649 * 650 * @syscap SystemCapability.ArkUI.ArkUI.Full 651 * @crossplatform 652 * @atomicservice 653 * @since 11 654 */ 655 open(); 656 657 /** 658 * Closes the custom pop-up window. If the window is closed, the window does not take effect. 659 * 660 * @syscap SystemCapability.ArkUI.ArkUI.Full 661 * @since 7 662 */ 663 /** 664 * Closes the custom pop-up window. If the window is closed, the window does not take effect. 665 * 666 * @syscap SystemCapability.ArkUI.ArkUI.Full 667 * @crossplatform 668 * @since 10 669 */ 670 /** 671 * Closes the custom pop-up window. If the window is closed, the window does not take effect. 672 * 673 * @syscap SystemCapability.ArkUI.ArkUI.Full 674 * @crossplatform 675 * @atomicservice 676 * @since 11 677 */ 678 close(); 679} 680