1/* 2 * Copyright (c) 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 type { AsyncCallback, BusinessError, Callback } from './@ohos.base'; 24import type unifiedDataChannel from './@ohos.data.unifiedDataChannel'; 25 26/** 27 * This module allows developers to trigger a drag event. 28 * @namespace dragController 29 * @syscap SystemCapability.ArkUI.ArkUI.Full 30 * @since 10 31 */ 32/** 33 * This module allows developers to trigger a drag event. 34 * @namespace dragController 35 * @syscap SystemCapability.ArkUI.ArkUI.Full 36 * @atomicservice 37 * @since 12 38 */ 39/** 40 * This module allows developers to trigger a drag event. 41 * @namespace dragController 42 * @syscap SystemCapability.ArkUI.ArkUI.Full 43 * @crossplatform 44 * @atomicservice 45 * @since 18 46 */ 47declare namespace dragController { 48 /** 49 * Defines the Drag Status. 50 * 51 * @enum { number } 52 * @syscap SystemCapability.ArkUI.ArkUI.Full 53 * @since 11 54 */ 55 /** 56 * Defines the Drag Status. 57 * 58 * @enum { number } 59 * @syscap SystemCapability.ArkUI.ArkUI.Full 60 * @atomicservice 61 * @since 12 62 */ 63 /** 64 * Defines the Drag Status. 65 * 66 * @enum { number } 67 * @syscap SystemCapability.ArkUI.ArkUI.Full 68 * @crossplatform 69 * @atomicservice 70 * @since 18 71 */ 72 const enum DragStatus { 73 /** 74 * Drag has started. 75 * @syscap SystemCapability.ArkUI.ArkUI.Full 76 * @since 11 77 */ 78 /** 79 * Drag has started. 80 * @syscap SystemCapability.ArkUI.ArkUI.Full 81 * @atomicservice 82 * @since 12 83 */ 84 /** 85 * Drag has started. 86 * @syscap SystemCapability.ArkUI.ArkUI.Full 87 * @crossplatform 88 * @atomicservice 89 * @since 18 90 */ 91 STARTED = 0, 92 /** 93 * Drag has ended. 94 * @syscap SystemCapability.ArkUI.ArkUI.Full 95 * @since 11 96 */ 97 /** 98 * Drag has ended. 99 * @syscap SystemCapability.ArkUI.ArkUI.Full 100 * @atomicservice 101 * @since 12 102 */ 103 /** 104 * Drag has ended. 105 * @syscap SystemCapability.ArkUI.ArkUI.Full 106 * @crossplatform 107 * @atomicservice 108 * @since 18 109 */ 110 ENDED = 1, 111 } 112 113 /** 114 * Drag and drop information 115 * 116 * @interface DragAndDropInfo 117 * @syscap SystemCapability.ArkUI.ArkUI.Full 118 * @since 11 119 */ 120 /** 121 * Drag and drop information 122 * 123 * @interface DragAndDropInfo 124 * @syscap SystemCapability.ArkUI.ArkUI.Full 125 * @atomicservice 126 * @since 12 127 */ 128 /** 129 * Drag and drop information 130 * 131 * @interface DragAndDropInfo 132 * @syscap SystemCapability.ArkUI.ArkUI.Full 133 * @crossplatform 134 * @atomicservice 135 * @since 18 136 */ 137 interface DragAndDropInfo { 138 /** 139 * The drag status. 140 * @type { DragStatus } 141 * @syscap SystemCapability.ArkUI.ArkUI.Full 142 * @since 11 143 */ 144 /** 145 * The drag status. 146 * @type { DragStatus } 147 * @syscap SystemCapability.ArkUI.ArkUI.Full 148 * @atomicservice 149 * @since 12 150 */ 151 /** 152 * The drag status. 153 * @type { DragStatus } 154 * @syscap SystemCapability.ArkUI.ArkUI.Full 155 * @crossplatform 156 * @atomicservice 157 * @since 18 158 */ 159 status: DragStatus; 160 /** 161 * The information containing the drag event. 162 * @type { DragEvent } 163 * @syscap SystemCapability.ArkUI.ArkUI.Full 164 * @since 11 165 */ 166 /** 167 * The information containing the drag event. 168 * @type { DragEvent } 169 * @syscap SystemCapability.ArkUI.ArkUI.Full 170 * @atomicservice 171 * @since 12 172 */ 173 /** 174 * The information containing the drag event. 175 * @type { DragEvent } 176 * @syscap SystemCapability.ArkUI.ArkUI.Full 177 * @crossplatform 178 * @atomicservice 179 * @since 18 180 */ 181 event: DragEvent; 182 /** 183 * Additional information about the drag info. 184 * @type { ?string } 185 * @syscap SystemCapability.ArkUI.ArkUI.Full 186 * @since 11 187 */ 188 /** 189 * Additional information about the drag info. 190 * @type { ?string } 191 * @syscap SystemCapability.ArkUI.ArkUI.Full 192 * @atomicservice 193 * @since 12 194 */ 195 /** 196 * Additional information about the drag info. 197 * @type { ?string } 198 * @syscap SystemCapability.ArkUI.ArkUI.Full 199 * @crossplatform 200 * @atomicservice 201 * @since 18 202 */ 203 extraParams?: string; 204 } 205 206 /** 207 * One drag action object for drag process 208 * 209 * @interface DragAction 210 * @syscap SystemCapability.ArkUI.ArkUI.Full 211 * @since 11 212 */ 213 /** 214 * One drag action object for drag process 215 * 216 * @interface DragAction 217 * @syscap SystemCapability.ArkUI.ArkUI.Full 218 * @atomicservice 219 * @since 12 220 */ 221 /** 222 * One drag action object for drag process 223 * 224 * @interface DragAction 225 * @syscap SystemCapability.ArkUI.ArkUI.Full 226 * @crossplatform 227 * @atomicservice 228 * @since 18 229 */ 230 interface DragAction { 231 /** 232 * trigger drag action 233 * 234 * @returns { Promise<void> } A Promise can indicate the start result. 235 * @throws { BusinessError } 100001 - Internal handling failed. 236 * @syscap SystemCapability.ArkUI.ArkUI.Full 237 * @since 11 238 */ 239 /** 240 * trigger drag action 241 * 242 * @returns { Promise<void> } A Promise can indicate the start result. 243 * @throws { BusinessError } 100001 - Internal handling failed. 244 * @syscap SystemCapability.ArkUI.ArkUI.Full 245 * @atomicservice 246 * @since 12 247 */ 248 /** 249 * trigger drag action 250 * 251 * @returns { Promise<void> } A Promise can indicate the start result. 252 * @throws { BusinessError } 100001 - Internal handling failed. 253 * @syscap SystemCapability.ArkUI.ArkUI.Full 254 * @crossplatform 255 * @atomicservice 256 * @since 18 257 */ 258 startDrag(): Promise<void>; 259 /** 260 * Registers a callback for listening on drag status changes. 261 * This callback is triggered when the drag status change. 262 * 263 * @param { 'statusChange' } type for status changing 264 * @param { Callback<DragAndDropInfo> } callback with drag event and status information 265 * @syscap SystemCapability.ArkUI.ArkUI.Full 266 * @since 11 267 */ 268 /** 269 * Registers a callback for listening on drag status changes. 270 * This callback is triggered when the drag status change. 271 * 272 * @param { 'statusChange' } type for status changing 273 * @param { Callback<DragAndDropInfo> } callback with drag event and status information 274 * @syscap SystemCapability.ArkUI.ArkUI.Full 275 * @atomicservice 276 * @since 12 277 */ 278 /** 279 * Registers a callback for listening on drag status changes. 280 * This callback is triggered when the drag status change. 281 * 282 * @param { 'statusChange' } type for status changing 283 * @param { Callback<DragAndDropInfo> } callback with drag event and status information 284 * @syscap SystemCapability.ArkUI.ArkUI.Full 285 * @crossplatform 286 * @atomicservice 287 * @since 18 288 */ 289 on(type: 'statusChange', callback: Callback<DragAndDropInfo>): void; 290 291 /** 292 * Deregisters a callback for listening on drag status changes. 293 * This callback is not triggered when the drag status change. 294 * 295 * @param { 'statusChange' } type for status changing 296 * @param { Callback<DragAndDropInfo> } callback with drag event and status information 297 * @syscap SystemCapability.ArkUI.ArkUI.Full 298 * @since 11 299 */ 300 /** 301 * Deregisters a callback for listening on drag status changes. 302 * This callback is not triggered when the drag status change. 303 * 304 * @param { 'statusChange' } type for status changing 305 * @param { Callback<DragAndDropInfo> } callback with drag event and status information 306 * @syscap SystemCapability.ArkUI.ArkUI.Full 307 * @atomicservice 308 * @since 12 309 */ 310 /** 311 * Deregisters a callback for listening on drag status changes. 312 * This callback is not triggered when the drag status change. 313 * 314 * @param { 'statusChange' } type for status changing 315 * @param { Callback<DragAndDropInfo> } callback with drag event and status information 316 * @syscap SystemCapability.ArkUI.ArkUI.Full 317 * @crossplatform 318 * @atomicservice 319 * @since 18 320 */ 321 off(type: 'statusChange', callback?: Callback<DragAndDropInfo>): void; 322 } 323 324 /** 325 * DragInfo object description 326 * 327 * @interface DragInfo 328 * @syscap SystemCapability.ArkUI.ArkUI.Full 329 * @since 10 330 */ 331 /** 332 * DragInfo object description 333 * 334 * @interface DragInfo 335 * @syscap SystemCapability.ArkUI.ArkUI.Full 336 * @atomicservice 337 * @since 12 338 */ 339 /** 340 * DragInfo object description 341 * 342 * @interface DragInfo 343 * @syscap SystemCapability.ArkUI.ArkUI.Full 344 * @crossplatform 345 * @atomicservice 346 * @since 18 347 */ 348 interface DragInfo { 349 /** 350 * A unique identifier to identify which touch point. 351 * @type { number } 352 * @syscap SystemCapability.ArkUI.ArkUI.Full 353 * @since 10 354 */ 355 /** 356 * A unique identifier to identify which touch point. 357 * @type { number } 358 * @syscap SystemCapability.ArkUI.ArkUI.Full 359 * @atomicservice 360 * @since 12 361 */ 362 /** 363 * A unique identifier to identify which touch point. 364 * @type { number } 365 * @syscap SystemCapability.ArkUI.ArkUI.Full 366 * @crossplatform 367 * @atomicservice 368 * @since 18 369 */ 370 pointerId: number; 371 372 /** 373 * Drag data. 374 * @type { ?unifiedDataChannel.UnifiedData } 375 * @syscap SystemCapability.ArkUI.ArkUI.Full 376 * @since 10 377 */ 378 /** 379 * Drag data. 380 * @type { ?unifiedDataChannel.UnifiedData } 381 * @syscap SystemCapability.ArkUI.ArkUI.Full 382 * @atomicservice 383 * @since 12 384 */ 385 /** 386 * Drag data. 387 * @type { ?unifiedDataChannel.UnifiedData } 388 * @syscap SystemCapability.ArkUI.ArkUI.Full 389 * @crossplatform 390 * @atomicservice 391 * @since 18 392 */ 393 data?: unifiedDataChannel.UnifiedData; 394 395 /** 396 * Additional information about the drag info. 397 * @type { ?string } 398 * @syscap SystemCapability.ArkUI.ArkUI.Full 399 * @since 10 400 */ 401 /** 402 * Additional information about the drag info. 403 * @type { ?string } 404 * @syscap SystemCapability.ArkUI.ArkUI.Full 405 * @atomicservice 406 * @since 12 407 */ 408 /** 409 * Additional information about the drag info. 410 * @type { ?string } 411 * @syscap SystemCapability.ArkUI.ArkUI.Full 412 * @crossplatform 413 * @atomicservice 414 * @since 18 415 */ 416 extraParams?: string; 417 418 /** 419 * Touch point coordinates. 420 * @type { ?TouchPoint } 421 * @syscap SystemCapability.ArkUI.ArkUI.Full 422 * @since 11 423 */ 424 /** 425 * Touch point coordinates. 426 * @type { ?TouchPoint } 427 * @syscap SystemCapability.ArkUI.ArkUI.Full 428 * @atomicservice 429 * @since 12 430 */ 431 /** 432 * Touch point coordinates. 433 * @type { ?TouchPoint } 434 * @syscap SystemCapability.ArkUI.ArkUI.Full 435 * @crossplatform 436 * @atomicservice 437 * @since 18 438 */ 439 touchPoint?: TouchPoint; 440 441 /** 442 * Drag preview options. 443 * @type { ?DragPreviewOptions } 444 * @syscap SystemCapability.ArkUI.ArkUI.Full 445 * @since 11 446 */ 447 /** 448 * Drag preview options. 449 * @type { ?DragPreviewOptions } 450 * @syscap SystemCapability.ArkUI.ArkUI.Full 451 * @atomicservice 452 * @since 12 453 */ 454 /** 455 * Drag preview options. 456 * @type { ?DragPreviewOptions } 457 * @syscap SystemCapability.ArkUI.ArkUI.Full 458 * @crossplatform 459 * @atomicservice 460 * @since 18 461 */ 462 previewOptions?: DragPreviewOptions; 463 } 464 465 /** 466 * Defines the animation options for drag preview. 467 * 468 * @interface AnimationOptions 469 * @syscap SystemCapability.ArkUI.ArkUI.Full 470 * @since 11 471 */ 472 /** 473 * Defines the animation options for drag preview. 474 * 475 * @interface AnimationOptions 476 * @syscap SystemCapability.ArkUI.ArkUI.Full 477 * @atomicservice 478 * @since 12 479 */ 480 /** 481 * Defines the animation options for drag preview. 482 * 483 * @interface AnimationOptions 484 * @syscap SystemCapability.ArkUI.ArkUI.Full 485 * @crossplatform 486 * @atomicservice 487 * @since 18 488 */ 489 interface AnimationOptions { 490 /** 491 * Animation duration, in ms. 492 * @type { ?number } 493 * @syscap SystemCapability.ArkUI.ArkUI.Full 494 * @since 11 495 */ 496 /** 497 * Animation duration, in ms. 498 * @type { ?number } 499 * @syscap SystemCapability.ArkUI.ArkUI.Full 500 * @atomicservice 501 * @since 12 502 */ 503 /** 504 * Animation duration, in ms. 505 * @type { ?number } 506 * @syscap SystemCapability.ArkUI.ArkUI.Full 507 * @crossplatform 508 * @atomicservice 509 * @since 18 510 */ 511 duration?: number; 512 /** 513 * Animation curve. 514 * @type { ?(Curve | ICurve) } 515 * @syscap SystemCapability.ArkUI.ArkUI.Full 516 * @since 11 517 */ 518 /** 519 * Animation curve. 520 * @type { ?(Curve | ICurve) } 521 * @syscap SystemCapability.ArkUI.ArkUI.Full 522 * @atomicservice 523 * @since 12 524 */ 525 /** 526 * Animation curve. 527 * @type { ?(Curve | ICurve) } 528 * @syscap SystemCapability.ArkUI.ArkUI.Full 529 * @crossplatform 530 * @atomicservice 531 * @since 18 532 */ 533 curve?: Curve | ICurve; 534 } 535 536 /** 537 * Provides the functions of setting color or updating animation. 538 * @syscap SystemCapability.ArkUI.ArkUI.Full 539 * @since 11 540 */ 541 /** 542 * Provides the functions of setting color or updating animation. 543 * @syscap SystemCapability.ArkUI.ArkUI.Full 544 * @atomicservice 545 * @since 12 546 */ 547 /** 548 * Provides the functions of setting color or updating animation. 549 * @syscap SystemCapability.ArkUI.ArkUI.Full 550 * @crossplatform 551 * @atomicservice 552 * @since 18 553 */ 554 export class DragPreview { 555 /** 556 * change foreground color of preview 557 * @param { ResourceColor } color - color value 558 * @syscap SystemCapability.ArkUI.ArkUI.Full 559 * @since 11 560 */ 561 /** 562 * change foreground color of preview 563 * @param { ResourceColor } color - color value 564 * @syscap SystemCapability.ArkUI.ArkUI.Full 565 * @atomicservice 566 * @since 12 567 */ 568 /** 569 * change foreground color of preview 570 * @param { ResourceColor } color - color value 571 * @syscap SystemCapability.ArkUI.ArkUI.Full 572 * @crossplatform 573 * @atomicservice 574 * @since 18 575 */ 576 setForegroundColor(color: ResourceColor): void; 577 /** 578 * update preview style with animation 579 * @param { AnimationOptions } options - animation options 580 * @param { function } handler - change style functions 581 * @syscap SystemCapability.ArkUI.ArkUI.Full 582 * @since 11 583 */ 584 /** 585 * update preview style with animation 586 * @param { AnimationOptions } options - animation options 587 * @param { function } handler - change style functions 588 * @syscap SystemCapability.ArkUI.ArkUI.Full 589 * @atomicservice 590 * @since 12 591 */ 592 /** 593 * update preview style with animation 594 * @param { AnimationOptions } options - animation options 595 * @param { function } handler - change style functions 596 * @syscap SystemCapability.ArkUI.ArkUI.Full 597 * @crossplatform 598 * @atomicservice 599 * @since 18 600 */ 601 animate(options: AnimationOptions, handler: () =>void): void; 602 } 603 604 /** 605 * Define the drag event paramters 606 * 607 * @interface DragEventParam 608 * @syscap SystemCapability.ArkUI.ArkUI.Full 609 * @atomicservice 610 * @since 12 611 */ 612 /** 613 * Define the drag event paramters 614 * 615 * @interface DragEventParam 616 * @syscap SystemCapability.ArkUI.ArkUI.Full 617 * @crossplatform 618 * @atomicservice 619 * @since 18 620 */ 621 interface DragEventParam { 622 623 /** 624 * The information containing the drag event. 625 * @type { DragEvent } 626 * @syscap SystemCapability.ArkUI.ArkUI.Full 627 * @since 10 628 */ 629 /** 630 * The information containing the drag event. 631 * @type { DragEvent } 632 * @syscap SystemCapability.ArkUI.ArkUI.Full 633 * @atomicservice 634 * @since 12 635 */ 636 /** 637 * The information containing the drag event. 638 * @type { DragEvent } 639 * @syscap SystemCapability.ArkUI.ArkUI.Full 640 * @crossplatform 641 * @atomicservice 642 * @since 18 643 */ 644 event: DragEvent; 645 646 /** 647 * Additional information about the drag info. 648 * @type { string } 649 * @syscap SystemCapability.ArkUI.ArkUI.Full 650 * @since 10 651 */ 652 /** 653 * Additional information about the drag info. 654 * @type { string } 655 * @syscap SystemCapability.ArkUI.ArkUI.Full 656 * @atomicservice 657 * @since 12 658 */ 659 /** 660 * Additional information about the drag info. 661 * @type { string } 662 * @syscap SystemCapability.ArkUI.ArkUI.Full 663 * @crossplatform 664 * @atomicservice 665 * @since 18 666 */ 667 extraParams: string; 668 } 669 670 /** 671 * Execute a drag event. 672 * @param { CustomBuilder | DragItemInfo } custom - Object used for prompts displayed when the object is dragged. 673 * @param { DragInfo } dragInfo - Information about the drag event. 674 * @param { AsyncCallback<{ event: DragEvent, extraParams: string }> } callback - Callback that contains the drag event information. 675 * @throws { BusinessError } 401 - Parameter error. Possible causes: 676 * <br> 1. Mandatory parameters are left unspecified. 677 * <br> 2. Incorrect parameters types. 678 * <br> 3. Parameter verification failed. 679 * @throws { BusinessError } 100001 - Internal handling failed. 680 * @syscap SystemCapability.ArkUI.ArkUI.Full 681 * @since 10 682 */ 683 /** 684 * Execute a drag event. 685 * @param { CustomBuilder | DragItemInfo } custom - Object used for prompts displayed when the object is dragged. 686 * @param { DragInfo } dragInfo - Information about the drag event. 687 * @param { AsyncCallback<DragEventParam> } callback - Callback that contains the drag event information. 688 * @throws { BusinessError } 401 - Parameter error. Possible causes: 689 * <br> 1. Mandatory parameters are left unspecified. 690 * <br> 2. Incorrect parameters types. 691 * <br> 3. Parameter verification failed. 692 * @throws { BusinessError } 100001 - Internal handling failed. 693 * @syscap SystemCapability.ArkUI.ArkUI.Full 694 * @atomicservice 695 * @since 12 696 */ 697 /** 698 * Execute a drag event. 699 * @param { CustomBuilder | DragItemInfo } custom - Object used for prompts displayed when the object is dragged. 700 * @param { DragInfo } dragInfo - Information about the drag event. 701 * @param { AsyncCallback<DragEventParam> } callback - Callback that contains the drag event information. 702 * @throws { BusinessError } 401 - Parameter error. Possible causes: 703 * <br> 1. Mandatory parameters are left unspecified. 704 * <br> 2. Incorrect parameters types. 705 * <br> 3. Parameter verification failed. 706 * @throws { BusinessError } 100001 - Internal handling failed. 707 * @syscap SystemCapability.ArkUI.ArkUI.Full 708 * @crossplatform 709 * @atomicservice 710 * @since 18 711 * @deprecated since 18 712 * @useinstead ohos.arkui.UIContext.DragController#executeDrag 713 */ 714 function executeDrag(custom: CustomBuilder | DragItemInfo, dragInfo: DragInfo, 715 callback: AsyncCallback<DragEventParam>): void; 716 717 /** 718 * Execute a drag event. 719 * @param { CustomBuilder | DragItemInfo } custom - Object used for prompts displayed when the object is dragged. 720 * @param { DragInfo } dragInfo - Information about the drag event. 721 * @returns { Promise<{ event: DragEvent, extraParams: string }> } A Promise with the drag event information. 722 * @throws { BusinessError } 401 - Parameter error. Possible causes: 723 * <br> 1. Mandatory parameters are left unspecified. 724 * <br> 2. Incorrect parameters types. 725 * <br> 3. Parameter verification failed. 726 * @throws { BusinessError } 100001 - Internal handling failed. 727 * @syscap SystemCapability.ArkUI.ArkUI.Full 728 * @since 10 729 */ 730 /** 731 * Execute a drag event. 732 * @param { CustomBuilder | DragItemInfo } custom - Object used for prompts displayed when the object is dragged. 733 * @param { DragInfo } dragInfo - Information about the drag event. 734 * @returns { Promise<DragEventParam> } A Promise with the drag event information. 735 * @throws { BusinessError } 401 - Parameter error. Possible causes: 736 * <br> 1. Mandatory parameters are left unspecified. 737 * <br> 2. Incorrect parameters types. 738 * <br> 3. Parameter verification failed. 739 * @throws { BusinessError } 100001 - Internal handling failed. 740 * @syscap SystemCapability.ArkUI.ArkUI.Full 741 * @atomicservice 742 * @since 12 743 */ 744 /** 745 * Execute a drag event. 746 * @param { CustomBuilder | DragItemInfo } custom - Object used for prompts displayed when the object is dragged. 747 * @param { DragInfo } dragInfo - Information about the drag event. 748 * @returns { Promise<DragEventParam> } A Promise with the drag event information. 749 * @throws { BusinessError } 401 - Parameter error. Possible causes: 750 * <br> 1. Mandatory parameters are left unspecified. 751 * <br> 2. Incorrect parameters types. 752 * <br> 3. Parameter verification failed. 753 * @throws { BusinessError } 100001 - Internal handling failed. 754 * @syscap SystemCapability.ArkUI.ArkUI.Full 755 * @crossplatform 756 * @atomicservice 757 * @since 18 758 * @deprecated since 18 759 * @useinstead ohos.arkui.UIContext.DragController#executeDrag 760 */ 761 function executeDrag(custom: CustomBuilder | DragItemInfo, dragInfo: DragInfo): Promise<DragEventParam>; 762 763 /** 764 * Create one drag action object, which can be used for starting drag later or monitoring 765 * the drag status after drag started. 766 * @param { Array<CustomBuilder | DragItemInfo> } customArray - Objects used for prompts 767 * displayed when the objects are dragged. 768 * @param { DragInfo } dragInfo - Information about the drag event. 769 * @returns { DragAction } one drag action object 770 * @throws { BusinessError } 401 - Parameter error. Possible causes: 771 * <br> 1. Mandatory parameters are left unspecified. 772 * <br> 2. Incorrect parameters types. 773 * <br> 3. Parameter verification failed. 774 * @throws { BusinessError } 100001 - Internal handling failed. 775 * @syscap SystemCapability.ArkUI.ArkUI.Full 776 * @since 11 777 */ 778 /** 779 * Create one drag action object, which can be used for starting drag later or monitoring 780 * the drag status after drag started. 781 * @param { Array<CustomBuilder | DragItemInfo> } customArray - Objects used for prompts 782 * displayed when the objects are dragged. 783 * @param { DragInfo } dragInfo - Information about the drag event. 784 * @returns { DragAction } one drag action object 785 * @throws { BusinessError } 401 - Parameter error. Possible causes: 786 * <br> 1. Mandatory parameters are left unspecified. 787 * <br> 2. Incorrect parameters types. 788 * <br> 3. Parameter verification failed. 789 * @throws { BusinessError } 100001 - Internal handling failed. 790 * @syscap SystemCapability.ArkUI.ArkUI.Full 791 * @atomicservice 792 * @since 12 793 */ 794 /** 795 * Create one drag action object, which can be used for starting drag later or monitoring 796 * the drag status after drag started. 797 * @param { Array<CustomBuilder | DragItemInfo> } customArray - Objects used for prompts 798 * displayed when the objects are dragged. 799 * @param { DragInfo } dragInfo - Information about the drag event. 800 * @returns { DragAction } one drag action object 801 * @throws { BusinessError } 401 - Parameter error. Possible causes: 802 * <br> 1. Mandatory parameters are left unspecified. 803 * <br> 2. Incorrect parameters types. 804 * <br> 3. Parameter verification failed. 805 * @throws { BusinessError } 100001 - Internal handling failed. 806 * @syscap SystemCapability.ArkUI.ArkUI.Full 807 * @crossplatform 808 * @atomicservice 809 * @since 18 810 * @deprecated since 18 811 * @useinstead ohos.arkui.UIContext.DragController#createDragAction 812 */ 813 function createDragAction(customArray: Array<CustomBuilder | DragItemInfo>, dragInfo: DragInfo): DragAction; 814 815 /** 816 * Get drag preview object. 817 * @returns { DragPreview } An drag preview object. 818 * @syscap SystemCapability.ArkUI.ArkUI.Full 819 * @since 11 820 */ 821 /** 822 * Get drag preview object. 823 * @returns { DragPreview } An drag preview object. 824 * @syscap SystemCapability.ArkUI.ArkUI.Full 825 * @atomicservice 826 * @since 12 827 */ 828 /** 829 * Get drag preview object. 830 * @returns { DragPreview } An drag preview object. 831 * @syscap SystemCapability.ArkUI.ArkUI.Full 832 * @crossplatform 833 * @atomicservice 834 * @since 18 835 * @deprecated since 18 836 * @useinstead ohos.arkui.UIContext.DragController#getDragPreview 837 */ 838 function getDragPreview(): DragPreview; 839 840 /** 841 * Define the status for the application to notify the framework whether to execute drag. 842 * 843 * @enum { number } 844 * @syscap SystemCapability.ArkUI.ArkUI.Full 845 * @atomicservice 846 * @since 18 847 */ 848 const enum DragStartRequestStatus { 849 /** 850 * Notify the framework that the application is not yet ready and needs to temporarily block 851 * the start of drag, only effective in onDragStart calls. 852 * 853 * @syscap SystemCapability.ArkUI.ArkUI.Full 854 * @atomicservice 855 * @since 18 856 */ 857 WAITING = 0, 858 859 /** 860 * Notify the framework that the drag can continue to be started, but only during the start 861 * of drag, and will not take effect when the drag is started. 862 * 863 * @syscap SystemCapability.ArkUI.ArkUI.Full 864 * @atomicservice 865 * @since 18 866 */ 867 READY = 1, 868 } 869} 870 871export default dragController; 872