import { KbqActionsPanelModule } from '@koobiq/components/actions-panel';

KbqActionsPanel

serviceCopy link to KbqActionsPanel

Service for opening actions panel.

@Injectable({ providedIn: 'root' })
class KbqActionsPanel {
    open<T, D = unknown, R = unknown>(
        component: ComponentType<T>,
        config?: KbqActionsPanelConfig<D>
    ): KbqActionsPanelRef<T, R>;
    open<T, D = unknown, R = unknown>(
        template: TemplateRef<T>,
        config?: KbqActionsPanelConfig<D>
    ): KbqActionsPanelRef<T, R>;
    close<R>(result?: R): void;
}
open()Copy link to open()KbqActionsPanelRef<T, R>

Opens actions panel.

Parameters
config?KbqActionsPanelConfig<D>

Additional configuration options for the actions panel.

Returns
KbqActionsPanelRef<T, R>

A reference to the opened actions panel.

close()Copy link to close()void

Closes the currently opened actions panel.

KbqActionsPanelConfig

classCopy link to KbqActionsPanelConfig

Configuration for opened actions panel. Based on cdk DialogConfig.

class KbqActionsPanelConfig<D = unknown> {
    injector?: Injector;
    data?: D | null;
    containerClass?: string | string[];
    closeOnNavigation?: boolean;
    overlayContainer?: ElementRef<HTMLElement>;
    overlayPanelClass?: string | string[];
    width?: string;
    minWidth?: number | string;
    maxWidth?: number | string;
    direction?: Direction;
    scrollStrategy?: (overlay: Overlay) => ScrollStrategy;
    disableClose?: boolean;
}
injectoroptionalCopy link to injectorInjector

Injector used for the instantiation of the component to be attached.

dataoptionalCopy link to dataD | null

Data being injected into the child component with KBQ_ACTIONS_PANEL_DATA.

containerClassoptionalCopy link to containerClassstring | string[]

Extra CSS classes to be added to the actions panel container.

closeOnNavigationoptionalCopy link to closeOnNavigationboolean

Whether the actions panel should be closed of when the user goes backwards/forwards in history. Defaults to true. NOTE! This does not apply to router navigation.

overlayContaineroptionalCopy link to overlayContainerElementRef<HTMLElement>

Element the actions panel overlay is rendered into, instead of the application-wide overlay container. The panel is pinned to the bottom center of that element and resizes with it. An element that sets overflow: hidden clips it; at the default overflow: visible the entrance animation renders it below the element.

The element is mutated for as long as the panel is open: it gains one child node holding the overlay, and a static element is promoted to position: relative, since the overlay is positioned against it.

NOTE: the panel bypasses a globally provided OverlayContainer while this is set.

overlayPanelClassoptionalCopy link to overlayPanelClassstring | string[]

Extra CSS classes to be added to the overlay panel.

widthoptionalCopy link to widthstring

Width of the actions panel.

minWidthoptionalCopy link to minWidthnumber | string

Min-width of the actions panel. If a number is provided, assumes pixel units.

maxWidthoptionalCopy link to maxWidthnumber | string

Max-width of the actions panel. If a number is provided, assumes pixel units.

When omitted, the panel is capped by the width of the overlay container it is rendered into.

directionoptionalCopy link to directionDirection

Direction of the text in the actions panel. Defaults to 'ltr'.

scrollStrategyoptionalCopy link to scrollStrategy(overlay: Overlay) => ScrollStrategy

Scroll strategy to be used for the actions panel. Defaults to RepositionScrollStrategy.

disableCloseoptionalCopy link to disableCloseboolean

Whether the user can use ESC or click on close button to close the actions panel. Defaults to false.

KbqActionsPanelRef

classCopy link to KbqActionsPanelRef

Reference to actions panel opened by KbqActionsPanel service.

class KbqActionsPanelRef<I = unknown, R = unknown> {
    readonly keydownEvents: Observable<KeyboardEvent>;
    readonly beforeOpened: Observable<void>;
    readonly afterOpened: Observable<void>;
    readonly beforeClosed: Observable<R | undefined>;
    readonly afterClosed: Observable<R | undefined>;
    constructor(
        dialogRef: DialogRef<R, I>,
        containerInstance: KbqActionsPanelContainer
    );
    close(result?: R): void;
}
keydownEventsCopy link to keydownEventsObservable<KeyboardEvent>

Emits when keydown events are targeted on the overlay.

beforeOpenedCopy link to beforeOpenedObservable<void>

Emits when the actions panel starts opening, before its entrance animation plays.

afterOpenedCopy link to afterOpenedObservable<void>

Emits when the actions panel has opened and appeared, or once closing cuts its entrance short.

beforeClosedCopy link to beforeClosedObservable<R | undefined>

Emits when the actions panel starts closing, before its exit animation plays.

afterClosedCopy link to afterClosedObservable<R | undefined>

Emits when the actions panel is finished closing.

close()Copy link to close()void

Closes the actions panel.

KbqActionsPanelTemplateContext

typeCopy link to KbqActionsPanelTemplateContext

Context for actions panel template.

type KbqActionsPanelTemplateContext<T = unknown, D = unknown, R = unknown> = {
    $implicit?: D | null;
    data?: D | null;
    actionsPanelRef: KbqActionsPanelRef<T, R>;
};
$implicitoptionalCopy link to $implicitD | null

Data passed to actions panel.

Example:

<ng-template #actionsPanel let-data>{{ data.KEY }}</ng-template>
dataoptionalCopy link to dataD | null

Data passed to actions panel.

Example:

<ng-template #actionsPanel let-data="data">{{ data.KEY }}</ng-template>
actionsPanelRefCopy link to actionsPanelRefKbqActionsPanelRef<T, R>

Opened actions panel reference.

Example:

<ng-template #actionsPanel let-actionsPanelRef="actionsPanelRef">
  <button (click)="actionsPanelRef.close()">close</button>
</ng-template>

KBQ_ACTIONS_PANEL_DATA

constCopy link to KBQ_ACTIONS_PANEL_DATA

Injection token that can be used to access the data that was passed in to actions panel.

const KBQ_ACTIONS_PANEL_DATA: InjectionToken<unknown>;

KBQ_ACTIONS_PANEL_DEFAULT_CONFIG

constCopy link to KBQ_ACTIONS_PANEL_DEFAULT_CONFIG

Injection token that can be used to specify default actions panel config.

const KBQ_ACTIONS_PANEL_DEFAULT_CONFIG: InjectionToken<KbqActionsPanelConfig>;

KBQ_ACTIONS_PANEL_LOCALE_CONFIGURATION

constCopy link to KBQ_ACTIONS_PANEL_LOCALE_CONFIGURATION

Localization configuration provider.

const KBQ_ACTIONS_PANEL_LOCALE_CONFIGURATION: InjectionToken<KbqActionsPanelLocaleConfiguration>;

kbqActionsPanelDefaultConfigProvider

constCopy link to kbqActionsPanelDefaultConfigProvider

Utility for providing default actions panel config through KBQ_ACTIONS_PANEL_DEFAULT_CONFIG.

const kbqActionsPanelDefaultConfigProvider: <D>(
    config: KbqActionsPanelConfig<D>
) => Provider;

kbqActionsPanelLocaleConfigurationProvider

constCopy link to kbqActionsPanelLocaleConfigurationProvider

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

const kbqActionsPanelLocaleConfigurationProvider: (
    configuration: KbqDeepPartial<KbqActionsPanelLocaleConfiguration>
) => Provider;
Suggestions for improvement
If you found a mistake or want to improve the article, create an issue on GitHub.