/* * Copyright (c) 2021-2023 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 './@ohos.base'; import { Resource } from 'GlobalResource'; /** * @namespace promptAction * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 */ /** * @namespace promptAction * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ declare namespace promptAction { /** * @typedef ShowToastOptions * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 */ /** * @typedef ShowToastOptions * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ interface ShowToastOptions { /** * Text to display. * * @type { string | Resource } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 */ /** * Text to display. * * @type { string | Resource } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ message: string | Resource; /** * Duration of toast dialog box. The default value is 1500. * The recommended value ranges from 1500ms to 10000ms. * NOTE: A value less than 1500 is automatically changed to 1500. The maximum value is 10000ms. * * @type { ?number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 */ /** * Duration of toast dialog box. The default value is 1500. * The recommended value ranges from 1500ms to 10000ms. * NOTE: A value less than 1500 is automatically changed to 1500. The maximum value is 10000ms. * * @type { ?number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ duration?: number; /** * The distance between toast dialog box and the bottom of screen. * * @type { ?string | number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 */ /** * The distance between toast dialog box and the bottom of screen. * * @type { ?string | number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ bottom?: string | number; } /** * @typedef Button * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 */ /** * @typedef Button * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ interface Button { /** * The text displayed in the button. * * @type { string | Resource } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 */ /** * The text displayed in the button. * * @type { string | Resource } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ text: string | Resource; /** * The foreground color of button. * * @type { string | Resource } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 */ /** * The foreground color of button. * * @type { string | Resource } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ color: string | Resource; } /** * @typedef ShowDialogSuccessResponse * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 */ /** * @typedef ShowDialogSuccessResponse * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ interface ShowDialogSuccessResponse { /** * Index of the selected button, starting from 0. * * @type { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 */ /** * Index of the selected button, starting from 0. * * @type { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ index: number; } /** * @typedef ShowDialogOptions * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 */ /** * @typedef ShowDialogOptions * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ interface ShowDialogOptions { /** * Title of the text to display. * * @type { ?string | Resource } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 */ /** * Title of the text to display. * * @type { ?string | Resource } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ title?: string | Resource; /** * Text body. * * @type { ?string | Resource } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 */ /** * Text body. * * @type { ?string | Resource } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ message?: string | Resource; /** * Array of buttons in the dialog box. * The array structure is {text:'button', color: '#666666'}. * One to three buttons are supported. * The first button is of the positiveButton type, the second is of the negativeButton type, and the third is of the neutralButton type. * * @type { ?Array