Interface ShellTabsApi<T>

This API provides functionality relating to the shell tabs.

Accessed from the window at window.sas.vi.shellTabs.

window.sas.vi.shellTabs.getSelectedTab();
interface ShellTabsApi<T> {
    createTabApiForElement: ((context: any, nativeElement: HTMLElement) => void);
    getAllTabs: (() => {
        application: INavigationBarTab<{
            [key: string]: any;
        }, {
            [key: string]: any;
        }>[];
        system: INavigationBarTab<{
            [key: string]: any;
        }, {
            [key: string]: any;
        }>[];
    });
    getSelectedTab: (() => {
        primaryTab: INavigationBarTab<{
            [key: string]: any;
        }, {
            [key: string]: any;
        }>;
        secondaryTab?: INavigationBarTab<{
            [key: string]: any;
        }, {
            [key: string]: any;
        }>;
    });
    getTabById: ((tabId: string) => undefined | INavigationBarTab<{
        [key: string]: any;
    }, {
        [key: string]: any;
    }>);
    openTab: ((tabToSelect: INavigationBarTab<{
        [key: string]: any;
    }, {
        [key: string]: any;
    }>, secondaryTab?: INavigationBarTab<{
        [key: string]: any;
    }, {
        [key: string]: any;
    }>) => Promise<boolean>);
    openTabsChanged$: Observable<{
        applicationTabs: INavigationBarTab<{
            [key: string]: any;
        }, {
            [key: string]: any;
        }>[];
        systemTabs: INavigationBarTab<{
            [key: string]: any;
        }, {
            [key: string]: any;
        }>[];
    }>;
    registerExternalTabs: ((tab: ExternalTabConfig<T, any>[]) => void);
    removeAllApplicationTabs: (() => Promise<boolean>);
    removeApplicationTabById: ((tabIdToRemove: string, suppressNavigation?: boolean) => Promise<boolean>);
    removeOtherApplicationTabs: ((tabIdToKeep?: string) => Promise<boolean>);
    replaceApplicationTab: ((tabId: string, newTab: INavigationBarTab<{
        [key: string]: any;
    }, {
        [key: string]: any;
    }>) => Promise<boolean>);
    selectDefaultTab: (() => Promise<boolean>);
    selectedPrimaryTabChanged$: Observable<INavigationBarTab<{
        [key: string]: any;
    }, {
        [key: string]: any;
    }>>;
    selectedSecondaryTabChanged$: Observable<undefined | INavigationBarTab<{
        [key: string]: any;
    }, {
        [key: string]: any;
    }>>;
    selectTabById: ((tabId: string) => Promise<boolean>);
    tabRemoved$: Observable<INavigationBarTab<{
        [key: string]: any;
    }, {
        [key: string]: any;
    }>>;
    unregisterExternalTabs: ((tabsToRemove: ExternalTabConfig<T, any>[]) => void);
}

Type Parameters

Properties

createTabApiForElement: ((context: any, nativeElement: HTMLElement) => void)

Type declaration

    • (context, nativeElement): void
    • Parameters

      • context: any

        pass "this"

      • nativeElement: HTMLElement

        This will pass the ElementRef for the component

        onTabClose OnTabClose, optional, can be used to prevent closing of a tab or close async onAttachTab OnAttachTab, will always trigger when currentNavigationBarTab has set onAttachToolbar TabWithToolbar, optional, will set currentToolbar if there was a toolbar in the VI Router onTabEnter OnTabEnter, optional, will trigger when tab is entered onTabLeave OnTabLeave, optional, will trigger when tab is left onTabSaveConfirm OnTabSaveConfirm, optional, basic dialog box can be created whe closing a dirty tab.

      Returns void

This is used to expose any PotentialTabItem hooks on a component up to the Tab Service.

getAllTabs: (() => {
    application: INavigationBarTab<{
        [key: string]: any;
    }, {
        [key: string]: any;
    }>[];
    system: INavigationBarTab<{
        [key: string]: any;
    }, {
        [key: string]: any;
    }>[];
})

This will return a slice of the current system and application tabs.

getSelectedTab: (() => {
    primaryTab: INavigationBarTab<{
        [key: string]: any;
    }, {
        [key: string]: any;
    }>;
    secondaryTab?: INavigationBarTab<{
        [key: string]: any;
    }, {
        [key: string]: any;
    }>;
})

This will return the current primary and secondary tabs.

getTabById: ((tabId: string) => undefined | INavigationBarTab<{
    [key: string]: any;
}, {
    [key: string]: any;
}>)

