• 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   * Defines the distance between the customDialog and system keyboard.
508   *
509   * @type { ?LengthMetrics }
510   * @syscap SystemCapability.ArkUI.ArkUI.Full
511   * @crossplatform
512   * @atomicservice
513   * @since 15
514   */
515  keyboardAvoidDistance?: LengthMetrics;
516
517  /**
518   * Determine the display level of the dialog.
519   *
520   * @type { ?LevelMode }
521   * @default LevelMode.OVERLAY
522   * @syscap SystemCapability.ArkUI.ArkUI.Full
523   * @crossplatform
524   * @atomicservice
525   * @since 15
526   */
527  levelMode?: LevelMode;
528
529  /**
530   * The uniqueId of any node in the router or navigation page.
531   *
532   * @type { ?number }
533   * @syscap SystemCapability.ArkUI.ArkUI.Full
534   * @crossplatform
535   * @atomicservice
536   * @since 15
537   */
538  levelUniqueId?: number;
539
540  /**
541   * Determine the immersive mode of the dialog.
542   *
543   * @type { ?ImmersiveMode }
544   * @default ImmersiveMode.DEFAULT
545   * @syscap SystemCapability.ArkUI.ArkUI.Full
546   * @crossplatform
547   * @atomicservice
548   * @since 15
549   */
550  immersiveMode?: ImmersiveMode;
551
552  /**
553   * Determine the display order of the dialog.
554   *
555   * @type { ?LevelOrder }
556   * @default The value returns by LevelOrder.clamp(0)
557   * @syscap SystemCapability.ArkUI.ArkUI.Full
558   * @crossplatform
559   * @atomicservice
560   * @since 18
561   */
562  levelOrder?: LevelOrder;
563}
564
565/**
566 * Component dialog dismiss action.
567 *
568 * @interface DismissDialogAction
569 * @syscap SystemCapability.ArkUI.ArkUI.Full
570 * @crossplatform
571 * @atomicservice
572 * @since 12
573 */
574declare interface DismissDialogAction {
575  /**
576   * Defines dialog dismiss function
577   *
578   * @type { Callback<void> }
579   * @syscap SystemCapability.ArkUI.ArkUI.Full
580   * @crossplatform
581   * @atomicservice
582   * @since 12
583   */
584  dismiss: Callback<void>;
585
586  /**
587   * Dismiss reason type.
588   *
589   * @type { DismissReason }
590   * @syscap SystemCapability.ArkUI.ArkUI.Full
591   * @crossplatform
592   * @atomicservice
593   * @since 12
594   */
595  reason: DismissReason;
596}
597
598/**
599 * Use the CustomDialogController class to display the custom pop-up window.
600 *
601 * @syscap SystemCapability.ArkUI.ArkUI.Full
602 * @since 7
603 */
604/**
605 * Use the CustomDialogController class to display the custom pop-up window.
606 *
607 * @syscap SystemCapability.ArkUI.ArkUI.Full
608 * @crossplatform
609 * @since 10
610 */
611/**
612 * Use the CustomDialogController class to display the custom pop-up window.
613 *
614 * @syscap SystemCapability.ArkUI.ArkUI.Full
615 * @crossplatform
616 * @atomicservice
617 * @since 11
618 */
619declare class CustomDialogController {
620  /**
621   * The constructor transfers parameter settings.
622   *
623   * @param { CustomDialogControllerOptions } value
624   * @syscap SystemCapability.ArkUI.ArkUI.Full
625   * @since 7
626   */
627  /**
628   * The constructor transfers parameter settings.
629   *
630   * @param { CustomDialogControllerOptions } value
631   * @syscap SystemCapability.ArkUI.ArkUI.Full
632   * @crossplatform
633   * @since 10
634   */
635  /**
636   * The constructor transfers parameter settings.
637   *
638   * @param { CustomDialogControllerOptions } value
639   * @syscap SystemCapability.ArkUI.ArkUI.Full
640   * @crossplatform
641   * @atomicservice
642   * @since 11
643   */
644  constructor(value: CustomDialogControllerOptions);
645
646  /**
647   * Display the content of the customized pop-up window. If the content has been displayed, it does not take effect.
648   *
649   * @syscap SystemCapability.ArkUI.ArkUI.Full
650   * @since 7
651   */
652  /**
653   * Display the content of the customized pop-up window. If the content has been displayed, it does not take effect.
654   *
655   * @syscap SystemCapability.ArkUI.ArkUI.Full
656   * @crossplatform
657   * @since 10
658   */
659  /**
660   * Display the content of the customized pop-up window. If the content has been displayed, it does not take effect.
661   *
662   * @syscap SystemCapability.ArkUI.ArkUI.Full
663   * @crossplatform
664   * @atomicservice
665   * @since 11
666   */
667  open();
668
669  /**
670   * Closes the custom pop-up window. If the window is closed, the window does not take effect.
671   *
672   * @syscap SystemCapability.ArkUI.ArkUI.Full
673   * @since 7
674   */
675  /**
676   * Closes the custom pop-up window. If the window is closed, the window does not take effect.
677   *
678   * @syscap SystemCapability.ArkUI.ArkUI.Full
679   * @crossplatform
680   * @since 10
681   */
682  /**
683   * Closes the custom pop-up window. If the window is closed, the window does not take effect.
684   *
685   * @syscap SystemCapability.ArkUI.ArkUI.Full
686   * @crossplatform
687   * @atomicservice
688   * @since 11
689   */
690  close();
691}
692