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