1/* 2 * Copyright (c) 2021 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 ArkUI 19 */ 20 21 22import { AsyncCallback } from './@ohos.base'; 23 24/** 25 * @namespace prompt 26 * @syscap SystemCapability.ArkUI.ArkUI.Full 27 * @since 8 28 * @deprecated since 9 29 * @useinstead ohos.promptAction 30 */ 31declare namespace prompt { 32 33 /** 34 * @interface ShowToastOptions 35 * @syscap SystemCapability.ArkUI.ArkUI.Full 36 * @since 8 37 * @deprecated since 9 38 */ 39 interface ShowToastOptions { 40 41 /** 42 * Text to display. 43 * 44 * @type { string } 45 * @syscap SystemCapability.ArkUI.ArkUI.Full 46 * @since 8 47 * @deprecated since 9 48 */ 49 message: string; 50 51 /** 52 * Duration of toast dialog box. The default value is 1500. 53 * The recommended value ranges from 1500 ms to 10000ms. 54 * NOTE: A value less than 1500 is automatically changed to 1500. The maximum value is 10000 ms. 55 * 56 * @type { ?number } 57 * @syscap SystemCapability.ArkUI.ArkUI.Full 58 * @since 8 59 * @deprecated since 9 60 */ 61 duration?: number; 62 63 /** 64 * The distance between toast dialog box and the bottom of screen. 65 * 66 * @type { ?(string | number) } 67 * @syscap SystemCapability.ArkUI.ArkUI.Full 68 * @since 8 69 * @deprecated since 9 70 */ 71 bottom?: string | number; 72 } 73 74 /** 75 * @interface Button 76 * @syscap SystemCapability.ArkUI.ArkUI.Full 77 * @since 8 78 * @deprecated since 9 79 */ 80 interface Button { 81 82 /** 83 * @type { string } 84 * @syscap SystemCapability.ArkUI.ArkUI.Full 85 * @since 8 86 * @deprecated since 9 87 */ 88 text: string; 89 90 /** 91 * @type { string } 92 * @syscap SystemCapability.ArkUI.ArkUI.Full 93 * @since 8 94 * @deprecated since 9 95 */ 96 color: string; 97 } 98 99 /** 100 * @interface ShowDialogSuccessResponse 101 * @syscap SystemCapability.ArkUI.ArkUI.Full 102 * @since 8 103 * @deprecated since 9 104 */ 105 interface ShowDialogSuccessResponse { 106 107 /** 108 * @type { number } 109 * @syscap SystemCapability.ArkUI.ArkUI.Full 110 * @since 8 111 * @deprecated since 9 112 */ 113 index: number; 114 } 115 116 /** 117 * @interface ShowDialogOptions 118 * @syscap SystemCapability.ArkUI.ArkUI.Full 119 * @since 8 120 * @deprecated since 9 121 */ 122 interface ShowDialogOptions { 123 124 /** 125 * Title of the text to display. 126 * 127 * @type { ?string } 128 * @syscap SystemCapability.ArkUI.ArkUI.Full 129 * @since 8 130 * @deprecated since 9 131 */ 132 title?: string; 133 134 /** 135 * Text body. 136 * 137 * @type { ?string } 138 * @syscap SystemCapability.ArkUI.ArkUI.Full 139 * @since 8 140 * @deprecated since 9 141 */ 142 message?: string; 143 144 /** 145 * Array of buttons in the dialog box. 146 * The array structure is {text:'button', color: '#666666'}. 147 * 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. 148 * 149 * @type { ?[Button, Button?, Button?] } 150 * @syscap SystemCapability.ArkUI.ArkUI.Full 151 * @since 8 152 * @deprecated since 9 153 */ 154 buttons?: [Button, Button?, Button?]; 155 } 156 157 /** 158 * @interface ActionMenuSuccessResponse 159 * @syscap SystemCapability.ArkUI.ArkUI.Full 160 * @since 8 161 * @deprecated since 9 162 */ 163 interface ActionMenuSuccessResponse { 164 165 /** 166 * @type { number } 167 * @syscap SystemCapability.ArkUI.ArkUI.Full 168 * @since 8 169 * @deprecated since 9 170 */ 171 index: number; 172 } 173 174 /** 175 * @interface ActionMenuOptions 176 * @syscap SystemCapability.ArkUI.ArkUI.Full 177 * @since 8 178 * @deprecated since 9 179 */ 180 interface ActionMenuOptions { 181 182 /** 183 * Title of the text to display. 184 * 185 * @type { ?string } 186 * @syscap SystemCapability.ArkUI.ArkUI.Full 187 * @since 8 188 * @deprecated since 9 189 */ 190 title?: string; 191 192 /** 193 * Array of buttons in the dialog box. 194 * The array structure is {text:'button', color: '#666666'}. 195 * One to six buttons are supported. 196 * 197 * @type { [Button, Button?, Button?, Button?, Button?, Button?] } 198 * @syscap SystemCapability.ArkUI.ArkUI.Full 199 * @since 8 200 * @deprecated since 9 201 */ 202 buttons: [Button, Button?, Button?, Button?, Button?, Button?]; 203 } 204 205 /** 206 * Displays the notification text. 207 * 208 * @param { ShowToastOptions } options - Options. 209 * @syscap SystemCapability.ArkUI.ArkUI.Full 210 * @since 8 211 * @deprecated since 9 212 */ 213 function showToast(options: ShowToastOptions): void; 214 215 /** 216 * Displays the dialog box. 217 * 218 * @param { ShowDialogOptions } options - Options. 219 * @param { AsyncCallback<ShowDialogSuccessResponse> } callback 220 * @syscap SystemCapability.ArkUI.ArkUI.Full 221 * @since 8 222 * @deprecated since 9 223 */ 224 function showDialog(options: ShowDialogOptions, callback: AsyncCallback<ShowDialogSuccessResponse>): void; 225 226 /** 227 * Displays the dialog box. 228 * 229 * @param { ShowDialogOptions } options - Options. 230 * @returns { Promise<ShowDialogSuccessResponse> } 231 * @syscap SystemCapability.ArkUI.ArkUI.Full 232 * @since 8 233 * @deprecated since 9 234 */ 235 function showDialog(options: ShowDialogOptions): Promise<ShowDialogSuccessResponse>; 236 237 /** 238 * Displays the menu. 239 * 240 * @param { ActionMenuOptions } options - Options. 241 * @param { AsyncCallback<ActionMenuSuccessResponse> } callback 242 * @syscap SystemCapability.ArkUI.ArkUI.Full 243 * @since 8 244 * @deprecated since 9 245 */ 246 function showActionMenu(options: ActionMenuOptions, callback: AsyncCallback<ActionMenuSuccessResponse>): void; 247 248 /** 249 * Displays the menu. 250 * 251 * @param { ActionMenuOptions } options - Options. 252 * @returns { Promise<ActionMenuSuccessResponse> } 253 * @syscap SystemCapability.ArkUI.ArkUI.Full 254 * @since 8 255 * @deprecated since 9 256 */ 257 function showActionMenu(options: ActionMenuOptions): Promise<ActionMenuSuccessResponse>; 258} 259 260export default prompt; 261