• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022-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 * Indicates the information of the route page.
18 *
19 * @interface RouteInfo
20 * @syscap SystemCapability.ArkUI.ArkUI.Full
21 * @crossplatform
22 * @since 10
23 */
24declare interface RouteInfo {
25  /**
26   * The name of the route page.
27   *
28   * @type { string }
29   * @syscap SystemCapability.ArkUI.ArkUI.Full
30   * @crossplatform
31   * @since 10
32   */
33  name: string;
34
35  /**
36   * The detailed parameter of the route page.
37   *
38   * @type { ?unknown }
39   * @syscap SystemCapability.ArkUI.ArkUI.Full
40   * @crossplatform
41   * @since 10
42   */
43  param?: unknown;
44}
45
46/**
47 * The construct function of NavRouter.
48 *
49 * @interface NavRouterInterface
50 * @syscap SystemCapability.ArkUI.ArkUI.Full
51 * @since 9
52 */
53/**
54 * The construct function of NavRouter.
55 *
56 * @interface NavRouterInterface
57 * @syscap SystemCapability.ArkUI.ArkUI.Full
58 * @crossplatform
59 * @since 10
60 */
61declare interface NavRouterInterface {
62  /**
63   * Constructor.
64   *
65   * @returns { NavRouterAttribute }
66   * @syscap SystemCapability.ArkUI.ArkUI.Full
67   * @since 9
68   */
69  /**
70   * Constructor.
71   *
72   * @returns { NavRouterAttribute }
73   * @syscap SystemCapability.ArkUI.ArkUI.Full
74   * @crossplatform
75   * @since 10
76   */
77  (): NavRouterAttribute;
78
79  /**
80   * NavDestination Constructor.
81   *
82   * @param { RouteInfo } value - Indicates the information of route page.
83   * @returns { NavRouterAttribute }
84   * @syscap SystemCapability.ArkUI.ArkUI.Full
85   * @crossplatform
86   * @since 10
87   */
88  (value: RouteInfo): NavRouterAttribute;
89}
90
91/**
92 * Define the route mode.
93 *
94 * @enum { number }
95 * @syscap SystemCapability.ArkUI.ArkUI.Full
96 * @crossplatform
97 * @since 10
98 */
99declare enum NavRouteMode {
100  /**
101   * Create a new page to replace the current. The old page is destroyed but kept in the stack for recreating.
102   *
103   * @syscap SystemCapability.ArkUI.ArkUI.Full
104   * @crossplatform
105   * @since 10
106   */
107  PUSH_WITH_RECREATE,
108
109  /**
110   * Create a new page to cover the current. The old page is remained and kept in the stack.
111   *
112   * @syscap SystemCapability.ArkUI.ArkUI.Full
113   * @crossplatform
114   * @since 10
115   */
116  PUSH,
117
118  /**
119   * Create a new page to replace the current. The old page is destroyed and removed out of the stack.
120   *
121   * @syscap SystemCapability.ArkUI.ArkUI.Full
122   * @crossplatform
123   * @since 10
124   */
125  REPLACE
126}
127
128/**
129 * The attribute function of NavRouter
130 *
131 * @extends CommonMethod
132 * @syscap SystemCapability.ArkUI.ArkUI.Full
133 * @since 9
134 */
135/**
136 * The attribute function of NavRouter
137 *
138 * @extends CommonMethod
139 * @syscap SystemCapability.ArkUI.ArkUI.Full
140 * @crossplatform
141 * @since 10
142 */
143declare class NavRouterAttribute extends CommonMethod<NavRouterAttribute> {
144  /**
145   * Trigger callback when NavigationView state change.
146   *
147   * @param { function } callback
148   * @returns { NavRouterAttribute }
149   * @syscap SystemCapability.ArkUI.ArkUI.Full
150   * @since 9
151   */
152  /**
153   * Trigger callback when NavigationView state change.
154   *
155   * @param { function } callback
156   * @returns { NavRouterAttribute }
157   * @syscap SystemCapability.ArkUI.ArkUI.Full
158   * @crossplatform
159   * @since 10
160   */
161  onStateChange(callback: (isActivated: boolean) => void): NavRouterAttribute;
162
163  /**
164   * Define the route mode.
165   *
166   * @param { NavRouteMode } mode - The route mode of the NavRouter.
167   * @returns { NavRouterAttribute } Returns the instance of the NavRouterAttribute.
168   * @syscap SystemCapability.ArkUI.ArkUI.Full
169   * @crossplatform
170   * @since 10
171   */
172  mode(mode: NavRouteMode): NavRouterAttribute;
173}
174
175/**
176 * Defines NavRouter Component.
177 *
178 * @syscap SystemCapability.ArkUI.ArkUI.Full
179 * @since 9
180 */
181/**
182 * Defines NavRouter Component.
183 *
184 * @syscap SystemCapability.ArkUI.ArkUI.Full
185 * @crossplatform
186 * @since 10
187 */
188declare const NavRouter: NavRouterInterface;
189
190/**
191 * Defines NavRouter Component instance.
192 *
193 * @syscap SystemCapability.ArkUI.ArkUI.Full
194 * @since 9
195 */
196/**
197 * Defines NavRouter Component instance.
198 *
199 * @syscap SystemCapability.ArkUI.ArkUI.Full
200 * @crossplatform
201 * @since 10
202 */
203declare const NavRouterInstance: NavRouterAttribute;
204