diff --git a/api/@internal/ets/lifecycle.d.ts b/api/@internal/ets/lifecycle.d.ts index 18cff8475eb22d59cca76a92c7ce6d10701ef7d7..cbd6cf61db20e3e6ecc0358820f9bf6a4c93c1c2 100644 --- a/api/@internal/ets/lifecycle.d.ts +++ b/api/@internal/ets/lifecycle.d.ts @@ -20,7 +20,7 @@ import { DataAbilityResult } from "../ability/dataAbilityResult"; import { DataAbilityOperation } from "../ability/dataAbilityOperation"; import dataAbility from "../@ohos.data.dataAbility"; import formBindingData from "../@ohos.ability.formBindingData"; -import formManager from "../@ohos.ability.formManager"; +import formInfo from "../@ohos.application.formInfo"; import rdb from "../@ohos.data.rdb"; import rpc from "../@ohos.rpc"; import resourceManager from "../@ohos.resourceManager"; @@ -37,11 +37,11 @@ export declare interface LifecycleForm { /** * Called to return a {@link formBindingData.FormBindingData} object. * - * @since 7 + * @since 8 * @param want Indicates the detailed information for creating a {@link formBindingData#FormBindingData}. * The {@code Want} object must include the form ID, form name, and grid style of the form, - * which can be obtained from {@link formManager#FormParam#IDENTITY_KEY}, - * {@link formManager#FormParam#NAME_KEY}, and {@link formManager#FormParam#DIMENSION_KEY}, + * which can be obtained from {@link formInfo#FormParam#IDENTITY_KEY}, + * {@link formInfo#FormParam#NAME_KEY}, and {@link formInfo#FormParam#DIMENSION_KEY}, * respectively. Such form information must be managed as persistent data for further form * acquisition, update, and deletion. * @return Returns the created {@link formBindingData#FormBindingData} object. @@ -52,17 +52,17 @@ export declare interface LifecycleForm { /** * Called when the form provider is notified that a temporary form is successfully converted to a normal form. * - * @since 7 + * @since 8 * @param formId Indicates the ID of the form. * @return - * @FAModelOnly */ - onCastTempToNormal?(formId: string): void; + onCastToNormal?(formId: string): void; /** * Called to notify the form provider to update a specified form. * - * @since 7 + * @since 8 * @param formId Indicates the ID of the form to update. * @return - * @FAModelOnly @@ -72,22 +72,22 @@ export declare interface LifecycleForm { /** * Called when the form provider receives form events from the system. * - * @since 7 + * @since 8 * @param newStatus Indicates the form events occurred. The key in the {@code Map} object indicates the form ID, - * and the value indicates the event type, which can be either {@link formManager#VisibilityType#FORM_VISIBLE} - * or {@link formManager#VisibilityType#FORM_INVISIBLE}. {@link formManager#VisibilityType#FORM_VISIBLE} - * means that the form becomes visible, and {@link formManager#VisibilityType#FORM_INVISIBLE} + * and the value indicates the event type, which can be either {@link formInfo#VisibilityType#FORM_VISIBLE} + * or {@link formInfo#VisibilityType#FORM_INVISIBLE}. {@link formInfo#VisibilityType#FORM_VISIBLE} + * means that the form becomes visible, and {@link formInfo#VisibilityType#FORM_INVISIBLE} * means that the form becomes invisible. * @return - * @FAModelOnly */ - onVisibilityChanged?(newStatus: { [key: string]: number }): void; + onVisibilityChange?(newStatus: { [key: string]: number }): void; /** * Called when a specified message event defined by the form provider is triggered. This method is valid only for * JS forms. * - * @since 7 + * @since 8 * @param formId Indicates the ID of the form on which the message event is triggered, which is provided by * the client to the form provider. * @param message Indicates the value of the {@code params} field of the message event. This parameter is @@ -95,18 +95,18 @@ export declare interface LifecycleForm { * @return - * @FAModelOnly */ - onTriggerEvent?(formId: string, message: string): void; + onEvent?(formId: string, message: string): void; /** * Called to notify the form provider that a specified form has been deleted. Override this method if * you want your application, as the form provider, to be notified of form deletion. * - * @since 7 + * @since 8 * @param formId Indicates the ID of the deleted form. * @return - * @FAModelOnly */ - onDelete?(formId: string): void; + onDestroy?(formId: string): void; /** * Called to return a {@link FormState} object. @@ -114,13 +114,13 @@ export declare interface LifecycleForm { *

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.

* - * @since 7 - * @param want Indicates the description of the form for which the {@link formManager#FormState} is obtained. + * @since 8 + * @param 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. - * @return Returns the {@link formManager#FormState} object. + * @return Returns the {@link formInfo#FormState} object. * @FAModelOnly */ - onAcquireFormState?(want: Want): formManager.FormState; + onAcquireFormState?(want: Want): formInfo.FormState; } /** diff --git a/api/@ohos.application.formError.d.ts b/api/@ohos.application.formError.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..df34a39ea9755735e56420596301f5f32f395847 --- /dev/null +++ b/api/@ohos.application.formError.d.ts @@ -0,0 +1,225 @@ +/* + * Copyright (c) 2022 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * interface of formError. + * + * @name formError + * @since 8 + * @syscap SystemCapability.Ability.Form + */ +declare namespace formError { + /** + * Error of form. + * + * @name FormError + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + enum FormError { + /** + * A common internal error occurs during form processing. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + ERR_COMMON = 1, + + /** + * The application does not have permission to use forms. + * Ensure that the application is granted with the ohos.permission.REQUIRE_FORM + * and ohos.permission.GET_BUNDLE_INFO_PRIVILEGED permissions. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + ERR_PERMISSION_DENY = 2, + + /** + * Failed to obtain the configuration information about the form specified by the + * request parameters. Ensure that the parameters of the form to be added are + * consistent with those provided by the form provider. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + ERR_GET_INFO_FAILED = 4, + + /** + * Failed to obtain the bundle to which the form belongs based on the request parameters. + * Ensure that the bundle to which the form to be added belongs is available. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + ERR_GET_BUNDLE_FAILED = 5, + + /** + * Failed to initialize the form layout based on the request parameters. + * Ensure that the grid style of the form is supported by the form provider. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + ERR_GET_LAYOUT_FAILED = 6, + + /** + * Invalid input parameter during form operation. Ensure that all input + * parameters are valid. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + ERR_ADD_INVALID_PARAM = 7, + + /** + * The form configuration to be obtained using an existing form ID is + * different from that obtained for the first time. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + ERR_CFG_NOT_MATCH_ID = 8, + + /** + * The ID of the form to be operated does not exist in the Form Manager Service. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + ERR_NOT_EXIST_ID = 9, + + /** + * Failed to bind the Form Manager Service to the provider service. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + ERR_BIND_PROVIDER_FAILED = 10, + + /** + * The total number of added forms exceeds the maximum allowed by the system. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + ERR_MAX_SYSTEM_FORMS = 11, + + /** + * The number of form instances generated using the same form configuration + * exceeds the maximum allowed by the system. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + ERR_MAX_INSTANCES_PER_FORM = 12, + + /** + * The form being requested was added by other applications and cannot be + * operated by the current application. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + ERR_OPERATION_FORM_NOT_SELF = 13, + + /** + * The Form Manager Service failed to instruct the form provider to delete the form. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + ERR_PROVIDER_DEL_FAIL = 14, + + /** + * The total number of added forms exceeds the maximum per client. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + ERR_MAX_FORMS_PER_CLIENT = 15, + + /** + * The total number of added temp forms exceeds the maximum in system. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + ERR_MAX_SYSTEM_TEMP_FORMS = 16, + + /** + * The module can not be find in system. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + ERR_FORM_NO_SUCH_MODULE = 17, + + /** + * The ability can not be find in system. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + ERR_FORM_NO_SUCH_ABILITY = 18, + + /** + * The dimension is not exist in the form. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + ERR_FORM_NO_SUCH_DIMENSION = 19, + + /** + * The ability is not installed. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + ERR_FORM_FA_NOT_INSTALLED = 20, + + /** + * Failed to obtain the RPC object of the Form Manager Service because + * the service is not started.Please try again after the service is started. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + ERR_SYSTEM_RESPONSES_FAILED = 30, + + /** + * Failed to obtain the form requested by the client because another form + * with the same form ID is in use. Forms in use cannot have the same ID. + * To obtain and display a form that has the same configuration as an in-use + * form in the same application, you are advised to set the form ID to 0 in + * the request parameters. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + ERR_FORM_DUPLICATE_ADDED = 31, + + /** + * The form is being restored. Perform operations on the form only after + * the restoration is complete. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + ERR_IN_RECOVERY = 36 + } +} +export default formError; \ No newline at end of file diff --git a/api/@ohos.application.formHost.d.ts b/api/@ohos.application.formHost.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..51a1e8f992e89a365fa115558a38827ecc172785 --- /dev/null +++ b/api/@ohos.application.formHost.d.ts @@ -0,0 +1,275 @@ +/* + * Copyright (c) 2022 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { AsyncCallback } from "./basic"; +import { Callback } from "./basic"; +import Want from './@ohos.application.Want'; +import formInfo from './@ohos.application.formInfo' + +/** + * interface of formHost. + * + * @name formHost + * @since 8 + * @syscap SystemCapability.Ability.Form + * @systemapi hide for inner use. + */ +declare namespace formHost { + /** + * Deletes an obtained form by its ID. + * + *

After this method is called, the form won't be available for use by the application and the Form Manager + * Service no longer keeps the cache information about the form.

+ * + * @since 8 + * @syscap SystemCapability.Ability.Form + * @param formId Indicates the form ID + * @return - + * @permission ohos.permission.REQUIRE_FORM + */ + function deleteForm(formId: string, callback: AsyncCallback): void; + function deleteForm(formId: string): Promise; + + /** + * Releases an obtained form by its ID. + * + *

After this method is called, the form won't be available for use by the application, but the Form Manager + * Service still keeps the cache information about the form, so that the application can quickly obtain it based on + * the {@code formId}.

+ * + * @since 8 + * @syscap SystemCapability.Ability.Form + * @param formId Indicates the form ID + * @return - + * @permission ohos.permission.REQUIRE_FORM + */ + function releaseForm(formId: string, callback: AsyncCallback): void; + function releaseForm(formId: string): Promise; + + /** + * Requests for form update. + * + *

This method must be called when the application has detected that a system setting item (such as the language, + * resolution, or screen orientation) being listened for has changed. Upon receiving the update request, the form + * provider automatically updates the form data (if there is any update) through the form framework, with the update + * process being unperceivable by the application.

+ * + * @since 8 + * @syscap SystemCapability.Ability.Form + * @param formId Indicates the ID of the form to update. + * @return - + * @permission ohos.permission.REQUIRE_FORM + */ + function requestForm(formId: string, callback: AsyncCallback): void; + function requestForm(formId: string): Promise; + + /** + * Converts a specified temporary form that has been obtained by the application into a normal form. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + * @param formId Indicates the ID of the temporary form to convert. + * @return - + * @permission ohos.permission.REQUIRE_FORM + */ + function castTempForm(formId: string, callback: AsyncCallback): void; + function castTempForm(formId: string): Promise; + + /** + * Sends a notification to the form framework to make the specified forms visible. + * + *

After this method is successfully called, onVisibilityChange will be called to notify the form provider of + * the form visibility change event.

+ * + * @since 8 + * @syscap SystemCapability.Ability.Form + * @param formIds Indicates the IDs of the forms to be made visible. + * @return - + * @permission ohos.permission.REQUIRE_FORM + */ + function notifyVisibleForms(formIds: Array, callback: AsyncCallback): void; + function notifyVisibleForms(formIds: Array): Promise; + + /** + * Sends a notification to the form framework to make the specified forms invisible. + * + *

After this method is successfully called, onVisibilityChange will be called to notify the form provider of + * the form visibility change event.

+ * + * @since 8 + * @syscap SystemCapability.Ability.Form + * @param formIds Indicates the IDs of the forms to be made invisible. + * @return - + * @permission ohos.permission.REQUIRE_FORM + */ + function notifyInvisibleForms(formIds: Array, callback: AsyncCallback): void; + function notifyInvisibleForms(formIds: Array): Promise; + + /** + * Notify the form framework to make the specified forms updatable. + * + *

You can use this method to set form refresh state to true, the form can receive new + * update from service.

+ * + * @since 8 + * @syscap SystemCapability.Ability.Form + * @param formIds Indicates the IDs of the forms to be made invisible. + * @return - + * @permission ohos.permission.REQUIRE_FORM + */ + function enableFormsUpdate(formIds: Array, callback: AsyncCallback): void; + function enableFormsUpdate(formIds: Array): Promise; + + /** + * Notifys the form framework to make the specified forms non updatable. + * + *

You can use this method to set form refresh state to false, the form do not receive + * new update from service.

+ * + * @since 8 + * @syscap SystemCapability.Ability.Form + * @param formIds Indicates the IDs of the forms to be made invisible. + * @return - + * @permission ohos.permission.REQUIRE_FORM + */ + function disableFormsUpdate(formIds: Array, callback: AsyncCallback): void; + function disableFormsUpdate(formIds: Array): Promise; + + /** + * Checks whether the system is ready. + * + *

You can use this method to obtain the system is ready + * new update from service.

+ * + * @since 8 + * @syscap SystemCapability.Ability.Form + * @return - + */ + function isSystemReady(callback: AsyncCallback): void; + function isSystemReady(): Promise; + + /** + * Obtains the FormInfo objects provided by all applications on the device. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + * @return Returns the {@link FormInfo} + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + */ + function getAllFormsInfo(callback: AsyncCallback>): void; + function getAllFormsInfo(): Promise>; + + /** + * Obtains the FormInfo objects provided by a specified application on the device. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + * @param bundleName Indicates the bundle name of the application. + * @param moduleName Indicates the module name of the application. + * @return Returns the {@link FormInfo} + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + */ + function getFormsInfo(bundleName: string, callback: AsyncCallback>): void; + function getFormsInfo(bundleName: string, moduleName: string, callback: AsyncCallback>): void; + function getFormsInfo(bundleName: string, moduleName?: string): Promise>; + + /** + * Deletes invalid forms of the application in the Form Manager Service based on the list of. + * + *

You can use this method to delete invalid forms of the application + * new update from service.

+ * + * @since 8 + * @sysCap SystemCapability.Ability.Form + * @param formIds Indicates the specify form id. + * @return Returns the number of invalid forms deleted by the Form Manager Service + * @permission ohos.permission.REQUIRE_FORM. + */ + function deleteInvalidForms(formIds: Array, callback: AsyncCallback): void; + function deleteInvalidForms(formIds: Array): Promise; + + /** + * Obtains the Form state. + * + *

You can use this method to obtains the form state + * new update from service.

+ * + * @since 8 + * @sysCap SystemCapability.Ability.Form + * @param want Indicates want of the form. + * @return Returns form state {@link FormStateInfo} + * @permission ohos.permission.GET_BUNDLE_INFO, ohos.permission.GET_BUNDLE_INFO_PRIVILEGED. + */ + function acquireFormState(want: Want, callback: AsyncCallback): void; + function acquireFormState(want: Want): Promise; + + /** + * Listens to the event of uninstall form. + * + *

You can use this method to listen to the event of uninstall form + * new update from service.

+ * + * @since 8 + * @sysCap SystemCapability.Ability.Form + * @param type Indicates event type. + * @return - + */ + function on(type: "formUninstall", callback: Callback): void; + + /** + * Cancels listening to the event of uninstall form. + * + *

You can use this method to cancel listening to the event of uninstall form + * new update from service.

+ * + * @since 8 + * @sysCap SystemCapability.Ability.Form + * @param type Indicates event type. + * @return - + */ + function off(type: "formUninstall", callback?: Callback): void; + + /** + * notify form is Visible + * + *

You can use this method to notify form visible state.

+ * + * @since 8 + * @sysCap SystemCapability.Ability.Form + * @param formIds Indicates the specify form id. + * @param isVisible Indicates whether visible. + * @return - + * @permission ohos.permission.REQUIRE_FORM. + */ + function notifyFormsVisible(formIds: Array, isVisible: boolean, callback: AsyncCallback): void; + function notifyFormsVisible(formIds: Array, isVisible: boolean): Promise; + + /** + * notify form enable update state. + * + *

You can use this method to notify form enable update state.

+ * + * @devices phone, tablet, tv, wearable, car + * @since 8 + * @sysCap SystemCapability.Ability.Form + * @param formIds Indicates the specify form id. + * @param isEnableUpdate Indicates whether enable update. + * @return - + * @permission ohos.permission.REQUIRE_FORM. + */ + function notifyFormsEnableUpdate(formIds: Array, isEnableUpdate: boolean, callback: AsyncCallback): void; + function notifyFormsEnableUpdate(formIds: Array, isEnableUpdate: boolean): Promise; +} +export default formHost; \ No newline at end of file diff --git a/api/@ohos.application.formInfo.d.ts b/api/@ohos.application.formInfo.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..92d3fd28a8b6ba0af510a015c93305bbb9682edd --- /dev/null +++ b/api/@ohos.application.formInfo.d.ts @@ -0,0 +1,390 @@ +/* + * Copyright (c) 2022 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import Want from './@ohos.application.Want'; + +/** + * interface of formInfo. + * + * @name formInfo + * @since 8 + * @syscap SystemCapability.Ability.Form + */ +declare namespace formInfo { + /** + * Provides information about a form. + * + * @name FormInfo + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + interface FormInfo { + /** + * Obtains the bundle name of the application to which this form belongs. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + bundleName: string; + + /** + * Obtains the name of the application module to which this form belongs. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + moduleName: string; + + /** + * Obtains the class name of the ability to which this form belongs. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + abilityName: string; + + /** + * Obtains the name of this form. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + name: string; + + /** + * Obtains the name of this form. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + description: string; + + /** + * Obtains the type of this form. Currently, JS forms are supported. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + type: FormType; + + /** + * Obtains the JS component name of this JS form. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + jsComponentName: string; + + /** + * Obtains the color mode of this form. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + colorMode: ColorMode; + + /** + * Checks whether this form is a default form. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + isDefault: boolean; + + /** + * Obtains the updateEnabled. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + updateEnabled: boolean; + + /** + * Obtains whether notify visible of this form. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + formVisibleNotify: boolean; + + /** + * Obtains the bundle relatedBundleName of the application to which this form belongs. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + relatedBundleName: string; + + /** + * Obtains the scheduledUpdateTime. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + scheduledUpdateTime: string; + + /** + * Obtains the form config ability about this form. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + formConfigAbility: string; + + /** + * Obtains the updateDuration. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + updateDuration: number; + + /** + * Obtains the default grid style of this form. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + defaultDimension: number; + + /** + * Obtains the grid styles supported by this form. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + supportDimensions: Array; + + /** + * Obtains the custom data defined in this form. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + customizeData: {[key: string]: [value: string]}; + } + + /** + * Type of form. + * + * @name FormType + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + enum FormType { + /** + * JS form. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + JS = 1 + } + + /** + * Color mode. + * + * @name ColorMode + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + enum ColorMode { + /** + * Automatic mode. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + MODE_AUTO = -1, + + /** + * Dark mode. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + MODE_DARK = 0, + + /** + * Light mode. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + MODE_LIGHT = 1 + } + + /** + * Provides state information about a form. + * + * @name FormStateInfo + * @since 8 + * @sysCap SystemCapability.Ability.Form + */ + interface FormStateInfo { + /** + * Obtains the form state. + * + * @since 8 + * @sysCap SystemCapability.Ability.Form + */ + formState: FormState; + + /** + * Obtains the want form . + * + * @since 8 + * @sysCap SystemCapability.Ability.Form + */ + want: Want; + } + + /** + * Provides state about a form. + * + * @name FormState + * @since 8 + * @sysCap SystemCapability.Ability.Form + */ + enum FormState { + /** + * Indicates that the form status is unknown due to an internal error. + * + * @since 8 + * @sysCap SystemCapability.Ability.Form + */ + UNKNOWN = -1, + + /** + * Indicates that the form is in the default state. + * + * @since 8 + * @sysCap SystemCapability.Ability.Form + */ + DEFAULT = 0, + + /** + * Indicates that the form is ready. + * + * @since 8 + * @sysCap SystemCapability.Ability.Form + */ + READY = 1, + } + + /** + * Parameter of form. + * + * @name FormParam + * @since 8 + * @sysCap SystemCapability.Ability.Form + */ + enum FormParam { + /** + * Indicates the key specifying the ID of the form to be obtained, which is represented as + * want: { + * "parameters": { + * IDENTITY_KEY: 1L + * } + * }. + * + * @since 8 + * @sysCap SystemCapability.Ability.Form + * @systemapi hide for inner use. + */ + IDENTITY_KEY = "ohos.extra.param.key.form_identity", + + /** + * Indicates the key specifying the grid style of the form to be obtained, which is represented as + * want: { + * "parameters": { + * DIMENSION_KEY: 1 + * } + * }. + * + * @since 8 + * @sysCap SystemCapability.Ability.Form + */ + DIMENSION_KEY = "ohos.extra.param.key.form_dimension", + + /** + * Indicates the key specifying the name of the form to be obtained, which is represented as + * want: { + * "parameters": { + * NAME_KEY: "formName" + * } + * }. + * + * @since 8 + * @sysCap SystemCapability.Ability.Form + */ + NAME_KEY = "ohos.extra.param.key.form_name", + + /** + * Indicates the key specifying the name of the module to which the form to be obtained belongs, which is + * represented as + * want: { + * "parameters": { + * MODULE_NAME_KEY: "formEntry" + * } + * } + * This constant is mandatory. + * + * @since 8 + * @sysCap SystemCapability.Ability.Form + */ + MODULE_NAME_KEY = "ohos.extra.param.key.module_name", + + /** + * Indicates the key specifying the width of the form to be obtained, which is represented as + * want: { + * "parameters": { + * WIDTH_KEY: 800 + * } + * } + * + * @since 8 + * @sysCap SystemCapability.Ability.Form + */ + WIDTH_KEY = "ohos.extra.param.key.form_width", + + /** + * Indicates the key specifying the height of the form to be obtained, which is represented as + * want: { + * "parameters": { + * HEIGHT_KEY: 400 + * } + * } + * + * @since 8 + * @sysCap SystemCapability.Ability.Form + */ + HEIGHT_KEY = "ohos.extra.param.key.form_height", + + /** + * Indicates the key specifying whether a form is temporary, which is represented as + * want: { + * "parameters": { + * TEMPORARY_KEY: true + * } + * } + * + * @since 8 + * @sysCap SystemCapability.Ability.Form + */ + TEMPORARY_KEY = "ohos.extra.param.key.form_temporary" + } +} +export default formInfo; \ No newline at end of file diff --git a/api/@ohos.application.formProvider.d.ts b/api/@ohos.application.formProvider.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ea4c90794c35a7f5e044e9efdbef99261f73329c --- /dev/null +++ b/api/@ohos.application.formProvider.d.ts @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2022 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { AsyncCallback } from "./basic"; +import formBindingData from "./@ohos.application.formBindingData"; + +/** + * interface of formProvider. + * + * @name formProvider + * @since 9 + * @syscap SystemCapability.Ability.Form + */ +declare namespace formProvider { + /** + * Set next update time for a specified form. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + * @param formId Indicates the form ID. + * @param minute Indicates duration minute before next update. + * @return - + */ + function setFormNextRefreshTime(formId: string, minute: number, callback: AsyncCallback): void; + function setFormNextRefreshTime(formId: string, minute: number): Promise; + + /** + * Update a specified form. + * + * Client to communication with FormManagerService. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + * @param formId Indicates the form ID + * @return - + */ + function updateForm(formId: string, formBindingData: formBindingData.FormBindingData, + callback: AsyncCallback): void; + function updateForm(formId: string, formBindingData: formBindingData.FormBindingData): Promise; +} +export default formProvider; \ No newline at end of file