diff --git a/api/@ohos.app.form.FormExtensionAbility.d.ts b/api/@ohos.app.form.FormExtensionAbility.d.ts index 45c4805d4ddcec60e0535672373d51f5e7066809..c9dd95d82b262b63bb3610aace1859622406ce86 100644 --- a/api/@ohos.app.form.FormExtensionAbility.d.ts +++ b/api/@ohos.app.form.FormExtensionAbility.d.ts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Copyright (c) 2021-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"), * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -19,14 +19,28 @@ */ import formBindingData from './@ohos.app.form.formBindingData'; -/*** if arkts 1.1 */ import formInfo from './@ohos.app.form.formInfo'; -/*** endif */ import FormExtensionContext from './application/FormExtensionContext'; import Want from './@ohos.app.ability.Want'; -/*** if arkts 1.1 */ import { Configuration } from './@ohos.app.ability.Configuration'; -/*** endif */ + +/** + * Called to return a {@link FormState} object. + *

You must override this callback if you want this ability to return the actual form state. Otherwise, + * this method returns {@link FormState#DEFAULT} by default.

+ * + * @typedef { function } + * @param { Want } want - Indicates the description of the form for which the {@link formInfo#FormState} + * is obtained. The description covers the bundle name, ability name, module name, + * form name, and form dimensions. + * @returns { formInfo.FormState } Returns the {@link formInfo#FormState} object. + * @syscap SystemCapability.Ability.Form + * @stagemodelonly + * @atomicservice + * @since 20 + * @arkts 1.2 + */ +type OnAcquireFormStateFn = (want: Want) => formInfo.FormState; /** * Called when this ability breaks the last link, notifying the provider that the provider process is about to stop. @@ -254,7 +268,8 @@ declare class FormExtensionAbility { * @syscap SystemCapability.Ability.Form * @stagemodelonly * @atomicservice - * @since 11 + * @since arkts{ '1.1':'11','1.2':'20'} + * @arkts 1.1&1.2 */ onConfigurationUpdate(newConfig: Configuration): void; @@ -331,6 +346,20 @@ declare class FormExtensionAbility { */ onAcquireFormData?(formId: string): Record; + /** + * Called to return a {@link FormState} object. + *

You must override this callback if you want this ability to return the actual form state. Otherwise, + * this method returns {@link FormState#DEFAULT} by default.

+ * + * @type { ?OnAcquireFormStateFn } + * @syscap SystemCapability.Ability.Form + * @stagemodelonly + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + onAcquireFormState?: OnAcquireFormStateFn; + /** * Called when this ability breaks the last link, notifying the provider that the provider process is about to stop. *