1/* 2 * Copyright (c) 2022 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 16import Want from './@ohos.app.ability.Want'; 17 18/** 19 * interface of formInfo. 20 * @namespace formInfo 21 * @syscap SystemCapability.Ability.Form 22 * @since 9 23 */ 24declare namespace formInfo { 25 /** 26 * Provides information about a form. 27 * @typedef FormInfo 28 * @syscap SystemCapability.Ability.Form 29 * @since 9 30 */ 31 interface FormInfo { 32 /** 33 * Obtains the bundle name of the application to which this form belongs. 34 * @syscap SystemCapability.Ability.Form 35 * @since 9 36 */ 37 bundleName: string; 38 39 /** 40 * Obtains the name of the application module to which this form belongs. 41 * @syscap SystemCapability.Ability.Form 42 * @since 9 43 */ 44 moduleName: string; 45 46 /** 47 * Obtains the class name of the ability to which this form belongs. 48 * @syscap SystemCapability.Ability.Form 49 * @since 9 50 */ 51 abilityName: string; 52 53 /** 54 * Obtains the name of this form. 55 * @syscap SystemCapability.Ability.Form 56 * @since 9 57 */ 58 name: string; 59 60 /** 61 * Obtains the name of this form. 62 * @syscap SystemCapability.Ability.Form 63 * @since 9 64 */ 65 description: string; 66 67 /** 68 * Obtains the type of this form. Currently, JS forms are supported. 69 * @syscap SystemCapability.Ability.Form 70 * @since 9 71 */ 72 type: FormType; 73 74 /** 75 * Obtains the JS component name of this JS form. 76 * @syscap SystemCapability.Ability.Form 77 * @since 9 78 */ 79 jsComponentName: string; 80 81 /** 82 * Obtains the color mode of this form. 83 * @syscap SystemCapability.Ability.Form 84 * @since 9 85 */ 86 colorMode: ColorMode; 87 88 /** 89 * Checks whether this form is a default form. 90 * @syscap SystemCapability.Ability.Form 91 * @since 9 92 */ 93 isDefault: boolean; 94 95 /** 96 * Obtains the updateEnabled. 97 * @syscap SystemCapability.Ability.Form 98 * @since 9 99 */ 100 updateEnabled: boolean; 101 102 /** 103 * Obtains whether notify visible of this form. 104 * @syscap SystemCapability.Ability.Form 105 * @since 9 106 */ 107 formVisibleNotify: boolean; 108 109 /** 110 * Obtains the scheduledUpdateTime. 111 * @syscap SystemCapability.Ability.Form 112 * @since 9 113 */ 114 scheduledUpdateTime: string; 115 116 /** 117 * Obtains the form config ability about this form. 118 * @syscap SystemCapability.Ability.Form 119 * @since 9 120 */ 121 formConfigAbility: string; 122 123 /** 124 * Obtains the updateDuration. 125 * @syscap SystemCapability.Ability.Form 126 * @since 9 127 */ 128 updateDuration: number; 129 130 /** 131 * Obtains the default grid style of this form. 132 * @syscap SystemCapability.Ability.Form 133 * @since 9 134 */ 135 defaultDimension: number; 136 137 /** 138 * Obtains the grid styles supported by this form. 139 * @syscap SystemCapability.Ability.Form 140 * @since 9 141 */ 142 supportDimensions: Array<number>; 143 144 /** 145 * Obtains the custom data defined in this form. 146 * @syscap SystemCapability.Ability.Form 147 * @since 9 148 */ 149 customizeData: {[key: string]: [value: string]}; 150 } 151 152 /** 153 * Type of form. 154 * @enum { number } 155 * @syscap SystemCapability.Ability.Form 156 * @since 9 157 */ 158 enum FormType { 159 /** 160 * JS form. 161 * @syscap SystemCapability.Ability.Form 162 * @since 9 163 */ 164 JS = 1, 165 166 /** 167 * eTS form. 168 * @syscap SystemCapability.Ability.Form 169 * @since 9 170 */ 171 eTS = 2 172 } 173 174 /** 175 * Color mode. 176 * @enum { number } 177 * @syscap SystemCapability.Ability.Form 178 * @since 9 179 */ 180 enum ColorMode { 181 /** 182 * Automatic mode. 183 * @syscap SystemCapability.Ability.Form 184 * @since 9 185 */ 186 MODE_AUTO = -1, 187 188 /** 189 * Dark mode. 190 * @syscap SystemCapability.Ability.Form 191 * @since 9 192 */ 193 MODE_DARK = 0, 194 195 /** 196 * Light mode. 197 * @syscap SystemCapability.Ability.Form 198 * @since 9 199 */ 200 MODE_LIGHT = 1 201 } 202 203 /** 204 * Provides state information about a form. 205 * @typedef FormStateInfo 206 * @syscap SystemCapability.Ability.Form 207 * @since 9 208 */ 209 interface FormStateInfo { 210 /** 211 * Obtains the form state. 212 * @syscap SystemCapability.Ability.Form 213 * @since 9 214 */ 215 formState: FormState; 216 217 /** 218 * Obtains the want form . 219 * @syscap SystemCapability.Ability.Form 220 * @since 9 221 */ 222 want: Want; 223 } 224 225 /** 226 * Provides state about a form. 227 * @enum { number } 228 * @syscap SystemCapability.Ability.Form 229 * @since 9 230 */ 231 enum FormState { 232 /** 233 * Indicates that the form status is unknown due to an internal error. 234 * @syscap SystemCapability.Ability.Form 235 * @since 9 236 */ 237 UNKNOWN = -1, 238 239 /** 240 * Indicates that the form is in the default state. 241 * @syscap SystemCapability.Ability.Form 242 * @since 9 243 */ 244 DEFAULT = 0, 245 246 /** 247 * Indicates that the form is ready. 248 * @syscap SystemCapability.Ability.Form 249 * @since 9 250 */ 251 READY = 1, 252 } 253 254 /** 255 * Parameter of form. 256 * @enum { string } 257 * @syscap SystemCapability.Ability.Form 258 * @since 9 259 */ 260 enum FormParam { 261 /** 262 * Indicates the key specifying the ID of the form to be obtained, which is represented as 263 * want: { 264 * "parameters": { 265 * IDENTITY_KEY: "119476135" 266 * } 267 * }. 268 * 269 * @syscap SystemCapability.Ability.Form 270 * @since 9 271 */ 272 IDENTITY_KEY = "ohos.extra.param.key.form_identity", 273 274 /** 275 * Indicates the key specifying the grid style of the form to be obtained, which is represented as 276 * want: { 277 * "parameters": { 278 * DIMENSION_KEY: FormDimension.Dimension_1_2 279 * } 280 * }. 281 * 282 * @syscap SystemCapability.Ability.Form 283 * @since 9 284 */ 285 DIMENSION_KEY = "ohos.extra.param.key.form_dimension", 286 287 /** 288 * Indicates the key specifying the name of the form to be obtained, which is represented as 289 * want: { 290 * "parameters": { 291 * NAME_KEY: "formName" 292 * } 293 * }. 294 * 295 * @syscap SystemCapability.Ability.Form 296 * @since 9 297 */ 298 NAME_KEY = "ohos.extra.param.key.form_name", 299 300 /** 301 * Indicates the key specifying the name of the module to which the form to be obtained belongs, which is 302 * represented as 303 * want: { 304 * "parameters": { 305 * MODULE_NAME_KEY: "formEntry" 306 * } 307 * } 308 * This constant is mandatory. 309 * 310 * @syscap SystemCapability.Ability.Form 311 * @since 9 312 */ 313 MODULE_NAME_KEY = "ohos.extra.param.key.module_name", 314 315 /** 316 * Indicates the key specifying the width of the form to be obtained, which is represented as 317 * want: { 318 * "parameters": { 319 * WIDTH_KEY: 800 320 * } 321 * } 322 * 323 * @syscap SystemCapability.Ability.Form 324 * @since 9 325 */ 326 WIDTH_KEY = "ohos.extra.param.key.form_width", 327 328 /** 329 * Indicates the key specifying the height of the form to be obtained, which is represented as 330 * want: { 331 * "parameters": { 332 * HEIGHT_KEY: 400 333 * } 334 * } 335 * 336 * @syscap SystemCapability.Ability.Form 337 * @since 9 338 */ 339 HEIGHT_KEY = "ohos.extra.param.key.form_height", 340 341 /** 342 * Indicates the key specifying whether a form is temporary, which is represented as 343 * want: { 344 * "parameters": { 345 * TEMPORARY_KEY: true 346 * } 347 * } 348 * 349 * @syscap SystemCapability.Ability.Form 350 * @since 9 351 */ 352 TEMPORARY_KEY = "ohos.extra.param.key.form_temporary", 353 354 /** 355 * Indicates the key specifying the name of the bundle to be obtained, which is represented as 356 * want: { 357 * "parameters": { 358 * BUNDLE_NAME_KEY: "bundleName" 359 * } 360 * } 361 * 362 * @syscap SystemCapability.Ability.Form 363 * @since 9 364 */ 365 BUNDLE_NAME_KEY = "ohos.extra.param.key.bundle_name", 366 367 /** 368 * Indicates the key specifying the name of the ability to be obtained, which is represented as 369 * want: { 370 * "parameters": { 371 * ABILITY_NAME_KEY: "abilityName" 372 * } 373 * } 374 * 375 * @syscap SystemCapability.Ability.Form 376 * @since 9 377 */ 378 ABILITY_NAME_KEY = "ohos.extra.param.key.ability_name", 379 380 /** 381 * Indicates the key specifying the the device ID, which is represented as 382 * want: { 383 * "parameters": { 384 * DEVICE_ID_KEY : "EFC11C0C53628D8CC2F8CB5052477E130D075917034613B9884C55CD22B3DEF2" 385 * } 386 * } 387 * 388 * @syscap SystemCapability.Ability.Form 389 * @systemapi 390 * @since 9 391 */ 392 DEVICE_ID_KEY = "ohos.extra.param.key.device_id" 393 } 394 395 /** 396 * The optional options used as filters to ask 397 * getFormsInfo to return formInfos from only forms that match the options. 398 * @typedef FormInfoFilter 399 * @syscap SystemCapability.Ability.Form 400 * @since 9 401 */ 402 interface FormInfoFilter { 403 /** 404 * optional moduleName that used to ask getFormsInfo to return 405 * form infos with the same moduleName. 406 * @syscap SystemCapability.Ability.Form 407 * @since 9 408 */ 409 moduleName?: string; 410 } 411 412 /** 413 * Defines the FormDimension enum. 414 * @enum { number } 415 * @syscap SystemCapability.Ability.Form 416 * @since 9 417 */ 418 enum FormDimension { 419 /** 420 * 1 x 2 form 421 * @syscap SystemCapability.Ability.Form 422 * @since 9 423 */ 424 Dimension_1_2 = 1, 425 426 /** 427 * 2 x 2 form 428 * @syscap SystemCapability.Ability.Form 429 * @since 9 430 */ 431 Dimension_2_2, 432 433 /** 434 * 2 x 4 form 435 * @syscap SystemCapability.Ability.Form 436 * @since 9 437 */ 438 Dimension_2_4, 439 440 /** 441 * 4 x 4 form 442 * @syscap SystemCapability.Ability.Form 443 * @since 9 444 */ 445 Dimension_4_4, 446 447 /** 448 * 2 x 1 form 449 * @syscap SystemCapability.Ability.Form 450 * @since 9 451 */ 452 Dimension_2_1, 453 } 454 /** 455 * The visibility of a form. 456 * @enum { number } 457 * @syscap SystemCapability.Ability.Form 458 * @since 9 459 */ 460 enum VisibilityType { 461 /** 462 * Indicates the type of the form is visible. 463 * Often used as a condition variable in function OnVisibilityChange to specify actions only on forms that are 464 * changing to visible. 465 * @syscap SystemCapability.Ability.Form 466 * @since 9 467 */ 468 FORM_VISIBLE = 1, 469 /** 470 * Indicates the type of the form is invisible. 471 * Often used as a condition variable in function OnVisibilityChange to specify actions only on forms that are 472 * changing to invisible. 473 * @syscap SystemCapability.Ability.Form 474 * @since 9 475 */ 476 FORM_INVISIBLE, 477 } 478} 479export default formInfo;