• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2* Copyright (C) 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 This section describes the interfaces used by AtomicServiceNavigation
18 * @kit ArkUI
19 */
20
21import { Callback } from '@ohos.base';
22
23/**
24 * Defines AtomicServiceNavigation.
25 *
26 * @struct AtomicServiceNavigation
27 * @syscap SystemCapability.ArkUI.ArkUI.Full
28 * @atomicservice
29 * @since 12
30 */
31@Component
32export declare struct AtomicServiceNavigation {
33  /**
34   * the information of route page.Providers methods for controlling destination page in the stack.
35   *
36   * @type { ?NavPathStack }.
37   * @syscap SystemCapability.ArkUI.ArkUI.Full
38   * @atomicservice
39   * @since 12
40   */
41  @State
42  navPathStack?: NavPathStack;
43  /**
44   * the content of Navigation.
45   *
46   * @type { ?Callback<void> }.
47   * @syscap SystemCapability.ArkUI.ArkUI.Full
48   * @atomicservice
49   * @since 12
50   */
51  @BuilderParam
52  navigationContent?: Callback<void>;
53  /**
54   * Sets the Navigation title.
55   *
56   * @type { ?ResourceStr }.
57   * @syscap SystemCapability.ArkUI.ArkUI.Full
58   * @atomicservice
59   * @since 12
60   */
61  @Prop
62  title?: ResourceStr;
63  /**
64   * The color of Navigation's TitleBar.
65   *
66   * @type { ?TitleOptions }.
67   * @syscap SystemCapability.ArkUI.ArkUI.Full
68   * @atomicservice
69   * @since 12
70   */
71  @Prop
72  titleOptions?: TitleOptions;
73  /**
74   * Hide navigation title bar.
75   *
76   * @type { ?boolean }.
77   * @syscap SystemCapability.ArkUI.ArkUI.Full
78   * @atomicservice
79   * @since 12
80   */
81  @Prop
82  hideTitleBar?: boolean;
83  /**
84   * Sets the width of navigation bar.
85   *
86   * @type { ?Length }.
87   * @syscap SystemCapability.ArkUI.ArkUI.Full
88   * @atomicservice
89   * @since 12
90   */
91  @Prop
92  navBarWidth?: Length;
93  /**
94   * Sets the mode of navigation.
95   *
96   * @type { ?NavigationMode }.
97   * @syscap SystemCapability.ArkUI.ArkUI.Full
98   * @atomicservice
99   * @since 12
100   */
101  @Prop
102  mode?: NavigationMode;
103  /**
104   * The builder of navDestination.
105   *
106   * @type { ?NavDestinationBuilder }.
107   * @syscap SystemCapability.ArkUI.ArkUI.Full
108   * @atomicservice
109   * @since 12
110   */
111  @BuilderParam
112  navDestinationBuilder?: NavDestinationBuilder;
113  /**
114   * Sets the minimum width and the maximum width of navigation bar.
115   *
116   * @type { ?[Dimension, Dimension] }.
117   * @syscap SystemCapability.ArkUI.ArkUI.Full
118   * @atomicservice
119   * @since 12
120   */
121  @Prop
122  navBarWidthRange?: [
123    Dimension,
124    Dimension
125  ];
126  /**
127   * Sets the minimum width of content.
128   *
129   * @type { ?Dimension }.
130   * @syscap SystemCapability.ArkUI.ArkUI.Full
131   * @atomicservice
132   * @since 12
133   */
134  @Prop
135  minContentWidth?: Dimension;
136  /**
137   * Trigger callback when the visibility of navigation bar change.
138   *
139   * @type { ?Callback<boolean> }.
140   * @syscap SystemCapability.ArkUI.ArkUI.Full
141   * @atomicservice
142   * @since 12
143   */
144  stateChangeCallback?: Callback<boolean>;
145  /**
146   * Trigger callback when navigation mode changes.
147   *
148   * @type { ?Callback<NavigationMode> }.
149   * @syscap SystemCapability.ArkUI.ArkUI.Full
150   * @atomicservice
151   * @since 12
152   */
153  modeChangeCallback?: Callback<NavigationMode>;
154}
155
156/**
157 * Indicates the options of Navigation's Titlebar.
158 *
159 * @typedef TitleOptions
160 * @syscap SystemCapability.ArkUI.ArkUI.Full
161 * @atomicservice
162 * @since 12
163 */
164export interface TitleOptions {
165  /**
166   * Background color.
167   *
168   * @type { ?ResourceColor }
169   * @syscap SystemCapability.ArkUI.ArkUI.Full
170   * @atomicservice
171   * @since 12
172   */
173  backgroundColor?: ResourceColor;
174
175  /**
176   * Whether to enable the blur effect.
177   *
178   * @type { ?boolean }.
179   * @default true
180   * @syscap SystemCapability.ArkUI.ArkUI.Full
181   * @atomicservice
182   * @since 12
183   */
184  isBlurEnabled?: boolean;
185
186  /**
187   * Set title bar style.
188   *
189   * @type { ?BarStyle }
190   * @default BarStyle.STANDARD
191   * @syscap SystemCapability.ArkUI.ArkUI.Full
192   * @atomicservice
193   * @since 12
194   */
195  barStyle?: BarStyle;
196}
197
198/**
199 * The builder function of NavDestination component.
200 *
201 * @typedef { function } NavDestinationBuilder.
202 * @param { string } name - The name of route page.
203 * @param { ?Object } - param - The detailed parameter of the route page.
204 * @syscap SystemCapability.ArkUI.ArkUI.Full
205 * @atomicservice
206 * @since 12
207 */
208export type NavDestinationBuilder = (name: string, param?: Object) => void;