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/** 484 * Component dialog dismiss action. 485 * 486 * @interface DismissDialogAction 487 * @syscap SystemCapability.ArkUI.ArkUI.Full 488 * @crossplatform 489 * @atomicservice 490 * @since 12 491 */ 492declare interface DismissDialogAction { 493 /** 494 * Defines dialog dismiss function 495 * 496 * @type { Callback<void> } 497 * @syscap SystemCapability.ArkUI.ArkUI.Full 498 * @crossplatform 499 * @atomicservice 500 * @since 12 501 */ 502 dismiss: Callback<void>; 503 504 /** 505 * Dismiss reason type. 506 * 507 * @type { DismissReason } 508 * @syscap SystemCapability.ArkUI.ArkUI.Full 509 * @crossplatform 510 * @atomicservice 511 * @since 12 512 */ 513 reason: DismissReason; 514} 515 516/** 517 * Use the CustomDialogController class to display the custom pop-up window. 518 * 519 * @syscap SystemCapability.ArkUI.ArkUI.Full 520 * @since 7 521 */ 522/** 523 * Use the CustomDialogController class to display the custom pop-up window. 524 * 525 * @syscap SystemCapability.ArkUI.ArkUI.Full 526 * @crossplatform 527 * @since 10 528 */ 529/** 530 * Use the CustomDialogController class to display the custom pop-up window. 531 * 532 * @syscap SystemCapability.ArkUI.ArkUI.Full 533 * @crossplatform 534 * @atomicservice 535 * @since 11 536 */ 537declare class CustomDialogController { 538 /** 539 * The constructor transfers parameter settings. 540 * 541 * @param { CustomDialogControllerOptions } value 542 * @syscap SystemCapability.ArkUI.ArkUI.Full 543 * @since 7 544 */ 545 /** 546 * The constructor transfers parameter settings. 547 * 548 * @param { CustomDialogControllerOptions } value 549 * @syscap SystemCapability.ArkUI.ArkUI.Full 550 * @crossplatform 551 * @since 10 552 */ 553 /** 554 * The constructor transfers parameter settings. 555 * 556 * @param { CustomDialogControllerOptions } value 557 * @syscap SystemCapability.ArkUI.ArkUI.Full 558 * @crossplatform 559 * @atomicservice 560 * @since 11 561 */ 562 constructor(value: CustomDialogControllerOptions); 563 564 /** 565 * Display the content of the customized pop-up window. If the content has been displayed, it does not take effect. 566 * 567 * @syscap SystemCapability.ArkUI.ArkUI.Full 568 * @since 7 569 */ 570 /** 571 * Display the content of the customized pop-up window. If the content has been displayed, it does not take effect. 572 * 573 * @syscap SystemCapability.ArkUI.ArkUI.Full 574 * @crossplatform 575 * @since 10 576 */ 577 /** 578 * Display the content of the customized pop-up window. If the content has been displayed, it does not take effect. 579 * 580 * @syscap SystemCapability.ArkUI.ArkUI.Full 581 * @crossplatform 582 * @atomicservice 583 * @since 11 584 */ 585 open(); 586 587 /** 588 * Closes the custom pop-up window. If the window is closed, the window does not take effect. 589 * 590 * @syscap SystemCapability.ArkUI.ArkUI.Full 591 * @since 7 592 */ 593 /** 594 * Closes the custom pop-up window. If the window is closed, the window does not take effect. 595 * 596 * @syscap SystemCapability.ArkUI.ArkUI.Full 597 * @crossplatform 598 * @since 10 599 */ 600 /** 601 * Closes the custom pop-up window. If the window is closed, the window does not take effect. 602 * 603 * @syscap SystemCapability.ArkUI.ArkUI.Full 604 * @crossplatform 605 * @atomicservice 606 * @since 11 607 */ 608 close(); 609} 610