Type declaration

    • (tabId): undefined | INavigationBarTab<{
          [key: string]: any;
      }, {
          [key: string]: any;
      }>
    • Parameters

      • tabId: string

        {string} This will be ID of an existing tab.

      Returns undefined | INavigationBarTab<{
          [key: string]: any;
      }, {
          [key: string]: any;
      }>

get Tab by ID

openTab: ((tabToSelect: INavigationBarTab<{
    [key: string]: any;
}, {
    [key: string]: any;
}>, secondaryTab?: INavigationBarTab<{
    [key: string]: any;
}, {
    [key: string]: any;
}>) => Promise<boolean>)

Type declaration

    • (tabToSelect, secondaryTab?): Promise<boolean>
    • Parameters

      • tabToSelect: INavigationBarTab<{
            [key: string]: any;
        }, {
            [key: string]: any;
        }>

        {INavigationBarTab} See INavigationBarTab

      • OptionalsecondaryTab: INavigationBarTab<{
            [key: string]: any;
        }, {
            [key: string]: any;
        }>

        {INavigationBarTab} See INavigationBarTab if left undefined, this will select the previously selected secondary tab of the primary tab or its first index secondary tab.

      Returns Promise<boolean>

This will attempt to open+select a matching INavigationBarTab and optional secondaryTab, returning false on failure in the event the tab doesn't exist already, it will add the tab assuming an appropriate route has been registered for it.

openTabsChanged$: Observable<{
    applicationTabs: INavigationBarTab<{
        [key: string]: any;
    }, {
        [key: string]: any;
    }>[];
    systemTabs: INavigationBarTab<{
        [key: string]: any;
    }, {
        [key: string]: any;
    }>[];
}>

This stream will update after any additions/removals to either system or application tabs.

registerExternalTabs: ((tab: ExternalTabConfig<T, any>[]) => void)

Type declaration

Use this function to register new routes for tabs.

removeAllApplicationTabs: (() => Promise<boolean>)

This will run removeApplicationTabById on all tabs, will stop if any fail to close, will wait for each close to complete.

removeApplicationTabById: ((tabIdToRemove: string, suppressNavigation?: boolean) => Promise<boolean>)

Type declaration

    • (tabIdToRemove, suppressNavigation?): Promise<boolean>
    • Parameters

      • tabIdToRemove: string

        {string} This will be ID of an existing tab.

      • OptionalsuppressNavigation: boolean

        {boolean} Set suppressNavigation to true if you want to close a tab that isn't open.

      Returns Promise<boolean>

This will remove an application tab, if allowed, and will trigger any closing and saving logic beforehand.

removeOtherApplicationTabs: ((tabIdToKeep?: string) => Promise<boolean>)

Type declaration

    • (tabIdToKeep?): Promise<boolean>
    • Parameters

      • OptionaltabIdToKeep: string

        {string}

      Returns Promise<boolean>

This will run the same as removeAllApplicationTabs, but not on the provided tabIdToKeep.

replaceApplicationTab: ((tabId: string, newTab: INavigationBarTab<{
    [key: string]: any;
}, {
    [key: string]: any;
}>) => Promise<boolean>)

Type declaration

    • (tabId, newTab): Promise<boolean>
    • Parameters

      • tabId: string

        {string} This will be ID of an existing tab.

      • newTab: INavigationBarTab<{
            [key: string]: any;
        }, {
            [key: string]: any;
        }>

        {INavigationBarTab} See INavigationBarTab

      Returns Promise<boolean>

This will remove an existing application tab then replace with another, if removeApplicationTabById is unsuccessful this will fail use case can be saving a tab which has a temporary ID, and reopening it with a saved payload.

selectDefaultTab: (() => Promise<boolean>)

This will move user to the default tab.

selectedPrimaryTabChanged$: Observable<INavigationBarTab<{
    [key: string]: any;
}, {
    [key: string]: any;
}>>

This stream will track the current top level tab.

selectedSecondaryTabChanged$: Observable<undefined | INavigationBarTab<{
    [key: string]: any;
}, {
    [key: string]: any;
}>>

This stream will track the current second level tab.

selectTabById: ((tabId: string) => Promise<boolean>)

Type declaration

    • (tabId): Promise<boolean>
    • Parameters

      • tabId: string

        {string} This will be ID of an existing tab.

      Returns Promise<boolean>

This will attempt to select a tab by its id, returning false on failure.

tabRemoved$: Observable<INavigationBarTab<{
    [key: string]: any;
}, {
    [key: string]: any;
}>>

This stream will emit any removed tabs.

unregisterExternalTabs: ((tabsToRemove: ExternalTabConfig<T, any>[]) => void)

Type declaration

Use this function to remove routes added via registerTabFn.