1/* 2 * Copyright (c) 2022-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 FormKit 19 */ 20 21import Want from './@ohos.app.ability.Want'; 22 23/** 24 * interface of formInfo. 25 * 26 * @namespace formInfo 27 * @syscap SystemCapability.Ability.Form 28 * @since 9 29 */ 30/** 31 * interface of formInfo. 32 * 33 * @namespace formInfo 34 * @syscap SystemCapability.Ability.Form 35 * @atomicservice 36 * @since 11 37 */ 38declare namespace formInfo { 39 /** 40 * Provides information about a form. 41 * 42 * @typedef FormInfo 43 * @syscap SystemCapability.Ability.Form 44 * @since 9 45 */ 46 /** 47 * Provides information about a form. 48 * 49 * @typedef FormInfo 50 * @syscap SystemCapability.Ability.Form 51 * @atomicservice 52 * @since 11 53 */ 54 interface FormInfo { 55 /** 56 * Obtains the bundle name of the application to which this form belongs. 57 * 58 * @type { string } 59 * @syscap SystemCapability.Ability.Form 60 * @since 9 61 */ 62 /** 63 * Obtains the bundle name of the application to which this form belongs. 64 * 65 * @type { string } 66 * @syscap SystemCapability.Ability.Form 67 * @atomicservice 68 * @since 11 69 */ 70 bundleName: string; 71 72 /** 73 * Obtains the name of the application module to which this form belongs. 74 * 75 * @type { string } 76 * @syscap SystemCapability.Ability.Form 77 * @since 9 78 */ 79 /** 80 * Obtains the name of the application module to which this form belongs. 81 * 82 * @type { string } 83 * @syscap SystemCapability.Ability.Form 84 * @atomicservice 85 * @since 11 86 */ 87 moduleName: string; 88 89 /** 90 * Obtains the class name of the ability to which this form belongs. 91 * 92 * @type { string } 93 * @syscap SystemCapability.Ability.Form 94 * @since 9 95 */ 96 /** 97 * Obtains the class name of the ability to which this form belongs. 98 * 99 * @type { string } 100 * @syscap SystemCapability.Ability.Form 101 * @atomicservice 102 * @since 11 103 */ 104 abilityName: string; 105 106 /** 107 * Obtains the name of this form. 108 * 109 * @type { string } 110 * @syscap SystemCapability.Ability.Form 111 * @since 9 112 */ 113 /** 114 * Obtains the name of this form. 115 * 116 * @type { string } 117 * @syscap SystemCapability.Ability.Form 118 * @atomicservice 119 * @since 11 120 */ 121 name: string; 122 123 /** 124 * Obtains the display name of this form. 125 * 126 * @type { string } 127 * @syscap SystemCapability.Ability.Form 128 * @atomicservice 129 * @since 11 130 */ 131 displayName: string; 132 133 /** 134 * Obtains the displayName resource id of this form. 135 * 136 * @type { number } 137 * @syscap SystemCapability.Ability.Form 138 * @atomicservice 139 * @since 11 140 */ 141 displayNameId: number; 142 143 /** 144 * Obtains the description of this form. 145 * 146 * @type { string } 147 * @syscap SystemCapability.Ability.Form 148 * @since 9 149 */ 150 /** 151 * Obtains the description of this form. 152 * 153 * @type { string } 154 * @syscap SystemCapability.Ability.Form 155 * @atomicservice 156 * @since 11 157 */ 158 description: string; 159 160 /** 161 * Obtains the description id of this form. 162 * 163 * @type { number } 164 * @syscap SystemCapability.Ability.Form 165 * @since 10 166 */ 167 /** 168 * Obtains the description id of this form. 169 * 170 * @type { number } 171 * @syscap SystemCapability.Ability.Form 172 * @atomicservice 173 * @since 11 174 */ 175 descriptionId: number; 176 177 /** 178 * Obtains the type of this form. Currently, JS forms are supported. 179 * 180 * @type { FormType } 181 * @syscap SystemCapability.Ability.Form 182 * @since 9 183 */ 184 /** 185 * Obtains the type of this form. Currently, JS forms are supported. 186 * 187 * @type { FormType } 188 * @syscap SystemCapability.Ability.Form 189 * @atomicservice 190 * @since 11 191 */ 192 type: FormType; 193 194 /** 195 * Obtains the JS component name of this JS form. 196 * 197 * @type { string } 198 * @syscap SystemCapability.Ability.Form 199 * @since 9 200 */ 201 /** 202 * Obtains the JS component name of this JS form. 203 * 204 * @type { string } 205 * @syscap SystemCapability.Ability.Form 206 * @atomicservice 207 * @since 11 208 */ 209 jsComponentName: string; 210 211 /** 212 * Obtains the color mode of this form. 213 * 214 * @type { ColorMode } 215 * @syscap SystemCapability.Ability.Form 216 * @since 9 217 */ 218 /** 219 * Obtains the color mode of this form. 220 * 221 * @type { ColorMode } 222 * @syscap SystemCapability.Ability.Form 223 * @atomicservice 224 * @since 11 225 */ 226 colorMode: ColorMode; 227 228 /** 229 * Checks whether this form is a default form. 230 * 231 * @type { boolean } 232 * @syscap SystemCapability.Ability.Form 233 * @since 9 234 */ 235 /** 236 * Checks whether this form is a default form. 237 * 238 * @type { boolean } 239 * @syscap SystemCapability.Ability.Form 240 * @atomicservice 241 * @since 11 242 */ 243 isDefault: boolean; 244 245 /** 246 * Obtains the updateEnabled. 247 * 248 * @type { boolean } 249 * @syscap SystemCapability.Ability.Form 250 * @since 9 251 */ 252 /** 253 * Obtains the updateEnabled. 254 * 255 * @type { boolean } 256 * @syscap SystemCapability.Ability.Form 257 * @atomicservice 258 * @since 11 259 */ 260 updateEnabled: boolean; 261 262 /** 263 * Obtains whether notify visible of this form. 264 * 265 * @type { boolean } 266 * @syscap SystemCapability.Ability.Form 267 * @since 9 268 */ 269 /** 270 * Obtains whether notify visible of this form. 271 * 272 * @type { boolean } 273 * @syscap SystemCapability.Ability.Form 274 * @atomicservice 275 * @since 11 276 */ 277 formVisibleNotify: boolean; 278 279 /** 280 * Obtains the scheduledUpdateTime. 281 * 282 * @type { string } 283 * @syscap SystemCapability.Ability.Form 284 * @since 9 285 */ 286 /** 287 * Obtains the scheduledUpdateTime. 288 * 289 * @type { string } 290 * @syscap SystemCapability.Ability.Form 291 * @atomicservice 292 * @since 11 293 */ 294 scheduledUpdateTime: string; 295 296 /** 297 * Obtains the form config ability about this form. 298 * 299 * @type { string } 300 * @syscap SystemCapability.Ability.Form 301 * @since 9 302 */ 303 /** 304 * Obtains the form config ability about this form. 305 * 306 * @type { string } 307 * @syscap SystemCapability.Ability.Form 308 * @atomicservice 309 * @since 11 310 */ 311 formConfigAbility: string; 312 313 /** 314 * Obtains the updateDuration. 315 * 316 * @type { number } 317 * @syscap SystemCapability.Ability.Form 318 * @since 9 319 */ 320 /** 321 * Obtains the updateDuration. 322 * 323 * @type { number } 324 * @syscap SystemCapability.Ability.Form 325 * @atomicservice 326 * @since 11 327 */ 328 updateDuration: number; 329 330 /** 331 * Obtains the default grid style of this form. 332 * 333 * @type { number } 334 * @syscap SystemCapability.Ability.Form 335 * @since 9 336 */ 337 /** 338 * Obtains the default grid style of this form. 339 * 340 * @type { number } 341 * @syscap SystemCapability.Ability.Form 342 * @atomicservice 343 * @since 11 344 */ 345 defaultDimension: number; 346 347 /** 348 * Obtains the grid styles supported by this form. 349 * 350 * @type { Array<number> } 351 * @syscap SystemCapability.Ability.Form 352 * @since 9 353 */ 354 /** 355 * Obtains the grid styles supported by this form. 356 * 357 * @type { Array<number> } 358 * @syscap SystemCapability.Ability.Form 359 * @atomicservice 360 * @since 11 361 */ 362 supportDimensions: Array<number>; 363 364 /** 365 * Obtains the custom data defined in this form. 366 * 367 * @type { object } 368 * @syscap SystemCapability.Ability.Form 369 * @since 9 370 */ 371 /** 372 * Obtains the custom data defined in this form. 373 * 374 * @type { Record<string, string> } 375 * @syscap SystemCapability.Ability.Form 376 * @atomicservice 377 * @since 11 378 */ 379 customizeData: Record<string, string>; 380 381 /** 382 * Obtains whether this form is a dynamic form. 383 * 384 * @type { boolean } 385 * @syscap SystemCapability.Ability.Form 386 * @since 10 387 */ 388 /** 389 * Obtains whether this form is a dynamic form. 390 * 391 * @type { boolean } 392 * @syscap SystemCapability.Ability.Form 393 * @atomicservice 394 * @since 11 395 */ 396 isDynamic: boolean; 397 398 /** 399 * Indicates whether the form can be set as a transparent background 400 * 401 * @type { boolean } 402 * @default false 403 * @syscap SystemCapability.Ability.Form 404 * @atomicservice 405 * @since 11 406 */ 407 transparencyEnabled: boolean; 408 409 /** 410 * Obtains the shape supported by this form. 411 * 412 * @type { Array<number> } 413 * @syscap SystemCapability.Ability.Form 414 * @atomicservice 415 * @since 12 416 */ 417 supportedShapes: Array<number>; 418 } 419 420 /** 421 * Type of form. 422 * 423 * @enum { number } 424 * @syscap SystemCapability.Ability.Form 425 * @since 9 426 */ 427 /** 428 * Type of form. 429 * 430 * @enum { number } 431 * @syscap SystemCapability.Ability.Form 432 * @atomicservice 433 * @since 11 434 */ 435 enum FormType { 436 /** 437 * JS form. 438 * 439 * @syscap SystemCapability.Ability.Form 440 * @since 9 441 */ 442 /** 443 * JS form. 444 * 445 * @syscap SystemCapability.Ability.Form 446 * @atomicservice 447 * @since 11 448 */ 449 JS = 1, 450 451 /** 452 * eTS form. 453 * 454 * @syscap SystemCapability.Ability.Form 455 * @since 9 456 */ 457 /** 458 * eTS form. 459 * 460 * @syscap SystemCapability.Ability.Form 461 * @atomicservice 462 * @since 11 463 */ 464 eTS = 2 465 } 466 467 /** 468 * Color mode. 469 * 470 * @enum { number } 471 * @syscap SystemCapability.Ability.Form 472 * @since 9 473 */ 474 /** 475 * Color mode. 476 * 477 * @enum { number } 478 * @syscap SystemCapability.Ability.Form 479 * @atomicservice 480 * @since 11 481 */ 482 enum ColorMode { 483 /** 484 * Automatic mode. 485 * 486 * @syscap SystemCapability.Ability.Form 487 * @since 9 488 */ 489 /** 490 * Automatic mode. 491 * 492 * @syscap SystemCapability.Ability.Form 493 * @atomicservice 494 * @since 11 495 */ 496 MODE_AUTO = -1, 497 498 /** 499 * Dark mode. 500 * 501 * @syscap SystemCapability.Ability.Form 502 * @since 9 503 */ 504 /** 505 * Dark mode. 506 * 507 * @syscap SystemCapability.Ability.Form 508 * @atomicservice 509 * @since 11 510 */ 511 MODE_DARK = 0, 512 513 /** 514 * Light mode. 515 * 516 * @syscap SystemCapability.Ability.Form 517 * @since 9 518 */ 519 /** 520 * Light mode. 521 * 522 * @syscap SystemCapability.Ability.Form 523 * @atomicservice 524 * @since 11 525 */ 526 MODE_LIGHT = 1 527 } 528 529 /** 530 * Provides state information about a form. 531 * 532 * @typedef FormStateInfo 533 * @syscap SystemCapability.Ability.Form 534 * @since 9 535 */ 536 /** 537 * Provides state information about a form. 538 * 539 * @typedef FormStateInfo 540 * @syscap SystemCapability.Ability.Form 541 * @atomicservice 542 * @since 11 543 */ 544 interface FormStateInfo { 545 /** 546 * Obtains the form state. 547 * 548 * @type { FormState } 549 * @syscap SystemCapability.Ability.Form 550 * @since 9 551 */ 552 /** 553 * Obtains the form state. 554 * 555 * @type { FormState } 556 * @syscap SystemCapability.Ability.Form 557 * @atomicservice 558 * @since 11 559 */ 560 formState: FormState; 561 562 /** 563 * Obtains the want form . 564 * 565 * @type { Want } 566 * @syscap SystemCapability.Ability.Form 567 * @since 9 568 */ 569 /** 570 * Obtains the want form . 571 * 572 * @type { Want } 573 * @syscap SystemCapability.Ability.Form 574 * @atomicservice 575 * @since 11 576 */ 577 want: Want; 578 } 579 580 /** 581 * Provides state about a form. 582 * 583 * @enum { number } 584 * @syscap SystemCapability.Ability.Form 585 * @since 9 586 */ 587 /** 588 * Provides state about a form. 589 * 590 * @enum { number } 591 * @syscap SystemCapability.Ability.Form 592 * @atomicservice 593 * @since 11 594 */ 595 enum FormState { 596 /** 597 * Indicates that the form status is unknown due to an internal error. 598 * 599 * @syscap SystemCapability.Ability.Form 600 * @since 9 601 */ 602 /** 603 * Indicates that the form status is unknown due to an internal error. 604 * 605 * @syscap SystemCapability.Ability.Form 606 * @atomicservice 607 * @since 11 608 */ 609 UNKNOWN = -1, 610 611 /** 612 * Indicates that the form is in the default state. 613 * 614 * @syscap SystemCapability.Ability.Form 615 * @since 9 616 */ 617 /** 618 * Indicates that the form is in the default state. 619 * 620 * @syscap SystemCapability.Ability.Form 621 * @atomicservice 622 * @since 11 623 */ 624 DEFAULT = 0, 625 626 /** 627 * Indicates that the form is ready. 628 * 629 * @syscap SystemCapability.Ability.Form 630 * @since 9 631 */ 632 /** 633 * Indicates that the form is ready. 634 * 635 * @syscap SystemCapability.Ability.Form 636 * @atomicservice 637 * @since 11 638 */ 639 READY = 1 640 } 641 642 /** 643 * Parameter of form. 644 * 645 * @enum { string } 646 * @syscap SystemCapability.Ability.Form 647 * @since 9 648 */ 649 /** 650 * Parameter of form. 651 * 652 * @enum { string } 653 * @syscap SystemCapability.Ability.Form 654 * @atomicservice 655 * @since 11 656 */ 657 enum FormParam { 658 /** 659 * Indicates the key specifying the ID of the form to be obtained, which is represented as 660 * want: { 661 * "parameters": { 662 * IDENTITY_KEY: "119476135" 663 * } 664 * }. 665 * 666 * @syscap SystemCapability.Ability.Form 667 * @since 9 668 */ 669 /** 670 * Indicates the key specifying the ID of the form to be obtained, which is represented as 671 * want: { 672 * "parameters": { 673 * IDENTITY_KEY: "119476135" 674 * } 675 * }. 676 * 677 * @syscap SystemCapability.Ability.Form 678 * @atomicservice 679 * @since 11 680 */ 681 IDENTITY_KEY = 'ohos.extra.param.key.form_identity', 682 683 /** 684 * Indicates the key specifying the grid style of the form to be obtained, which is represented as 685 * want: { 686 * "parameters": { 687 * DIMENSION_KEY: FormDimension.Dimension_1_2 688 * } 689 * }. 690 * 691 * @syscap SystemCapability.Ability.Form 692 * @since 9 693 */ 694 /** 695 * Indicates the key specifying the grid style of the form to be obtained, which is represented as 696 * want: { 697 * "parameters": { 698 * DIMENSION_KEY: FormDimension.Dimension_1_2 699 * } 700 * }. 701 * 702 * @syscap SystemCapability.Ability.Form 703 * @atomicservice 704 * @since 11 705 */ 706 DIMENSION_KEY = 'ohos.extra.param.key.form_dimension', 707 708 /** 709 * Indicates the key specifying the name of the form to be obtained, which is represented as 710 * want: { 711 * "parameters": { 712 * NAME_KEY: "formName" 713 * } 714 * }. 715 * 716 * @syscap SystemCapability.Ability.Form 717 * @since 9 718 */ 719 /** 720 * Indicates the key specifying the name of the form to be obtained, which is represented as 721 * want: { 722 * "parameters": { 723 * NAME_KEY: "formName" 724 * } 725 * }. 726 * 727 * @syscap SystemCapability.Ability.Form 728 * @atomicservice 729 * @since 11 730 */ 731 NAME_KEY = 'ohos.extra.param.key.form_name', 732 733 /** 734 * Indicates the key specifying the name of the module to which the form to be obtained belongs, which is 735 * represented as 736 * want: { 737 * "parameters": { 738 * MODULE_NAME_KEY: "formEntry" 739 * } 740 * } 741 * This constant is mandatory. 742 * 743 * @syscap SystemCapability.Ability.Form 744 * @since 9 745 */ 746 /** 747 * Indicates the key specifying the name of the module to which the form to be obtained belongs, which is 748 * represented as 749 * want: { 750 * "parameters": { 751 * MODULE_NAME_KEY: "formEntry" 752 * } 753 * } 754 * This constant is mandatory. 755 * 756 * @syscap SystemCapability.Ability.Form 757 * @atomicservice 758 * @since 11 759 */ 760 MODULE_NAME_KEY = 'ohos.extra.param.key.module_name', 761 762 /** 763 * Indicates the key specifying the width of the form to be obtained, which is represented as 764 * want: { 765 * "parameters": { 766 * WIDTH_KEY: 800 767 * } 768 * } 769 * 770 * @syscap SystemCapability.Ability.Form 771 * @since 9 772 */ 773 /** 774 * Indicates the key specifying the width of the form to be obtained, which is represented as 775 * want: { 776 * "parameters": { 777 * WIDTH_KEY: 800 778 * } 779 * } 780 * 781 * @syscap SystemCapability.Ability.Form 782 * @atomicservice 783 * @since 11 784 */ 785 WIDTH_KEY = 'ohos.extra.param.key.form_width', 786 787 /** 788 * Indicates the key specifying the height of the form to be obtained, which is represented as 789 * want: { 790 * "parameters": { 791 * HEIGHT_KEY: 400 792 * } 793 * } 794 * 795 * @syscap SystemCapability.Ability.Form 796 * @since 9 797 */ 798 /** 799 * Indicates the key specifying the height of the form to be obtained, which is represented as 800 * want: { 801 * "parameters": { 802 * HEIGHT_KEY: 400 803 * } 804 * } 805 * 806 * @syscap SystemCapability.Ability.Form 807 * @atomicservice 808 * @since 11 809 */ 810 HEIGHT_KEY = 'ohos.extra.param.key.form_height', 811 812 /** 813 * Indicates the key specifying whether a form is temporary, which is represented as 814 * want: { 815 * "parameters": { 816 * TEMPORARY_KEY: true 817 * } 818 * } 819 * 820 * @syscap SystemCapability.Ability.Form 821 * @since 9 822 */ 823 /** 824 * Indicates the key specifying whether a form is temporary, which is represented as 825 * want: { 826 * "parameters": { 827 * TEMPORARY_KEY: true 828 * } 829 * } 830 * 831 * @syscap SystemCapability.Ability.Form 832 * @atomicservice 833 * @since 11 834 */ 835 TEMPORARY_KEY = 'ohos.extra.param.key.form_temporary', 836 837 /** 838 * Indicates the key specifying the name of the bundle to be obtained, which is represented as 839 * want: { 840 * "parameters": { 841 * BUNDLE_NAME_KEY: "bundleName" 842 * } 843 * } 844 * 845 * @syscap SystemCapability.Ability.Form 846 * @since 9 847 */ 848 /** 849 * Indicates the key specifying the name of the bundle to be obtained, which is represented as 850 * want: { 851 * "parameters": { 852 * BUNDLE_NAME_KEY: "bundleName" 853 * } 854 * } 855 * 856 * @syscap SystemCapability.Ability.Form 857 * @atomicservice 858 * @since 11 859 */ 860 BUNDLE_NAME_KEY = 'ohos.extra.param.key.bundle_name', 861 862 /** 863 * Indicates the key specifying the name of the ability to be obtained, which is represented as 864 * want: { 865 * "parameters": { 866 * ABILITY_NAME_KEY: "abilityName" 867 * } 868 * } 869 * 870 * @syscap SystemCapability.Ability.Form 871 * @since 9 872 */ 873 /** 874 * Indicates the key specifying the name of the ability to be obtained, which is represented as 875 * want: { 876 * "parameters": { 877 * ABILITY_NAME_KEY: "abilityName" 878 * } 879 * } 880 * 881 * @syscap SystemCapability.Ability.Form 882 * @atomicservice 883 * @since 11 884 */ 885 ABILITY_NAME_KEY = 'ohos.extra.param.key.ability_name', 886 887 /** 888 * Indicates the key specifying whether a form type is theme, which is represented as 889 * want: { 890 * "parameters": { 891 * THEME_KEY: true 892 * } 893 * } 894 * 895 * @syscap SystemCapability.Ability.Form 896 * @systemapi 897 * @since 12 898 */ 899 THEME_KEY = 'ohos.extra.param.key.form_is_theme', 900 901 /** 902 * Indicates the key specifying the the device ID, which is represented as 903 * want: { 904 * "parameters": { 905 * DEVICE_ID_KEY : "EFC11C0C53628D8CC2F8CB5052477E130D075917034613B9884C55CD22B3DEF2" 906 * } 907 * } 908 * 909 * @syscap SystemCapability.Ability.Form 910 * @systemapi 911 * @since 9 912 */ 913 DEVICE_ID_KEY = 'ohos.extra.param.key.device_id', 914 915 /** 916 * Indicates the key specifying the launch reason of the form to be obtained, which is represented as 917 * want: { 918 * "parameters": { 919 * LAUNCH_REASON_KEY: LaunchReason.FORM_DEFAULT 920 * } 921 * } 922 * 923 * @syscap SystemCapability.Ability.Form 924 * @since 10 925 */ 926 /** 927 * Indicates the key specifying the launch reason of the form to be obtained, which is represented as 928 * want: { 929 * "parameters": { 930 * LAUNCH_REASON_KEY: LaunchReason.FORM_DEFAULT 931 * } 932 * } 933 * 934 * @syscap SystemCapability.Ability.Form 935 * @atomicservice 936 * @since 11 937 */ 938 LAUNCH_REASON_KEY = 'ohos.extra.param.key.form_launch_reason', 939 940 /** 941 * Indicates the key specifying the custom data of the form to be obtained, which is represented as 942 * want: { 943 * "parameters": { 944 * PARAM_FORM_CUSTOMIZE_KEY: { 945 * "key": "userData" 946 * } 947 * } 948 * } 949 * 950 * @syscap SystemCapability.Ability.Form 951 * @since 10 952 */ 953 /** 954 * Indicates the key specifying the custom data of the form to be obtained, which is represented as 955 * want: { 956 * "parameters": { 957 * PARAM_FORM_CUSTOMIZE_KEY: { 958 * "key": "userData" 959 * } 960 * } 961 * } 962 * 963 * @syscap SystemCapability.Ability.Form 964 * @atomicservice 965 * @since 11 966 */ 967 PARAM_FORM_CUSTOMIZE_KEY = 'ohos.extra.param.key.form_customize', 968 969 /** 970 * Indicates the key specifying the form location, which is represented as 971 * want: { 972 * "parameters": { 973 * FORM_LOCATION_KEY: FormLocation.DESKTOP 974 * } 975 * }. 976 * 977 * @syscap SystemCapability.Ability.Form 978 * @since 12 979 */ 980 FORM_LOCATION_KEY = 'ohos.extra.param.key.form_location', 981 982 /** 983 * Indicates the key specifying the form rendering mode, which is represented as 984 * want: { 985 * "parameters": { 986 * FORM_RENDERING_MODE_KEY: FormRenderingMode.SINGLE_COLOR 987 * } 988 * }. 989 * 990 * @syscap SystemCapability.Ability.Form 991 * @since 11 992 */ 993 /** 994 * Indicates the key specifying the form rendering mode, which is represented as 995 * want: { 996 * "parameters": { 997 * FORM_RENDERING_MODE_KEY: FormRenderingMode.SINGLE_COLOR 998 * } 999 * }. 1000 * 1001 * @syscap SystemCapability.Ability.Form 1002 * @atomicservice 1003 * @since 12 1004 */ 1005 FORM_RENDERING_MODE_KEY = 'ohos.extra.param.key.form_rendering_mode', 1006 1007 /** 1008 * Indicates the key specifying the inverse of the host background color, which is represented as 1009 * want: { 1010 * "parameters": { 1011 * HOST_BG_INVERSE_COLOR_KEY: "#FF000000" 1012 * } 1013 * }. 1014 * 1015 * @syscap SystemCapability.Ability.Form 1016 * @atomicservice 1017 * @since 12 1018 */ 1019 HOST_BG_INVERSE_COLOR_KEY = 'ohos.extra.param.key.host_bg_inverse_color', 1020 1021 /** 1022 * Indicates the key specifying the user granted permission name, which is represented as 1023 * want: { 1024 * "parameters": { 1025 * FORM_PERMISSION_NAME_KEY: "permissionName" 1026 * } 1027 * }. 1028 * 1029 * @syscap SystemCapability.Ability.Form 1030 * @atomicservice 1031 * @since 12 1032 */ 1033 FORM_PERMISSION_NAME_KEY = 'ohos.extra.param.key.permission_name', 1034 1035 /** 1036 * Indicates the key specifying whether the user granted, which is represented as 1037 * want: { 1038 * "parameters": { 1039 * FORM_PERMISSION_GRANTED_KEY: true 1040 * } 1041 * }. 1042 * 1043 * @syscap SystemCapability.Ability.Form 1044 * @atomicservice 1045 * @since 12 1046 */ 1047 FORM_PERMISSION_GRANTED_KEY = 'ohos.extra.param.key.permission_granted', 1048 } 1049 1050 /** 1051 * The optional options used as filters to ask 1052 * getFormsInfo to return formInfos from only forms that match the options. 1053 * 1054 * @typedef FormInfoFilter 1055 * @syscap SystemCapability.Ability.Form 1056 * @since 9 1057 */ 1058 /** 1059 * The optional options used as filters to ask 1060 * getFormsInfo to return formInfos from only forms that match the options. 1061 * 1062 * @typedef FormInfoFilter 1063 * @syscap SystemCapability.Ability.Form 1064 * @atomicservice 1065 * @since 11 1066 */ 1067 interface FormInfoFilter { 1068 /** 1069 * optional bundleName that used to ask getFormsInfo to return 1070 * form infos with the same bundleName. 1071 * 1072 * @type { ?string } 1073 * @syscap SystemCapability.Ability.Form 1074 * @systemapi 1075 * @since 12 1076 */ 1077 bundleName?: string; 1078 1079 /** 1080 * optional moduleName that used to ask getFormsInfo to return 1081 * form infos with the same moduleName. 1082 * 1083 * @type { ?string } 1084 * @syscap SystemCapability.Ability.Form 1085 * @since 9 1086 */ 1087 /** 1088 * optional moduleName that used to ask getFormsInfo to return 1089 * form infos with the same moduleName. 1090 * 1091 * @type { ?string } 1092 * @syscap SystemCapability.Ability.Form 1093 * @atomicservice 1094 * @since 11 1095 */ 1096 moduleName?: string; 1097 1098 /** 1099 * optional supportedDimensions that used to ask getFormsInfo to return 1100 * form infos with the same supportedDimensions. 1101 * 1102 * @type { ?Array<number> } 1103 * @syscap SystemCapability.Ability.Form 1104 * @systemapi 1105 * @since 12 1106 */ 1107 supportedDimensions?: Array<number>; 1108 1109 /** 1110 * optional supportedShapes that used to ask getFormsInfo to return 1111 * form infos with the same supportedShapes. 1112 * 1113 * @type { ?Array<number> } 1114 * @syscap SystemCapability.Ability.Form 1115 * @systemapi 1116 * @since 12 1117 */ 1118 supportedShapes?: Array<number>; 1119 } 1120 1121 /** 1122 * Defines the FormDimension enum. 1123 * 1124 * @enum { number } 1125 * @syscap SystemCapability.Ability.Form 1126 * @since 9 1127 */ 1128 /** 1129 * Defines the FormDimension enum. 1130 * 1131 * @enum { number } 1132 * @syscap SystemCapability.Ability.Form 1133 * @atomicservice 1134 * @since 11 1135 */ 1136 enum FormDimension { 1137 /** 1138 * 1 x 2 form 1139 * 1140 * @syscap SystemCapability.Ability.Form 1141 * @since 9 1142 */ 1143 /** 1144 * 1 x 2 form 1145 * 1146 * @syscap SystemCapability.Ability.Form 1147 * @atomicservice 1148 * @since 11 1149 */ 1150 Dimension_1_2 = 1, 1151 1152 /** 1153 * 2 x 2 form 1154 * 1155 * @syscap SystemCapability.Ability.Form 1156 * @since 9 1157 */ 1158 /** 1159 * 2 x 2 form 1160 * 1161 * @syscap SystemCapability.Ability.Form 1162 * @atomicservice 1163 * @since 11 1164 */ 1165 Dimension_2_2, 1166 1167 /** 1168 * 2 x 4 form 1169 * 1170 * @syscap SystemCapability.Ability.Form 1171 * @since 9 1172 */ 1173 /** 1174 * 2 x 4 form 1175 * 1176 * @syscap SystemCapability.Ability.Form 1177 * @atomicservice 1178 * @since 11 1179 */ 1180 Dimension_2_4, 1181 1182 /** 1183 * 4 x 4 form 1184 * 1185 * @syscap SystemCapability.Ability.Form 1186 * @since 9 1187 */ 1188 /** 1189 * 4 x 4 form 1190 * 1191 * @syscap SystemCapability.Ability.Form 1192 * @atomicservice 1193 * @since 11 1194 */ 1195 Dimension_4_4, 1196 1197 /** 1198 * 2 x 1 form 1199 * 1200 * @syscap SystemCapability.Ability.Form 1201 * @since 9 1202 */ 1203 /** 1204 * 2 x 1 form 1205 * 1206 * @syscap SystemCapability.Ability.Form 1207 * @atomicservice 1208 * @since 11 1209 */ 1210 Dimension_2_1, 1211 1212 /** 1213 * 1 x 1 form 1214 * 1215 * @syscap SystemCapability.Ability.Form 1216 * @atomicservice 1217 * @since 11 1218 */ 1219 DIMENSION_1_1, 1220 1221 /** 1222 * 6 x 4 form 1223 * 1224 * @syscap SystemCapability.Ability.Form 1225 * @atomicservice 1226 * @since 12 1227 */ 1228 DIMENSION_6_4, 1229 } 1230 1231 /** 1232 * Defines the FormShape enum. 1233 * 1234 * @enum { number } 1235 * @syscap SystemCapability.Ability.Form 1236 * @atomicservice 1237 * @since 12 1238 */ 1239 enum FormShape { 1240 /** 1241 * The rect shape. 1242 * 1243 * @syscap SystemCapability.Ability.Form 1244 * @atomicservice 1245 * @since 12 1246 */ 1247 RECT = 1, 1248 1249 /** 1250 * The circle shape. 1251 * 1252 * @syscap SystemCapability.Ability.Form 1253 * @atomicservice 1254 * @since 12 1255 */ 1256 CIRCLE, 1257 } 1258 1259 /** 1260 * The visibility of a form. 1261 * 1262 * @enum { number } 1263 * @syscap SystemCapability.Ability.Form 1264 * @since 9 1265 */ 1266 /** 1267 * The visibility of a form. 1268 * 1269 * @enum { number } 1270 * @syscap SystemCapability.Ability.Form 1271 * @atomicservice 1272 * @since 11 1273 */ 1274 enum VisibilityType { 1275 /** 1276 * Indicates the type of the form type is unknown. 1277 * Often used as a condition variable in function OnVisibilityChange to specify actions only on forms that are 1278 * changing to unknown. 1279 * 1280 * @syscap SystemCapability.Ability.Form 1281 * @since 10 1282 */ 1283 /** 1284 * Indicates the type of the form type is unknown. 1285 * Often used as a condition variable in function OnVisibilityChange to specify actions only on forms that are 1286 * changing to unknown. 1287 * 1288 * @syscap SystemCapability.Ability.Form 1289 * @atomicservice 1290 * @since 11 1291 */ 1292 UNKNOWN = 0, 1293 /** 1294 * Indicates the type of the form is visible. 1295 * Often used as a condition variable in function OnVisibilityChange to specify actions only on forms that are 1296 * changing to visible. 1297 * 1298 * @syscap SystemCapability.Ability.Form 1299 * @since 9 1300 */ 1301 /** 1302 * Indicates the type of the form is visible. 1303 * Often used as a condition variable in function OnVisibilityChange to specify actions only on forms that are 1304 * changing to visible. 1305 * 1306 * @syscap SystemCapability.Ability.Form 1307 * @atomicservice 1308 * @since 11 1309 */ 1310 FORM_VISIBLE = 1, 1311 /** 1312 * Indicates the type of the form is invisible. 1313 * Often used as a condition variable in function OnVisibilityChange to specify actions only on forms that are 1314 * changing to invisible. 1315 * 1316 * @syscap SystemCapability.Ability.Form 1317 * @since 9 1318 */ 1319 /** 1320 * Indicates the type of the form is invisible. 1321 * Often used as a condition variable in function OnVisibilityChange to specify actions only on forms that are 1322 * changing to invisible. 1323 * 1324 * @syscap SystemCapability.Ability.Form 1325 * @atomicservice 1326 * @since 11 1327 */ 1328 FORM_INVISIBLE 1329 } 1330 1331 /** 1332 * Indicates the launch reason of a form. 1333 * 1334 * @enum { number } 1335 * @syscap SystemCapability.Ability.Form 1336 * @since 10 1337 */ 1338 /** 1339 * Indicates the launch reason of a form. 1340 * 1341 * @enum { number } 1342 * @syscap SystemCapability.Ability.Form 1343 * @atomicservice 1344 * @since 11 1345 */ 1346 enum LaunchReason { 1347 /** 1348 * Indicates the launch reason of a form is default. 1349 * 1350 * @syscap SystemCapability.Ability.Form 1351 * @since 10 1352 */ 1353 /** 1354 * Indicates the launch reason of a form is default. 1355 * 1356 * @syscap SystemCapability.Ability.Form 1357 * @atomicservice 1358 * @since 11 1359 */ 1360 FORM_DEFAULT = 1, 1361 /** 1362 * Indicates the launch reason of a form is share. 1363 * 1364 * @syscap SystemCapability.Ability.Form 1365 * @since 10 1366 */ 1367 /** 1368 * Indicates the launch reason of a form is share. 1369 * 1370 * @syscap SystemCapability.Ability.Form 1371 * @atomicservice 1372 * @since 11 1373 */ 1374 FORM_SHARE 1375 } 1376 1377 /** 1378 * The result of publish form. 1379 * 1380 * @typedef PublishFormResult 1381 * @syscap SystemCapability.Ability.Form 1382 * @systemapi 1383 * @stagemodelonly 1384 * @since 12 1385 */ 1386 interface PublishFormResult { 1387 /** 1388 * The error code. 1389 * 1390 * @type { PublishFormErrorCode } 1391 * @syscap SystemCapability.Ability.Form 1392 * @systemapi 1393 * @stagemodelonly 1394 * @since 12 1395 */ 1396 code: PublishFormErrorCode; 1397 1398 /** 1399 * The message. 1400 * 1401 * @type { string } 1402 * @syscap SystemCapability.Ability.Form 1403 * @systemapi 1404 * @stagemodelonly 1405 * @since 12 1406 */ 1407 message: string; 1408 } 1409 1410 /** 1411 * The error code of publish form. 1412 * 1413 * @enum { number } 1414 * @syscap SystemCapability.Ability.Form 1415 * @systemapi 1416 * @stagemodelonly 1417 * @since 12 1418 */ 1419 enum PublishFormErrorCode { 1420 /** 1421 * Publish form success. 1422 * 1423 * @syscap SystemCapability.Ability.Form 1424 * @systemapi 1425 * @stagemodelonly 1426 * @since 12 1427 */ 1428 SUCCESS, 1429 1430 /** 1431 * Host has no space to publish form. 1432 * 1433 * @syscap SystemCapability.Ability.Form 1434 * @systemapi 1435 * @stagemodelonly 1436 * @since 12 1437 */ 1438 NO_SPACE, 1439 1440 /** 1441 * Check param failed. 1442 * 1443 * @syscap SystemCapability.Ability.Form 1444 * @systemapi 1445 * @stagemodelonly 1446 * @since 12 1447 */ 1448 PARAM_ERROR, 1449 1450 /** 1451 * Internal error occurs during form processing. 1452 * 1453 * @syscap SystemCapability.Ability.Form 1454 * @systemapi 1455 * @stagemodelonly 1456 * @since 12 1457 */ 1458 INTERNAL_ERROR, 1459 } 1460 1461 /** 1462 * Information about a running form. 1463 * 1464 * @typedef FormProviderFilter 1465 * @syscap SystemCapability.Ability.Form 1466 * @systemapi 1467 * @stagemodelonly 1468 * @since 10 1469 */ 1470 interface FormProviderFilter { 1471 /** 1472 * Obtains the bundle name of the provider application. 1473 * 1474 * @type { string } 1475 * @syscap SystemCapability.Ability.Form 1476 * @systemapi 1477 * @stagemodelonly 1478 * @since 10 1479 */ 1480 bundleName: string; 1481 1482 /** 1483 * Obtains the form name of the provider application form. 1484 * 1485 * @type { ?string } 1486 * @syscap SystemCapability.Ability.Form 1487 * @systemapi 1488 * @stagemodelonly 1489 * @since 10 1490 */ 1491 formName?: string; 1492 1493 /** 1494 * Obtains the module name of the provider application module. 1495 * 1496 * @type { ?string } 1497 * @syscap SystemCapability.Ability.Form 1498 * @systemapi 1499 * @stagemodelonly 1500 * @since 10 1501 */ 1502 moduleName?: string; 1503 1504 /** 1505 * Obtains the ability name of the provider application module. 1506 * 1507 * @type { ?string } 1508 * @syscap SystemCapability.Ability.Form 1509 * @systemapi 1510 * @stagemodelonly 1511 * @since 10 1512 */ 1513 abilityName?: string; 1514 1515 /** 1516 * Indicates whether to include unused form. 1517 * 1518 * @type { ?boolean } 1519 * @default false 1520 * @syscap SystemCapability.Ability.Form 1521 * @systemapi 1522 * @stagemodelonly 1523 * @since 11 1524 */ 1525 isUnusedIncluded?: boolean; 1526 } 1527 1528 /** 1529 * The class of a running form information. 1530 * 1531 * @typedef RunningFormInfo 1532 * @syscap SystemCapability.Ability.Form 1533 * @systemapi hide this for inner system use 1534 * @since 10 1535 */ 1536 interface RunningFormInfo { 1537 /** 1538 * Obtains the id of the this form. 1539 * 1540 * @type { string } 1541 * @default - 1542 * @syscap SystemCapability.Ability.Form 1543 * @systemapi 1544 * @since 10 1545 */ 1546 readonly formId: string; 1547 1548 /** 1549 * Obtains the bundle name of the application to which this form belongs. 1550 * 1551 * @type { string } 1552 * @default - 1553 * @syscap SystemCapability.Ability.Form 1554 * @systemapi 1555 * @since 10 1556 */ 1557 readonly bundleName: string; 1558 1559 /** 1560 * Obtains the bundle name of the form host application. 1561 * 1562 * @type { string } 1563 * @default - 1564 * @syscap SystemCapability.Ability.Form 1565 * @systemapi 1566 * @since 10 1567 */ 1568 readonly hostBundleName: string; 1569 1570 /** 1571 * The location of this form. 1572 * 1573 * @type { FormLocation } 1574 * @default - 1575 * @syscap SystemCapability.Ability.Form 1576 * @systemapi 1577 * @since 12 1578 */ 1579 readonly formLocation: FormLocation; 1580 1581 /** 1582 * Obtains the visibility of this form. 1583 * 1584 * @type { VisibilityType } 1585 * @default - 1586 * @syscap SystemCapability.Ability.Form 1587 * @systemapi 1588 * @since 10 1589 */ 1590 readonly visibilityType: VisibilityType; 1591 1592 /** 1593 * Obtains the name of the application module to which this form belongs. 1594 * 1595 * @type { string } 1596 * @default - 1597 * @syscap SystemCapability.Ability.Form 1598 * @systemapi 1599 * @since 10 1600 */ 1601 readonly moduleName: string; 1602 1603 /** 1604 * Obtains the class name of the ability to which this form belongs. 1605 * 1606 * @type { string } 1607 * @default - 1608 * @syscap SystemCapability.Ability.Form 1609 * @systemapi 1610 * @since 10 1611 */ 1612 readonly abilityName: string; 1613 1614 /** 1615 * Obtains the name of this form. 1616 * 1617 * @type { string } 1618 * @default - 1619 * @syscap SystemCapability.Ability.Form 1620 * @systemapi 1621 * @since 10 1622 */ 1623 readonly formName: string; 1624 1625 /** 1626 * Obtains the grid style of this form. 1627 * 1628 * @type { number } 1629 * @default - 1630 * @syscap SystemCapability.Ability.Form 1631 * @systemapi 1632 * @since 10 1633 */ 1634 readonly dimension: number; 1635 1636 /** 1637 * Obtains the stage of form use. 1638 * 1639 * @type { FormUsageState } 1640 * @default FormUsageState.USED 1641 * @readonly 1642 * @syscap SystemCapability.Ability.Form 1643 * @systemapi 1644 * @since 11 1645 */ 1646 readonly formUsageState: FormUsageState; 1647 1648 /** 1649 * Obtains the description of this form. 1650 * 1651 * @type { string } 1652 * @readonly 1653 * @syscap SystemCapability.Ability.Form 1654 * @systemapi 1655 * @since 11 1656 */ 1657 readonly formDescription: string; 1658 1659 /** 1660 * Obtains the extra data of the this form. 1661 * 1662 * @type { ?Record<string, Object> } 1663 * @default - 1664 * @readonly 1665 * @syscap SystemCapability.Ability.Form 1666 * @systemapi 1667 * @since 12 1668 */ 1669 readonly extraData?: Record<string, Object>; 1670 } 1671 1672 /** 1673 * The stage of form use. 1674 * 1675 * @enum { number } 1676 * @syscap SystemCapability.Ability.Form 1677 * @systemapi 1678 * @since 11 1679 */ 1680 enum FormUsageState { 1681 /** 1682 * Indicates the stage of the form is used. 1683 * 1684 * @syscap SystemCapability.Ability.Form 1685 * @systemapi 1686 * @since 11 1687 */ 1688 USED = 0, 1689 /** 1690 * Indicates the stage of the form is unused. 1691 * 1692 * @syscap SystemCapability.Ability.Form 1693 * @systemapi 1694 * @since 11 1695 */ 1696 UNUSED = 1, 1697 } 1698 1699 /** 1700 * Defines the FormLocation enum. 1701 * 1702 * @enum { number } 1703 * @syscap SystemCapability.Ability.Form 1704 * @systemapi 1705 * @since 12 1706 */ 1707 enum FormLocation { 1708 /** 1709 * Form is on the other location. 1710 * 1711 * @syscap SystemCapability.Ability.Form 1712 * @systemapi 1713 * @since 12 1714 */ 1715 OTHER = -1, 1716 1717 /** 1718 * Form is on the desktop 1719 * 1720 * @syscap SystemCapability.Ability.Form 1721 * @systemapi 1722 * @since 12 1723 */ 1724 DESKTOP = 0, 1725 1726 /** 1727 * Form is on the form center. 1728 * 1729 * @syscap SystemCapability.Ability.Form 1730 * @systemapi 1731 * @since 12 1732 */ 1733 FORM_CENTER = 1, 1734 1735 /** 1736 * Form is on the form manager. 1737 * 1738 * @syscap SystemCapability.Ability.Form 1739 * @systemapi 1740 * @since 12 1741 */ 1742 FORM_MANAGER = 2, 1743 1744 /** 1745 * Form is on the negative screen. 1746 * 1747 * @syscap SystemCapability.Ability.Form 1748 * @systemapi 1749 * @since 12 1750 */ 1751 NEGATIVE_SCREEN = 3, 1752 1753 /** 1754 * Form is on the form center of negative screen. 1755 * 1756 * @syscap SystemCapability.Ability.Form 1757 * @systemapi 1758 * @since 12 1759 */ 1760 FORM_CENTER_NEGATIVE_SCREEN = 4, 1761 1762 /** 1763 * Form is on the form manager of negative screen. 1764 * 1765 * @syscap SystemCapability.Ability.Form 1766 * @systemapi 1767 * @since 12 1768 */ 1769 FORM_MANAGER_NEGATIVE_SCREEN = 5, 1770 1771 /** 1772 * Form is on the screen lock. 1773 * 1774 * @syscap SystemCapability.Ability.Form 1775 * @systemapi 1776 * @since 12 1777 */ 1778 SCREEN_LOCK = 6, 1779 1780 /** 1781 * Form is on the ai suggestion. 1782 * 1783 * @syscap SystemCapability.Ability.Form 1784 * @systemapi 1785 * @since 12 1786 */ 1787 AI_SUGGESTION = 7, 1788 } 1789} 1790export default formInfo; 1791