import { KbqAppSwitcherModule } from '@koobiq/components/app-switcher';

KbqAppSwitcherComponent

componentСкопировать ссылку на KbqAppSwitcherComponent

Popup rendered by KbqAppSwitcherTrigger. The trigger attaches it to a CDK overlay itself (see getOverlayHandleComponentType) and assigns trigger on the created instance, so consumers never place <kbq-app-switcher> in a template - [kbqAppSwitcher] on the trigger element is the whole public surface.

@Component({ selector: 'kbq-app-switcher' })
class KbqAppSwitcherComponent extends KbqPopUp {
    readonly localeConfiguration: Signal<KbqAppSwitcherLocaleConfiguration>;
    readonly destroyRef: DestroyRef;
    readonly hovered: Signal<boolean>;
    header: string | TemplateRef<unknown>;
    content: string | TemplateRef<unknown>;
    context: { $implicit: unknown } | null;
    classMap: {};
    arrow: boolean;
    arrowCentered: boolean;
    defaultPaddings: boolean;
    offset: number | null;
    visibility: PopUpVisibility;
    visibleChange: EventEmitter<boolean>;
    isTemplateRef(value: any): boolean;
    show(delay: number): void;
    hide(delay: number): void;
    isVisible(): boolean;
    afterHidden(): Observable<void>;
    detectChanges(): void;
}
localeConfigurationСкопировать ссылку на localeConfigurationSignal<KbqAppSwitcherLocaleConfiguration>

Strings currently rendered by the popup.

hoveredСкопировать ссылку на hoveredSignal<boolean>

Whether the pointer is over the pop-up.

classMapСкопировать ссылку на classMap{}

CSS classes of the pop-up element: the placement, the custom class and the modifiers of the subclass.

arrowCenteredСкопировать ссылку на arrowCenteredboolean

Whether the arrow points at the origin center while the panel keeps its placement. Defaults to false.

visibilityСкопировать ссылку на visibilityPopUpVisibility

Stage of the pop-up's life: not shown yet, visible, or hidden.

hide()Скопировать ссылку на hide()void

Hides the popup after a specified delay.

The hide timeout triggers the hiding of the popup by updating visibility and emitting relevant events.

Parameters
delaynumber

The delay in milliseconds before hiding the popup.

afterHidden()Скопировать ссылку на afterHidden()Observable<void>

Returns an observable that notifies when the tooltip has been hidden from view.

KbqAppSwitcherTrigger

directiveСкопировать ссылку на KbqAppSwitcherTrigger
@Directive({ selector: '[kbqAppSwitcher]', exportAs: 'kbqAppSwitcher' })
class KbqAppSwitcherTrigger extends KbqPopUpTrigger<KbqAppSwitcherComponent> {
    readonly selectedApp = model<KbqAppSwitcherApp | undefined>();
    backdropClass = input<string | undefined>();
    offset = input<number | null | undefined>();
    sites = input<KbqAppSwitcherSite[] | undefined>();
    groupBy = input<KbqAppSwitcherGroupBy | undefined>();
    readonly selectedSite = model<KbqAppSwitcherSite | undefined>();
    disabled = input<boolean | undefined>();
    get withSearch(): boolean;
    placement: KbqPopUpPlacementValues;
    readonly placementChange: EventEmitter<KbqPopUpPlacementValues>;
    readonly visibleChange: EventEmitter<boolean>;
    set originalSites(value: KbqAppSwitcherSite[]);
    isOpen: boolean;
    get isAttached(): boolean;
    get openedChange(): Observable<boolean>;
    arrowCentered: boolean;
    updateOrigin(origin: KbqOverlayOrigin | null): void;
}
selectedAppmodelСкопировать ссылку на selectedAppKbqAppSwitcherApp | undefined

Selected application

backdropClassinputСкопировать ссылку на backdropClassstring | undefined

Class that will be used in the background

offsetinputСкопировать ссылку на offsetnumber | null | undefined

Offset of popUp

sitesinputСкопировать ссылку на sitesKbqAppSwitcherSite[] | undefined

