• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022-2024 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 navigation destination common title.
23 *
24 * @interface NavDestinationCommonTitle
25 * @syscap SystemCapability.ArkUI.ArkUI.Full
26 * @since 9
27 */
28/**
29 * Defines the navigation destination common title.
30 *
31 * @interface NavDestinationCommonTitle
32 * @syscap SystemCapability.ArkUI.ArkUI.Full
33 * @crossplatform
34 * @since 10
35 */
36/**
37 * Defines the navigation destination common title.
38 *
39 * @interface NavDestinationCommonTitle
40 * @syscap SystemCapability.ArkUI.ArkUI.Full
41 * @crossplatform
42 * @atomicservice
43 * @since 11
44 */
45declare interface NavDestinationCommonTitle {
46  /**
47   * Sets the main title.
48   *
49   * @type { string }
50   * @syscap SystemCapability.ArkUI.ArkUI.Full
51   * @since 9
52   */
53  /**
54   * Sets the main title.
55   *
56   * @type { string }
57   * @syscap SystemCapability.ArkUI.ArkUI.Full
58   * @crossplatform
59   * @since 10
60   */
61  /**
62   * Sets the main title.
63   *
64   * @type { string }
65   * @syscap SystemCapability.ArkUI.ArkUI.Full
66   * @crossplatform
67   * @atomicservice
68   * @since 11
69   */
70  main: string;
71
72  /**
73   * Sets the sub title.
74   *
75   * @type { string }
76   * @syscap SystemCapability.ArkUI.ArkUI.Full
77   * @since 9
78   */
79  /**
80   * Sets the sub title.
81   *
82   * @type { string }
83   * @syscap SystemCapability.ArkUI.ArkUI.Full
84   * @crossplatform
85   * @since 10
86   */
87  /**
88   * Sets the sub title.
89   *
90   * @type { string }
91   * @syscap SystemCapability.ArkUI.ArkUI.Full
92   * @crossplatform
93   * @atomicservice
94   * @since 11
95   */
96  sub: string;
97}
98
99/**
100 * Defines the navigation destination custom title.
101 *
102 * @interface NavDestinationCustomTitle
103 * @syscap SystemCapability.ArkUI.ArkUI.Full
104 * @since 9
105 */
106/**
107 * Defines the navigation destination custom title.
108 *
109 * @interface NavDestinationCustomTitle
110 * @syscap SystemCapability.ArkUI.ArkUI.Full
111 * @crossplatform
112 * @since 10
113 */
114/**
115 * Defines the navigation destination custom title.
116 *
117 * @interface NavDestinationCustomTitle
118 * @syscap SystemCapability.ArkUI.ArkUI.Full
119 * @crossplatform
120 * @atomicservice
121 * @since 11
122 */
123declare interface NavDestinationCustomTitle {
124  /**
125   * Sets the custom title builder.
126   *
127   * @type { CustomBuilder }
128   * @syscap SystemCapability.ArkUI.ArkUI.Full
129   * @since 9
130   */
131  /**
132   * Sets the custom title builder.
133   *
134   * @type { CustomBuilder }
135   * @syscap SystemCapability.ArkUI.ArkUI.Full
136   * @crossplatform
137   * @since 10
138   */
139  /**
140   * Sets the custom title builder.
141   *
142   * @type { CustomBuilder }
143   * @syscap SystemCapability.ArkUI.ArkUI.Full
144   * @crossplatform
145   * @atomicservice
146   * @since 11
147   */
148  builder: CustomBuilder;
149
150  /**
151   * Sets the custom title height.
152   *
153   * @type { TitleHeight | Length }
154   * @syscap SystemCapability.ArkUI.ArkUI.Full
155   * @since 9
156   */
157  /**
158   * Sets the custom title height.
159   *
160   * @type { TitleHeight | Length }
161   * @syscap SystemCapability.ArkUI.ArkUI.Full
162   * @crossplatform
163   * @since 10
164   */
165  /**
166   * Sets the custom title height.
167   *
168   * @type { TitleHeight | Length }
169   * @syscap SystemCapability.ArkUI.ArkUI.Full
170   * @crossplatform
171   * @atomicservice
172   * @since 11
173   */
174  height: TitleHeight | Length;
175}
176
177/**
178 * NavDestination mode.
179 *
180 * @enum { number }
181 * @syscap SystemCapability.ArkUI.ArkUI.Full
182 * @crossplatform
183 * @since 11
184 */
185/**
186 * NavDestination mode.
187 *
188 * @enum { number }
189 * @syscap SystemCapability.ArkUI.ArkUI.Full
190 * @crossplatform
191 * @atomicservice
192 * @since 12
193 */
194declare enum NavDestinationMode {
195  /**
196   * Standard mode is default mode of NavDestination.
197   *
198   * @syscap SystemCapability.ArkUI.ArkUI.Full
199   * @crossplatform
200   * @since 11
201   */
202  /**
203   * Standard mode is default mode of NavDestination.
204   *
205   * @syscap SystemCapability.ArkUI.ArkUI.Full
206   * @crossplatform
207   * @atomicservice
208   * @since 12
209   */
210  STANDARD = 0,
211
212  /**
213   * Dialog mode is transparent by default and does not affect the life cycle of other NavDestination.
214   *
215   * @syscap SystemCapability.ArkUI.ArkUI.Full
216   * @crossplatform
217   * @since 11
218   */
219  /**
220   * Dialog mode is transparent by default and does not affect the life cycle of other NavDestination.
221   *
222   * @syscap SystemCapability.ArkUI.ArkUI.Full
223   * @crossplatform
224   * @atomicservice
225   * @since 12
226   */
227  DIALOG = 1,
228}
229
230/**
231 * The construct function of NavDestination.
232 *
233 * @interface NavDestinationInterface
234 * @syscap SystemCapability.ArkUI.ArkUI.Full
235 * @since 9
236 */
237/**
238 * The construct function of NavDestination.
239 *
240 * @interface NavDestinationInterface
241 * @syscap SystemCapability.ArkUI.ArkUI.Full
242 * @crossplatform
243 * @since 10
244 */
245/**
246 * The construct function of NavDestination.
247 *
248 * @interface NavDestinationInterface
249 * @syscap SystemCapability.ArkUI.ArkUI.Full
250 * @crossplatform
251 * @atomicservice
252 * @since 11
253 */
254declare interface NavDestinationInterface {
255  /**
256   * Constructor.
257   *
258   * @returns { NavDestinationAttribute }
259   * @syscap SystemCapability.ArkUI.ArkUI.Full
260   * @since 9
261   */
262  /**
263   * Constructor.
264   *
265   * @returns { NavDestinationAttribute }
266   * @syscap SystemCapability.ArkUI.ArkUI.Full
267   * @crossplatform
268   * @since 10
269   */
270  /**
271   * Constructor.
272   *
273   * @returns { NavDestinationAttribute }
274   * @syscap SystemCapability.ArkUI.ArkUI.Full
275   * @crossplatform
276   * @atomicservice
277   * @since 11
278   */
279  (): NavDestinationAttribute;
280}
281
282/**
283 * Indicates configuration info of destination.
284 *
285 * @interface RouteMapConfig
286 * @syscap SystemCapability.ArkUI.ArkUI.Full
287 * @crossplatform
288 * @atomicservice
289 * @since 12
290 */
291declare interface RouteMapConfig {
292  /**
293   * Get destination name.
294   *
295   * @type { string }
296   * @syscap SystemCapability.ArkUI.ArkUI.Full
297   * @crossplatform
298   * @atomicservice
299   * @since 12
300   */
301  name: string;
302
303  /**
304   * Get destination builder file position
305   *
306   * @type { string }
307   * @syscap SystemCapability.ArkUI.ArkUI.Full
308   * @crossplatform
309   * @atomicservice
310   * @since 12
311   */
312  pageSourceFile: string;
313
314  /**
315   * Indicate the custom data of current destination.
316   *
317   * @type { Object }
318   * @syscap SystemCapability.ArkUI.ArkUI.Full
319   * @crossplatform
320   * @atomicservice
321   * @since 12
322   */
323  data: Object
324}
325
326/**
327 * Indicates the context of NavDestination.
328 *
329 * @interface NavDestinationContext
330 * @syscap SystemCapability.ArkUI.ArkUI.Full
331 * @crossplatform
332 * @atomicservice
333 * @since 11
334 */
335declare interface NavDestinationContext {
336  /**
337   * Get path info.
338   *
339   * @type { NavPathInfo }
340   * @syscap SystemCapability.ArkUI.ArkUI.Full
341   * @crossplatform
342   * @atomicservice
343   * @since 11
344   */
345  pathInfo: NavPathInfo;
346
347  /**
348   * Get stack of the Navigation where the NavDestination is located.
349   *
350   * @type { NavPathStack }
351   * @syscap SystemCapability.ArkUI.ArkUI.Full
352   * @crossplatform
353   * @atomicservice
354   * @since 11
355   */
356  pathStack: NavPathStack;
357
358  /**
359   * Get the unique id of NavDestination, which is different from common property id of Component.
360   *
361   * @type { ?string }
362   * @syscap SystemCapability.ArkUI.ArkUI.Full
363   * @crossplatform
364   * @atomicservice
365   * @since 12
366   */
367  navDestinationId?: string;
368
369  /**
370   * Get configuration of current Destination in module.json
371   *
372   * @returns {RouteMapConfig | undefined}
373   *
374   * @syscap SystemCapability.ArkUI.ArkUI.Full
375   * @crossplatform
376   * @atomicservice
377   * @since 12
378   */
379  getConfigInRouteMap(): RouteMapConfig | undefined;
380}
381
382/**
383 * The attribute function of NavDestination
384 *
385 * @extends CommonMethod<NavDestinationAttribute>
386 * @syscap SystemCapability.ArkUI.ArkUI.Full
387 * @since 9
388 */
389/**
390 * The attribute function of NavDestination
391 *
392 * @extends CommonMethod<NavDestinationAttribute>
393 * @syscap SystemCapability.ArkUI.ArkUI.Full
394 * @crossplatform
395 * @since 10
396 */
397/**
398 * The attribute function of NavDestination
399 *
400 * @extends CommonMethod<NavDestinationAttribute>
401 * @syscap SystemCapability.ArkUI.ArkUI.Full
402 * @crossplatform
403 * @atomicservice
404 * @since 11
405 */
406declare class NavDestinationAttribute extends CommonMethod<NavDestinationAttribute> {
407  /**
408   * Navigation title bar
409   *
410   * @param { string | CustomBuilder | NavDestinationCommonTitle | NavDestinationCustomTitle } value
411   * @returns { NavDestinationAttribute }
412   * @syscap SystemCapability.ArkUI.ArkUI.Full
413   * @since 9
414   */
415  /**
416   * Navigation title bar
417   *
418   * @param { string | CustomBuilder | NavDestinationCommonTitle | NavDestinationCustomTitle } value
419   * @returns { NavDestinationAttribute }
420   * @syscap SystemCapability.ArkUI.ArkUI.Full
421   * @crossplatform
422   * @since 10
423   */
424  /**
425   * Navigation title bar
426   *
427   * @param { string | CustomBuilder | NavDestinationCommonTitle | NavDestinationCustomTitle } value
428   * @returns { NavDestinationAttribute }
429   * @syscap SystemCapability.ArkUI.ArkUI.Full
430   * @crossplatform
431   * @atomicservice
432   * @since 11
433   */
434  /**
435   * NavDestination title bar
436   *
437   * @param { string | CustomBuilder | NavDestinationCommonTitle | NavDestinationCustomTitle } value
438   * @param { NavigationTitleOptions } [options] - Indicates the options of titlebar.
439   * @returns { NavDestinationAttribute }
440   * @syscap SystemCapability.ArkUI.ArkUI.Full
441   * @crossplatform
442   * @atomicservice
443   * @since 12
444   */
445  title(value: string | CustomBuilder | NavDestinationCommonTitle | NavDestinationCustomTitle, options?: NavigationTitleOptions): NavDestinationAttribute;
446
447  /**
448   * Hide navigation title bar
449   *
450   * @param { boolean } value
451   * @returns { NavDestinationAttribute }
452   * @syscap SystemCapability.ArkUI.ArkUI.Full
453   * @since 9
454   */
455  /**
456   * Hide navigation title bar
457   *
458   * @param { boolean } value
459   * @returns { NavDestinationAttribute }
460   * @syscap SystemCapability.ArkUI.ArkUI.Full
461   * @crossplatform
462   * @since 10
463   */
464  /**
465   * Hide navigation title bar
466   *
467   * @param { boolean } value
468   * @returns { NavDestinationAttribute }
469   * @syscap SystemCapability.ArkUI.ArkUI.Full
470   * @crossplatform
471   * @atomicservice
472   * @since 11
473   */
474  hideTitleBar(value: boolean): NavDestinationAttribute;
475
476  /**
477   * Hide navigation title bar
478   *
479   * @param { boolean } hide
480   * @param { boolean } animated
481   * @returns { NavDestinationAttribute }
482   * @syscap SystemCapability.ArkUI.ArkUI.Full
483   * @crossplatform
484   * @atomicservice
485   * @since 13
486   */
487  hideTitleBar(hide: boolean, animated: boolean): NavDestinationAttribute;
488
489  /**
490   * Invoked when the navDestination page is displayed.
491   *
492   * @param { function } callback - Indicates callback when the navDestination page is displayed.
493   * @returns { NavDestinationAttribute }
494   * @syscap SystemCapability.ArkUI.ArkUI.Full
495   * @crossplatform
496   * @since 10
497   */
498  /**
499   * Invoked when the navDestination page is displayed.
500   *
501   * @param { function } callback - Indicates callback when the navDestination page is displayed.
502   * @returns { NavDestinationAttribute }
503   * @syscap SystemCapability.ArkUI.ArkUI.Full
504   * @crossplatform
505   * @atomicservice
506   * @since 11
507   */
508  onShown(callback: () => void): NavDestinationAttribute;
509
510  /**
511   * Invoked when the navDestination is hidden.
512   *
513   * @param { function } callback - Indicates callback when the navDestination is hidden.
514   * @returns { NavDestinationAttribute }
515   * @syscap SystemCapability.ArkUI.ArkUI.Full
516   * @crossplatform
517   * @since 10
518   */
519  /**
520   * Invoked when the navDestination is hidden.
521   *
522   * @param { function } callback - Indicates callback when the navDestination is hidden.
523   * @returns { NavDestinationAttribute }
524   * @syscap SystemCapability.ArkUI.ArkUI.Full
525   * @crossplatform
526   * @atomicservice
527   * @since 11
528   */
529  onHidden(callback: () => void): NavDestinationAttribute;
530
531  /**
532   * Invoked when the backButton is pressed.
533   *
534   * @param { function } callback - Indicates callback when the backButton is pressed.
535   * @returns { NavDestinationAttribute }
536   * @syscap SystemCapability.ArkUI.ArkUI.Full
537   * @crossplatform
538   * @since 10
539   */
540  /**
541   * Invoked when the backButton is pressed.
542   *
543   * @param { function } callback - Indicates callback when the backButton is pressed.
544   * @returns { NavDestinationAttribute }
545   * @syscap SystemCapability.ArkUI.ArkUI.Full
546   * @crossplatform
547   * @atomicservice
548   * @since 11
549   */
550  onBackPressed(callback: () => boolean): NavDestinationAttribute;
551
552  /**
553   * Sets the different mode of NavDestination.
554   *
555   * @param { NavDestinationMode } value - NavDestinationMode
556   * @returns { NavDestinationAttribute }
557   * @syscap SystemCapability.ArkUI.ArkUI.Full
558   * @crossplatform
559   * @since 11
560   */
561  /**
562   * Sets the different mode of NavDestination.
563   *
564   * @param { NavDestinationMode } value - NavDestinationMode
565   * @returns { NavDestinationAttribute }
566   * @syscap SystemCapability.ArkUI.ArkUI.Full
567   * @crossplatform
568   * @atomicservice
569   * @since 12
570   */
571  mode(value: NavDestinationMode): NavDestinationAttribute;
572
573  /**
574   * Set back button icon.
575   *
576   * @param { ResourceStr | PixelMap } value - Indicates icon of back button.
577   * @returns { NavDestinationAttribute }
578   * @syscap SystemCapability.ArkUI.ArkUI.Full
579   * @crossplatform
580   * @since 11
581   */
582  /**
583   * Set back button icon.
584   *
585   * @param { ResourceStr | PixelMap | SymbolGlyphModifier } value - Indicates icon of back button.
586   * @returns { NavDestinationAttribute }
587   * @syscap SystemCapability.ArkUI.ArkUI.Full
588   * @crossplatform
589   * @atomicservice
590   * @since 12
591   */
592  backButtonIcon(value: ResourceStr | PixelMap | SymbolGlyphModifier): NavDestinationAttribute;
593
594  /**
595   * NavDestination title bar's menus
596   *
597   * @param { Array<NavigationMenuItem> | CustomBuilder } value
598   * @returns { NavDestinationAttribute }
599   * @syscap SystemCapability.ArkUI.ArkUI.Full
600   * @crossplatform
601   * @atomicservice
602   * @since 12
603   */
604  menus(value: Array<NavigationMenuItem> | CustomBuilder): NavDestinationAttribute;
605
606  /**
607    * Configure toolbar with default style parameter or custom parameter.
608    *
609    * @param { Array<ToolbarItem> | CustomBuilder } toolbarParam - Toolbar configuration parameters.
610    * @param { NavigationToolbarOptions } [options] - Indicates the options of toolbar.
611    * @returns { NavDestinationAttribute }
612    * @syscap SystemCapability.ArkUI.ArkUI.Full
613    * @crossplatform
614    * @atomicservice
615    * @since 13
616    */
617  toolbarConfiguration(toolbarParam: Array<ToolbarItem> | CustomBuilder, options?: NavigationToolbarOptions): NavDestinationAttribute;
618
619  /**
620   * Hide tool bar
621   *
622   * @param { boolean } hide
623   * @param { boolean } [animated]
624   * @returns { NavDestinationAttribute }
625   * @syscap SystemCapability.ArkUI.ArkUI.Full
626   * @crossplatform
627   * @atomicservice
628   * @since 13
629   */
630  hideToolBar(hide: boolean, animated?: boolean): NavDestinationAttribute;
631
632  /**
633   * Invoked before sub-components of NavDestination are created.
634   *
635   * @param { import('../api/@ohos.base').Callback<NavDestinationContext> } callback
636   * - Indicates callback that invoked before sub-components of NavDestination are created.
637   * @returns { NavDestinationAttribute }
638   * @syscap SystemCapability.ArkUI.ArkUI.Full
639   * @crossplatform
640   * @atomicservice
641   * @since 11
642   */
643  onReady(callback: import('../api/@ohos.base').Callback<NavDestinationContext>): NavDestinationAttribute;
644
645  /**
646   * Invoked before the navDestination is appeared.
647   *
648   * @param { Callback<void> } callback - Indicates callback before the navDestination is appeared.
649   * @returns { NavDestinationAttribute }
650   * @syscap SystemCapability.ArkUI.ArkUI.Full
651   * @crossplatform
652   * @atomicservice
653   * @since 12
654   */
655  onWillAppear(callback: Callback<void>): NavDestinationAttribute;
656
657  /**
658   * Invoked before the navDestination is disappeared.
659   *
660   * @param { Callback<void> } callback - Indicates callback before the navDestination is disappeared.
661   * @returns { NavDestinationAttribute }
662   * @syscap SystemCapability.ArkUI.ArkUI.Full
663   * @crossplatform
664   * @atomicservice
665   * @since 12
666   */
667  onWillDisappear(callback: Callback<void>): NavDestinationAttribute;
668
669  /**
670   * Invoked before the navDestination is displayed.
671   *
672   * @param { Callback<void> } callback - Indicates callback before the navDestination is displayed.
673   * @returns { NavDestinationAttribute }
674   * @syscap SystemCapability.ArkUI.ArkUI.Full
675   * @crossplatform
676   * @atomicservice
677   * @since 12
678   */
679  onWillShow(callback: Callback<void>): NavDestinationAttribute;
680
681  /**
682   * Invoked before the navDestination is hidden.
683   *
684   * @param { Callback<void> } callback - Indicates callback before the navDestination is hidden.
685   * @returns { NavDestinationAttribute }
686   * @syscap SystemCapability.ArkUI.ArkUI.Full
687   * @crossplatform
688   * @atomicservice
689   * @since 12
690   */
691  onWillHide(callback: Callback<void>): NavDestinationAttribute;
692
693  /**
694   * Set navDestination content expand types and edges.
695   *
696   * @param { Array<LayoutSafeAreaType> } [types] - Indicates the types of the safe area.
697   * @param { Array<LayoutSafeAreaEdge> } [edges] - Indicates the edges of the safe area.
698   * @returns { NavDestinationAttribute }
699   * @syscap SystemCapability.ArkUI.ArkUI.Full
700   * @crossplatform
701   * @atomicservice
702   * @since 12
703   */
704  ignoreLayoutSafeArea(types?: Array<LayoutSafeAreaType>, edges?: Array<LayoutSafeAreaEdge>): NavDestinationAttribute;
705
706  /**
707   * Set the style of system bar
708   *
709   * @param { Optional<SystemBarStyle> } style - The properties of system bar
710   * @returns { NavDestinationAttribute }
711   * @syscap SystemCapability.ArkUI.ArkUI.Full
712   * @atomicservice
713   * @since 12
714   */
715  systemBarStyle(style: Optional<SystemBarStyle>): NavDestinationAttribute;
716}
717
718/**
719 * Defines NavDestination Component.
720 *
721 * @syscap SystemCapability.ArkUI.ArkUI.Full
722 * @since 9
723 */
724/**
725 * Defines NavDestination Component.
726 *
727 * @syscap SystemCapability.ArkUI.ArkUI.Full
728 * @crossplatform
729 * @since 10
730 */
731/**
732 * Defines NavDestination Component.
733 *
734 * @syscap SystemCapability.ArkUI.ArkUI.Full
735 * @crossplatform
736 * @atomicservice
737 * @since 11
738 */
739declare const NavDestination: NavDestinationInterface;
740
741/**
742 * Defines NavDestination Component instance.
743 *
744 * @syscap SystemCapability.ArkUI.ArkUI.Full
745 * @since 9
746 */
747/**
748 * Defines NavDestination Component instance.
749 *
750 * @syscap SystemCapability.ArkUI.ArkUI.Full
751 * @crossplatform
752 * @since 10
753 */
754/**
755 * Defines NavDestination Component instance.
756 *
757 * @syscap SystemCapability.ArkUI.ArkUI.Full
758 * @crossplatform
759 * @atomicservice
760 * @since 11
761 */
762declare const NavDestinationInstance: NavDestinationAttribute;
763