1/* 2 * Copyright (c) 2021 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 ArkUI 19 */ 20 21/** 22 * Defines the FormDimension enum. 23 * 24 * @enum { number } 25 * @syscap SystemCapability.ArkUI.ArkUI.Full 26 * @systemapi 27 * @since 7 28 */ 29declare enum FormDimension { 30 /** 31 * 1 x 2 cards 32 * 33 * @syscap SystemCapability.ArkUI.ArkUI.Full 34 * @systemapi 35 * @since 7 36 */ 37 Dimension_1_2, 38 39 /** 40 * 2 x 2 cards 41 * 42 * @syscap SystemCapability.ArkUI.ArkUI.Full 43 * @systemapi 44 * @since 7 45 */ 46 Dimension_2_2, 47 48 /** 49 * 2 x 4 cards 50 * 51 * @syscap SystemCapability.ArkUI.ArkUI.Full 52 * @systemapi 53 * @since 7 54 */ 55 Dimension_2_4, 56 57 /** 58 * 4 x 4 cards 59 * 60 * @syscap SystemCapability.ArkUI.ArkUI.Full 61 * @systemapi 62 * @since 7 63 */ 64 Dimension_4_4, 65 66 /** 67 * 2 x 1 cards 68 * 69 * @syscap SystemCapability.ArkUI.ArkUI.Full 70 * @systemapi 71 * @since 9 72 */ 73 Dimension_2_1, 74 75 /** 76 * 1 x 1 cards 77 * The default value is 6 78 * 79 * @syscap SystemCapability.ArkUI.ArkUI.Full 80 * @systemapi 81 * @since 11 82 */ 83 DIMENSION_1_1 = 6, 84 85 /** 86 * 6 x 4 cards 87 * 88 * @syscap SystemCapability.ArkUI.ArkUI.Full 89 * @systemapi 90 * @since 12 91 */ 92 DIMENSION_6_4, 93} 94 95/** 96 * Defines the FormRenderingMode enum. 97 * 98 * @enum { number } 99 * @syscap SystemCapability.ArkUI.ArkUI.Full 100 * @systemapi 101 * @since 11 102 */ 103declare enum FormRenderingMode { 104 105 /** 106 * Full color mode, this is default value 107 * 108 * @syscap SystemCapability.ArkUI.ArkUI.Full 109 * @systemapi 110 * @since 11 111 */ 112 FULL_COLOR, 113 114 /** 115 * single color mode 116 * 117 * @syscap SystemCapability.ArkUI.ArkUI.Full 118 * @systemapi 119 * @since 11 120 */ 121 SINGLE_COLOR, 122} 123 124/** 125 * Defines the FormShape enum. 126 * 127 * @enum { number } 128 * @syscap SystemCapability.ArkUI.ArkUI.Full 129 * @systemapi 130 * @since 12 131 */ 132declare enum FormShape { 133 /** 134 * The rect shape. 135 * 136 * @syscap SystemCapability.ArkUI.ArkUI.Full 137 * @systemapi 138 * @since 12 139 */ 140 RECT = 1, 141 142 /** 143 * The circle shape. 144 * 145 * @syscap SystemCapability.ArkUI.ArkUI.Full 146 * @systemapi 147 * @since 12 148 */ 149 CIRCLE, 150} 151 152/** 153 * Defines the FormInfo. 154 * 155 * @interface FormInfo 156 * @syscap SystemCapability.ArkUI.ArkUI.Full 157 * @systemapi 158 * @since 12 159 */ 160declare interface FormInfo { 161 /** 162 * The id the form. 163 * 164 * @type { number | string } 165 * @syscap SystemCapability.ArkUI.ArkUI.Full 166 * @systemapi 167 * @since 12 168 */ 169 id: number | string; 170 171 /** 172 * The name of the form. 173 * 174 * @type { string } 175 * @syscap SystemCapability.ArkUI.ArkUI.Full 176 * @systemapi 177 * @since 12 178 */ 179 name: string; 180 181 /** 182 * The bundle of the form. 183 * 184 * @type { string } 185 * @syscap SystemCapability.ArkUI.ArkUI.Full 186 * @systemapi 187 * @since 12 188 */ 189 bundle: string; 190 191 /** 192 * The ability of the form. 193 * 194 * @type { string } 195 * @syscap SystemCapability.ArkUI.ArkUI.Full 196 * @systemapi 197 * @since 12 198 */ 199 ability: string; 200 201 /** 202 * The module of the form. 203 * 204 * @type { string } 205 * @syscap SystemCapability.ArkUI.ArkUI.Full 206 * @systemapi 207 * @since 12 208 */ 209 module: string; 210 211 /** 212 * The dimension of the form. 213 * 214 * @type { ?FormDimension } 215 * @syscap SystemCapability.ArkUI.ArkUI.Full 216 * @systemapi 217 * @since 12 218 */ 219 dimension?: FormDimension; 220 221 /** 222 * Whether the form is temporary. 223 * 224 * @type { ?boolean } 225 * @syscap SystemCapability.ArkUI.ArkUI.Full 226 * @systemapi 227 * @since 12 228 */ 229 temporary?: boolean; 230 231 /** 232 * The want of the form. 233 * 234 * @type { ?import('../api/@ohos.app.ability.Want').default } 235 * @syscap SystemCapability.ArkUI.ArkUI.Full 236 * @systemapi 237 * @since 12 238 */ 239 want?: import('../api/@ohos.app.ability.Want').default; 240 241 /** 242 * The renderingMode of the form. 243 * 244 * @type { ?FormRenderingMode } 245 * @syscap SystemCapability.ArkUI.ArkUI.Full 246 * @systemapi 247 * @since 12 248 */ 249 renderingMode?: FormRenderingMode; 250 251 /** 252 * The shape of the form. 253 * 254 * @type { ?FormShape } 255 * @syscap SystemCapability.ArkUI.ArkUI.Full 256 * @systemapi 257 * @since 12 258 */ 259 shape?: FormShape; 260} 261 262/** 263 * Defines the FormComponent. 264 * 265 * @interface FormComponentInterface 266 * @syscap SystemCapability.ArkUI.ArkUI.Full 267 * @systemapi 268 * @since 7 269 */ 270interface FormComponentInterface { 271 /** 272 * Set a new value. 273 * 274 * @param { { 275 * id: number; 276 * name: string; 277 * bundle: string; 278 * ability: string; 279 * module: string; 280 * dimension?: FormDimension; 281 * temporary?: boolean; 282 * want?: import('../api/@ohos.app.ability.Want').default; 283 * } } value 284 * @returns { FormComponentAttribute } 285 * @syscap SystemCapability.ArkUI.ArkUI.Full 286 * @systemapi 287 * @since 7 288 */ 289 /** 290 * Set a new value. 291 * 292 * @param { object } value 293 * @returns { FormComponentAttribute } 294 * @syscap SystemCapability.ArkUI.ArkUI.Full 295 * @systemapi 296 * @since 9 297 */ 298 /** 299 * Set a new value. 300 * 301 * @param { object } value 302 * @returns { FormComponentAttribute } 303 * @syscap SystemCapability.ArkUI.ArkUI.Full 304 * @systemapi 305 * @since 11 306 */ 307 /** 308 * Set a new value of form info. 309 * 310 * @param { FormInfo } value 311 * @returns { FormComponentAttribute } 312 * @syscap SystemCapability.ArkUI.ArkUI.Full 313 * @systemapi 314 * @since 12 315 */ 316 (value: FormInfo): FormComponentAttribute; 317} 318 319/** 320 * Defines the FormCallbackInfo. 321 * 322 * @interface FormCallbackInfo 323 * @syscap SystemCapability.ArkUI.ArkUI.Full 324 * @systemapi 325 * @since 12 326 */ 327interface FormCallbackInfo { 328 /** 329 * The id of the form. 330 * 331 * @type { number } 332 * @syscap SystemCapability.ArkUI.ArkUI.Full 333 * @systemapi 334 * @since 12 335 */ 336 id: number; 337 338 /** 339 * The string id of the form. 340 * 341 * @type { string } 342 * @syscap SystemCapability.ArkUI.ArkUI.Full 343 * @systemapi 344 * @since 12 345 */ 346 idString: string; 347} 348 349/** 350 * @extends CommonMethod<FormComponentAttribute> 351 * @syscap SystemCapability.ArkUI.ArkUI.Full 352 * @systemapi 353 * @since 7 354 */ 355declare class FormComponentAttribute extends CommonMethod<FormComponentAttribute> { 356 /** 357 * Sets the display area size of the card. 358 * 359 * @param { object } value 360 * @returns { FormComponentAttribute } 361 * @syscap SystemCapability.ArkUI.ArkUI.Full 362 * @systemapi 363 * @since 7 364 */ 365 size(value: { width: number; height: number }): FormComponentAttribute; 366 367 /** 368 * Card module name. 369 * 370 * @param { string } value 371 * @returns { FormComponentAttribute } 372 * @syscap SystemCapability.ArkUI.ArkUI.Full 373 * @systemapi 374 * @since 7 375 */ 376 moduleName(value: string): FormComponentAttribute; 377 378 /** 379 * Set the card size. 380 * 381 * @param { FormDimension } value 382 * @returns { FormComponentAttribute } 383 * @syscap SystemCapability.ArkUI.ArkUI.Full 384 * @systemapi 385 * @since 7 386 */ 387 dimension(value: FormDimension): FormComponentAttribute; 388 389 /** 390 * Indicates whether to allow card update. 391 * 392 * @param { boolean } value 393 * @returns { FormComponentAttribute } 394 * @syscap SystemCapability.ArkUI.ArkUI.Full 395 * @systemapi 396 * @since 7 397 */ 398 allowUpdate(value: boolean): FormComponentAttribute; 399 400 /** 401 * Whether the card is visible. 402 * 403 * @param { Visibility } value 404 * @returns { FormComponentAttribute } 405 * @syscap SystemCapability.ArkUI.ArkUI.Full 406 * @systemapi 407 * @since 7 408 */ 409 visibility(value: Visibility): FormComponentAttribute; 410 411 /** 412 * This function is triggered after card information is obtained. 413 * For details about the form information, see the definition of the original capability subsystem. 414 * 415 * @param { function } callback 416 * @returns { FormComponentAttribute } 417 * @syscap SystemCapability.ArkUI.ArkUI.Full 418 * @systemapi 419 * @since 7 420 */ 421 /** 422 * This function is triggered after card information is obtained. 423 * For details about the form information, see the definition of the original capability subsystem. 424 * 425 * @param { Callback<FormCallbackInfo> } callback 426 * @returns { FormComponentAttribute } 427 * @syscap SystemCapability.ArkUI.ArkUI.Full 428 * @systemapi 429 * @since 12 430 */ 431 onAcquired(callback: Callback<FormCallbackInfo>): FormComponentAttribute; 432 433 /** 434 * Card loading error. 435 * 436 * @param { function } callback 437 * @returns { FormComponentAttribute } 438 * @syscap SystemCapability.ArkUI.ArkUI.Full 439 * @systemapi 440 * @since 7 441 */ 442 onError(callback: (info: { errcode: number; msg: string }) => void): FormComponentAttribute; 443 444 /** 445 * Card to be redirected. 446 * 447 * @param { function } callback 448 * @returns { FormComponentAttribute } 449 * @syscap SystemCapability.ArkUI.ArkUI.Full 450 * @systemapi 451 * @since 7 452 */ 453 onRouter(callback: (info: any) => void): FormComponentAttribute; 454 455 /** 456 * Uninstall Card. 457 * 458 * @param { function } callback 459 * @returns { FormComponentAttribute } 460 * @syscap SystemCapability.ArkUI.ArkUI.Full 461 * @systemapi 462 * @since 7 463 */ 464 /** 465 * Uninstall Card. 466 * 467 * @param { Callback<FormCallbackInfo> } callback 468 * @returns { FormComponentAttribute } 469 * @syscap SystemCapability.ArkUI.ArkUI.Full 470 * @systemapi 471 * @since 12 472 */ 473 onUninstall(callback: Callback<FormCallbackInfo>): FormComponentAttribute; 474 475 /** 476 * Card to be loaded. 477 * 478 * @param { function } callback 479 * @returns { FormComponentAttribute } 480 * @syscap SystemCapability.ArkUI.ArkUI.Full 481 * @systemapi 482 * @since 10 483 */ 484 onLoad(callback: () => void): FormComponentAttribute; 485} 486 487/** 488 * Defines FormComponent Component. 489 * 490 * @syscap SystemCapability.ArkUI.ArkUI.Full 491 * @systemapi 492 * @since 7 493 */ 494declare const FormComponent: FormComponentInterface; 495 496/** 497 * Defines FormComponent Component instance. 498 * 499 * @syscap SystemCapability.ArkUI.ArkUI.Full 500 * @systemapi 501 * @since 7 502 */ 503declare const FormComponentInstance: FormComponentAttribute; 504