161847f8eSopenharmony_ci/* 261847f8eSopenharmony_ci * Copyright (c) 2021 Huawei Device Co., Ltd. 361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 461847f8eSopenharmony_ci * you may not use this file except in compliance with the License. 561847f8eSopenharmony_ci * You may obtain a copy of the License at 661847f8eSopenharmony_ci * 761847f8eSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 861847f8eSopenharmony_ci * 961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and 1361847f8eSopenharmony_ci * limitations under the License. 1461847f8eSopenharmony_ci */ 1561847f8eSopenharmony_ci 1661847f8eSopenharmony_ci/** 1761847f8eSopenharmony_ci * @file 1861847f8eSopenharmony_ci * @kit ArkUI 1961847f8eSopenharmony_ci */ 2061847f8eSopenharmony_ci 2161847f8eSopenharmony_ci 2261847f8eSopenharmony_ciimport { AsyncCallback } from './@ohos.base'; 2361847f8eSopenharmony_ci 2461847f8eSopenharmony_ci/** 2561847f8eSopenharmony_ci * @namespace prompt 2661847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 2761847f8eSopenharmony_ci * @since 8 2861847f8eSopenharmony_ci * @deprecated since 9 2961847f8eSopenharmony_ci * @useinstead ohos.promptAction 3061847f8eSopenharmony_ci */ 3161847f8eSopenharmony_cideclare namespace prompt { 3261847f8eSopenharmony_ci 3361847f8eSopenharmony_ci /** 3461847f8eSopenharmony_ci * @interface ShowToastOptions 3561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 3661847f8eSopenharmony_ci * @since 8 3761847f8eSopenharmony_ci * @deprecated since 9 3861847f8eSopenharmony_ci */ 3961847f8eSopenharmony_ci interface ShowToastOptions { 4061847f8eSopenharmony_ci 4161847f8eSopenharmony_ci /** 4261847f8eSopenharmony_ci * Text to display. 4361847f8eSopenharmony_ci * 4461847f8eSopenharmony_ci * @type { string } 4561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 4661847f8eSopenharmony_ci * @since 8 4761847f8eSopenharmony_ci * @deprecated since 9 4861847f8eSopenharmony_ci */ 4961847f8eSopenharmony_ci message: string; 5061847f8eSopenharmony_ci 5161847f8eSopenharmony_ci /** 5261847f8eSopenharmony_ci * Duration of toast dialog box. The default value is 1500. 5361847f8eSopenharmony_ci * The recommended value ranges from 1500 ms to 10000ms. 5461847f8eSopenharmony_ci * NOTE: A value less than 1500 is automatically changed to 1500. The maximum value is 10000 ms. 5561847f8eSopenharmony_ci * 5661847f8eSopenharmony_ci * @type { ?number } 5761847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 5861847f8eSopenharmony_ci * @since 8 5961847f8eSopenharmony_ci * @deprecated since 9 6061847f8eSopenharmony_ci */ 6161847f8eSopenharmony_ci duration?: number; 6261847f8eSopenharmony_ci 6361847f8eSopenharmony_ci /** 6461847f8eSopenharmony_ci * The distance between toast dialog box and the bottom of screen. 6561847f8eSopenharmony_ci * 6661847f8eSopenharmony_ci * @type { ?(string | number) } 6761847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 6861847f8eSopenharmony_ci * @since 8 6961847f8eSopenharmony_ci * @deprecated since 9 7061847f8eSopenharmony_ci */ 7161847f8eSopenharmony_ci bottom?: string | number; 7261847f8eSopenharmony_ci } 7361847f8eSopenharmony_ci 7461847f8eSopenharmony_ci /** 7561847f8eSopenharmony_ci * @interface Button 7661847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 7761847f8eSopenharmony_ci * @since 8 7861847f8eSopenharmony_ci * @deprecated since 9 7961847f8eSopenharmony_ci */ 8061847f8eSopenharmony_ci interface Button { 8161847f8eSopenharmony_ci 8261847f8eSopenharmony_ci /** 8361847f8eSopenharmony_ci * @type { string } 8461847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 8561847f8eSopenharmony_ci * @since 8 8661847f8eSopenharmony_ci * @deprecated since 9 8761847f8eSopenharmony_ci */ 8861847f8eSopenharmony_ci text: string; 8961847f8eSopenharmony_ci 9061847f8eSopenharmony_ci /** 9161847f8eSopenharmony_ci * @type { string } 9261847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 9361847f8eSopenharmony_ci * @since 8 9461847f8eSopenharmony_ci * @deprecated since 9 9561847f8eSopenharmony_ci */ 9661847f8eSopenharmony_ci color: string; 9761847f8eSopenharmony_ci } 9861847f8eSopenharmony_ci 9961847f8eSopenharmony_ci /** 10061847f8eSopenharmony_ci * @interface ShowDialogSuccessResponse 10161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 10261847f8eSopenharmony_ci * @since 8 10361847f8eSopenharmony_ci * @deprecated since 9 10461847f8eSopenharmony_ci */ 10561847f8eSopenharmony_ci interface ShowDialogSuccessResponse { 10661847f8eSopenharmony_ci 10761847f8eSopenharmony_ci /** 10861847f8eSopenharmony_ci * @type { number } 10961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 11061847f8eSopenharmony_ci * @since 8 11161847f8eSopenharmony_ci * @deprecated since 9 11261847f8eSopenharmony_ci */ 11361847f8eSopenharmony_ci index: number; 11461847f8eSopenharmony_ci } 11561847f8eSopenharmony_ci 11661847f8eSopenharmony_ci /** 11761847f8eSopenharmony_ci * @interface ShowDialogOptions 11861847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 11961847f8eSopenharmony_ci * @since 8 12061847f8eSopenharmony_ci * @deprecated since 9 12161847f8eSopenharmony_ci */ 12261847f8eSopenharmony_ci interface ShowDialogOptions { 12361847f8eSopenharmony_ci 12461847f8eSopenharmony_ci /** 12561847f8eSopenharmony_ci * Title of the text to display. 12661847f8eSopenharmony_ci * 12761847f8eSopenharmony_ci * @type { ?string } 12861847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 12961847f8eSopenharmony_ci * @since 8 13061847f8eSopenharmony_ci * @deprecated since 9 13161847f8eSopenharmony_ci */ 13261847f8eSopenharmony_ci title?: string; 13361847f8eSopenharmony_ci 13461847f8eSopenharmony_ci /** 13561847f8eSopenharmony_ci * Text body. 13661847f8eSopenharmony_ci * 13761847f8eSopenharmony_ci * @type { ?string } 13861847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 13961847f8eSopenharmony_ci * @since 8 14061847f8eSopenharmony_ci * @deprecated since 9 14161847f8eSopenharmony_ci */ 14261847f8eSopenharmony_ci message?: string; 14361847f8eSopenharmony_ci 14461847f8eSopenharmony_ci /** 14561847f8eSopenharmony_ci * Array of buttons in the dialog box. 14661847f8eSopenharmony_ci * The array structure is {text:'button', color: '#666666'}. 14761847f8eSopenharmony_ci * 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. 14861847f8eSopenharmony_ci * 14961847f8eSopenharmony_ci * @type { ?[Button, Button?, Button?] } 15061847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 15161847f8eSopenharmony_ci * @since 8 15261847f8eSopenharmony_ci * @deprecated since 9 15361847f8eSopenharmony_ci */ 15461847f8eSopenharmony_ci buttons?: [Button, Button?, Button?]; 15561847f8eSopenharmony_ci } 15661847f8eSopenharmony_ci 15761847f8eSopenharmony_ci /** 15861847f8eSopenharmony_ci * @interface ActionMenuSuccessResponse 15961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 16061847f8eSopenharmony_ci * @since 8 16161847f8eSopenharmony_ci * @deprecated since 9 16261847f8eSopenharmony_ci */ 16361847f8eSopenharmony_ci interface ActionMenuSuccessResponse { 16461847f8eSopenharmony_ci 16561847f8eSopenharmony_ci /** 16661847f8eSopenharmony_ci * @type { number } 16761847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 16861847f8eSopenharmony_ci * @since 8 16961847f8eSopenharmony_ci * @deprecated since 9 17061847f8eSopenharmony_ci */ 17161847f8eSopenharmony_ci index: number; 17261847f8eSopenharmony_ci } 17361847f8eSopenharmony_ci 17461847f8eSopenharmony_ci /** 17561847f8eSopenharmony_ci * @interface ActionMenuOptions 17661847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 17761847f8eSopenharmony_ci * @since 8 17861847f8eSopenharmony_ci * @deprecated since 9 17961847f8eSopenharmony_ci */ 18061847f8eSopenharmony_ci interface ActionMenuOptions { 18161847f8eSopenharmony_ci 18261847f8eSopenharmony_ci /** 18361847f8eSopenharmony_ci * Title of the text to display. 18461847f8eSopenharmony_ci * 18561847f8eSopenharmony_ci * @type { ?string } 18661847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 18761847f8eSopenharmony_ci * @since 8 18861847f8eSopenharmony_ci * @deprecated since 9 18961847f8eSopenharmony_ci */ 19061847f8eSopenharmony_ci title?: string; 19161847f8eSopenharmony_ci 19261847f8eSopenharmony_ci /** 19361847f8eSopenharmony_ci * Array of buttons in the dialog box. 19461847f8eSopenharmony_ci * The array structure is {text:'button', color: '#666666'}. 19561847f8eSopenharmony_ci * One to six buttons are supported. 19661847f8eSopenharmony_ci * 19761847f8eSopenharmony_ci * @type { [Button, Button?, Button?, Button?, Button?, Button?] } 19861847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 19961847f8eSopenharmony_ci * @since 8 20061847f8eSopenharmony_ci * @deprecated since 9 20161847f8eSopenharmony_ci */ 20261847f8eSopenharmony_ci buttons: [Button, Button?, Button?, Button?, Button?, Button?]; 20361847f8eSopenharmony_ci } 20461847f8eSopenharmony_ci 20561847f8eSopenharmony_ci /** 20661847f8eSopenharmony_ci * Displays the notification text. 20761847f8eSopenharmony_ci * 20861847f8eSopenharmony_ci * @param { ShowToastOptions } options - Options. 20961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 21061847f8eSopenharmony_ci * @since 8 21161847f8eSopenharmony_ci * @deprecated since 9 21261847f8eSopenharmony_ci */ 21361847f8eSopenharmony_ci function showToast(options: ShowToastOptions): void; 21461847f8eSopenharmony_ci 21561847f8eSopenharmony_ci /** 21661847f8eSopenharmony_ci * Displays the dialog box. 21761847f8eSopenharmony_ci * 21861847f8eSopenharmony_ci * @param { ShowDialogOptions } options - Options. 21961847f8eSopenharmony_ci * @param { AsyncCallback<ShowDialogSuccessResponse> } callback 22061847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 22161847f8eSopenharmony_ci * @since 8 22261847f8eSopenharmony_ci * @deprecated since 9 22361847f8eSopenharmony_ci */ 22461847f8eSopenharmony_ci function showDialog(options: ShowDialogOptions, callback: AsyncCallback<ShowDialogSuccessResponse>): void; 22561847f8eSopenharmony_ci 22661847f8eSopenharmony_ci /** 22761847f8eSopenharmony_ci * Displays the dialog box. 22861847f8eSopenharmony_ci * 22961847f8eSopenharmony_ci * @param { ShowDialogOptions } options - Options. 23061847f8eSopenharmony_ci * @returns { Promise<ShowDialogSuccessResponse> } 23161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 23261847f8eSopenharmony_ci * @since 8 23361847f8eSopenharmony_ci * @deprecated since 9 23461847f8eSopenharmony_ci */ 23561847f8eSopenharmony_ci function showDialog(options: ShowDialogOptions): Promise<ShowDialogSuccessResponse>; 23661847f8eSopenharmony_ci 23761847f8eSopenharmony_ci /** 23861847f8eSopenharmony_ci * Displays the menu. 23961847f8eSopenharmony_ci * 24061847f8eSopenharmony_ci * @param { ActionMenuOptions } options - Options. 24161847f8eSopenharmony_ci * @param { AsyncCallback<ActionMenuSuccessResponse> } callback 24261847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 24361847f8eSopenharmony_ci * @since 8 24461847f8eSopenharmony_ci * @deprecated since 9 24561847f8eSopenharmony_ci */ 24661847f8eSopenharmony_ci function showActionMenu(options: ActionMenuOptions, callback: AsyncCallback<ActionMenuSuccessResponse>): void; 24761847f8eSopenharmony_ci 24861847f8eSopenharmony_ci /** 24961847f8eSopenharmony_ci * Displays the menu. 25061847f8eSopenharmony_ci * 25161847f8eSopenharmony_ci * @param { ActionMenuOptions } options - Options. 25261847f8eSopenharmony_ci * @returns { Promise<ActionMenuSuccessResponse> } 25361847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 25461847f8eSopenharmony_ci * @since 8 25561847f8eSopenharmony_ci * @deprecated since 9 25661847f8eSopenharmony_ci */ 25761847f8eSopenharmony_ci function showActionMenu(options: ActionMenuOptions): Promise<ActionMenuSuccessResponse>; 25861847f8eSopenharmony_ci} 25961847f8eSopenharmony_ci 26061847f8eSopenharmony_ciexport default prompt; 261