• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2025 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 ExtensionAbility from './@ohos.app.ability.ExtensionAbility';
22import LiveFormExtensionContext from './application/LiveFormExtensionContext';
23import type UIExtensionContentSession from './@ohos.app.ability.UIExtensionContentSession';
24import formInfo from './@ohos.app.form.formInfo';
25
26/**
27 * Provides information about a live form.
28 * @typedef { LiveFormInfo }
29 * @syscap SystemCapability.Ability.Form
30 * @stagemodelonly
31 * @atomicservice
32 * @since 20
33 */
34export interface LiveFormInfo {
35  /**
36   * The form id.
37   *
38   * @type { string }
39   * @syscap SystemCapability.Ability.Form
40   * @stagemodelonly
41   * @atomicservice
42   * @since 20
43   */
44  formId: string;
45
46  /**
47   * The live form display area.
48   *
49   * @type { formInfo.Rect }
50   * @syscap SystemCapability.Ability.Form
51   * @stagemodelonly
52   * @atomicservice
53   * @since 20
54   */
55  rect: formInfo.Rect;
56
57  /**
58   * The form border radius.
59   *
60   * @type { number }
61   * @syscap SystemCapability.Ability.Form
62   * @stagemodelonly
63   * @atomicservice
64   * @since 20
65   */
66  borderRadius: number;
67}
68
69/**
70 * The class of live form extension ability.
71 *
72 * @extends ExtensionAbility
73 * @syscap SystemCapability.Ability.Form
74 * @stagemodelonly
75 * @atomicservice
76 * @since 20
77 */
78declare class LiveFormExtensionAbility extends ExtensionAbility {
79  /**
80   * Indicates configuration information about a live form extension ability context.
81   *
82   * @type { LiveFormExtensionContext }
83   * @syscap SystemCapability.Ability.Form
84   * @stagemodelonly
85   * @atomicservice
86   * @since 20
87   */
88  context: LiveFormExtensionContext;
89
90  /**
91   * Called back when a live form extension is started for initialization.
92   *
93   * @param { LiveFormInfo } liveFormInfo - Indicates the live form info.
94   * @param { UIExtensionContentSession } session - Indicates the session of the UI extension page.
95   * @syscap SystemCapability.Ability.Form
96   * @stagemodelonly
97   * @atomicservice
98   * @since 20
99   */
100  onLiveFormCreate(liveFormInfo: LiveFormInfo, session: UIExtensionContentSession): void;
101
102  /**
103   * Called back when a live form extension is destroyed.
104   *
105   * @param { LiveFormInfo } liveFormInfo - Indicates the live form info.
106   * @syscap SystemCapability.Ability.Form
107   * @stagemodelonly
108   * @atomicservice
109   * @since 20
110   */
111  onLiveFormDestroy(liveFormInfo: LiveFormInfo): void;
112}
113export default LiveFormExtensionAbility;
114