• 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 * the enum for the blend mode of background color.
25 *
26 * @enum { number }.
27 * @syscap SystemCapability.ArkUI.ArkUI.Full
28 * @atomicservice
29 * @since 18
30 */
31export declare enum MixMode {
32  /**
33   * when the MixMode set AVERAGE,the mixing method for background colors is that the two colors have equal proportions.
34   *
35   * @syscap SystemCapability.ArkUI.ArkUI.Full
36   * @atomicservice
37   * @since 18
38   */
39  AVERAGE = 1,
40  /**
41   * when the MixMode set CROSS,the color mixing method for the background is a transition where one color crosses
42   *  through to another.
43   *
44   * @syscap SystemCapability.ArkUI.ArkUI.Full
45   * @atomicservice
46   * @since 18
47   */
48  CROSS = 2,
49  /**
50   * when the MixMode set TOWARDS,the color mixing method for the background is a transition from one color to another.
51   *
52   * @syscap SystemCapability.ArkUI.ArkUI.Full
53   * @atomicservice
54   * @since 18
55   */
56  TOWARDS = 3,
57}
58
59/**
60 * the enum for the opacity  of the background color.
61 *
62 * @enum { number }.
63 * @syscap SystemCapability.ArkUI.ArkUI.Full
64 * @atomicservice
65 * @since 18
66 */
67export declare enum GradientAlpha {
68  /**
69   * when the GradientAlpha set OPACITY_20,the opacity of background colors is 0.2.
70   *
71   * @syscap SystemCapability.ArkUI.ArkUI.Full
72   * @atomicservice
73   * @since 18
74   */
75  OPACITY_20 = 1,
76  /**
77   * when the GradientAlpha set OPACITY_60,the opacity of background colors is 0.6.
78   *
79   * @syscap SystemCapability.ArkUI.ArkUI.Full
80   * @atomicservice
81   * @since 18
82   */
83  OPACITY_60 = 2,
84  /**
85   * when the GradientAlpha set OPACITY_80,the opacity of background colors is 0.8.
86   *
87   * @syscap SystemCapability.ArkUI.ArkUI.Full
88   * @atomicservice
89   * @since 18
90   */
91  OPACITY_80 = 3,
92  /**
93   * when the GradientAlpha set OPACITY_100,the opacity of background colors is 1.0.
94   *
95   * @syscap SystemCapability.ArkUI.ArkUI.Full
96   * @atomicservice
97   * @since 18
98   */
99  OPACITY_100 = 4,
100}
101
102/**
103 * the theme of the background color.
104 *
105 * @enum { number }.
106 * @syscap SystemCapability.ArkUI.ArkUI.Full
107 * @atomicservice
108 * @since 18
109 */
110export declare enum BackgroundTheme {
111  /**
112   * when the BackgroundTheme set DARK,the basic color of background is dark.
113   *
114   * @syscap SystemCapability.ArkUI.ArkUI.Full
115   * @atomicservice
116   * @since 18
117   */
118  DARK = 1,
119  /**
120   * when the BackgroundTheme set LIGHT,the basic color of background  is white.
121   *
122   * @syscap SystemCapability.ArkUI.ArkUI.Full
123   * @atomicservice
124   * @since 18
125   */
126  LIGHT = 2,
127  /**
128   * when the BackgroundTheme set DEFAULT,the basic color of background  is F1F3F5.
129   *
130   * @syscap SystemCapability.ArkUI.ArkUI.Full
131   * @atomicservice
132   * @since 18
133   */
134  DEFAULT = 3,
135}
136
137/**
138 * Defines AtomicServiceNavigation.
139 *
140 * @struct { AtomicServiceNavigation }
141 * @syscap SystemCapability.ArkUI.ArkUI.Full
142 * @atomicservice
143 * @since 12
144 */
145@Component
146export declare struct AtomicServiceNavigation {
147  /**
148   * the information of route page.Providers methods for controlling destination page in the stack.
149   *
150   * @type { ?NavPathStack }.
151   * @syscap SystemCapability.ArkUI.ArkUI.Full
152   * @atomicservice
153   * @since 12
154   */
155  @State
156  navPathStack?: NavPathStack;
157  /**
158   * the content of Navigation.
159   *
160   * @type { ?Callback<void> }.
161   * @syscap SystemCapability.ArkUI.ArkUI.Full
162   * @atomicservice
163   * @since 12
164   */
165  @BuilderParam
166  navigationContent?: Callback<void>;
167  /**
168   * Sets the Navigation title.
169   *
170   * @type { ?ResourceStr }.
171   * @syscap SystemCapability.ArkUI.ArkUI.Full
172   * @atomicservice
173   * @since 12
174   */
175  @Prop
176  title?: ResourceStr;
177  /**
178   * The color of Navigation's TitleBar.
179   *
180   * @type { ?TitleOptions }.
181   * @syscap SystemCapability.ArkUI.ArkUI.Full
182   * @atomicservice
183   * @since 12
184   */
185  @Prop
186  titleOptions?: TitleOptions;
187  /**
188   * The background with gradient colors of Navigation.
189   *
190   * @type { ?GradientBackground }.
191   * @syscap SystemCapability.ArkUI.ArkUI.Full
192   * @atomicservice
193   * @since 18
194   */
195  @Prop
196  gradientBackground?: GradientBackground;
197  /**
198   * Hide navigation title bar.
199   *
200   * @type { ?boolean }.
201   * @syscap SystemCapability.ArkUI.ArkUI.Full
202   * @atomicservice
203   * @since 12
204   */
205  @Prop
206  hideTitleBar?: boolean;
207  /**
208   * Sets the width of navigation bar.
209   *
210   * @type { ?Length }.
211   * @syscap SystemCapability.ArkUI.ArkUI.Full
212   * @atomicservice
213   * @since 12
214   */
215  @Prop
216  navBarWidth?: Length;
217  /**
218   * Sets the mode of navigation.
219   *
220   * @type { ?NavigationMode }.
221   * @syscap SystemCapability.ArkUI.ArkUI.Full
222   * @atomicservice
223   * @since 12
224   */
225  @Prop
226  mode?: NavigationMode;
227  /**
228   * The builder of navDestination.
229   *
230   * @type { ?NavDestinationBuilder }.
231   * @syscap SystemCapability.ArkUI.ArkUI.Full
232   * @atomicservice
233   * @since 12
234   */
235  @BuilderParam
236  navDestinationBuilder?: NavDestinationBuilder;
237  /**
238   * Sets the minimum width and the maximum width of navigation bar.
239   *
240   * @type { ?[Dimension, Dimension] }.
241   * @syscap SystemCapability.ArkUI.ArkUI.Full
242   * @atomicservice
243   * @since 12
244   */
245  @Prop
246  navBarWidthRange?: [
247    Dimension,
248    Dimension
249  ];
250  /**
251   * Sets the minimum width of content.
252   *
253   * @type { ?Dimension }.
254   * @syscap SystemCapability.ArkUI.ArkUI.Full
255   * @atomicservice
256   * @since 12
257   */
258  @Prop
259  minContentWidth?: Dimension;
260  /**
261   * Trigger callback when the visibility of navigation bar change.
262   *
263   * @type { ?Callback<boolean> }.
264   * @syscap SystemCapability.ArkUI.ArkUI.Full
265   * @atomicservice
266   * @since 12
267   */
268  stateChangeCallback?: Callback<boolean>;
269  /**
270   * Trigger callback when navigation mode changes.
271   *
272   * @type { ?Callback<NavigationMode> }.
273   * @syscap SystemCapability.ArkUI.ArkUI.Full
274   * @atomicservice
275   * @since 12
276   */
277  modeChangeCallback?: Callback<NavigationMode>;
278  /**
279   * The layout style users defined and inserted.
280   *
281   * @type { ?(CustomBuilder | Array<NavigationMenuItem>) }.
282   * @syscap SystemCapability.ArkUI.ArkUI.Full
283   * @atomicservice
284   * @since 18
285   */
286  @BuilderParam
287  menus?: CustomBuilder | Array<NavigationMenuItem>;
288  /**
289   * Set side bar options.
290   *
291   * @type { ?SideBarOptions }.
292   * @syscap SystemCapability.ArkUI.ArkUI.Full
293   * @atomicservice
294   * @since 18
295   */
296  @Prop
297  sideBarOptions?: SideBarOptions;
298  /**
299   * Set side bar content.
300   *
301   * @type { ?Callback<void> }.
302   * @syscap SystemCapability.ArkUI.ArkUI.Full
303   * @atomicservice
304   * @since 18
305   */
306  @BuilderParam
307  sideBarContent?: Callback<void>;
308}
309
310/**
311 * Indicates the options of Navigation's Titlebar.
312 *
313 * @typedef TitleOptions
314 * @syscap SystemCapability.ArkUI.ArkUI.Full
315 * @atomicservice
316 * @since 12
317 */
318export interface TitleOptions {
319  /**
320   * Background color.
321   *
322   * @type { ?ResourceColor }
323   * @syscap SystemCapability.ArkUI.ArkUI.Full
324   * @atomicservice
325   * @since 12
326   */
327  backgroundColor?: ResourceColor;
328
329  /**
330   * Whether to enable the blur effect.
331   *
332   * @type { ?boolean }.
333   * @default true
334   * @syscap SystemCapability.ArkUI.ArkUI.Full
335   * @atomicservice
336   * @since 12
337   */
338  isBlurEnabled?: boolean;
339
340  /**
341   * Set title bar style.
342   *
343   * @type { ?BarStyle }
344   * @default BarStyle.STANDARD
345   * @syscap SystemCapability.ArkUI.ArkUI.Full
346   * @atomicservice
347   * @since 12
348   */
349  barStyle?: BarStyle;
350
351  /**
352   * Set title bar type.
353   *
354   * @type { ?TitleBarType }
355   * @default TitleBarType.ROUND_ICON
356   * @syscap SystemCapability.ArkUI.ArkUI.Full
357   * @atomicservice
358   * @since 18
359   */
360  titleBarType?: TitleBarType;
361
362  /**
363   * Set title bar icon.
364   *
365   * @type { ?(Resource | SymbolGlyphModifier) }
366   * @default atomicservice icon
367   * @syscap SystemCapability.ArkUI.ArkUI.Full
368   * @atomicservice
369   * @since 18
370   */
371  titleIcon?: Resource | SymbolGlyphModifier;
372}
373
374/**
375 * Indicates the options of Navigation's gradientBackground.
376 *
377 * @typedef GradientBackground
378 * @syscap SystemCapability.ArkUI.ArkUI.Full
379 * @atomicservice
380 * @since 18
381 */
382export interface GradientBackground {
383  /**
384   * the primaryColor of Background.
385   *
386   * @type { ResourceColor }
387   * @syscap SystemCapability.ArkUI.ArkUI.Full
388   * @atomicservice
389   * @since 18
390   */
391  primaryColor: ResourceColor;
392
393  /**
394   * the secondaryColor of Background.
395   *
396   * @type { ?ResourceColor }
397   * @syscap SystemCapability.ArkUI.ArkUI.Full
398   * @atomicservice
399   * @since 18
400   */
401  secondaryColor?: ResourceColor;
402
403  /**
404   * the theme color of Background.
405   *
406   * @type { ?BackgroundTheme }
407   * @syscap SystemCapability.ArkUI.ArkUI.Full
408   * @atomicservice
409   * @since 18
410   */
411  backgroundTheme?: BackgroundTheme;
412
413  /**
414   * the blend mode of background color.
415   *
416   * @type { ?MixMode }
417   * @syscap SystemCapability.ArkUI.ArkUI.Full
418   * @atomicservice
419   * @since 18
420   */
421  mixMode?: MixMode;
422
423  /**
424   * the opacity of background colors.
425   *
426   * @type { ?GradientAlpha }
427   * @syscap SystemCapability.ArkUI.ArkUI.Full
428   * @atomicservice
429   * @since 18
430   */
431  alpha?: GradientAlpha;
432}
433
434/**
435 * Side bar options.
436 *
437 * @typedef SideBarOptions
438 * @syscap SystemCapability.ArkUI.ArkUI.Full
439 * @atomicservice
440 * @since 18
441 */
442export interface SideBarOptions {
443  /**
444   * Side bar Background.
445   *
446   * @type { ?ResourceColor }.
447   * @syscap SystemCapability.ArkUI.ArkUI.Full
448   * @atomicservice
449   * @since 18
450   */
451  sideBarBackground?: ResourceColor;
452
453  /**
454   * Side bar status change callback.
455   *
456   * @type { ?Callback<boolean> }.
457   * @syscap SystemCapability.ArkUI.ArkUI.Full
458   * @atomicservice
459   * @since 18
460   */
461  onChange?: Callback<boolean>;
462
463  /**
464   * Side bar icon.
465   *
466   * @type { ?(Resource | SymbolGlyphModifier) }.
467   * @default $r('sys.symbol.open_sidebar')
468   * @syscap SystemCapability.ArkUI.ArkUI.Full
469   * @atomicservice
470   * @since 18
471   */
472  sideBarIcon?: Resource | SymbolGlyphModifier;
473}
474
475/**
476 * Title bar types.
477 *
478 * @enum { number }.
479 * @syscap SystemCapability.ArkUI.ArkUI.Full
480 * @atomicservice
481 * @since 18
482 */
483export declare enum TitleBarType {
484  /**
485   * Set title bar type with squared icon.
486   *
487   * @syscap SystemCapability.ArkUI.ArkUI.Full
488   * @atomicservice
489   * @since 18
490   */
491  SQUARED_ICON = 1,
492
493  /**
494   * Set title bar type with round icon.
495   *
496   * @syscap SystemCapability.ArkUI.ArkUI.Full
497   * @atomicservice
498   * @since 18
499   */
500  ROUND_ICON = 2,
501
502  /**
503   * Set title bar type with drawer.
504   *
505   * @syscap SystemCapability.ArkUI.ArkUI.Full
506   * @atomicservice
507   * @since 18
508   */
509  DRAWER = 3
510}
511
512/**
513 * The builder function of NavDestination component.
514 *
515 * @typedef { function } NavDestinationBuilder.
516 * @param { string } name - The name of route page.
517 * @param { ?Object } - param - The detailed parameter of the route page.
518 * @syscap SystemCapability.ArkUI.ArkUI.Full
519 * @atomicservice
520 * @since 12
521 */
522export type NavDestinationBuilder = (name: string, param?: Object) => void;