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 /** 411 * Type of form. 412 * 413 * @enum { number } 414 * @syscap SystemCapability.Ability.Form 415 * @since 9 416 */ 417 /** 418 * Type of form. 419 * 420 * @enum { number } 421 * @syscap SystemCapability.Ability.Form 422 * @atomicservice 423 * @since 11 424 */ 425 enum FormType { 426 /** 427 * JS form. 428 * 429 * @syscap SystemCapability.Ability.Form 430 * @since 9 431 */ 432 /** 433 * JS form. 434 * 435 * @syscap SystemCapability.Ability.Form 436 * @atomicservice 437 * @since 11 438 */ 439 JS = 1, 440 441 /** 442 * eTS form. 443 * 444 * @syscap SystemCapability.Ability.Form 445 * @since 9 446 */ 447 /** 448 * eTS form. 449 * 450 * @syscap SystemCapability.Ability.Form 451 * @atomicservice 452 * @since 11 453 */ 454 eTS = 2 455 } 456 457 /** 458 * Color mode. 459 * 460 * @enum { number } 461 * @syscap SystemCapability.Ability.Form 462 * @since 9 463 */ 464 /** 465 * Color mode. 466 * 467 * @enum { number } 468 * @syscap SystemCapability.Ability.Form 469 * @atomicservice 470 * @since 11 471 */ 472 enum ColorMode { 473 /** 474 * Automatic mode. 475 * 476 * @syscap SystemCapability.Ability.Form 477 * @since 9 478 */ 479 /** 480 * Automatic mode. 481 * 482 * @syscap SystemCapability.Ability.Form 483 * @atomicservice 484 * @since 11 485 */ 486 MODE_AUTO = -1, 487 488 /** 489 * Dark mode. 490 * 491 * @syscap SystemCapability.Ability.Form 492 * @since 9 493 */ 494 /** 495 * Dark mode. 496 * 497 * @syscap SystemCapability.Ability.Form 498 * @atomicservice 499 * @since 11 500 */ 501 MODE_DARK = 0, 502 503 /** 504 * Light mode. 505 * 506 * @syscap SystemCapability.Ability.Form 507 * @since 9 508 */ 509 /** 510 * Light mode. 511 * 512 * @syscap SystemCapability.Ability.Form 513 * @atomicservice 514 * @since 11 515 */ 516 MODE_LIGHT = 1 517 } 518 519 /** 520 * Provides state information about a form. 521 * 522 * @typedef FormStateInfo 523 * @syscap SystemCapability.Ability.Form 524 * @since 9 525 */ 526 /** 527 * Provides state information about a form. 528 * 529 * @typedef FormStateInfo 530 * @syscap SystemCapability.Ability.Form 531 * @atomicservice 532 * @since 11 533 */ 534 interface FormStateInfo { 535 /** 536 * Obtains the form state. 537 * 538 * @type { FormState } 539 * @syscap SystemCapability.Ability.Form 540 * @since 9 541 */ 542 /** 543 * Obtains the form state. 544 * 545 * @type { FormState } 546 * @syscap SystemCapability.Ability.Form 547 * @atomicservice 548 * @since 11 549 */ 550 formState: FormState; 551 552 /** 553 * Obtains the want form . 554 * 555 * @type { Want } 556 * @syscap SystemCapability.Ability.Form 557 * @since 9 558 */ 559 /** 560 * Obtains the want form . 561 * 562 * @type { Want } 563 * @syscap SystemCapability.Ability.Form 564 * @atomicservice 565 * @since 11 566 */ 567 want: Want; 568 } 569 570 /** 571 * Provides state about a form. 572 * 573 * @enum { number } 574 * @syscap SystemCapability.Ability.Form 575 * @since 9 576 */ 577 /** 578 * Provides state about a form. 579 * 580 * @enum { number } 581 * @syscap SystemCapability.Ability.Form 582 * @atomicservice 583 * @since 11 584 */ 585 enum FormState { 586 /** 587 * Indicates that the form status is unknown due to an internal error. 588 * 589 * @syscap SystemCapability.Ability.Form 590 * @since 9 591 */ 592 /** 593 * Indicates that the form status is unknown due to an internal error. 594 * 595 * @syscap SystemCapability.Ability.Form 596 * @atomicservice 597 * @since 11 598 */ 599 UNKNOWN = -1, 600 601 /** 602 * Indicates that the form is in the default state. 603 * 604 * @syscap SystemCapability.Ability.Form 605 * @since 9 606 */ 607 /** 608 * Indicates that the form is in the default state. 609 * 610 * @syscap SystemCapability.Ability.Form 611 * @atomicservice 612 * @since 11 613 */ 614 DEFAULT = 0, 615 616 /** 617 * Indicates that the form is ready. 618 * 619 * @syscap SystemCapability.Ability.Form 620 * @since 9 621 */ 622 /** 623 * Indicates that the form is ready. 624 * 625 * @syscap SystemCapability.Ability.Form 626 * @atomicservice 627 * @since 11 628 */ 629 READY = 1 630 } 631 632 /** 633 * Parameter of form. 634 * 635 * @enum { string } 636 * @syscap SystemCapability.Ability.Form 637 * @since 9 638 */ 639 /** 640 * Parameter of form. 641 * 642 * @enum { string } 643 * @syscap SystemCapability.Ability.Form 644 * @atomicservice 645 * @since 11 646 */ 647 enum FormParam { 648 /** 649 * Indicates the key specifying the ID of the form to be obtained, which is represented as 650 * want: { 651 * "parameters": { 652 * IDENTITY_KEY: "119476135" 653 * } 654 * }. 655 * 656 * @syscap SystemCapability.Ability.Form 657 * @since 9 658 */ 659 /** 660 * Indicates the key specifying the ID of the form to be obtained, which is represented as 661 * want: { 662 * "parameters": { 663 * IDENTITY_KEY: "119476135" 664 * } 665 * }. 666 * 667 * @syscap SystemCapability.Ability.Form 668 * @atomicservice 669 * @since 11 670 */ 671 IDENTITY_KEY = 'ohos.extra.param.key.form_identity', 672 673 /** 674 * Indicates the key specifying the grid style of the form to be obtained, which is represented as 675 * want: { 676 * "parameters": { 677 * DIMENSION_KEY: FormDimension.Dimension_1_2 678 * } 679 * }. 680 * 681 * @syscap SystemCapability.Ability.Form 682 * @since 9 683 */ 684 /** 685 * Indicates the key specifying the grid style of the form to be obtained, which is represented as 686 * want: { 687 * "parameters": { 688 * DIMENSION_KEY: FormDimension.Dimension_1_2 689 * } 690 * }. 691 * 692 * @syscap SystemCapability.Ability.Form 693 * @atomicservice 694 * @since 11 695 */ 696 DIMENSION_KEY = 'ohos.extra.param.key.form_dimension', 697 698 /** 699 * Indicates the key specifying the name of the form to be obtained, which is represented as 700 * want: { 701 * "parameters": { 702 * NAME_KEY: "formName" 703 * } 704 * }. 705 * 706 * @syscap SystemCapability.Ability.Form 707 * @since 9 708 */ 709 /** 710 * Indicates the key specifying the name of the form to be obtained, which is represented as 711 * want: { 712 * "parameters": { 713 * NAME_KEY: "formName" 714 * } 715 * }. 716 * 717 * @syscap SystemCapability.Ability.Form 718 * @atomicservice 719 * @since 11 720 */ 721 NAME_KEY = 'ohos.extra.param.key.form_name', 722 723 /** 724 * Indicates the key specifying the name of the module to which the form to be obtained belongs, which is 725 * represented as 726 * want: { 727 * "parameters": { 728 * MODULE_NAME_KEY: "formEntry" 729 * } 730 * } 731 * This constant is mandatory. 732 * 733 * @syscap SystemCapability.Ability.Form 734 * @since 9 735 */ 736 /** 737 * Indicates the key specifying the name of the module to which the form to be obtained belongs, which is 738 * represented as 739 * want: { 740 * "parameters": { 741 * MODULE_NAME_KEY: "formEntry" 742 * } 743 * } 744 * This constant is mandatory. 745 * 746 * @syscap SystemCapability.Ability.Form 747 * @atomicservice 748 * @since 11 749 */ 750 MODULE_NAME_KEY = 'ohos.extra.param.key.module_name', 751 752 /** 753 * Indicates the key specifying the width of the form to be obtained, which is represented as 754 * want: { 755 * "parameters": { 756 * WIDTH_KEY: 800 757 * } 758 * } 759 * 760 * @syscap SystemCapability.Ability.Form 761 * @since 9 762 */ 763 /** 764 * Indicates the key specifying the width of the form to be obtained, which is represented as 765 * want: { 766 * "parameters": { 767 * WIDTH_KEY: 800 768 * } 769 * } 770 * 771 * @syscap SystemCapability.Ability.Form 772 * @atomicservice 773 * @since 11 774 */ 775 WIDTH_KEY = 'ohos.extra.param.key.form_width', 776 777 /** 778 * Indicates the key specifying the height of the form to be obtained, which is represented as 779 * want: { 780 * "parameters": { 781 * HEIGHT_KEY: 400 782 * } 783 * } 784 * 785 * @syscap SystemCapability.Ability.Form 786 * @since 9 787 */ 788 /** 789 * Indicates the key specifying the height of the form to be obtained, which is represented as 790 * want: { 791 * "parameters": { 792 * HEIGHT_KEY: 400 793 * } 794 * } 795 * 796 * @syscap SystemCapability.Ability.Form 797 * @atomicservice 798 * @since 11 799 */ 800 HEIGHT_KEY = 'ohos.extra.param.key.form_height', 801 802 /** 803 * Indicates the key specifying whether a form is temporary, which is represented as 804 * want: { 805 * "parameters": { 806 * TEMPORARY_KEY: true 807 * } 808 * } 809 * 810 * @syscap SystemCapability.Ability.Form 811 * @since 9 812 */ 813 /** 814 * Indicates the key specifying whether a form is temporary, which is represented as 815 * want: { 816 * "parameters": { 817 * TEMPORARY_KEY: true 818 * } 819 * } 820 * 821 * @syscap SystemCapability.Ability.Form 822 * @atomicservice 823 * @since 11 824 */ 825 TEMPORARY_KEY = 'ohos.extra.param.key.form_temporary', 826 827 /** 828 * Indicates the key specifying the name of the bundle to be obtained, which is represented as 829 * want: { 830 * "parameters": { 831 * BUNDLE_NAME_KEY: "bundleName" 832 * } 833 * } 834 * 835 * @syscap SystemCapability.Ability.Form 836 * @since 9 837 */ 838 /** 839 * Indicates the key specifying the name of the bundle to be obtained, which is represented as 840 * want: { 841 * "parameters": { 842 * BUNDLE_NAME_KEY: "bundleName" 843 * } 844 * } 845 * 846 * @syscap SystemCapability.Ability.Form 847 * @atomicservice 848 * @since 11 849 */ 850 BUNDLE_NAME_KEY = 'ohos.extra.param.key.bundle_name', 851 852 /** 853 * Indicates the key specifying the name of the ability to be obtained, which is represented as 854 * want: { 855 * "parameters": { 856 * ABILITY_NAME_KEY: "abilityName" 857 * } 858 * } 859 * 860 * @syscap SystemCapability.Ability.Form 861 * @since 9 862 */ 863 /** 864 * Indicates the key specifying the name of the ability to be obtained, which is represented as 865 * want: { 866 * "parameters": { 867 * ABILITY_NAME_KEY: "abilityName" 868 * } 869 * } 870 * 871 * @syscap SystemCapability.Ability.Form 872 * @atomicservice 873 * @since 11 874 */ 875 ABILITY_NAME_KEY = 'ohos.extra.param.key.ability_name', 876 877 /** 878 * Indicates the key specifying whether a form type is theme, which is represented as 879 * want: { 880 * "parameters": { 881 * THEME_KEY: true 882 * } 883 * } 884 * 885 * @syscap SystemCapability.Ability.Form 886 * @systemapi 887 * @since 12 888 */ 889 THEME_KEY = 'ohos.extra.param.key.form_is_theme', 890 891 /** 892 * Indicates the key specifying the the device ID, which is represented as 893 * want: { 894 * "parameters": { 895 * DEVICE_ID_KEY : "EFC11C0C53628D8CC2F8CB5052477E130D075917034613B9884C55CD22B3DEF2" 896 * } 897 * } 898 * 899 * @syscap SystemCapability.Ability.Form 900 * @systemapi 901 * @since 9 902 */ 903 DEVICE_ID_KEY = 'ohos.extra.param.key.device_id', 904 905 /** 906 * Indicates the key specifying the launch reason of the form to be obtained, which is represented as 907 * want: { 908 * "parameters": { 909 * LAUNCH_REASON_KEY: LaunchReason.FORM_DEFAULT 910 * } 911 * } 912 * 913 * @syscap SystemCapability.Ability.Form 914 * @since 10 915 */ 916 /** 917 * Indicates the key specifying the launch reason of the form to be obtained, which is represented as 918 * want: { 919 * "parameters": { 920 * LAUNCH_REASON_KEY: LaunchReason.FORM_DEFAULT 921 * } 922 * } 923 * 924 * @syscap SystemCapability.Ability.Form 925 * @atomicservice 926 * @since 11 927 */ 928 LAUNCH_REASON_KEY = 'ohos.extra.param.key.form_launch_reason', 929 930 /** 931 * Indicates the key specifying the custom data of the form to be obtained, which is represented as 932 * want: { 933 * "parameters": { 934 * PARAM_FORM_CUSTOMIZE_KEY: { 935 * "key": "userData" 936 * } 937 * } 938 * } 939 * 940 * @syscap SystemCapability.Ability.Form 941 * @since 10 942 */ 943 /** 944 * Indicates the key specifying the custom data of the form to be obtained, which is represented as 945 * want: { 946 * "parameters": { 947 * PARAM_FORM_CUSTOMIZE_KEY: { 948 * "key": "userData" 949 * } 950 * } 951 * } 952 * 953 * @syscap SystemCapability.Ability.Form 954 * @atomicservice 955 * @since 11 956 */ 957 PARAM_FORM_CUSTOMIZE_KEY = 'ohos.extra.param.key.form_customize', 958 959 /** 960 * Indicates the key specifying the form location, which is represented as 961 * want: { 962 * "parameters": { 963 * FORM_LOCATION_KEY: FormLocation.DESKTOP 964 * } 965 * }. 966 * 967 * @syscap SystemCapability.Ability.Form 968 * @since 12 969 */ 970 FORM_LOCATION_KEY = 'ohos.extra.param.key.form_location', 971 972 /** 973 * Indicates the key specifying the form rendering mode, which is represented as 974 * want: { 975 * "parameters": { 976 * FORM_RENDERING_MODE_KEY: FormRenderingMode.SINGLE_COLOR 977 * } 978 * }. 979 * 980 * @syscap SystemCapability.Ability.Form 981 * @since 11 982 */ 983 /** 984 * Indicates the key specifying the form rendering mode, which is represented as 985 * want: { 986 * "parameters": { 987 * FORM_RENDERING_MODE_KEY: FormRenderingMode.SINGLE_COLOR 988 * } 989 * }. 990 * 991 * @syscap SystemCapability.Ability.Form 992 * @atomicservice 993 * @since 12 994 */ 995 FORM_RENDERING_MODE_KEY = 'ohos.extra.param.key.form_rendering_mode', 996 997 /** 998 * Indicates the key specifying the inverse of the host background color, which is represented as 999 * want: { 1000 * "parameters": { 1001 * HOST_BG_INVERSE_COLOR_KEY: "#FF000000" 1002 * } 1003 * }. 1004 * 1005 * @syscap SystemCapability.Ability.Form 1006 * @atomicservice 1007 * @since 12 1008 */ 1009 HOST_BG_INVERSE_COLOR_KEY = 'ohos.extra.param.key.host_bg_inverse_color', 1010 1011 /** 1012 * Indicates the key specifying the user granted permission name, which is represented as 1013 * want: { 1014 * "parameters": { 1015 * FORM_PERMISSION_NAME_KEY: "permissionName" 1016 * } 1017 * }. 1018 * 1019 * @syscap SystemCapability.Ability.Form 1020 * @atomicservice 1021 * @since 12 1022 */ 1023 FORM_PERMISSION_NAME_KEY = 'ohos.extra.param.key.permission_name', 1024 1025 /** 1026 * Indicates the key specifying whether the user granted, which is represented as 1027 * want: { 1028 * "parameters": { 1029 * FORM_PERMISSION_GRANTED_KEY: true 1030 * } 1031 * }. 1032 * 1033 * @syscap SystemCapability.Ability.Form 1034 * @atomicservice 1035 * @since 12 1036 */ 1037 FORM_PERMISSION_GRANTED_KEY = 'ohos.extra.param.key.permission_granted', 1038 } 1039 1040 /** 1041 * The optional options used as filters to ask 1042 * getFormsInfo to return formInfos from only forms that match the options. 1043 * 1044 * @typedef FormInfoFilter 1045 * @syscap SystemCapability.Ability.Form 1046 * @since 9 1047 */ 1048 /** 1049 * The optional options used as filters to ask 1050 * getFormsInfo to return formInfos from only forms that match the options. 1051 * 1052 * @typedef FormInfoFilter 1053 * @syscap SystemCapability.Ability.Form 1054 * @atomicservice 1055 * @since 11 1056 */ 1057 interface FormInfoFilter { 1058 /** 1059 * optional bundleName that used to ask getFormsInfo to return 1060 * form infos with the same bundleName. 1061 * 1062 * @type { ?string } 1063 * @syscap SystemCapability.Ability.Form 1064 * @systemapi 1065 * @since 12 1066 */ 1067 bundleName?: string; 1068 1069 /** 1070 * optional moduleName that used to ask getFormsInfo to return 1071 * form infos with the same moduleName. 1072 * 1073 * @type { ?string } 1074 * @syscap SystemCapability.Ability.Form 1075 * @since 9 1076 */ 1077 /** 1078 * optional moduleName that used to ask getFormsInfo to return 1079 * form infos with the same moduleName. 1080 * 1081 * @type { ?string } 1082 * @syscap SystemCapability.Ability.Form 1083 * @atomicservice 1084 * @since 11 1085 */ 1086 moduleName?: string; 1087 1088 /** 1089 * optional supportedDimensions that used to ask getFormsInfo to return 1090 * form infos with the same supportedDimensions. 1091 * 1092 * @type { ?Array<number> } 1093 * @syscap SystemCapability.Ability.Form 1094 * @systemapi 1095 * @since 12 1096 */ 1097 supportedDimensions?: Array<number>; 1098 } 1099 1100 /** 1101 * Defines the FormDimension enum. 1102 * 1103 * @enum { number } 1104 * @syscap SystemCapability.Ability.Form 1105 * @since 9 1106 */ 1107 /** 1108 * Defines the FormDimension enum. 1109 * 1110 * @enum { number } 1111 * @syscap SystemCapability.Ability.Form 1112 * @atomicservice 1113 * @since 11 1114 */ 1115 enum FormDimension { 1116 /** 1117 * 1 x 2 form 1118 * 1119 * @syscap SystemCapability.Ability.Form 1120 * @since 9 1121 */ 1122 /** 1123 * 1 x 2 form 1124 * 1125 * @syscap SystemCapability.Ability.Form 1126 * @atomicservice 1127 * @since 11 1128 */ 1129 Dimension_1_2 = 1, 1130 1131 /** 1132 * 2 x 2 form 1133 * 1134 * @syscap SystemCapability.Ability.Form 1135 * @since 9 1136 */ 1137 /** 1138 * 2 x 2 form 1139 * 1140 * @syscap SystemCapability.Ability.Form 1141 * @atomicservice 1142 * @since 11 1143 */ 1144 Dimension_2_2, 1145 1146 /** 1147 * 2 x 4 form 1148 * 1149 * @syscap SystemCapability.Ability.Form 1150 * @since 9 1151 */ 1152 /** 1153 * 2 x 4 form 1154 * 1155 * @syscap SystemCapability.Ability.Form 1156 * @atomicservice 1157 * @since 11 1158 */ 1159 Dimension_2_4, 1160 1161 /** 1162 * 4 x 4 form 1163 * 1164 * @syscap SystemCapability.Ability.Form 1165 * @since 9 1166 */ 1167 /** 1168 * 4 x 4 form 1169 * 1170 * @syscap SystemCapability.Ability.Form 1171 * @atomicservice 1172 * @since 11 1173 */ 1174 Dimension_4_4, 1175 1176 /** 1177 * 2 x 1 form 1178 * 1179 * @syscap SystemCapability.Ability.Form 1180 * @since 9 1181 */ 1182 /** 1183 * 2 x 1 form 1184 * 1185 * @syscap SystemCapability.Ability.Form 1186 * @atomicservice 1187 * @since 11 1188 */ 1189 Dimension_2_1, 1190 1191 /** 1192 * 1 x 1 form 1193 * 1194 * @syscap SystemCapability.Ability.Form 1195 * @atomicservice 1196 * @since 11 1197 */ 1198 DIMENSION_1_1, 1199 1200 /** 1201 * 6 x 4 form 1202 * 1203 * @syscap SystemCapability.Ability.Form 1204 * @atomicservice 1205 * @since 12 1206 */ 1207 DIMENSION_6_4, 1208 } 1209 /** 1210 * The visibility of a form. 1211 * 1212 * @enum { number } 1213 * @syscap SystemCapability.Ability.Form 1214 * @since 9 1215 */ 1216 /** 1217 * The visibility of a form. 1218 * 1219 * @enum { number } 1220 * @syscap SystemCapability.Ability.Form 1221 * @atomicservice 1222 * @since 11 1223 */ 1224 enum VisibilityType { 1225 /** 1226 * Indicates the type of the form type is unknown. 1227 * Often used as a condition variable in function OnVisibilityChange to specify actions only on forms that are 1228 * changing to unknown. 1229 * 1230 * @syscap SystemCapability.Ability.Form 1231 * @since 10 1232 */ 1233 /** 1234 * Indicates the type of the form type is unknown. 1235 * Often used as a condition variable in function OnVisibilityChange to specify actions only on forms that are 1236 * changing to unknown. 1237 * 1238 * @syscap SystemCapability.Ability.Form 1239 * @atomicservice 1240 * @since 11 1241 */ 1242 UNKNOWN = 0, 1243 /** 1244 * Indicates the type of the form is visible. 1245 * Often used as a condition variable in function OnVisibilityChange to specify actions only on forms that are 1246 * changing to visible. 1247 * 1248 * @syscap SystemCapability.Ability.Form 1249 * @since 9 1250 */ 1251 /** 1252 * Indicates the type of the form is visible. 1253 * Often used as a condition variable in function OnVisibilityChange to specify actions only on forms that are 1254 * changing to visible. 1255 * 1256 * @syscap SystemCapability.Ability.Form 1257 * @atomicservice 1258 * @since 11 1259 */ 1260 FORM_VISIBLE = 1, 1261 /** 1262 * Indicates the type of the form is invisible. 1263 * Often used as a condition variable in function OnVisibilityChange to specify actions only on forms that are 1264 * changing to invisible. 1265 * 1266 * @syscap SystemCapability.Ability.Form 1267 * @since 9 1268 */ 1269 /** 1270 * Indicates the type of the form is invisible. 1271 * Often used as a condition variable in function OnVisibilityChange to specify actions only on forms that are 1272 * changing to invisible. 1273 * 1274 * @syscap SystemCapability.Ability.Form 1275 * @atomicservice 1276 * @since 11 1277 */ 1278 FORM_INVISIBLE 1279 } 1280 1281 /** 1282 * Indicates the launch reason of a form. 1283 * 1284 * @enum { number } 1285 * @syscap SystemCapability.Ability.Form 1286 * @since 10 1287 */ 1288 /** 1289 * Indicates the launch reason of a form. 1290 * 1291 * @enum { number } 1292 * @syscap SystemCapability.Ability.Form 1293 * @atomicservice 1294 * @since 11 1295 */ 1296 enum LaunchReason { 1297 /** 1298 * Indicates the launch reason of a form is default. 1299 * 1300 * @syscap SystemCapability.Ability.Form 1301 * @since 10 1302 */ 1303 /** 1304 * Indicates the launch reason of a form is default. 1305 * 1306 * @syscap SystemCapability.Ability.Form 1307 * @atomicservice 1308 * @since 11 1309 */ 1310 FORM_DEFAULT = 1, 1311 /** 1312 * Indicates the launch reason of a form is share. 1313 * 1314 * @syscap SystemCapability.Ability.Form 1315 * @since 10 1316 */ 1317 /** 1318 * Indicates the launch reason of a form is share. 1319 * 1320 * @syscap SystemCapability.Ability.Form 1321 * @atomicservice 1322 * @since 11 1323 */ 1324 FORM_SHARE 1325 } 1326 1327 /** 1328 * The result of publish form. 1329 * 1330 * @typedef PublishFormResult 1331 * @syscap SystemCapability.Ability.Form 1332 * @systemapi 1333 * @stagemodelonly 1334 * @since 12 1335 */ 1336 interface PublishFormResult { 1337 /** 1338 * The error code. 1339 * 1340 * @type { PublishFormErrorCode } 1341 * @syscap SystemCapability.Ability.Form 1342 * @systemapi 1343 * @stagemodelonly 1344 * @since 12 1345 */ 1346 code: PublishFormErrorCode; 1347 1348 /** 1349 * The message. 1350 * 1351 * @type { string } 1352 * @syscap SystemCapability.Ability.Form 1353 * @systemapi 1354 * @stagemodelonly 1355 * @since 12 1356 */ 1357 message: string; 1358 } 1359 1360 /** 1361 * The error code of publish form. 1362 * 1363 * @enum { number } 1364 * @syscap SystemCapability.Ability.Form 1365 * @systemapi 1366 * @stagemodelonly 1367 * @since 12 1368 */ 1369 enum PublishFormErrorCode { 1370 /** 1371 * Publish form success. 1372 * 1373 * @syscap SystemCapability.Ability.Form 1374 * @systemapi 1375 * @stagemodelonly 1376 * @since 12 1377 */ 1378 SUCCESS, 1379 1380 /** 1381 * Host has no space to publish form. 1382 * 1383 * @syscap SystemCapability.Ability.Form 1384 * @systemapi 1385 * @stagemodelonly 1386 * @since 12 1387 */ 1388 NO_SPACE, 1389 1390 /** 1391 * Check param failed. 1392 * 1393 * @syscap SystemCapability.Ability.Form 1394 * @systemapi 1395 * @stagemodelonly 1396 * @since 12 1397 */ 1398 PARAM_ERROR, 1399 1400 /** 1401 * Internal error occurs during form processing. 1402 * 1403 * @syscap SystemCapability.Ability.Form 1404 * @systemapi 1405 * @stagemodelonly 1406 * @since 12 1407 */ 1408 INTERNAL_ERROR, 1409 } 1410 1411 /** 1412 * Information about a running form. 1413 * 1414 * @typedef FormProviderFilter 1415 * @syscap SystemCapability.Ability.Form 1416 * @systemapi 1417 * @stagemodelonly 1418 * @since 10 1419 */ 1420 interface FormProviderFilter { 1421 /** 1422 * Obtains the bundle name of the provider application. 1423 * 1424 * @type { string } 1425 * @syscap SystemCapability.Ability.Form 1426 * @systemapi 1427 * @stagemodelonly 1428 * @since 10 1429 */ 1430 bundleName: string; 1431 1432 /** 1433 * Obtains the form name of the provider application form. 1434 * 1435 * @type { ?string } 1436 * @syscap SystemCapability.Ability.Form 1437 * @systemapi 1438 * @stagemodelonly 1439 * @since 10 1440 */ 1441 formName?: string; 1442 1443 /** 1444 * Obtains the module name of the provider application module. 1445 * 1446 * @type { ?string } 1447 * @syscap SystemCapability.Ability.Form 1448 * @systemapi 1449 * @stagemodelonly 1450 * @since 10 1451 */ 1452 moduleName?: string; 1453 1454 /** 1455 * Obtains the ability name of the provider application module. 1456 * 1457 * @type { ?string } 1458 * @syscap SystemCapability.Ability.Form 1459 * @systemapi 1460 * @stagemodelonly 1461 * @since 10 1462 */ 1463 abilityName?: string; 1464 1465 /** 1466 * Indicates whether to include unused form. 1467 * 1468 * @type { ?boolean } 1469 * @default false 1470 * @syscap SystemCapability.Ability.Form 1471 * @systemapi 1472 * @stagemodelonly 1473 * @since 11 1474 */ 1475 isUnusedIncluded?: boolean; 1476 } 1477 1478 /** 1479 * The class of a running form information. 1480 * 1481 * @typedef RunningFormInfo 1482 * @syscap SystemCapability.Ability.Form 1483 * @systemapi hide this for inner system use 1484 * @since 10 1485 */ 1486 interface RunningFormInfo { 1487 /** 1488 * Obtains the id of the this form. 1489 * 1490 * @type { string } 1491 * @default - 1492 * @syscap SystemCapability.Ability.Form 1493 * @systemapi 1494 * @since 10 1495 */ 1496 readonly formId: string; 1497 1498 /** 1499 * Obtains the bundle name of the application to which this form belongs. 1500 * 1501 * @type { string } 1502 * @default - 1503 * @syscap SystemCapability.Ability.Form 1504 * @systemapi 1505 * @since 10 1506 */ 1507 readonly bundleName: string; 1508 1509 /** 1510 * Obtains the bundle name of the form host application. 1511 * 1512 * @type { string } 1513 * @default - 1514 * @syscap SystemCapability.Ability.Form 1515 * @systemapi 1516 * @since 10 1517 */ 1518 readonly hostBundleName: string; 1519 1520 /** 1521 * The location of this form. 1522 * 1523 * @type { FormLocation } 1524 * @default - 1525 * @syscap SystemCapability.Ability.Form 1526 * @systemapi 1527 * @since 12 1528 */ 1529 readonly formLocation: FormLocation; 1530 1531 /** 1532 * Obtains the visibility of this form. 1533 * 1534 * @type { VisibilityType } 1535 * @default - 1536 * @syscap SystemCapability.Ability.Form 1537 * @systemapi 1538 * @since 10 1539 */ 1540 readonly visibilityType: VisibilityType; 1541 1542 /** 1543 * Obtains the name of the application module to which this form belongs. 1544 * 1545 * @type { string } 1546 * @default - 1547 * @syscap SystemCapability.Ability.Form 1548 * @systemapi 1549 * @since 10 1550 */ 1551 readonly moduleName: string; 1552 1553 /** 1554 * Obtains the class name of the ability to which this form belongs. 1555 * 1556 * @type { string } 1557 * @default - 1558 * @syscap SystemCapability.Ability.Form 1559 * @systemapi 1560 * @since 10 1561 */ 1562 readonly abilityName: string; 1563 1564 /** 1565 * Obtains the name of this form. 1566 * 1567 * @type { string } 1568 * @default - 1569 * @syscap SystemCapability.Ability.Form 1570 * @systemapi 1571 * @since 10 1572 */ 1573 readonly formName: string; 1574 1575 /** 1576 * Obtains the grid style of this form. 1577 * 1578 * @type { number } 1579 * @default - 1580 * @syscap SystemCapability.Ability.Form 1581 * @systemapi 1582 * @since 10 1583 */ 1584 readonly dimension: number; 1585 1586 /** 1587 * Obtains the stage of form use. 1588 * 1589 * @type { FormUsageState } 1590 * @default FormUsageState.USED 1591 * @readonly 1592 * @syscap SystemCapability.Ability.Form 1593 * @systemapi 1594 * @since 11 1595 */ 1596 readonly formUsageState: FormUsageState; 1597 1598 /** 1599 * Obtains the description of this form. 1600 * 1601 * @type { string } 1602 * @readonly 1603 * @syscap SystemCapability.Ability.Form 1604 * @systemapi 1605 * @since 11 1606 */ 1607 readonly formDescription: string; 1608 1609 /** 1610 * Obtains the extra data of the this form. 1611 * 1612 * @type { ?Record<string, Object> } 1613 * @default - 1614 * @readonly 1615 * @syscap SystemCapability.Ability.Form 1616 * @systemapi 1617 * @since 12 1618 */ 1619 readonly extraData?: Record<string, Object>; 1620 } 1621 1622 /** 1623 * The stage of form use. 1624 * 1625 * @enum { number } 1626 * @syscap SystemCapability.Ability.Form 1627 * @systemapi 1628 * @since 11 1629 */ 1630 enum FormUsageState { 1631 /** 1632 * Indicates the stage of the form is used. 1633 * 1634 * @syscap SystemCapability.Ability.Form 1635 * @systemapi 1636 * @since 11 1637 */ 1638 USED = 0, 1639 /** 1640 * Indicates the stage of the form is unused. 1641 * 1642 * @syscap SystemCapability.Ability.Form 1643 * @systemapi 1644 * @since 11 1645 */ 1646 UNUSED = 1, 1647 } 1648 1649 /** 1650 * Defines the FormLocation enum. 1651 * 1652 * @enum { number } 1653 * @syscap SystemCapability.Ability.Form 1654 * @systemapi 1655 * @since 12 1656 */ 1657 enum FormLocation { 1658 /** 1659 * Form is on the other location. 1660 * 1661 * @syscap SystemCapability.Ability.Form 1662 * @systemapi 1663 * @since 12 1664 */ 1665 OTHER = -1, 1666 1667 /** 1668 * Form is on the desktop 1669 * 1670 * @syscap SystemCapability.Ability.Form 1671 * @systemapi 1672 * @since 12 1673 */ 1674 DESKTOP = 0, 1675 1676 /** 1677 * Form is on the form center. 1678 * 1679 * @syscap SystemCapability.Ability.Form 1680 * @systemapi 1681 * @since 12 1682 */ 1683 FORM_CENTER = 1, 1684 1685 /** 1686 * Form is on the form manager. 1687 * 1688 * @syscap SystemCapability.Ability.Form 1689 * @systemapi 1690 * @since 12 1691 */ 1692 FORM_MANAGER = 2, 1693 1694 /** 1695 * Form is on the negative screen. 1696 * 1697 * @syscap SystemCapability.Ability.Form 1698 * @systemapi 1699 * @since 12 1700 */ 1701 NEGATIVE_SCREEN = 3, 1702 1703 /** 1704 * Form is on the form center of negative screen. 1705 * 1706 * @syscap SystemCapability.Ability.Form 1707 * @systemapi 1708 * @since 12 1709 */ 1710 FORM_CENTER_NEGATIVE_SCREEN = 4, 1711 1712 /** 1713 * Form is on the form manager of negative screen. 1714 * 1715 * @syscap SystemCapability.Ability.Form 1716 * @systemapi 1717 * @since 12 1718 */ 1719 FORM_MANAGER_NEGATIVE_SCREEN = 5, 1720 1721 /** 1722 * Form is on the screen lock. 1723 * 1724 * @syscap SystemCapability.Ability.Form 1725 * @systemapi 1726 * @since 12 1727 */ 1728 SCREEN_LOCK = 6, 1729 1730 /** 1731 * Form is on the ai suggestion. 1732 * 1733 * @syscap SystemCapability.Ability.Form 1734 * @systemapi 1735 * @since 12 1736 */ 1737 AI_SUGGESTION = 7, 1738 } 1739} 1740export default formInfo; 1741