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 18 * @kit ArkUI 19 */ 20 21import base from '@ohos.base'; 22 23/** 24 * Splitpolicy indicates the policy of pages pushed to the stack. 25 * 26 * @enum { number } 27 * @syscap SystemCapability.ArkUI.ArkUI.Full 28 * @crossplatform 29 * @atomicservice 30 * @since 14 31 */ 32export declare enum SplitPolicy { 33 /** 34 * Indicates that the page will be pushed to the stack as home page. 35 * 36 * @syscap SystemCapability.ArkUI.ArkUI.Full 37 * @crossplatform 38 * @atomicservice 39 * @since 14 40 */ 41 HOME_PAGE = 0, 42 43 /** 44 * Indicates that the page will be pushed to the stack as detail page. 45 * 46 * @syscap SystemCapability.ArkUI.ArkUI.Full 47 * @crossplatform 48 * @atomicservice 49 * @since 14 50 */ 51 DETAIL_PAGE = 1, 52 53 /** 54 * Indicates that the page will be pushed to the stack as full-screen page. 55 * 56 * @syscap SystemCapability.ArkUI.ArkUI.Full 57 * @crossplatform 58 * @atomicservice 59 * @since 14 60 */ 61 FULL_PAGE = 2, 62} 63 64/** 65 * Declaration struct MultiNavigation. 66 * 67 * @struct { MultiNavigation } 68 * @syscap SystemCapability.ArkUI.ArkUI.Full 69 * @crossplatform 70 * @atomicservice 71 * @since 14 72 */ 73@Component 74export declare struct MultiNavigation { 75 /** 76 * MultiNavigation path stack of the MultiNavigation. 77 * 78 * @type { MultiNavPathStack } 79 * @syscap SystemCapability.ArkUI.ArkUI.Full 80 * @crossplatform 81 * @atomicservice 82 * @since 14 83 */ 84 @State 85 multiStack: MultiNavPathStack; 86 87 /** 88 * build function of NavDestination. 89 * 90 * @type { NavDestinationBuildFunction } 91 * @syscap SystemCapability.ArkUI.ArkUI.Full 92 * @crossplatform 93 * @atomicservice 94 * @since 14 95 */ 96 @BuilderParam 97 navDestination: NavDestinationBuildFunction; 98 99 /** 100 * callback when the MultiNavigationMode change. 101 * 102 * @type { ?OnNavigationModeChangeCallback } 103 * @syscap SystemCapability.ArkUI.ArkUI.Full 104 * @crossplatform 105 * @atomicservice 106 * @since 14 107 */ 108 onNavigationModeChange?: OnNavigationModeChangeCallback; 109 110 /** 111 * This callback is triggered when the HomePage at the top of the stack. 112 * 113 * @type { ?OnHomeShowOnTopCallback } 114 * @syscap SystemCapability.ArkUI.ArkUI.Full 115 * @crossplatform 116 * @atomicservice 117 * @since 14 118 */ 119 onHomeShowOnTop?: OnHomeShowOnTopCallback; 120} 121 122/** 123 * MultiNavPathStack is used for storing pages when shown as split mode. 124 * 125 * @extends NavPathStack 126 * @syscap SystemCapability.ArkUI.ArkUI.Full 127 * @crossplatform 128 * @atomicservice 129 * @since 14 130 */ 131export declare class MultiNavPathStack extends NavPathStack { 132 /** 133 * Creates an instance of MultiNavPathStack. 134 * 135 * @syscap SystemCapability.ArkUI.ArkUI.Full 136 * @crossplatform 137 * @atomicservice 138 * @since 14 139 */ 140 constructor(); 141 142 /** 143 * Pushes the NavDestination into the stack. 144 * 145 * @param { NavPathInfo } info - Indicates the NavDestination to be pushed. 146 * @param { boolean } [animated] - Indicates whether the transition is animated. 147 * @param { SplitPolicy } [policy] - SplitPolicy of the NavDestination which is currently 148 * pushed in stack. Default splitPolicy is DETAIL_PAGE. 149 * @syscap SystemCapability.ArkUI.ArkUI.Full 150 * @crossplatform 151 * @atomicservice 152 * @since 14 153 */ 154 pushPath(info: NavPathInfo, animated?: boolean, policy?: SplitPolicy): void; 155 156 /** 157 * Pushes the NavDestination into the stack. 158 * 159 * @param { NavPathInfo } info - Indicates the NavDestination to be pushed. 160 * @param { NavigationOptions } [options] - Indicates options of stack operation. 161 * @param { SplitPolicy } [policy] - SplitPolicy of the NavDestination which is currently 162 * pushed in stack. Default splitPolicy is DETAIL_PAGE. 163 * @syscap SystemCapability.ArkUI.ArkUI.Full 164 * @crossplatform 165 * @atomicservice 166 * @since 14 167 */ 168 pushPath(info: NavPathInfo, options?: NavigationOptions, policy?: SplitPolicy): void; 169 170 /** 171 * Pushes the NavDestination of specified name into the stack. 172 * 173 * @param { string } name - Indicates the name of the NavDestination to be pushed. 174 * @param { Object } param - Indicates the detailed parameter of the NavDestination to be pushed. 175 * @param { boolean } [animated] - Indicates whether the transition is animated. 176 * @param { SplitPolicy } [policy] - SplitPolicy of the NavDestination which is currently 177 * pushed in stack. Default splitPolicy is DETAIL_PAGE. 178 * @syscap SystemCapability.ArkUI.ArkUI.Full 179 * @crossplatform 180 * @atomicservice 181 * @since 14 182 */ 183 pushPathByName(name: string, param: Object, animated?: boolean, policy?: SplitPolicy): void; 184 185 /** 186 * Pushes the NavDestination of specified name into the stack. 187 * 188 * @param { string } name - Indicates the name of the NavDestination to be pushed. 189 * @param { Object } param - Indicates the detailed parameter of the NavDestination to be pushed. 190 * @param { base.Callback<PopInfo> } [onPop] - The callback when next page returns. 191 * @param { boolean } [animated] - Indicates whether the transition is animated. 192 * @param { SplitPolicy } [policy] - SplitPolicy of the NavDestination which is currently 193 * pushed in stack. Default splitPolicy is DETAIL_PAGE. 194 * @syscap SystemCapability.ArkUI.ArkUI.Full 195 * @crossplatform 196 * @atomicservice 197 * @since 14 198 */ 199 pushPathByName( 200 name: string, param: Object, onPop?: base.Callback<PopInfo>, animated?: boolean, policy?: SplitPolicy): void; 201 202 /** 203 * Replace the current NavDestination with the one specificed by NavPathInfo. 204 * The current NavDestination will be destroyed. 205 * 206 * @param { NavPathInfo } info - Indicates the new NavDestination in top of the stack. 207 * @param { boolean } [animated] - Indicates whether the transition is animated. 208 * @syscap SystemCapability.ArkUI.ArkUI.Full 209 * @crossplatform 210 * @atomicservice 211 * @since 14 212 */ 213 replacePath(info: NavPathInfo, animated?: boolean): void; 214 215 /** 216 * Replace the current NavDestination with the one specificed by NavPathInfo. 217 * The current NavDestination will be destroyed. 218 * 219 * @param { NavPathInfo } info - Indicates the new NavDestination in top of the stack. 220 * @param { NavigationOptions } [options] - Indicates options of stack operation. 221 * @syscap SystemCapability.ArkUI.ArkUI.Full 222 * @crossplatform 223 * @atomicservice 224 * @since 14 225 */ 226 replacePath(info: NavPathInfo, options?: NavigationOptions): void; 227 228 /** 229 * Replace the current NavDestination with the one specificed by name. 230 * The current NavDestination will be destroyed. 231 * 232 * @param { string } name - Indicates name of the new NavDestination in top of stack. 233 * @param { Object } param - Indicates the detailed parameter of the new NavDestination in top of the stack. 234 * @param { boolean } [animated] - Indicates whether the transition is animated. 235 * @syscap SystemCapability.ArkUI.ArkUI.Full 236 * @crossplatform 237 * @atomicservice 238 * @since 14 239 */ 240 replacePathByName(name: string, param: Object, animated?: boolean): void; 241 242 /** 243 * Remove the specified NavDestinations by indexes. 244 * 245 * @param { Array<number> } indexes - Indicates the indexes of the NavDestinations to be removed. 246 * @returns { number } Returns the number of removed pages. Invalid indexes will be ignored. 247 * @syscap SystemCapability.ArkUI.ArkUI.Full 248 * @crossplatform 249 * @atomicservice 250 * @since 14 251 */ 252 removeByIndexes(indexes: Array<number>): number; 253 254 /** 255 * Remove the specified NavDestination by name. 256 * 257 * @param { string } name - Indicates the name of the NavDestination to be removed. 258 * @returns { number } Returns the number of removed NavDestinations. 259 * @syscap SystemCapability.ArkUI.ArkUI.Full 260 * @crossplatform 261 * @atomicservice 262 * @since 14 263 */ 264 removeByName(name: string): number; 265 266 /** 267 * Pop the top NavDestination of the stack. 268 * 269 * @param { boolean } [animated] - Indicates whether the transition is animated. 270 * @returns { NavPathInfo | undefined } Returns the top NavPathInfo if the stack is not empty, 271 * otherwise returns undefined. 272 * @syscap SystemCapability.ArkUI.ArkUI.Full 273 * @crossplatform 274 * @atomicservice 275 * @since 14 276 */ 277 pop(animated?: boolean): NavPathInfo | undefined; 278 279 /** 280 * Pop the top NavDestination of the stack. When keepBottomPage sets true, the page at the bottom of the 281 * stack will be retained. 282 * 283 * @param { Object } [result] - Page Customization processing results. 284 * @param { boolean } [animated] - Indicates whether the transition is animated. 285 * @returns { NavPathInfo | undefined } Returns the top NavPathInfo if the stack is not empty, 286 * otherwise returns undefined. 287 * @syscap SystemCapability.ArkUI.ArkUI.Full 288 * @crossplatform 289 * @atomicservice 290 * @since 14 291 */ 292 pop(result?: Object, animated?: boolean): NavPathInfo | undefined; 293 294 /** 295 * Pop to the NavDestination of specified name. Always the first one 296 * in the stack from bottom up when several NavDestinations match the same name. 297 * 298 * @param { string } name - Name of the NavDestination. 299 * @param { boolean } [animated] - Indicates whether the transition is animated. 300 * @returns { number } Returns the index of the NavDestination if it exists in the stack, otherwise returns -1. 301 * @syscap SystemCapability.ArkUI.ArkUI.Full 302 * @crossplatform 303 * @atomicservice 304 * @since 14 305 */ 306 popToName(name: string, animated?: boolean): number; 307 308 /** 309 * Pop to the NavDestination of specified name. Always the first one 310 * in the stack from bottom up when several NavDestinations match the same name. 311 * 312 * @param { string } name - Name of the NavDestination. 313 * @param { Object } result - Page Customization processing results. 314 * @param { boolean } [animated] - Indicates whether the transition is animated. 315 * @returns { number } Returns the index of the NavDestination if it exists in the stack, otherwise returns -1. 316 * @syscap SystemCapability.ArkUI.ArkUI.Full 317 * @crossplatform 318 * @atomicservice 319 * @since 14 320 */ 321 popToName(name: string, result: Object, animated?: boolean): number; 322 323 /** 324 * Pop to the NavDestination of specified index. Do nothing if index is invalid. 325 * 326 * @param { number } index - The index of NavDestination page. 327 * @param { boolean } [animated] - Indicates whether the transition is animated. 328 * @syscap SystemCapability.ArkUI.ArkUI.Full 329 * @crossplatform 330 * @atomicservice 331 * @since 14 332 */ 333 popToIndex(index: number, animated?: boolean): void; 334 335 /** 336 * Pop to the NavDestination of specified index. Do nothing if index is invalid. 337 * 338 * @param { number } index - The index of NavDestination page. 339 * @param { Object } result - Page Customization processing results. 340 * @param { boolean } [animated] - Indicates whether the transition is animated. 341 * @syscap SystemCapability.ArkUI.ArkUI.Full 342 * @crossplatform 343 * @atomicservice 344 * @since 14 345 */ 346 popToIndex(index: number, result: Object, animated?: boolean): void; 347 348 /** 349 * Move the first NavDestination of specified name to the top of the stack. Always the first one 350 * in the stack from bottom up when several NavDestinations match the same name. 351 * 352 * @param { string } name - Indicates the name of the NavDestination to be moved to the top. 353 * @param { boolean } [animated] - Indicates whether the transition is animated. 354 * @returns { number } Returns the index of the NavDestination if it exists in the stack, otherwise returns -1. 355 * @syscap SystemCapability.ArkUI.ArkUI.Full 356 * @crossplatform 357 * @atomicservice 358 * @since 14 359 */ 360 moveToTop(name: string, animated?: boolean): number; 361 362 /** 363 * Move the first NavDestination of specified index to the top of the stack. 364 * 365 * @param { number } index - Indicates the index of the NavDestination to be moved to the top. 366 * @param { boolean } [animated] - Indicates whether the transition is animated. 367 * @syscap SystemCapability.ArkUI.ArkUI.Full 368 * @crossplatform 369 * @atomicservice 370 * @since 14 371 */ 372 moveIndexToTop(index: number, animated?: boolean): void; 373 374 /** 375 * Clear the stack. When keepBottomPage sets true, the page at the bottom of the 376 * stack will be retained. 377 * 378 * @param { boolean } [animated] - Indicates whether the transition is animated. 379 * @syscap SystemCapability.ArkUI.ArkUI.Full 380 * @crossplatform 381 * @atomicservice 382 * @since 14 383 */ 384 clear(animated?: boolean): void; 385 386 /** 387 * Obtains all the NavDestination name in the stack. 388 * 389 * @returns { Array<string> } Returns all the NavDestination name in the stack. 390 * @syscap SystemCapability.ArkUI.ArkUI.Full 391 * @crossplatform 392 * @atomicservice 393 * @since 14 394 */ 395 getAllPathName(): Array<string>; 396 397 /** 398 * Obtains parameter information of the NavDestination page specified by index. 399 * 400 * @param { number } index - The index of NavDestination page. 401 * @returns { unknown | undefined } Returns the detailed parameter of the NavDestination 402 * if it exists in the stack, otherwise returns undefined. 403 * @syscap SystemCapability.ArkUI.ArkUI.Full 404 * @crossplatform 405 * @atomicservice 406 * @since 14 407 */ 408 getParamByIndex(index: number): Object | undefined; 409 410 /** 411 * Obtains parameter information of all NavDestination pages specified by name. 412 * 413 * @param { string } name - Indicates the name of the NavDestination. 414 * @returns { Array<Object> } Returns the detailed parameter of all the NavDestinations. 415 * @syscap SystemCapability.ArkUI.ArkUI.Full 416 * @crossplatform 417 * @atomicservice 418 * @since 14 419 */ 420 getParamByName(name: string): Array<Object>; 421 422 /** 423 * Obtains the index of all NavDestination pages specified by name. 424 * 425 * @param { string } name - Indicates the name of the NavDestination. 426 * @returns { Array<number> } Returns the index of all the NavDestinations. 427 * @syscap SystemCapability.ArkUI.ArkUI.Full 428 * @crossplatform 429 * @atomicservice 430 * @since 14 431 */ 432 getIndexByName(name: string): Array<number>; 433 434 /** 435 * Obtains the size of the stack. 436 * 437 * @returns { number } Returns the size of the stack. 438 * @syscap SystemCapability.ArkUI.ArkUI.Full 439 * @crossplatform 440 * @atomicservice 441 * @since 14 442 */ 443 size(): number; 444 445 /** 446 * disable or enable all transition animation in this MultiNavigation. 447 * 448 * @param { boolean } disable - Indicates whether to disable the transition animation. 449 * @syscap SystemCapability.ArkUI.ArkUI.Full 450 * @crossplatform 451 * @atomicservice 452 * @since 14 453 */ 454 disableAnimation(disable: boolean): void; 455 456 /** 457 * Switches the details page of the split-mode page on the top stack to full screen (true) 458 * or split (false). 459 * 460 * @param { boolean } [isFullScreen] - Whether to switch to full screen. 461 * @returns { boolean } Returns switch result success(true) or failure(false). 462 * @syscap SystemCapability.ArkUI.ArkUI.Full 463 * @crossplatform 464 * @atomicservice 465 * @since 14 466 */ 467 switchFullScreenState(isFullScreen?: boolean): boolean; 468 469 /** 470 * Sets the dragable range of the home page width. 471 * 472 * @param { number } minPercent - Minimum Home Width Percentage. 473 * @param { number } maxPercent - Maximum Home Width Percentage. 474 * @syscap SystemCapability.ArkUI.ArkUI.Full 475 * @crossplatform 476 * @atomicservice 477 * @since 14 478 */ 479 setHomeWidthRange(minPercent: number, maxPercent: number): void; 480 481 /** 482 * Indicates whether to retain the bottom NavDestination of the stack when doing pop or clear. 483 * 484 * @param { boolean } keepBottom - Indicates whether to retain the bottom NavDestination of the stack. 485 * @syscap SystemCapability.ArkUI.ArkUI.Full 486 * @crossplatform 487 * @atomicservice 488 * @since 14 489 */ 490 keepBottomPage(keepBottom: boolean): void; 491 492 /** 493 * Set placeholder NavDestination. 494 * 495 * @param { NavPathInfo } info - info of placeHolder NavDestination. 496 * @syscap SystemCapability.ArkUI.ArkUI.Full 497 * @crossplatform 498 * @atomicservice 499 * @since 14 500 */ 501 setPlaceholderPage(info: NavPathInfo): void; 502} 503 504/** 505 * Function that sets the rule route to NavDestination. 506 * 507 * @typedef { function } NavDestinationBuildFunction 508 * @param { string } name - Indicates the name of target NavDestination. 509 * @param { object } [param] - Indicates the parameter of route operation. 510 * @syscap SystemCapability.ArkUI.ArkUI.Full 511 * @crossplatform 512 * @atomicservice 513 * @since 14 514 */ 515declare type NavDestinationBuildFunction = (name: string, param?: object) => void; 516 517/** 518 * Callback function when NavigationMode changed. 519 * 520 * @typedef { function } OnNavigationModeChangeCallback 521 * @param { NavigationMode } mode - current NavigationMode. 522 * @syscap SystemCapability.ArkUI.ArkUI.Full 523 * @crossplatform 524 * @atomicservice 525 * @since 14 526 */ 527declare type OnNavigationModeChangeCallback = (mode: NavigationMode) => void; 528 529/** 530 * Callback function when home NavDestination shown in top. 531 * 532 * @typedef { function } OnHomeShowOnTopCallback 533 * @param { string } name - the name of home NavDestination shown in top. 534 * @syscap SystemCapability.ArkUI.ArkUI.Full 535 * @crossplatform 536 * @atomicservice 537 * @since 14 538 */ 539declare type OnHomeShowOnTopCallback = (name: string) => void;