From bfef1b33304c0c31a701f4f5ad5146e1893f9958 Mon Sep 17 00:00:00 2001 From: luoxi Date: Fri, 15 Aug 2025 15:24:29 +0800 Subject: [PATCH 1/3] multinavigation sdk Signed-off-by: luoxi --- ...i.advanced.MultiNavigation.static.d.ets.ts | 455 ++++++++++++++++++ 1 file changed, 455 insertions(+) create mode 100644 api/@ohos.arkui.advanced.MultiNavigation.static.d.ets.ts diff --git a/api/@ohos.arkui.advanced.MultiNavigation.static.d.ets.ts b/api/@ohos.arkui.advanced.MultiNavigation.static.d.ets.ts new file mode 100644 index 0000000000..bdd05746d6 --- /dev/null +++ b/api/@ohos.arkui.advanced.MultiNavigation.static.d.ets.ts @@ -0,0 +1,455 @@ +** + * Copyright (C) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * @kit ArkUI + * @arkts 1.2 + */ + +import { BuilderParam, Callback, Component, NavPathInfo, NavPathStack, NavigationMode, NavigationOptions, PopInfo, Builder, PageMapBuilder } from '@ohos.arkui.component'; +import { State } from '@ohos.arkui.stateManagement'; + +/** + * Splitpolicy indicates the policy of pages pushed to the stack. + * + * @enum { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare enum SplitPolicy { + /** + * Indicates that the page will be pushed to the stack as home page. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + HOME_PAGE = 0, + + /** + * Indicates that the page will be pushed to the stack as detail page. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + DETAIL_PAGE = 1, + + /** + * Indicates that the page will be pushed to the stack as full-screen page. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + FULL_PAGE = 2, +} + +/** + * Callback function when NavigationMode changed. + * + * @typedef { function } OnNavigationModeChangeCallback + * @param { NavigationMode } mode - current NavigationMode. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +declare type OnNavigationModeChangeCallback = (mode: NavigationMode) => void; + +/** + * Callback function when home NavDestination shown in top. + * + * @typedef { function } OnHomeShowOnTopCallback + * @param { string } name - the name of home NavDestination shown in top. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +declare type OnHomeShowOnTopCallback = (name: string) => void; + +/** + * Declaration struct MultiNavigation. + * + * @struct { MultiNavigation } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +@Component +export declare struct MultiNavigation { + /** + * MultiNavigation path stack of the MultiNavigation. + * + * @type { MultiNavPathStack } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + @State + multiStack: MultiNavPathStack; + + /** + * build function of NavDestination. + * + * @type { NavDestinationBuildFunction } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + @BuilderParam + navDestination: PageMapBuilder | undefined; + + /** + * callback when the MultiNavigationMode change. + * + * @type { ?OnNavigationModeChangeCallback } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onNavigationModeChange?: OnNavigationModeChangeCallback; + + /** + * This callback is triggered when the HomePage at the top of the stack. + * + * @type { ?OnHomeShowOnTopCallback } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onHomeShowOnTop?: OnHomeShowOnTopCallback; + + /** + * The method to build multiNavigation. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 20 + */ + @Builder + build(): void; +} + +/** + * MultiNavPathStack is used for storing pages when shown as split mode. + * + * @extends NavPathStack + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare class MultiNavPathStack extends NavPathStack { + /** + * Creates an instance of MultiNavPathStack. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + constructor(); + + /** + * Pushes the NavDestination into the stack. + * + * @param { NavPathInfo } info - Indicates the NavDestination to be pushed. + * @param { boolean } [animated] - Indicates whether the transition is animated. + * @param { SplitPolicy } [policy] - SplitPolicy of the NavDestination which is currently + * pushed in stack. Default splitPolicy is DETAIL_PAGE. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + pushPath(info: NavPathInfo, animated?: boolean, policy?: SplitPolicy): void; + + /** + * Pushes the NavDestination into the stack. + * + * @param { NavPathInfo } info - Indicates the NavDestination to be pushed. + * @param { NavigationOptions } [options] - Indicates options of stack operation. + * @param { SplitPolicy } [policy] - SplitPolicy of the NavDestination which is currently + * pushed in stack. Default splitPolicy is DETAIL_PAGE. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + pushPath(info: NavPathInfo, options?: NavigationOptions, policy?: SplitPolicy): void; + + /** + * Pushes the NavDestination of specified name into the stack. + * + * @param { string } name - Indicates the name of the NavDestination to be pushed. + * @param { Object } param - Indicates the detailed parameter of the NavDestination to be pushed. + * @param { boolean } [animated] - Indicates whether the transition is animated. + * @param { SplitPolicy } [policy] - SplitPolicy of the NavDestination which is currently + * pushed in stack. Default splitPolicy is DETAIL_PAGE. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + pushPathByName(name: string, param: Object, animated?: boolean, policy?: SplitPolicy): void; + + /** + * Pushes the NavDestination of specified name into the stack. + * + * @param { string } name - Indicates the name of the NavDestination to be pushed. + * @param { Object } param - Indicates the detailed parameter of the NavDestination to be pushed. + * @param { Callback } [onPop] - The callback when next page returns. + * @param { boolean } [animated] - Indicates whether the transition is animated. + * @param { SplitPolicy } [policy] - SplitPolicy of the NavDestination which is currently + * pushed in stack. Default splitPolicy is DETAIL_PAGE. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + pushPathByName( + name: string, param: Object, onPop?: Callback, animated?: boolean, policy?: SplitPolicy): void; + + /** + * Replace the current NavDestination with the one specificed by NavPathInfo. + * The current NavDestination will be destroyed. + * + * @param { NavPathInfo } info - Indicates the new NavDestination in top of the stack. + * @param { boolean } [animated] - Indicates whether the transition is animated. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + replacePath(info: NavPathInfo, animated?: boolean): void; + + /** + * Replace the current NavDestination with the one specificed by NavPathInfo. + * The current NavDestination will be destroyed. + * + * @param { NavPathInfo } info - Indicates the new NavDestination in top of the stack. + * @param { NavigationOptions } [options] - Indicates options of stack operation. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + replacePath(info: NavPathInfo, options?: NavigationOptions): void; + + /** + * Replace the current NavDestination with the one specificed by name. + * The current NavDestination will be destroyed. + * + * @param { string } name - Indicates name of the new NavDestination in top of stack. + * @param { Object } param - Indicates the detailed parameter of the new NavDestination in top of the stack. + * @param { boolean } [animated] - Indicates whether the transition is animated. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + replacePathByName(name: string, param: Object, animated?: boolean): void; + + /** + * Remove the specified NavDestinations by indexes. + * + * @param { Array } indexes - Indicates the indexes of the NavDestinations to be removed. + * @returns { number } Returns the number of removed pages. Invalid indexes will be ignored. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + removeByIndexes(indexes: Array): number; + + /** + * Remove the specified NavDestination by name. + * + * @param { string } name - Indicates the name of the NavDestination to be removed. + * @returns { number } Returns the number of removed NavDestinations. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + removeByName(name: string): number; + + /** + * Pop the top NavDestination of the stack. + * + * @param { boolean } [animated] - Indicates whether the transition is animated. + * @returns { NavPathInfo | undefined } Returns the top NavPathInfo if the stack is not empty, + * otherwise returns undefined. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + pop(animated?: boolean): NavPathInfo | undefined; + + /** + * Pop the top NavDestination of the stack. When keepBottomPage sets true, the page at the bottom of the + * stack will be retained. + * + * @param { Object } [result] - Page Customization processing results. + * @param { boolean } [animated] - Indicates whether the transition is animated. + * @returns { NavPathInfo | undefined } Returns the top NavPathInfo if the stack is not empty, + * otherwise returns undefined. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + pop(result?: Object, animated?: boolean): NavPathInfo | undefined; + + /** + * Pop to the NavDestination of specified name. Always the first one + * in the stack from bottom up when several NavDestinations match the same name. + * + * @param { string } name - Name of the NavDestination. + * @param { boolean } [animated] - Indicates whether the transition is animated. + * @returns { number } Returns the index of the NavDestination if it exists in the stack, otherwise returns -1. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + popToName(name: string, animated?: boolean): number; + + /** + * Pop to the NavDestination of specified name. Always the first one + * in the stack from bottom up when several NavDestinations match the same name. + * + * @param { string } name - Name of the NavDestination. + * @param { Object } result - Page Customization processing results. + * @param { boolean } [animated] - Indicates whether the transition is animated. + * @returns { number } Returns the index of the NavDestination if it exists in the stack, otherwise returns -1. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + popToName(name: string, result: Object, animated?: boolean): number; + + /** + * Pop to the NavDestination of specified index. Do nothing if index is invalid. + * + * @param { number } index - The index of NavDestination page. + * @param { boolean } [animated] - Indicates whether the transition is animated. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + popToIndex(index: number, animated?: boolean): void; + + /** + * Pop to the NavDestination of specified index. Do nothing if index is invalid. + * + * @param { number } index - The index of NavDestination page. + * @param { Object } result - Page Customization processing results. + * @param { boolean } [animated] - Indicates whether the transition is animated. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + popToIndex(index: number, result: Object, animated?: boolean): void; + + /** + * Move the first NavDestination of specified name to the top of the stack. Always the first one + * in the stack from bottom up when several NavDestinations match the same name. + * + * @param { string } name - Indicates the name of the NavDestination to be moved to the top. + * @param { boolean } [animated] - Indicates whether the transition is animated. + * @returns { number } Returns the index of the NavDestination if it exists in the stack, otherwise returns -1. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + moveToTop(name: string, animated?: boolean): number; + + /** + * Move the first NavDestination of specified index to the top of the stack. + * + * @param { number } index - Indicates the index of the NavDestination to be moved to the top. + * @param { boolean } [animated] - Indicates whether the transition is animated. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + moveIndexToTop(index: number, animated?: boolean): void; + + /** + * Clear the stack. When keepBottomPage sets true, the page at the bottom of the + * stack will be retained. + * + * @param { boolean } [animated] - Indicates whether the transition is animated. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + clear(animated?: boolean): void; + + /** + * Obtains all the NavDestination name in the stack. + * + * @returns { Array } Returns all the NavDestination name in the stack. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + getAllPathName(): Array; + + /** + * Obtains parameter information of the NavDestination page specified by index. + * + * @param { number } index - The index of NavDestination page. + * @returns { unknown | undefined } Returns the detailed parameter of the NavDestination + * if it exists in the stack, otherwise returns undefined. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + getParamByIndex(index: number): Object | undefined; + + /** + * Obtains parameter information of all NavDestination pages specified by name. + * + * @param { string } name - Indicates the name of the NavDestination. + * @returns { Array } Returns the detailed parameter of all the NavDestinations. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + getParamByName(name: string): Array; + + /** + * Obtains the index of all NavDestination pages specified by name. + * + * @param { string } name - Indicates the name of the NavDestination. + * @returns { Array } Returns the index of all the NavDestinations. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + getIndexByName(name: string): Array; + + /** + * Obtains the size of the stack. + * + * @returns { number } Returns the size of the stack. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + size(): number; + + /** + * disable or enable all transition animation in this MultiNavigation. + * + * @param { boolean } disable - Indicates whether to disable the transition animation. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + disableAnimation(disable: boolean): void; + + /** + * Switches the details page of the split-mode page on the top stack to full screen (true) + * or split (false). + * + * @param { boolean } [isFullScreen] - Whether to switch to full screen. + * @returns { boolean } Returns switch result success(true) or failure(false). + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + switchFullScreenState(isFullScreen?: boolean): boolean; + + /** + * Sets the dragable range of the home page width. + * + * @param { number } minPercent - Minimum Home Width Percentage. + * @param { number } maxPercent - Maximum Home Width Percentage. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + setHomeWidthRange(minPercent: number, maxPercent: number): void; + + /** + * Indicates whether to retain the bottom NavDestination of the stack when doing pop or clear. + * + * @param { boolean } keepBottom - Indicates whether to retain the bottom NavDestination of the stack. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + keepBottomPage(keepBottom: boolean): void; + + /** + * Set placeholder NavDestination. + * + * @param { NavPathInfo } info - info of placeHolder NavDestination. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + setPlaceholderPage(info: NavPathInfo): void; +} \ No newline at end of file -- Gitee From 0d726e5fe384d12a7648bdbec3ba2e4f1bb93095 Mon Sep 17 00:00:00 2001 From: luoxi Date: Fri, 15 Aug 2025 15:50:22 +0800 Subject: [PATCH 2/3] multinavigation sdk Signed-off-by: luoxi --- api/@ohos.arkui.advanced.MultiNavigation.static.d.ets.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/@ohos.arkui.advanced.MultiNavigation.static.d.ets.ts b/api/@ohos.arkui.advanced.MultiNavigation.static.d.ets.ts index bdd05746d6..048641d323 100644 --- a/api/@ohos.arkui.advanced.MultiNavigation.static.d.ets.ts +++ b/api/@ohos.arkui.advanced.MultiNavigation.static.d.ets.ts @@ -369,7 +369,7 @@ export declare class MultiNavPathStack extends NavPathStack { * Obtains parameter information of the NavDestination page specified by index. * * @param { number } index - The index of NavDestination page. - * @returns { unknown | undefined } Returns the detailed parameter of the NavDestination + * @returns { Object | undefined } Returns the detailed parameter of the NavDestination * if it exists in the stack, otherwise returns undefined. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 20 -- Gitee From 0603e4d9e78bbc929cf1daad30d7578c8c5ccaea Mon Sep 17 00:00:00 2001 From: luoxi Date: Fri, 15 Aug 2025 16:24:43 +0800 Subject: [PATCH 3/3] multinavigation sdk Signed-off-by: luoxi --- ....ts => @ohos.arkui.advanced.MultiNavigation.static.d.ets} | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) rename api/{@ohos.arkui.advanced.MultiNavigation.static.d.ets.ts => @ohos.arkui.advanced.MultiNavigation.static.d.ets} (99%) diff --git a/api/@ohos.arkui.advanced.MultiNavigation.static.d.ets.ts b/api/@ohos.arkui.advanced.MultiNavigation.static.d.ets similarity index 99% rename from api/@ohos.arkui.advanced.MultiNavigation.static.d.ets.ts rename to api/@ohos.arkui.advanced.MultiNavigation.static.d.ets index 048641d323..19432c86c6 100644 --- a/api/@ohos.arkui.advanced.MultiNavigation.static.d.ets.ts +++ b/api/@ohos.arkui.advanced.MultiNavigation.static.d.ets @@ -1,4 +1,5 @@ -** +'use static' +/* * Copyright (C) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -12,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - + /** * @file * @kit ArkUI -- Gitee