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 CoreFileKit 19 */ 20 21import { AsyncCallback, Callback } from './@ohos.base'; 22import Context from './application/Context'; 23import window from './@ohos.window'; 24import type { CustomColors } from './@ohos.arkui.theme'; 25/** 26 * Provide the capabilities to use different pickers. 27 * 28 * @namespace picker 29 * @syscap SystemCapability.FileManagement.UserFileService 30 * @since 9 31 */ 32/** 33 * Provide the capabilities to use different pickers. 34 * 35 * @namespace picker 36 * @syscap SystemCapability.FileManagement.UserFileService 37 * @atomicservice 38 * @since 11 39 */ 40/** 41 * Provide the capabilities to use different pickers. 42 * 43 * @namespace picker 44 * @syscap SystemCapability.FileManagement.UserFileService 45 * @crossplatform 46 * @atomicservice 47 * @since 12 48 */ 49declare namespace picker { 50 /** 51 * PhotoViewMIMETypes represents the type of media resource that photo picker selects. 52 * 53 * @enum { string } PhotoViewMIMETypes 54 * @syscap SystemCapability.FileManagement.UserFileService 55 * @since 9 56 */ 57 /** 58 * PhotoViewMIMETypes represents the type of media resource that photo picker selects. 59 * 60 * @enum { string } PhotoViewMIMETypes 61 * @syscap SystemCapability.FileManagement.UserFileService 62 * @atomicservice 63 * @since 11 64 * @deprecated since 12 65 * @useinstead ohos.file.photoAccessHelper/photoAccessHelper#PhotoViewMIMETypes 66 */ 67 export enum PhotoViewMIMETypes { 68 /** 69 * Image type. 70 * 71 * @syscap SystemCapability.FileManagement.UserFileService 72 * @since 9 73 */ 74 /** 75 * Image type. 76 * 77 * @syscap SystemCapability.FileManagement.UserFileService 78 * @atomicservice 79 * @since 11 80 * @deprecated since 18 81 * @useinstead ohos.file.photoAccessHelper/photoAccessHelper#PhotoViewMIMETypes.IMAGE_TYPE 82 */ 83 IMAGE_TYPE = 'image/*', 84 85 /** 86 * Video type. 87 * 88 * @syscap SystemCapability.FileManagement.UserFileService 89 * @since 9 90 */ 91 /** 92 * Video type. 93 * 94 * @syscap SystemCapability.FileManagement.UserFileService 95 * @atomicservice 96 * @since 11 97 * @deprecated since 18 98 * @useinstead ohos.file.photoAccessHelper/photoAccessHelper#PhotoViewMIMETypes.VIDEO_TYPE 99 */ 100 VIDEO_TYPE = 'video/*', 101 102 /** 103 * Image and video type. 104 * 105 * @syscap SystemCapability.FileManagement.UserFileService 106 * @since 9 107 */ 108 /** 109 * Image and video type. 110 * 111 * @syscap SystemCapability.FileManagement.UserFileService 112 * @atomicservice 113 * @since 11 114 * @deprecated since 18 115 * @useinstead ohos.file.photoAccessHelper/photoAccessHelper#PhotoViewMIMETypes.IMAGE_VIDEO_TYPE 116 */ 117 IMAGE_VIDEO_TYPE = '*/*' 118 } 119 120 /** 121 * PhotoSelectOptions Object 122 * 123 * @syscap SystemCapability.FileManagement.UserFileService 124 * @since 9 125 */ 126 /** 127 * PhotoSelectOptions Object 128 * 129 * @syscap SystemCapability.FileManagement.UserFileService 130 * @atomicservice 131 * @since 11 132 * @deprecated since 12 133 * @useinstead ohos.file.photoAccessHelper/photoAccessHelper#PhotoSelectOptions 134 */ 135 class PhotoSelectOptions { 136 /** 137 * The Type of the file in the picker window. 138 * 139 * @type { ?PhotoViewMIMETypes } 140 * @syscap SystemCapability.FileManagement.UserFileService 141 * @since 9 142 */ 143 /** 144 * The Type of the file in the picker window. 145 * 146 * @type { ?PhotoViewMIMETypes } 147 * @syscap SystemCapability.FileManagement.UserFileService 148 * @atomicservice 149 * @since 11 150 * @deprecated since 18 151 * @useinstead ohos.file.photoAccessHelper/photoAccessHelper#PhotoSelectOptions.MIMEType 152 */ 153 MIMEType?: PhotoViewMIMETypes; 154 155 /** 156 * Maximum number of images for a single selection. 157 * 158 * @type { ?number } 159 * @syscap SystemCapability.FileManagement.UserFileService 160 * @since 9 161 */ 162 /** 163 * Maximum number of images for a single selection. 164 * 165 * @type { ?number } 166 * @syscap SystemCapability.FileManagement.UserFileService 167 * @atomicservice 168 * @since 11 169 * @deprecated since 18 170 * @useinstead ohos.file.photoAccessHelper/photoAccessHelper#PhotoSelectOptions.maxSelectNumber 171 */ 172 maxSelectNumber?: number; 173 } 174 175 /** 176 * PhotoSelectResult Object 177 * 178 * @syscap SystemCapability.FileManagement.UserFileService 179 * @since 9 180 */ 181 /** 182 * PhotoSelectResult Object 183 * 184 * @syscap SystemCapability.FileManagement.UserFileService 185 * @atomicservice 186 * @since 11 187 * @deprecated since 12 188 * @useinstead ohos.file.photoAccessHelper/photoAccessHelper#PhotoSelectResult 189 */ 190 class PhotoSelectResult { 191 /** 192 * The uris for the selected files. 193 * 194 * @type { Array<string> } 195 * @syscap SystemCapability.FileManagement.UserFileService 196 * @since 9 197 */ 198 /** 199 * The uris for the selected files. 200 * 201 * @type { Array<string> } 202 * @syscap SystemCapability.FileManagement.UserFileService 203 * @atomicservice 204 * @since 11 205 * @deprecated since 18 206 * @useinstead ohos.file.photoAccessHelper/photoAccessHelper#PhotoSelectResult.photoUris 207 */ 208 photoUris: Array<string>; 209 210 /** 211 * Original option. 212 * 213 * @type { boolean } 214 * @syscap SystemCapability.FileManagement.UserFileService 215 * @since 9 216 */ 217 /** 218 * Original option. 219 * 220 * @type { boolean } 221 * @syscap SystemCapability.FileManagement.UserFileService 222 * @atomicservice 223 * @since 11 224 * @deprecated since 18 225 * @useinstead ohos.file.photoAccessHelper/photoAccessHelper#PhotoSelectResult.isOriginalPhoto 226 */ 227 isOriginalPhoto: boolean; 228 } 229 230 /** 231 * PhotoSaveOptions Object 232 * 233 * @syscap SystemCapability.FileManagement.UserFileService 234 * @since 9 235 * @deprecated since 12 236 */ 237 class PhotoSaveOptions { 238 /** 239 * The names of the files to be saved. 240 * 241 * @type { ?Array<string> } 242 * @syscap SystemCapability.FileManagement.UserFileService 243 * @since 9 244 * @deprecated since 18 245 */ 246 newFileNames?: Array<string>; 247 } 248 249 /** 250 * PhotoViewPicker Object 251 * 252 * @syscap SystemCapability.FileManagement.UserFileService 253 * @since 9 254 */ 255 /** 256 * PhotoViewPicker Object 257 * 258 * @syscap SystemCapability.FileManagement.UserFileService 259 * @atomicservice 260 * @since 11 261 * @deprecated since 12 262 * @useinstead ohos.file.photoAccessHelper/photoAccessHelper#PhotoViewPicker 263 */ 264 class PhotoViewPicker { 265 /** 266 * The constructor used to create a PhotoViewPicker object. 267 * 268 * @syscap SystemCapability.FileManagement.UserFileService 269 * @atomicservice 270 * @since 12 271 * @deprecated since 18 272 */ 273 constructor(); 274 275 /** 276 * The constructor used to create a PhotoViewPicker object. 277 * 278 * @param { Context } context - represents the context. 279 * @syscap SystemCapability.FileManagement.UserFileService 280 * @since 12 281 * @deprecated since 18 282 */ 283 constructor(context: Context); 284 285 /** 286 * Pull up the photo picker based on the selection mode. 287 * 288 * @param { PhotoSelectOptions } option - represents the options provided in select mode. 289 * @returns { Promise<PhotoSelectResult> } Returns the uris for the selected files. 290 * @syscap SystemCapability.FileManagement.UserFileService 291 * @since 9 292 */ 293 /** 294 * Pull up the photo picker based on the selection mode. 295 * 296 * @param { PhotoSelectOptions } option - represents the options provided in select mode. 297 * @returns { Promise<PhotoSelectResult> } Returns the uris for the selected files. 298 * @syscap SystemCapability.FileManagement.UserFileService 299 * @atomicservice 300 * @since 11 301 * @deprecated since 12 302 * @useinstead ohos.file.photoAccessHelper/photoAccessHelper.PhotoViewPicker#select 303 */ 304 select(option?: PhotoSelectOptions): Promise<PhotoSelectResult>; 305 306 /** 307 * Pull up the photo picker based on the selection mode. 308 * 309 * @param { PhotoSelectOptions } option - represents the options provided in select mode. 310 * @param { AsyncCallback<PhotoSelectResult> } callback - callback 311 * @syscap SystemCapability.FileManagement.UserFileService 312 * @since 9 313 */ 314 /** 315 * Pull up the photo picker based on the selection mode. 316 * 317 * @param { PhotoSelectOptions } option - represents the options provided in select mode. 318 * @param { AsyncCallback<PhotoSelectResult> } callback - callback 319 * @syscap SystemCapability.FileManagement.UserFileService 320 * @atomicservice 321 * @since 11 322 * @deprecated since 12 323 * @useinstead ohos.file.photoAccessHelper/photoAccessHelper.PhotoViewPicker#select 324 */ 325 select(option: PhotoSelectOptions, callback: AsyncCallback<PhotoSelectResult>): void; 326 327 /** 328 * Pull up the photo picker based on the selection mode. 329 * 330 * @param { AsyncCallback<PhotoSelectResult> } callback - callback 331 * @syscap SystemCapability.FileManagement.UserFileService 332 * @since 9 333 */ 334 /** 335 * Pull up the photo picker based on the selection mode. 336 * 337 * @param { AsyncCallback<PhotoSelectResult> } callback - callback 338 * @syscap SystemCapability.FileManagement.UserFileService 339 * @atomicservice 340 * @since 11 341 * @deprecated since 12 342 * @useinstead ohos.file.photoAccessHelper/photoAccessHelper.PhotoViewPicker#select 343 */ 344 select(callback: AsyncCallback<PhotoSelectResult>): void; 345 346 /** 347 * Pull up the photo picker based on the save mode. 348 * 349 * @param { PhotoSaveOptions } option - represents the options provided in save mode. 350 * @returns { Promise<Array<string>> } Returns the uris for the saved files. 351 * @syscap SystemCapability.FileManagement.UserFileService 352 * @since 9 353 * @deprecated since 12 354 * @useinstead save_button/SaveButton 355 */ 356 save(option?: PhotoSaveOptions): Promise<Array<string>>; 357 358 /** 359 * Pull up the photo picker based on the save mode. 360 * 361 * @param { PhotoSaveOptions } option - represents the options provided in save mode. 362 * @param { AsyncCallback<Array<string>> } callback - callback 363 * @syscap SystemCapability.FileManagement.UserFileService 364 * @since 9 365 * @deprecated since 12 366 * @useinstead save_button/SaveButton 367 */ 368 save(option: PhotoSaveOptions, callback: AsyncCallback<Array<string>>): void; 369 370 /** 371 * Pull up the photo picker based on the save mode. 372 * 373 * @param { AsyncCallback<Array<string>> } callback - callback 374 * @syscap SystemCapability.FileManagement.UserFileService 375 * @since 9 376 * @deprecated since 12 377 * @useinstead save_button/SaveButton 378 */ 379 save(callback: AsyncCallback<Array<string>>): void; 380 } 381 382 /** 383 * Enumerates the picker's select mode types. 384 * 385 * @enum { number } DocumentSelectMode 386 * @syscap SystemCapability.FileManagement.UserFileService.FolderSelection 387 * @since 11 388 */ 389 /** 390 * Enumerates the picker's select mode types. 391 * 392 * @enum { number } DocumentSelectMode 393 * @syscap SystemCapability.FileManagement.UserFileService.FolderSelection 394 * @crossplatform 395 * @atomicservice 396 * @since 12 397 */ 398 export enum DocumentSelectMode { 399 /** 400 * Indicates that only files are allowed to be selected. 401 * 402 * @syscap SystemCapability.FileManagement.UserFileService.FolderSelection 403 * @since 11 404 */ 405 /** 406 * Indicates that only files are allowed to be selected. 407 * 408 * @syscap SystemCapability.FileManagement.UserFileService.FolderSelection 409 * @crossplatform 410 * @atomicservice 411 * @since 12 412 */ 413 FILE = 0, 414 415 /** 416 * Indicates that only folders are allowed to be selected. 417 * 418 * @syscap SystemCapability.FileManagement.UserFileService.FolderSelection 419 * @since 11 420 */ 421 /** 422 * Indicates that only folders are allowed to be selected. 423 * 424 * @syscap SystemCapability.FileManagement.UserFileService.FolderSelection 425 * @crossplatform 426 * @atomicservice 427 * @since 12 428 */ 429 FOLDER = 1, 430 431 /** 432 * Indicates that files and folders are allowed to be selected. 433 * 434 * @syscap SystemCapability.FileManagement.UserFileService.FolderSelection 435 * @since 11 436 */ 437 /** 438 * Indicates that files and folders are allowed to be selected. 439 * 440 * @syscap SystemCapability.FileManagement.UserFileService.FolderSelection 441 * @atomicservice 442 * @since 12 443 */ 444 MIXED = 2, 445 } 446 447 /** 448 * Enumerates the picker's mode types. 449 * 450 * @enum { number } DocumentPickerMode 451 * @syscap SystemCapability.FileManagement.UserFileService 452 * @atomicservice 453 * @since 12 454 */ 455 export enum DocumentPickerMode { 456 /** 457 * Document mode. 458 * 459 * @syscap SystemCapability.FileManagement.UserFileService 460 * @atomicservice 461 * @since 12 462 */ 463 DEFAULT = 0, 464 465 /** 466 * Download mode. 467 * 468 * @syscap SystemCapability.FileManagement.UserFileService 469 * @atomicservice 470 * @since 12 471 */ 472 DOWNLOAD = 1, 473 } 474 475 /** 476 * Enumerates the picker's merge mode types. 477 * 478 * @enum { number } DocumentPickerMode 479 * @syscap SystemCapability.FileManagement.UserFileService 480 * @atomicservice 481 * @since 15 482 */ 483 export enum MergeTypeMode { 484 /** 485 * Indicates common mode. 486 * 487 * @syscap SystemCapability.FileManagement.UserFileService 488 * @atomicservice 489 * @since 15 490 */ 491 DEFAULT = 0, 492 493 /** 494 * Indicates that audios are allowed to be selected 495 * 496 * @syscap SystemCapability.FileManagement.UserFileService 497 * @atomicservice 498 * @since 15 499 */ 500 AUDIO = 1, 501 502 /** 503 * Indicates that videos are allowed to be selected 504 * 505 * @syscap SystemCapability.FileManagement.UserFileService 506 * @atomicservice 507 * @since 15 508 */ 509 VIDEO = 2, 510 511 /** 512 * Indicates that documents are allowed to be selected 513 * 514 * @syscap SystemCapability.FileManagement.UserFileService 515 * @atomicservice 516 * @since 15 517 */ 518 DOCUMENT = 3, 519 520 /** 521 * Indicates that pictures are allowed to be selected 522 * 523 * @syscap SystemCapability.FileManagement.UserFileService 524 * @atomicservice 525 * @since 15 526 */ 527 PICTURE = 4, 528 } 529 530 /** 531 * DocumentSelectOptions Object. 532 * 533 * @syscap SystemCapability.FileManagement.UserFileService 534 * @since 9 535 */ 536 /** 537 * DocumentSelectOptions Object. 538 * 539 * @syscap SystemCapability.FileManagement.UserFileService 540 * @crossplatform 541 * @atomicservice 542 * @since 12 543 */ 544 class DocumentSelectOptions { 545 /** 546 * The default opening uri of the picker window. 547 * 548 * @type { ?string } 549 * @syscap SystemCapability.FileManagement.UserFileService 550 * @since 10 551 */ 552 /** 553 * The default opening uri of the picker window. 554 * 555 * @type { ?string } 556 * @syscap SystemCapability.FileManagement.UserFileService 557 * @crossplatform 558 * @atomicservice 559 * @since 12 560 */ 561 defaultFilePathUri?: string; 562 563 /** 564 * Suffixes for file selected. 565 * 566 * @type { ?Array<string> } 567 * @syscap SystemCapability.FileManagement.UserFileService 568 * @since 10 569 */ 570 /** 571 * Suffixes for file selected. 572 * 573 * @type { ?Array<string> } 574 * @syscap SystemCapability.FileManagement.UserFileService 575 * @crossplatform 576 * @atomicservice 577 * @since 12 578 */ 579 fileSuffixFilters?: Array<string>; 580 581 /** 582 * Maximum number of files for a single selection. 583 * 584 * @type { ?number } 585 * @syscap SystemCapability.FileManagement.UserFileService 586 * @since 10 587 */ 588 /** 589 * Maximum number of files for a single selection. 590 * 591 * @type { ?number } 592 * @syscap SystemCapability.FileManagement.UserFileService 593 * @crossplatform 594 * @atomicservice 595 * @since 12 596 */ 597 maxSelectNumber?: number; 598 599 /** 600 * Selection mode. 601 * 602 * @type { ?DocumentSelectMode } 603 * @syscap SystemCapability.FileManagement.UserFileService.FolderSelection 604 * @since 11 605 */ 606 /** 607 * Selection mode. 608 * 609 * @type { ?DocumentSelectMode } 610 * @syscap SystemCapability.FileManagement.UserFileService.FolderSelection 611 * @crossplatform 612 * @atomicservice 613 * @since 12 614 */ 615 selectMode?: DocumentSelectMode; 616 617 /** 618 * Granting Permissions to Specified Directories or Files. 619 * The value true indicates that authorization is required. 620 * When authmode is set to true, the defaultFilePathUri field is mandatory. 621 * 622 * @type { ?boolean } 623 * @syscap SystemCapability.FileManagement.UserFileService.FolderSelection 624 * @atomicservice 625 * @since 12 626 */ 627 authMode?: boolean; 628 629 /** 630 * Granting Permissions to Mutl file. 631 * 632 * @type { ?boolean } 633 * @syscap SystemCapability.FileManagement.UserFileService 634 * @atomicservice 635 * @since 15 636 */ 637 multiAuthMode?: boolean; 638 639 /** 640 * Mutl file to Granting Permissions 641 * 642 * @type { ?Array<string> } 643 * @syscap SystemCapability.FileManagement.UserFileService 644 * @atomicservice 645 * @since 15 646 */ 647 multiUriArray?: Array<string>; 648 649 /** 650 * Filtering by file type 651 * 652 * @type { ?MergeTypeMode } 653 * @syscap SystemCapability.FileManagement.UserFileService 654 * @atomicservice 655 * @since 15 656 */ 657 mergeMode?: MergeTypeMode; 658 659 /** 660 * Theme color 661 * 662 * @type { ?CustomColors } 663 * @syscap SystemCapability.FileManagement.UserFileService 664 * @systemapi 665 * @since 18 666 */ 667 themeColor?: CustomColors; 668 } 669 670 /** 671 * DocumentSaveOptions Object 672 * 673 * @syscap SystemCapability.FileManagement.UserFileService 674 * @since 9 675 */ 676 /** 677 * DocumentSaveOptions Object 678 * 679 * @syscap SystemCapability.FileManagement.UserFileService 680 * @crossplatform 681 * @atomicservice 682 * @since 12 683 */ 684 class DocumentSaveOptions { 685 /** 686 * The names of the files to be saved. 687 * 688 * @type { ?Array<string> } 689 * @syscap SystemCapability.FileManagement.UserFileService 690 * @since 9 691 */ 692 /** 693 * The names of the files to be saved. 694 * 695 * @type { ?Array<string> } 696 * @syscap SystemCapability.FileManagement.UserFileService 697 * @crossplatform 698 * @atomicservice 699 * @since 12 700 */ 701 newFileNames?: Array<string>; 702 703 /** 704 * The default opening uri of the picker window. 705 * 706 * @type { ?string } 707 * @syscap SystemCapability.FileManagement.UserFileService 708 * @since 10 709 */ 710 /** 711 * The default opening uri of the picker window. 712 * 713 * @type { ?string } 714 * @syscap SystemCapability.FileManagement.UserFileService 715 * @crossplatform 716 * @atomicservice 717 * @since 12 718 */ 719 defaultFilePathUri?: string; 720 721 /** 722 * Suffixes for file saved. 723 * 724 * @type { ?Array<string> } 725 * @syscap SystemCapability.FileManagement.UserFileService 726 * @since 10 727 */ 728 /** 729 * Suffixes for file saved. 730 * 731 * @type { ?Array<string> } 732 * @syscap SystemCapability.FileManagement.UserFileService 733 * @atomicservice 734 * @since 12 735 */ 736 fileSuffixChoices?: Array<string>; 737 /** 738 * picker mode. 739 * 740 * @type { ?DocumentPickerMode } 741 * @syscap SystemCapability.FileManagement.UserFileService 742 * @atomicservice 743 * @since 12 744 */ 745 pickerMode?: DocumentPickerMode; 746 747 /** 748 * Theme color 749 * 750 * @type { ?CustomColors } 751 * @syscap SystemCapability.FileManagement.UserFileService 752 * @systemapi 753 * @since 18 754 */ 755 themeColor?: CustomColors; 756 } 757 758 /** 759 * DocumentViewPicker Object 760 * 761 * @syscap SystemCapability.FileManagement.UserFileService 762 * @since 9 763 */ 764 /** 765 * DocumentViewPicker Object 766 * 767 * @syscap SystemCapability.FileManagement.UserFileService 768 * @crossplatform 769 * @atomicservice 770 * @since 12 771 */ 772 class DocumentViewPicker { 773 /** 774 * The constructor used to create a DocumentViewPicker object. 775 * 776 * @syscap SystemCapability.FileManagement.UserFileService 777 * @atomicservice 778 * @since 12 779 */ 780 constructor(); 781 782 /** 783 * The constructor used to create a DocumentViewPicker object. 784 * 785 * @param { Context } context - represents the context. 786 * @syscap SystemCapability.FileManagement.UserFileService 787 * @atomicservice 788 * @since 12 789 */ 790 constructor(context: Context); 791 792 /** 793 * The constructor used to create a DocumentViewPicker object. 794 * 795 * @param { Context } context - represents the context. 796 * @param { window.Window } window - represents the window. 797 * @syscap SystemCapability.FileManagement.UserFileService 798 * @since 13 799 */ 800 constructor(context: Context, window: window.Window); 801 802 /** 803 * Pull up the document picker based on the selection mode. 804 * 805 * @param { DocumentSelectOptions } option - represents the options provided in select mode. 806 * @returns { Promise<Array<string>> } Returns the uris for the selected files. 807 * @syscap SystemCapability.FileManagement.UserFileService 808 * @since 9 809 */ 810 /** 811 * Pull up the document picker based on the selection mode. 812 * 813 * @param { DocumentSelectOptions } option - represents the options provided in select mode. 814 * @returns { Promise<Array<string>> } Returns the uris for the selected files. 815 * @syscap SystemCapability.FileManagement.UserFileService 816 * @crossplatform 817 * @atomicservice 818 * @since 12 819 */ 820 select(option?: DocumentSelectOptions): Promise<Array<string>>; 821 822 /** 823 * Pull up the document picker based on the selection mode. 824 * 825 * @param { DocumentSelectOptions } option - represents the options provided in select mode. 826 * @param { AsyncCallback<Array<string>> } callback - callback 827 * @syscap SystemCapability.FileManagement.UserFileService 828 * @since 9 829 */ 830 /** 831 * Pull up the document picker based on the selection mode. 832 * 833 * @param { DocumentSelectOptions } option - represents the options provided in select mode. 834 * @param { AsyncCallback<Array<string>> } callback - callback 835 * @syscap SystemCapability.FileManagement.UserFileService 836 * @crossplatform 837 * @atomicservice 838 * @since 12 839 */ 840 select(option: DocumentSelectOptions, callback: AsyncCallback<Array<string>>): void; 841 842 /** 843 * Pull up the document picker based on the selection mode. 844 * 845 * @param { AsyncCallback<Array<string>> } callback - callback 846 * @syscap SystemCapability.FileManagement.UserFileService 847 * @since 9 848 */ 849 /** 850 * Pull up the document picker based on the selection mode. 851 * 852 * @param { AsyncCallback<Array<string>> } callback - callback 853 * @syscap SystemCapability.FileManagement.UserFileService 854 * @crossplatform 855 * @atomicservice 856 * @since 12 857 */ 858 select(callback: AsyncCallback<Array<string>>): void; 859 860 /** 861 * Pull up the document picker based on the save mode. 862 * 863 * @param { DocumentSaveOptions } option - represents the options provided in save mode. 864 * @returns { Promise<Array<string>> } Returns the uris for the saved files. 865 * @syscap SystemCapability.FileManagement.UserFileService 866 * @since 9 867 */ 868 /** 869 * Pull up the document picker based on the save mode. 870 * 871 * @param { DocumentSaveOptions } option - represents the options provided in save mode. 872 * @returns { Promise<Array<string>> } Returns the uris for the saved files. 873 * @syscap SystemCapability.FileManagement.UserFileService 874 * @crossplatform 875 * @atomicservice 876 * @since 12 877 */ 878 save(option?: DocumentSaveOptions): Promise<Array<string>>; 879 880 /** 881 * Pull up the document picker based on the save mode. 882 * 883 * @param { DocumentSaveOptions } option - represents the options provided in save mode. 884 * @param { AsyncCallback<Array<string>> } callback - callback 885 * @syscap SystemCapability.FileManagement.UserFileService 886 * @since 9 887 */ 888 /** 889 * Pull up the document picker based on the save mode. 890 * 891 * @param { DocumentSaveOptions } option - represents the options provided in save mode. 892 * @param { AsyncCallback<Array<string>> } callback - callback 893 * @syscap SystemCapability.FileManagement.UserFileService 894 * @crossplatform 895 * @atomicservice 896 * @since 12 897 */ 898 save(option: DocumentSaveOptions, callback: AsyncCallback<Array<string>>): void; 899 900 /** 901 * Pull up the document picker based on the save mode. 902 * 903 * @param { AsyncCallback<Array<string>> } callback - callback 904 * @syscap SystemCapability.FileManagement.UserFileService 905 * @since 9 906 */ 907 /** 908 * Pull up the document picker based on the save mode. 909 * 910 * @param { AsyncCallback<Array<string>> } callback - callback 911 * @syscap SystemCapability.FileManagement.UserFileService 912 * @crossplatform 913 * @atomicservice 914 * @since 12 915 */ 916 save(callback: AsyncCallback<Array<string>>): void; 917 918 /** 919 * Obtain the saving type selected by the user. 920 * 921 * @returns { number } Returns the index of the suffix array fileSuffixChoices configured by the user in DocumentSaveOptions. 922 * @syscap SystemCapability.FileManagement.UserFileService.FolderSelection 923 * @crossplatform 924 * @atomicservice 925 * @since 14 926 */ 927 getSelectedIndex(): number; 928 } 929 930 /** 931 * AudioSelectOptions Object. Currently not supported. 932 * 933 * @syscap SystemCapability.FileManagement.UserFileService 934 * @since 9 935 */ 936 /** 937 * AudioSelectOptions Object. 938 * 939 * @syscap SystemCapability.FileManagement.UserFileService 940 * @crossplatform 941 * @atomicservice 942 * @since 12 943 */ 944 class AudioSelectOptions { 945 /** 946 * Maximum number of audio for a single selection. 947 * 948 * @type { ?number } 949 * @syscap SystemCapability.FileManagement.UserFileService 950 * @crossplatform 951 * @atomicservice 952 * @since 12 953 */ 954 maxSelectNumber?: number; 955 } 956 957 /** 958 * AudioSaveOptions Object 959 * 960 * @syscap SystemCapability.FileManagement.UserFileService 961 * @since 9 962 */ 963 /** 964 * AudioSaveOptions Object 965 * 966 * @syscap SystemCapability.FileManagement.UserFileService 967 * @crossplatform 968 * @atomicservice 969 * @since 12 970 */ 971 class AudioSaveOptions { 972 /** 973 * The names of the files to be saved. 974 * 975 * @type { ?Array<string> } 976 * @syscap SystemCapability.FileManagement.UserFileService 977 * @since 9 978 */ 979 /** 980 * The names of the files to be saved. 981 * 982 * @type { ?Array<string> } 983 * @syscap SystemCapability.FileManagement.UserFileService 984 * @crossplatform 985 * @atomicservice 986 * @since 12 987 */ 988 newFileNames?: Array<string>; 989 } 990 991 /** 992 * AudioViewPicker Object 993 * 994 * @syscap SystemCapability.FileManagement.UserFileService 995 * @since 9 996 */ 997 /** 998 * AudioViewPicker Object 999 * 1000 * @syscap SystemCapability.FileManagement.UserFileService 1001 * @crossplatform 1002 * @atomicservice 1003 * @since 12 1004 */ 1005 class AudioViewPicker { 1006 /** 1007 * The constructor used to create a AudioViewPicker object. 1008 * 1009 * @syscap SystemCapability.FileManagement.UserFileService 1010 * @atomicservice 1011 * @since 12 1012 */ 1013 constructor(); 1014 1015 /** 1016 * The constructor used to create a AudioViewPicker object. 1017 * 1018 * @param { Context } context - represents the context. 1019 * @syscap SystemCapability.FileManagement.UserFileService 1020 * @atomicservice 1021 * @since 12 1022 */ 1023 constructor(context: Context); 1024 1025 /** 1026 * Pull up the audio picker based on the selection mode. 1027 * 1028 * @param { AudioSelectOptions } option - represents the options provided in select mode. 1029 * @returns { Promise<Array<string>> } Returns the uris for the selected files. 1030 * @syscap SystemCapability.FileManagement.UserFileService 1031 * @since 9 1032 */ 1033 /** 1034 * Pull up the audio picker based on the selection mode. 1035 * 1036 * @param { AudioSelectOptions } option - represents the options provided in select mode. 1037 * @returns { Promise<Array<string>> } Returns the uris for the selected files. 1038 * @syscap SystemCapability.FileManagement.UserFileService 1039 * @crossplatform 1040 * @atomicservice 1041 * @since 12 1042 */ 1043 select(option?: AudioSelectOptions): Promise<Array<string>>; 1044 1045 /** 1046 * Pull up the audio picker based on the selection mode. 1047 * 1048 * @param { AudioSelectOptions } option - represents the options provided in select mode. 1049 * @param { AsyncCallback<Array<string>> } callback - callback 1050 * @syscap SystemCapability.FileManagement.UserFileService 1051 * @since 9 1052 */ 1053 /** 1054 * Pull up the audio picker based on the selection mode. 1055 * 1056 * @param { AudioSelectOptions } option - represents the options provided in select mode. 1057 * @param { AsyncCallback<Array<string>> } callback - callback 1058 * @syscap SystemCapability.FileManagement.UserFileService 1059 * @crossplatform 1060 * @since 12 1061 */ 1062 select(option: AudioSelectOptions, callback: AsyncCallback<Array<string>>): void; 1063 1064 /** 1065 * Pull up the audio picker based on the selection mode. 1066 * 1067 * @param { AsyncCallback<Array<string>> } callback - callback 1068 * @syscap SystemCapability.FileManagement.UserFileService 1069 * @since 9 1070 */ 1071 /** 1072 * Pull up the audio picker based on the selection mode. 1073 * 1074 * @param { AsyncCallback<Array<string>> } callback - callback 1075 * @syscap SystemCapability.FileManagement.UserFileService 1076 * @crossplatform 1077 * @since 12 1078 */ 1079 select(callback: AsyncCallback<Array<string>>): void; 1080 1081 /** 1082 * Pull up the audio picker based on the save mode. 1083 * 1084 * @param { AudioSaveOptions } option - represents the options provided in save mode. 1085 * @returns { Promise<Array<string>> } Returns the uris for the saved files. 1086 * @syscap SystemCapability.FileManagement.UserFileService 1087 * @since 9 1088 */ 1089 /** 1090 * Pull up the audio picker based on the save mode. 1091 * 1092 * @param { AudioSaveOptions } option - represents the options provided in save mode. 1093 * @returns { Promise<Array<string>> } Returns the uris for the saved files. 1094 * @syscap SystemCapability.FileManagement.UserFileService 1095 * @crossplatform 1096 * @atomicservice 1097 * @since 12 1098 */ 1099 save(option?: AudioSaveOptions): Promise<Array<string>>; 1100 1101 /** 1102 * Pull up the audio picker based on the save mode. 1103 * 1104 * @param { AudioSaveOptions } option - represents the options provided in save mode. 1105 * @param { AsyncCallback<Array<string>> } callback - callback 1106 * @syscap SystemCapability.FileManagement.UserFileService 1107 * @since 9 1108 */ 1109 /** 1110 * Pull up the audio picker based on the save mode. 1111 * 1112 * @param { AudioSaveOptions } option - represents the options provided in save mode. 1113 * @param { AsyncCallback<Array<string>> } callback - callback 1114 * @syscap SystemCapability.FileManagement.UserFileService 1115 * @crossplatform 1116 * @since 12 1117 */ 1118 save(option: AudioSaveOptions, callback: AsyncCallback<Array<string>>): void; 1119 1120 /** 1121 * Pull up the audio picker based on the save mode. 1122 * 1123 * @param { AsyncCallback<Array<string>> } callback - callback 1124 * @syscap SystemCapability.FileManagement.UserFileService 1125 * @since 9 1126 */ 1127 /** 1128 * Pull up the audio picker based on the save mode. 1129 * 1130 * @param { AsyncCallback<Array<string>> } callback - callback 1131 * @syscap SystemCapability.FileManagement.UserFileService 1132 * @crossplatform 1133 * @since 12 1134 */ 1135 save(callback: AsyncCallback<Array<string>>): void; 1136 } 1137} 1138 1139export default picker; 1140