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