• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021-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 * Defines the options of CustomDialogController.
23 *
24 * @interface CustomDialogControllerOptions
25 * @syscap SystemCapability.ArkUI.ArkUI.Full
26 * @since 7
27 */
28/**
29 * Defines the options of CustomDialogController.
30 *
31 * @interface CustomDialogControllerOptions
32 * @syscap SystemCapability.ArkUI.ArkUI.Full
33 * @crossplatform
34 * @since 10
35 */
36/**
37 * Defines the options of CustomDialogController.
38 *
39 * @interface CustomDialogControllerOptions
40 * @syscap SystemCapability.ArkUI.ArkUI.Full
41 * @crossplatform
42 * @atomicservice
43 * @since 11
44 */
45declare interface CustomDialogControllerOptions {
46  /**
47   * Custom builder function.
48   *
49   * @type { any }
50   * @syscap SystemCapability.ArkUI.ArkUI.Full
51   * @since 7
52   */
53  /**
54   * Custom builder function.
55   *
56   * @type { any }
57   * @syscap SystemCapability.ArkUI.ArkUI.Full
58   * @crossplatform
59   * @since 10
60   */
61  /**
62   * Custom builder function.
63   *
64   * @type { any }
65   * @syscap SystemCapability.ArkUI.ArkUI.Full
66   * @crossplatform
67   * @atomicservice
68   * @since 11
69   */
70  builder: any;
71
72  /**
73   * Defines the cancel function.
74   *
75   * @type { ?function }
76   * @syscap SystemCapability.ArkUI.ArkUI.Full
77   * @since 7
78   */
79  /**
80   * Defines the cancel function.
81   *
82   * @type { ?function }
83   * @syscap SystemCapability.ArkUI.ArkUI.Full
84   * @crossplatform
85   * @since 10
86   */
87  /**
88   * Defines the cancel function.
89   *
90   * @type { ?function }
91   * @syscap SystemCapability.ArkUI.ArkUI.Full
92   * @crossplatform
93   * @atomicservice
94   * @since 11
95   */
96  cancel?: () => void;
97
98  /**
99   * Defines if use auto cancel when click on the outside of the dialog.
100   *
101   * @type { ?boolean }
102   * @syscap SystemCapability.ArkUI.ArkUI.Full
103   * @since 7
104   */
105  /**
106   * Defines if use auto cancel when click on the outside of the dialog.
107   *
108   * @type { ?boolean }
109   * @syscap SystemCapability.ArkUI.ArkUI.Full
110   * @crossplatform
111   * @since 10
112   */
113  /**
114   * Defines if use auto cancel when click on the outside of the dialog.
115   *
116   * @type { ?boolean }
117   * @syscap SystemCapability.ArkUI.ArkUI.Full
118   * @crossplatform
119   * @atomicservice
120   * @since 11
121   */
122  autoCancel?: boolean;
123
124  /**
125   * Defines the dialog alignment of the screen.
126   *
127   * @type { ?DialogAlignment }
128   * @syscap SystemCapability.ArkUI.ArkUI.Full
129   * @since 7
130   */
131  /**
132   * Defines the dialog alignment of the screen.
133   *
134   * @type { ?DialogAlignment }
135   * @syscap SystemCapability.ArkUI.ArkUI.Full
136   * @crossplatform
137   * @since 10
138   */
139  /**
140   * Defines the dialog alignment of the screen.
141   *
142   * @type { ?DialogAlignment }
143   * @syscap SystemCapability.ArkUI.ArkUI.Full
144   * @crossplatform
145   * @atomicservice
146   * @since 11
147   */
148  alignment?: DialogAlignment;
149
150  /**
151   * Defines the dialog offset.
152   *
153   * @type { ?Offset }
154   * @syscap SystemCapability.ArkUI.ArkUI.Full
155   * @since 7
156   */
157  /**
158   * Defines the dialog offset.
159   *
160   * @type { ?Offset }
161   * @syscap SystemCapability.ArkUI.ArkUI.Full
162   * @crossplatform
163   * @since 10
164   */
165  /**
166   * Defines the dialog offset.
167   *
168   * @type { ?Offset }
169   * @syscap SystemCapability.ArkUI.ArkUI.Full
170   * @crossplatform
171   * @atomicservice
172   * @since 11
173   */
174  offset?: Offset;
175
176  /**
177   * Defines if use custom style.
178   *
179   * @type { ?boolean }
180   * @syscap SystemCapability.ArkUI.ArkUI.Full
181   * @since 7
182   */
183  /**
184   * Defines if use custom style.
185   *
186   * @type { ?boolean }
187   * @syscap SystemCapability.ArkUI.ArkUI.Full
188   * @crossplatform
189   * @since 10
190   */
191  /**
192   * Defines if use custom style.
193   *
194   * @type { ?boolean }
195   * @syscap SystemCapability.ArkUI.ArkUI.Full
196   * @crossplatform
197   * @atomicservice
198   * @since 11
199   */
200  customStyle?: boolean;
201
202  /**
203   * Grid count of dialog.
204   *
205   * @type { ?number }
206   * @syscap SystemCapability.ArkUI.ArkUI.Full
207   * @since 8
208   */
209  /**
210   * Grid count of dialog.
211   *
212   * @type { ?number }
213   * @syscap SystemCapability.ArkUI.ArkUI.Full
214   * @crossplatform
215   * @since 10
216   */
217  /**
218   * Grid count of dialog.
219   *
220   * @type { ?number }
221   * @syscap SystemCapability.ArkUI.ArkUI.Full
222   * @crossplatform
223   * @atomicservice
224   * @since 11
225   */
226  gridCount?: number;
227
228  /**
229   * Mask color of dialog.
230   *
231   * @type { ?ResourceColor }
232   * @syscap SystemCapability.ArkUI.ArkUI.Full
233   * @crossplatform
234   * @since 10
235   */
236  /**
237   * Mask color of dialog.
238   *
239   * @type { ?ResourceColor }
240   * @syscap SystemCapability.ArkUI.ArkUI.Full
241   * @crossplatform
242   * @atomicservice
243   * @since 11
244   */
245  maskColor?: ResourceColor;
246
247  /**
248   * Mask Region of dialog. The size cannot exceed the main window.
249   *
250   * @type { ?Rectangle }
251   * @syscap SystemCapability.ArkUI.ArkUI.Full
252   * @crossplatform
253   * @since 10
254   */
255  /**
256   * Mask Region of dialog. The size cannot exceed the main window.
257   *
258   * @type { ?Rectangle }
259   * @syscap SystemCapability.ArkUI.ArkUI.Full
260   * @crossplatform
261   * @atomicservice
262   * @since 11
263   */
264  maskRect?: Rectangle;
265
266  /**
267   * Animation parameters of dialog opening.
268   *
269   * @type { ?AnimateParam }
270   * @syscap SystemCapability.ArkUI.ArkUI.Full
271   * @crossplatform
272   * @since 10
273   */
274  /**
275   * Animation parameters of dialog opening.
276   *
277   * @type { ?AnimateParam }
278   * @syscap SystemCapability.ArkUI.ArkUI.Full
279   * @crossplatform
280   * @atomicservice
281   * @since 11
282   */
283  openAnimation?: AnimateParam;
284
285  /**
286   * Animation parameters of dialog closing.
287   *
288   * @type { ?AnimateParam }
289   * @syscap SystemCapability.ArkUI.ArkUI.Full
290   * @crossplatform
291   * @since 10
292   */
293  /**
294   * Animation parameters of dialog closing.
295   *
296   * @type { ?AnimateParam }
297   * @syscap SystemCapability.ArkUI.ArkUI.Full
298   * @crossplatform
299   * @atomicservice
300   * @since 11
301   */
302  closeAnimation?: AnimateParam;
303
304  /**
305   * Whether to display in the sub window.
306   *
307   * @type { ?boolean }
308   * @syscap SystemCapability.ArkUI.ArkUI.Full
309   * @crossplatform
310   * @since 10
311   */
312  /**
313   * Whether to display in the sub window.
314   *
315   * @type { ?boolean }
316   * @default false
317   * @syscap SystemCapability.ArkUI.ArkUI.Full
318   * @crossplatform
319   * @atomicservice
320   * @since 11
321   */
322  showInSubWindow?: boolean;
323
324  /**
325   * Background color of dialog.
326   *
327   * @type { ?ResourceColor }
328   * @syscap SystemCapability.ArkUI.ArkUI.Full
329   * @crossplatform
330   * @since 10
331   */
332  /**
333   * Background color of dialog.
334   *
335   * @type { ?ResourceColor }
336   * @syscap SystemCapability.ArkUI.ArkUI.Full
337   * @crossplatform
338   * @atomicservice
339   * @since 11
340   */
341  backgroundColor?: ResourceColor;
342
343  /**
344   * Corner radius of dialog.
345   *
346   * @type { ?(Dimension | BorderRadiuses) }
347   * @syscap SystemCapability.ArkUI.ArkUI.Full
348   * @crossplatform
349   * @since 10
350   */
351  /**
352   * Corner radius of dialog.
353   *
354   * @type { ?(Dimension | BorderRadiuses) }
355   * @syscap SystemCapability.ArkUI.ArkUI.Full
356   * @crossplatform
357   * @atomicservice
358   * @since 11
359   */
360  cornerRadius?: Dimension | BorderRadiuses;
361
362  /**
363   * Whether it is a modal dialog
364   * @type { ?boolean }
365   * @default true
366   * @syscap SystemCapability.ArkUI.ArkUI.Full
367   * @crossplatform
368   * @since 11
369   */
370  /**
371   * Whether it is a modal dialog
372   * @type { ?boolean }
373   * @default true
374   * @syscap SystemCapability.ArkUI.ArkUI.Full
375   * @crossplatform
376   * @atomicservice
377   * @since 12
378   */
379  isModal?: boolean;
380
381  /**
382   * Callback function when the CustomDialog interactive dismiss.
383   *
384   * @type { ?Callback<DismissDialogAction> }
385   * @syscap SystemCapability.ArkUI.ArkUI.Full
386   * @crossplatform
387   * @atomicservice
388   * @since 12
389   */
390  onWillDismiss?: Callback<DismissDialogAction>;
391
392  /**
393   * Defines the custom dialog's width.
394   *
395   * @type { ?Dimension }
396   * @syscap SystemCapability.ArkUI.ArkUI.Full
397   * @crossplatform
398   * @atomicservice
399   * @since 12
400   */
401  width?: Dimension;
402
403  /**
404   * Defines the custom dialog's height.
405   *
406   * @type { ?Dimension }
407   * @syscap SystemCapability.ArkUI.ArkUI.Full
408   * @crossplatform
409   * @atomicservice
410   * @since 12
411   */
412  height?: Dimension;
413
414  /**
415   * Defines the custom dialog's border width.
416   *
417   * @type { ?(Dimension | EdgeWidths) }
418   * @syscap SystemCapability.ArkUI.ArkUI.Full
419   * @crossplatform
420   * @atomicservice
421   * @since 12
422   */
423  borderWidth?: Dimension | EdgeWidths;
424
425  /**
426   * Defines the custom dialog's border color.
427   *
428   * @type { ?(ResourceColor | EdgeColors) }
429   * @syscap SystemCapability.ArkUI.ArkUI.Full
430   * @crossplatform
431   * @atomicservice
432   * @since 12
433   */
434  borderColor?: ResourceColor | EdgeColors;
435
436  /**
437   * Defines the custom dialog's border style.
438   *
439   * @type { ?(BorderStyle | EdgeStyles) }
440   * @syscap SystemCapability.ArkUI.ArkUI.Full
441   * @crossplatform
442   * @atomicservice
443   * @since 12
444   */
445  borderStyle?: BorderStyle | EdgeStyles;
446
447  /**
448   * Defines the custom dialog's shadow.
449   *
450   * @type { ?(ShadowOptions | ShadowStyle) }
451   * @syscap SystemCapability.ArkUI.ArkUI.Full
452   * @crossplatform
453   * @atomicservice
454   * @since 12
455   */
456  shadow?: ShadowOptions | ShadowStyle;
457
458  /**
459   * Defines the customDialog's background blur Style
460   *
461   * @type { ?BlurStyle }
462   * @default BlurStyle.COMPONENT_ULTRA_THICK
463   * @syscap SystemCapability.ArkUI.ArkUI.Full
464   * @crossplatform
465   * @atomicservice
466   * @since 12
467   */
468  backgroundBlurStyle?: BlurStyle;
469
470  /**
471   * Defines the customDialog's keyboard avoid mode
472   *
473   * @type { ?KeyboardAvoidMode }
474   * @default KeyboardAvoidMode.DEFAULT
475   * @syscap SystemCapability.ArkUI.ArkUI.Full
476   * @crossplatform
477   * @atomicservice
478   * @since 12
479   */
480  keyboardAvoidMode?: KeyboardAvoidMode;
481
482  /**
483   * Defines whether to respond to the hover mode.
484   *
485   * @type { ?boolean }
486   * @default false
487   * @syscap SystemCapability.ArkUI.ArkUI.Full
488   * @crossplatform
489   * @atomicservice
490   * @since 14
491   */
492  enableHoverMode?: boolean;
493
494  /**
495   * Defines the customDialog's display area in hover mode.
496   *
497   * @type { ?HoverModeAreaType }
498   * @default HoverModeAreaType.BOTTOM_SCREEN
499   * @syscap SystemCapability.ArkUI.ArkUI.Full
500   * @crossplatform
501   * @atomicservice
502   * @since 14
503   */
504  hoverModeArea?: HoverModeAreaType;
505}
506
507/**
508 * Component dialog dismiss action.
509 *
510 * @interface DismissDialogAction
511 * @syscap SystemCapability.ArkUI.ArkUI.Full
512 * @crossplatform
513 * @atomicservice
514 * @since 12
515 */
516declare interface DismissDialogAction {
517  /**
518   * Defines dialog dismiss function
519   *
520   * @type { Callback<void> }
521   * @syscap SystemCapability.ArkUI.ArkUI.Full
522   * @crossplatform
523   * @atomicservice
524   * @since 12
525   */
526  dismiss: Callback<void>;
527
528  /**
529   * Dismiss reason type.
530   *
531   * @type { DismissReason }
532   * @syscap SystemCapability.ArkUI.ArkUI.Full
533   * @crossplatform
534   * @atomicservice
535   * @since 12
536   */
537  reason: DismissReason;
538}
539
540/**
541 * Use the CustomDialogController class to display the custom pop-up window.
542 *
543 * @syscap SystemCapability.ArkUI.ArkUI.Full
544 * @since 7
545 */
546/**
547 * Use the CustomDialogController class to display the custom pop-up window.
548 *
549 * @syscap SystemCapability.ArkUI.ArkUI.Full
550 * @crossplatform
551 * @since 10
552 */
553/**
554 * Use the CustomDialogController class to display the custom pop-up window.
555 *
556 * @syscap SystemCapability.ArkUI.ArkUI.Full
557 * @crossplatform
558 * @atomicservice
559 * @since 11
560 */
561declare class CustomDialogController {
562  /**
563   * The constructor transfers parameter settings.
564   *
565   * @param { CustomDialogControllerOptions } value
566   * @syscap SystemCapability.ArkUI.ArkUI.Full
567   * @since 7
568   */
569  /**
570   * The constructor transfers parameter settings.
571   *
572   * @param { CustomDialogControllerOptions } value
573   * @syscap SystemCapability.ArkUI.ArkUI.Full
574   * @crossplatform
575   * @since 10
576   */
577  /**
578   * The constructor transfers parameter settings.
579   *
580   * @param { CustomDialogControllerOptions } value
581   * @syscap SystemCapability.ArkUI.ArkUI.Full
582   * @crossplatform
583   * @atomicservice
584   * @since 11
585   */
586  constructor(value: CustomDialogControllerOptions);
587
588  /**
589   * Display the content of the customized pop-up window. If the content has been displayed, it does not take effect.
590   *
591   * @syscap SystemCapability.ArkUI.ArkUI.Full
592   * @since 7
593   */
594  /**
595   * Display the content of the customized pop-up window. If the content has been displayed, it does not take effect.
596   *
597   * @syscap SystemCapability.ArkUI.ArkUI.Full
598   * @crossplatform
599   * @since 10
600   */
601  /**
602   * Display the content of the customized pop-up window. If the content has been displayed, it does not take effect.
603   *
604   * @syscap SystemCapability.ArkUI.ArkUI.Full
605   * @crossplatform
606   * @atomicservice
607   * @since 11
608   */
609  open();
610
611  /**
612   * Closes the custom pop-up window. If the window is closed, the window does not take effect.
613   *
614   * @syscap SystemCapability.ArkUI.ArkUI.Full
615   * @since 7
616   */
617  /**
618   * Closes the custom pop-up window. If the window is closed, the window does not take effect.
619   *
620   * @syscap SystemCapability.ArkUI.ArkUI.Full
621   * @crossplatform
622   * @since 10
623   */
624  /**
625   * Closes the custom pop-up window. If the window is closed, the window does not take effect.
626   *
627   * @syscap SystemCapability.ArkUI.ArkUI.Full
628   * @crossplatform
629   * @atomicservice
630   * @since 11
631   */
632  close();
633}
634