Array of sites, with the applications of each site grouped for rendering.

groupByinputСкопировать ссылку на groupByKbqAppSwitcherGroupBy | undefined

Function to group the apps by type. The first argument is an app object with type. The second is a groups object and third is an array for untyped apps

disabledinputСкопировать ссылку на disabledboolean | undefined

Whether the trigger is disabled.

withSearchСкопировать ссылку на withSearchboolean

Whether search is used or not

placementChangeСкопировать ссылку на placementChangeEventEmitter<KbqPopUpPlacementValues>

Emits a change event whenever the placement state changes.

visibleChangeСкопировать ссылку на visibleChangeEventEmitter<boolean>

Emits a change event whenever the visible state changes.

isOpenСкопировать ссылку на isOpenboolean

Whether the pop-up overlay is currently open.

isAttachedСкопировать ссылку на isAttachedboolean

Whether the pop-up overlay is currently attached.

Unlike isOpen, which follows the visibility of the pop-up component and therefore lags a task behind show()/hide(), this flips synchronously — it is the window during which the overlay (and its backdrop) is present in the DOM. Part of the KbqSiblingPopup contract.

openedChangeСкопировать ссылку на openedChangeObservable<boolean>

Emits true when the pop-up opens and false when it closes. Part of the KbqSiblingPopup contract.

arrowCenteredСкопировать ссылку на arrowCenteredboolean

Whether the arrow points at the origin center while the panel keeps its placement. Defaults to false.

updateOrigin()Скопировать ссылку на updateOrigin()void

Positions the pop-up against origin — an element, or a rectangle in viewport coordinates such as the one kbqCreateCaretOrigin keeps on the caret — instead of the host element; null restores the host element. An open pop-up moves to the new origin at once.

This moves the position origin only. setExternalNativeElement moves the host itself, and with it the trigger's event listeners, its focus target and the scroll containers the pop-up follows.

KbqAppSwitcherIconSanitizer

serviceСкопировать ссылку на KbqAppSwitcherIconSanitizer

Turns the caller-supplied inline SVG of an app-switcher icon into markup that is safe to hand to [innerHtml].

Angular's own HTML sanitizer cannot be used here: its allow-list contains no SVG elements at all, so it would strip every icon. Instead the markup is parsed inert (inside a <template>, where no request is issued and no script runs), filtered against a strict SVG allow-list, and only then marked as trusted.

@Injectable({ providedIn: 'root' })
class KbqAppSwitcherIconSanitizer {
    sanitize(icon: string | null | undefined): SafeHtml | null;
}
sanitize()Скопировать ссылку на sanitize()SafeHtml | null

Sanitizes inline SVG markup and wraps it as SafeHtml. Returns null for empty input, so callers can use the result directly as the @if condition of the icon element.

kbqAppSwitcherProvider

functionСкопировать ссылку на kbqAppSwitcherProvider

Providers used by the app-switcher. KbqAppSwitcherModule applies them for NgModule consumers; standalone consumers that import KbqAppSwitcherTrigger directly may add them to their application (or route) providers.

Providing them is optional: the only entry is the scroll strategy, and the directive falls back to the default repositioning strategy when the token is absent. The app-switcher renders no focus trap, so - unlike KbqPopoverModule and KbqNotificationCenterModule, whose templates bind [cdkTrapFocus] - it must not swap FOCUS_TRAP_INERT_STRATEGY/FocusTrapFactory: those are injector-wide and would disable the CDK inert strategy for every other focus trap in the same scope.

function kbqAppSwitcherProvider(): Provider[];

makeGroupsForApps

functionСкопировать ссылку на makeGroupsForApps

Runs groupBy over apps and returns the rendered order: synthetic groups big enough to be collapsible first, then every remaining application as a plain row.

A group is kept only when it holds strictly more than minAppsForGrouping applications; smaller groups are flattened back into plain rows.

function makeGroupsForApps(
    apps: KbqAppSwitcherApp[],
    minAppsForGrouping: number,
    groupBy?: KbqAppSwitcherGroupBy
): KbqAppSwitcherApp[];

