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