import { KbqActionsPanelModule } from '@koobiq/components/actions-panel';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()KbqActionsPanelRef<T, R> Opens actions panel.
config?KbqActionsPanelConfig<D> Additional configuration options for the actions panel.
KbqActionsPanelRef<T, R> A reference to the opened actions panel.
close()void Closes the currently opened actions panel.
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;
}injectorInjector Injector used for the instantiation of the component to be attached.
dataD | null Data being injected into the child component with KBQ_ACTIONS_PANEL_DATA.
containerClassstring | string[] Extra CSS classes to be added to the actions panel container.
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.
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.
overlayPanelClassstring | string[] Extra CSS classes to be added to the overlay panel.
widthstring Width of the actions panel.
minWidthnumber | string Min-width of the actions panel. If a number is provided, assumes pixel units.
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.
directionDirection Direction of the text in the actions panel. Defaults to 'ltr'.
scrollStrategy(overlay: Overlay) => ScrollStrategy Scroll strategy to be used for the actions panel. Defaults to RepositionScrollStrategy.
disableCloseboolean Whether the user can use ESC or click on close button to close the actions panel. Defaults to false.
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;
}keydownEventsObservable<KeyboardEvent> Emits when keydown events are targeted on the overlay.
beforeOpenedObservable<void> Emits when the actions panel starts opening, before its entrance animation plays.
afterOpenedObservable<void> Emits when the actions panel has opened and appeared, or once closing cuts its entrance short.
beforeClosedObservable<R | undefined> Emits when the actions panel starts closing, before its exit animation plays.
afterClosedObservable<R | undefined> Emits when the actions panel is finished closing.
close()void Closes the actions panel.
Context for actions panel template.
type KbqActionsPanelTemplateContext<T = unknown, D = unknown, R = unknown> = {
$implicit?: D | null;
data?: D | null;
actionsPanelRef: KbqActionsPanelRef<T, R>;
};$implicitD | null Data passed to actions panel.
Example:
<ng-template #actionsPanel let-data>{{ data.KEY }}</ng-template>dataD | null Data passed to actions panel.
Example:
<ng-template #actionsPanel let-data="data">{{ data.KEY }}</ng-template>actionsPanelRefKbqActionsPanelRef<T, R> Opened actions panel reference.
Example:
<ng-template #actionsPanel let-actionsPanelRef="actionsPanelRef">
<button (click)="actionsPanelRef.close()">close</button>
</ng-template>Injection token that can be used to access the data that was passed in to actions panel.
const KBQ_ACTIONS_PANEL_DATA: InjectionToken<unknown>;Injection token that can be used to specify default actions panel config.
const KBQ_ACTIONS_PANEL_DEFAULT_CONFIG: InjectionToken<KbqActionsPanelConfig>;Localization configuration provider.
const KBQ_ACTIONS_PANEL_LOCALE_CONFIGURATION: InjectionToken<KbqActionsPanelLocaleConfiguration>;Utility for providing default actions panel config through KBQ_ACTIONS_PANEL_DEFAULT_CONFIG.
const kbqActionsPanelDefaultConfigProvider: <D>(
config: KbqActionsPanelConfig<D>
) => Provider;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;