1/* 2 * Copyright (c) 2023 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/** 22 * Enumerates the icon styles. 23 * 24 * @enum { number } 25 * @syscap SystemCapability.ArkUI.ArkUI.Full 26 * @since 10 27 */ 28/** 29 * Enumerates the icon styles. 30 * 31 * @enum { number } 32 * @syscap SystemCapability.ArkUI.ArkUI.Full 33 * @atomicservice 34 * @since 11 35 */ 36declare enum SaveIconStyle { 37 /** 38 * Icon filled with the specified color. 39 * 40 * @syscap SystemCapability.ArkUI.ArkUI.Full 41 * @since 10 42 */ 43 /** 44 * Icon filled with the specified color. 45 * 46 * @syscap SystemCapability.ArkUI.ArkUI.Full 47 * @atomicservice 48 * @since 11 49 */ 50 FULL_FILLED = 0, 51 52 /** 53 * Icon rendered as lines. 54 * 55 * @syscap SystemCapability.ArkUI.ArkUI.Full 56 * @since 10 57 */ 58 /** 59 * Icon rendered as lines. 60 * 61 * @syscap SystemCapability.ArkUI.ArkUI.Full 62 * @atomicservice 63 * @since 11 64 */ 65 LINES = 1, 66 67 /** 68 * Icon rendered as picture. 69 * 70 * @syscap SystemCapability.ArkUI.ArkUI.Full 71 * @systemapi 72 * @since 12 73 */ 74 PICTURE = 2 75} 76 77/** 78 * Enumerates the text that can be displayed on the save button. 79 * 80 * @enum { number } 81 * @syscap SystemCapability.ArkUI.ArkUI.Full 82 * @since 10 83 */ 84/** 85 * Enumerates the text that can be displayed on the save button. 86 * 87 * @enum { number } 88 * @syscap SystemCapability.ArkUI.ArkUI.Full 89 * @atomicservice 90 * @since 11 91 */ 92declare enum SaveDescription { 93 /** 94 * Download 95 * 96 * @syscap SystemCapability.ArkUI.ArkUI.Full 97 * @since 10 98 */ 99 /** 100 * Download 101 * 102 * @syscap SystemCapability.ArkUI.ArkUI.Full 103 * @atomicservice 104 * @since 11 105 */ 106 DOWNLOAD = 0, 107 108 /** 109 * Download File 110 * 111 * @syscap SystemCapability.ArkUI.ArkUI.Full 112 * @since 10 113 */ 114 /** 115 * Download File 116 * 117 * @syscap SystemCapability.ArkUI.ArkUI.Full 118 * @atomicservice 119 * @since 11 120 */ 121 DOWNLOAD_FILE = 1, 122 123 /** 124 * Save 125 * 126 * @syscap SystemCapability.ArkUI.ArkUI.Full 127 * @since 10 128 */ 129 /** 130 * Save 131 * 132 * @syscap SystemCapability.ArkUI.ArkUI.Full 133 * @atomicservice 134 * @since 11 135 */ 136 SAVE = 2, 137 138 /** 139 * Save Image 140 * 141 * @syscap SystemCapability.ArkUI.ArkUI.Full 142 * @since 10 143 */ 144 /** 145 * Save Image 146 * 147 * @syscap SystemCapability.ArkUI.ArkUI.Full 148 * @atomicservice 149 * @since 11 150 */ 151 SAVE_IMAGE = 3, 152 153 /** 154 * Save File 155 * 156 * @syscap SystemCapability.ArkUI.ArkUI.Full 157 * @since 10 158 */ 159 /** 160 * Save File 161 * 162 * @syscap SystemCapability.ArkUI.ArkUI.Full 163 * @atomicservice 164 * @since 11 165 */ 166 SAVE_FILE = 4, 167 168 /** 169 * Download and Share 170 * 171 * @syscap SystemCapability.ArkUI.ArkUI.Full 172 * @since 10 173 */ 174 /** 175 * Download and Share 176 * 177 * @syscap SystemCapability.ArkUI.ArkUI.Full 178 * @atomicservice 179 * @since 11 180 */ 181 DOWNLOAD_AND_SHARE = 5, 182 183 /** 184 * Receive 185 * 186 * @syscap SystemCapability.ArkUI.ArkUI.Full 187 * @since 10 188 */ 189 /** 190 * Receive 191 * 192 * @syscap SystemCapability.ArkUI.ArkUI.Full 193 * @atomicservice 194 * @since 11 195 */ 196 RECEIVE = 6, 197 198 /** 199 * Continue to Receive 200 * 201 * @syscap SystemCapability.ArkUI.ArkUI.Full 202 * @since 10 203 */ 204 /** 205 * Continue to Receive 206 * 207 * @syscap SystemCapability.ArkUI.ArkUI.Full 208 * @atomicservice 209 * @since 11 210 */ 211 CONTINUE_TO_RECEIVE = 7, 212 213 /** 214 * Save to gallery 215 * 216 * @syscap SystemCapability.ArkUI.ArkUI.Full 217 * @atomicservice 218 * @since 12 219 */ 220 SAVE_TO_GALLERY = 8, 221 222 /** 223 * Export to gallery 224 * 225 * @syscap SystemCapability.ArkUI.ArkUI.Full 226 * @atomicservice 227 * @since 12 228 */ 229 EXPORT_TO_GALLERY = 9, 230 231 /** 232 * Quick save to gallery 233 * 234 * @syscap SystemCapability.ArkUI.ArkUI.Full 235 * @atomicservice 236 * @since 12 237 */ 238 QUICK_SAVE_TO_GALLERY = 10, 239 240 /** 241 * Resave to gallery 242 * 243 * @syscap SystemCapability.ArkUI.ArkUI.Full 244 * @atomicservice 245 * @since 12 246 */ 247 RESAVE_TO_GALLERY = 11 248} 249 250/** 251 * Declares the interface for setting the save button options. 252 * 253 * @interface SaveButtonOptions 254 * @syscap SystemCapability.ArkUI.ArkUI.Full 255 * @since 10 256 */ 257/** 258 * Declares the interface for setting the save button options. 259 * 260 * @interface SaveButtonOptions 261 * @syscap SystemCapability.ArkUI.ArkUI.Full 262 * @atomicservice 263 * @since 11 264 */ 265declare interface SaveButtonOptions { 266 /** 267 * Style of the icon to be drawn. 268 * 269 * @type { ?SaveIconStyle } 270 * @syscap SystemCapability.ArkUI.ArkUI.Full 271 * @since 10 272 */ 273 /** 274 * Style of the icon to be drawn. 275 * 276 * @type { ?SaveIconStyle } 277 * @syscap SystemCapability.ArkUI.ArkUI.Full 278 * @atomicservice 279 * @since 11 280 */ 281 icon?: SaveIconStyle; 282 283 /** 284 * Text to be displayed on the button. 285 * 286 * @type { ?SaveDescription } 287 * @syscap SystemCapability.ArkUI.ArkUI.Full 288 * @since 10 289 */ 290 /** 291 * Text to be displayed on the button. 292 * 293 * @type { ?SaveDescription } 294 * @syscap SystemCapability.ArkUI.ArkUI.Full 295 * @atomicservice 296 * @since 11 297 */ 298 text?: SaveDescription; 299 300 /** 301 * Type of the button. 302 * 303 * @type { ?ButtonType } 304 * @syscap SystemCapability.ArkUI.ArkUI.Full 305 * @since 10 306 */ 307 /** 308 * Type of the button. 309 * 310 * @type { ?ButtonType } 311 * @syscap SystemCapability.ArkUI.ArkUI.Full 312 * @atomicservice 313 * @since 11 314 */ 315 buttonType?: ButtonType; 316} 317 318/** 319 * Enumerates the click event results of the save button. 320 * 321 * @enum { number } 322 * @syscap SystemCapability.ArkUI.ArkUI.Full 323 * @since 10 324 */ 325/** 326 * Enumerates the click event results of the save button. 327 * 328 * @enum { number } 329 * @syscap SystemCapability.ArkUI.ArkUI.Full 330 * @atomicservice 331 * @since 11 332 */ 333declare enum SaveButtonOnClickResult { 334 /** 335 * Success. 336 * 337 * @syscap SystemCapability.ArkUI.ArkUI.Full 338 * @since 10 339 */ 340 /** 341 * Success. 342 * 343 * @syscap SystemCapability.ArkUI.ArkUI.Full 344 * @atomicservice 345 * @since 11 346 */ 347 SUCCESS = 0, 348 349 /** 350 * Failure because the application is not temporarily authorized for saving files. 351 * 352 * @syscap SystemCapability.ArkUI.ArkUI.Full 353 * @since 10 354 */ 355 /** 356 * Failure because the application is not temporarily authorized for saving files. 357 * 358 * @syscap SystemCapability.ArkUI.ArkUI.Full 359 * @atomicservice 360 * @since 11 361 */ 362 TEMPORARY_AUTHORIZATION_FAILED = 1 363} 364 365/** 366 * Defines the interface for setting a save button. 367 * 368 * @interface SaveButtonInterface 369 * @syscap SystemCapability.ArkUI.ArkUI.Full 370 * @since 10 371 */ 372/** 373 * Defines the interface for setting a save button. 374 * 375 * @interface SaveButtonInterface 376 * @syscap SystemCapability.ArkUI.ArkUI.Full 377 * @atomicservice 378 * @since 11 379 */ 380interface SaveButtonInterface { 381 /** 382 * Creates a save button. 383 * 384 * @returns { SaveButtonAttribute } Returns the attribute of the save button. 385 * @syscap SystemCapability.ArkUI.ArkUI.Full 386 * @since 10 387 */ 388 /** 389 * Creates a save button. 390 * 391 * @returns { SaveButtonAttribute } Returns the attribute of the save button. 392 * @syscap SystemCapability.ArkUI.ArkUI.Full 393 * @atomicservice 394 * @since 11 395 */ 396 (): SaveButtonAttribute; 397 398 /** 399 * Creates a save button with the specified composition. 400 * If an attribute is not set, the corresponding element will not be drawn. 401 * 402 * @param { SaveButtonOptions } options - Indicates the options of the save button. 403 * @returns { SaveButtonAttribute } Returns the attribute of the save button. 404 * @syscap SystemCapability.ArkUI.ArkUI.Full 405 * @since 10 406 */ 407 /** 408 * Creates a save button with the specified composition. 409 * If an attribute is not set, the corresponding element will not be drawn. 410 * 411 * @param { SaveButtonOptions } options - Indicates the options of the save button. 412 * @returns { SaveButtonAttribute } Returns the attribute of the save button. 413 * @syscap SystemCapability.ArkUI.ArkUI.Full 414 * @atomicservice 415 * @since 11 416 */ 417 (options: SaveButtonOptions): SaveButtonAttribute; 418} 419 420/** 421 * Defines the attributes of the save button. 422 * 423 * @extends SecurityComponentMethod<SaveButtonAttribute> 424 * @syscap SystemCapability.ArkUI.ArkUI.Full 425 * @since 10 426 */ 427/** 428 * Defines the attributes of the save button. 429 * 430 * @extends SecurityComponentMethod<SaveButtonAttribute> 431 * @syscap SystemCapability.ArkUI.ArkUI.Full 432 * @atomicservice 433 * @since 11 434 */ 435declare class SaveButtonAttribute extends SecurityComponentMethod<SaveButtonAttribute> { 436 /** 437 * Called when the save button is clicked. 438 * 439 * @param { function } event 440 * @returns { SaveButtonAttribute } Returns the attribute of the save button. 441 * @syscap SystemCapability.ArkUI.ArkUI.Full 442 * @since 10 443 */ 444 /** 445 * Called when the save button is clicked. 446 * 447 * @param { function } event 448 * @returns { SaveButtonAttribute } Returns the attribute of the save button. 449 * @syscap SystemCapability.ArkUI.ArkUI.Full 450 * @atomicservice 451 * @since 11 452 */ 453 onClick(event: (event: ClickEvent, result: SaveButtonOnClickResult) => void): SaveButtonAttribute; 454} 455 456/** 457 * Defines a button that interacts with the security component service to 458 * request the permission for saving files in the media library. 459 * 460 * @syscap SystemCapability.ArkUI.ArkUI.Full 461 * @since 10 462 */ 463/** 464 * Defines a button that interacts with the security component service to 465 * request the permission for saving files in the media library. 466 * 467 * @syscap SystemCapability.ArkUI.ArkUI.Full 468 * @atomicservice 469 * @since 11 470 */ 471declare const SaveButton: SaveButtonInterface; 472 473/** 474 * Defines a save button instance for secure access. 475 * 476 * @syscap SystemCapability.ArkUI.ArkUI.Full 477 * @since 10 478 */ 479/** 480 * Defines a save button instance for secure access. 481 * 482 * @syscap SystemCapability.ArkUI.ArkUI.Full 483 * @atomicservice 484 * @since 11 485 */ 486declare const SaveButtonInstance: SaveButtonAttribute; 487