KbqAppSwitcherApp

interfaceСкопировать ссылку на KbqAppSwitcherApp
interface KbqAppSwitcherApp {
    name: string;
    id: string | number;
    type?: string | number;
    icon?: string;
    iconSrc?: string;
    caption?: string;
    aliases?: KbqAppSwitcherApp[];
    link?: string;
}
iconoptionalСкопировать ссылку на iconstring

Inline SVG markup for the application icon. Use this for SVG icons that should be rendered directly in the DOM.

The markup is sanitized against a strict SVG allow-list before it is rendered (see KbqAppSwitcherIconSanitizer): scripts, event handlers, foreignObject, style and external references are removed. Prefer iconSrc when the icon comes from a URL.

iconSrcoptionalСкопировать ссылку на iconSrcstring

Path to the icon file (URL or relative path).

KbqAppSwitcherGroupBy

typeСкопировать ссылку на KbqAppSwitcherGroupBy

Reducer that assigns an application to a group. Called once per application; implementations either push the app into untyped (rendered as a plain row) or add it to a synthetic group in groups.

type KbqAppSwitcherGroupBy = (
    app: KbqAppSwitcherApp,
    groups: Record<string, KbqAppSwitcherApp>,
    untyped: KbqAppSwitcherApp[]
) => void;

KbqAppSwitcherSite

interfaceСкопировать ссылку на KbqAppSwitcherSite
interface KbqAppSwitcherSite {
    name: string;
    id: string | number;
    status?: string;
    icon?: string;
    iconSrc?: string;
    apps: KbqAppSwitcherApp[];
}
iconoptionalСкопировать ссылку на iconstring

Inline SVG markup for the site icon. Use this for SVG icons that should be rendered directly in the DOM. Sanitized the same way as KbqAppSwitcherApp.icon.

iconSrcoptionalСкопировать ссылку на iconSrcstring

Path to the icon file (URL or relative path).

KBQ_APP_SWITCHER_CONFIGURATION

constDeprecatedСкопировать ссылку на KBQ_APP_SWITCHER_CONFIGURATION

Use KBQ_APP_SWITCHER_LOCALE_CONFIGURATION. Will be removed in 22.0.0.

const KBQ_APP_SWITCHER_CONFIGURATION: InjectionToken<KbqAppSwitcherLocaleConfiguration>;

KBQ_APP_SWITCHER_DEFAULT_CONFIGURATION

constDeprecatedСкопировать ссылку на KBQ_APP_SWITCHER_DEFAULT_CONFIGURATION

Use KBQ_APP_SWITCHER_DEFAULT_LOCALE_CONFIGURATION. Will be removed in 22.0.0.

const KBQ_APP_SWITCHER_DEFAULT_CONFIGURATION: KbqAppSwitcherLocaleConfiguration;

KBQ_MIN_NUMBER_OF_APPS_TO_ENABLE_GROUPING

constСкопировать ссылку на KBQ_MIN_NUMBER_OF_APPS_TO_ENABLE_GROUPING
const KBQ_MIN_NUMBER_OF_APPS_TO_ENABLE_GROUPING: number;

KBQ_MIN_NUMBER_OF_APPS_TO_ENABLE_SEARCH

constСкопировать ссылку на KBQ_MIN_NUMBER_OF_APPS_TO_ENABLE_SEARCH
const KBQ_MIN_NUMBER_OF_APPS_TO_ENABLE_SEARCH: number;

kbqAppSwitcherLocaleConfigurationProvider

constСкопировать ссылку на kbqAppSwitcherLocaleConfigurationProvider

Utility provider for KBQ_APP_SWITCHER_LOCALE_CONFIGURATION. Only the strings you pass are overridden; the rest keep following the active locale.

const kbqAppSwitcherLocaleConfigurationProvider: (
    configuration: KbqDeepPartial<KbqAppSwitcherLocaleConfiguration>
) => Provider;
Предложения по улучшению
Если вы нашли ошибку или хотите доработать статью, создайте запрос на GitHub.