primeng
Version:
PrimeNG is an open source UI library for Angular featuring a rich set of 80+ components, a theme designer, various theme alternatives such as Material, Bootstrap, Tailwind, premium templates and professional support. In addition, it integrates with PrimeB
775 lines (750 loc) • 33.9 kB
JavaScript
export * from 'primeng/types/drawer';
import * as i2 from '@angular/common';
import { CommonModule } from '@angular/common';
import * as i0 from '@angular/core';
import { Injectable, InjectionToken, inject, input, computed, EventEmitter, booleanAttribute, numberAttribute, ContentChildren, ContentChild, ViewChild, Output, Input, ViewEncapsulation, ChangeDetectionStrategy, Component, NgModule } from '@angular/core';
import { setAttribute, addClass, removeClass, appendChild } from '@primeuix/utils';
import { SharedModule, PrimeTemplate } from 'primeng/api';
import { BaseComponent, PARENT_INSTANCE } from 'primeng/basecomponent';
import * as i1 from 'primeng/bind';
import { Bind } from 'primeng/bind';
import { Button } from 'primeng/button';
import { blockBodyScroll, unblockBodyScroll } from 'primeng/dom';
import * as i3 from 'primeng/focustrap';
import { FocusTrapModule } from 'primeng/focustrap';
import { TimesIcon } from 'primeng/icons';
import * as i4 from 'primeng/motion';
import { MotionModule } from 'primeng/motion';
import { ZIndexUtils } from 'primeng/utils';
import { style as style$1 } from '@primeuix/styles/drawer';
import { BaseStyle } from 'primeng/base';
const style = /*css*/ `
${style$1}
/** For PrimeNG **/
.p-drawer {
position: fixed;
}
.p-drawer-left {
top: 0;
left: 0;
width: 20rem;
height: 100%;
border-inline-end-width: 1px;
}
.p-drawer-right {
top: 0;
right: 0;
width: 20rem;
height: 100%;
border-inline-start-width: 1px;
}
.p-drawer-top {
top: 0;
left: 0;
width: 100%;
height: 10rem;
border-block-end-width: 1px;
}
.p-drawer-bottom {
bottom: 0;
left: 0;
width: 100%;
height: 10rem;
border-block-start-width: 1px;
}
.p-drawer-full {
width: 100%;
height: 100%;
top: 0;
left: 0;
-webkit-transition: none;
transition: none;
}
/* Animations */
.p-drawer-enter-left {
animation: p-animate-drawer-enter-left 0.5s cubic-bezier(0.32, 0.72, 0, 1);
}
.p-drawer-leave-left {
animation: p-animate-drawer-leave-left 0.5s cubic-bezier(0.32, 0.72, 0, 1);
}
.p-drawer-enter-right {
animation: p-animate-drawer-enter-right 0.5s cubic-bezier(0.32, 0.72, 0, 1);
}
.p-drawer-leave-right {
animation: p-animate-drawer-leave-right 0.5s cubic-bezier(0.32, 0.72, 0, 1);
}
.p-drawer-enter-top {
animation: p-animate-drawer-enter-top 0.5s cubic-bezier(0.32, 0.72, 0, 1);
}
.p-drawer-leave-top {
animation: p-animate-drawer-leave-top 0.5s cubic-bezier(0.32, 0.72, 0, 1);
}
.p-drawer-enter-bottom {
animation: p-animate-drawer-enter-bottom 0.5s cubic-bezier(0.32, 0.72, 0, 1);
}
.p-drawer-leave-bottom {
animation: p-animate-drawer-leave-bottom 0.5s cubic-bezier(0.32, 0.72, 0, 1);
}
.p-drawer-enter-full {
animation: p-animate-drawer-enter-full 0.5s cubic-bezier(0.32, 0.72, 0, 1);
}
.p-drawer-leave-full {
animation: p-animate-drawer-leave-full 0.5s cubic-bezier(0.32, 0.72, 0, 1);
}
`;
const classes = {
mask: ({ instance }) => ['p-drawer-mask', { [`p-overlay-mask p-overlay-mask-enter-active`]: instance.modal }, { 'p-drawer-full': instance.fullScreen() }],
root: ({ instance }) => [
'p-drawer p-component',
{
'p-drawer-full': instance.fullScreen(),
'p-drawer-open': instance.visible
},
`p-drawer-${instance.position()}`
],
header: 'p-drawer-header',
title: 'p-drawer-title',
pcCloseButton: 'p-drawer-close-button',
content: 'p-drawer-content',
footer: 'p-drawer-footer'
};
class DrawerStyle extends BaseStyle {
name = 'drawer';
style = style;
classes = classes;
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: DrawerStyle, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: DrawerStyle });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: DrawerStyle, decorators: [{
type: Injectable
}] });
/**
*
* Drawer is a panel component displayed as an overlay at the edges of the screen.
*
* [Live Demo](https://www.primeng.org/drawer)
*
* @module drawerstyle
*
*/
var DrawerClasses;
(function (DrawerClasses) {
/**
* Class name of the mask element
*/
DrawerClasses["mask"] = "p-drawer-mask";
/**
* Class name of the root element
*/
DrawerClasses["root"] = "p-drawer";
/**
* Class name of the header element
*/
DrawerClasses["header"] = "p-drawer-header";
/**
* Class name of the title element
*/
DrawerClasses["title"] = "p-drawer-title";
/**
* Class name of the close button element
*/
DrawerClasses["pcCloseButton"] = "p-drawer-close-button";
/**
* Class name of the content element
*/
DrawerClasses["content"] = "p-drawer-content";
})(DrawerClasses || (DrawerClasses = {}));
const DRAWER_INSTANCE = new InjectionToken('DRAWER_INSTANCE');
/**
* Sidebar is a panel component displayed as an overlay at the edges of the screen.
* @group Components
*/
class Drawer extends BaseComponent {
$pcDrawer = inject(DRAWER_INSTANCE, { optional: true, skipSelf: true }) ?? undefined;
bindDirectiveInstance = inject(Bind, { self: true });
onAfterViewChecked() {
this.bindDirectiveInstance.setAttrs(this.ptm('host'));
}
/**
* Target element to attach the overlay, valid values are "body" or a local ng-template variable of another element (note: use binding with brackets for template variables, e.g. [appendTo]="mydiv" for a div element having #mydiv as variable name).
* @defaultValue 'self'
* @group Props
*/
appendTo = input(undefined, ...(ngDevMode ? [{ debugName: "appendTo" }] : []));
/**
* The motion options.
* @group Props
*/
motionOptions = input(undefined, ...(ngDevMode ? [{ debugName: "motionOptions" }] : []));
computedMotionOptions = computed(() => {
return {
...this.ptm('motion'),
...this.motionOptions()
};
}, ...(ngDevMode ? [{ debugName: "computedMotionOptions" }] : []));
/**
* Whether to block scrolling of the document when drawer is active.
* @group Props
*/
blockScroll = false;
/**
* Inline style of the component.
* @group Props
*/
style;
/**
* Style class of the component.
* @group Props
*/
styleClass;
/**
* Aria label of the close icon.
* @group Props
*/
ariaCloseLabel;
/**
* Whether to automatically manage layering.
* @group Props
*/
autoZIndex = true;
/**
* Base zIndex value to use in layering.
* @group Props
*/
baseZIndex = 0;
/**
* Whether an overlay mask is displayed behind the drawer.
* @group Props
*/
modal = true;
/**
* Used to pass all properties of the ButtonProps to the Button component.
* @group Props
*/
closeButtonProps = { severity: 'secondary', text: true, rounded: true };
/**
* Whether to dismiss drawer on click of the mask.
* @group Props
*/
dismissible = true;
/**
* Whether to display the close icon.
* @group Props
* @deprecated use 'closable' instead.
*/
showCloseIcon = true;
/**
* Specifies if pressing escape key should hide the drawer.
* @group Props
*/
closeOnEscape = true;
/**
* Transition options of the animation.
* @group Props
* @deprecated since v21.0.0. Use `motionOptions` instead.
*/
transitionOptions = '150ms cubic-bezier(0, 0, 0.2, 1)';
/**
* The visible property is an input that determines the visibility of the component.
* @defaultValue false
* @group Props
*/
get visible() {
return this._visible ?? false;
}
set visible(value) {
this._visible = value;
if (this._visible && !this.modalVisible) {
this.modalVisible = true;
}
}
/**
* Specifies the position of the drawer, valid values are "left", "right", "bottom" and "top".
* @defaultValue 'left'
* @group Props
*/
position = input('left', ...(ngDevMode ? [{ debugName: "position" }] : []));
/**
* Adds a close icon to the header to hide the dialog.
* @defaultValue false
* @group Props
*/
fullScreen = input(false, ...(ngDevMode ? [{ debugName: "fullScreen" }] : []));
$enterAnimation = computed(() => (this.fullScreen() ? 'p-drawer-enter-full' : `p-drawer-enter-${this.position()}`), ...(ngDevMode ? [{ debugName: "$enterAnimation" }] : []));
$leaveAnimation = computed(() => (this.fullScreen() ? 'p-drawer-leave-full' : `p-drawer-leave-${this.position()}`), ...(ngDevMode ? [{ debugName: "$leaveAnimation" }] : []));
/**
* Title content of the dialog.
* @group Props
*/
header;
/**
* Style of the mask.
* @group Props
*/
maskStyle;
/**
* Whether to display close button.
* @group Props
* @defaultValue true
*/
closable = true;
/**
* Callback to invoke when dialog is shown.
* @group Emits
*/
onShow = new EventEmitter();
/**
* Callback to invoke when dialog is hidden.
* @group Emits
*/
onHide = new EventEmitter();
/**
* Callback to invoke when dialog visibility is changed.
* @param {boolean} value - Visible value.
* @group Emits
*/
visibleChange = new EventEmitter();
containerViewChild;
closeButtonViewChild;
initialized;
_visible;
_position = 'left';
_fullScreen = false;
modalVisible = false;
container;
mask;
maskClickListener;
documentEscapeListener;
animationEndListener;
_componentStyle = inject(DrawerStyle);
onAfterViewInit() {
this.initialized = true;
}
/**
* Custom header template.
* @group Templates
*/
headerTemplate;
/**
* Custom footer template.
* @group Templates
*/
footerTemplate;
/**
* Custom content template.
* @group Templates
*/
contentTemplate;
/**
* Custom close icon template.
* @group Templates
*/
closeIconTemplate;
/**
* Custom headless template to replace the entire drawer content.
* @group Templates
*/
headlessTemplate;
$appendTo = computed(() => this.appendTo() || this.config.overlayAppendTo(), ...(ngDevMode ? [{ debugName: "$appendTo" }] : []));
_headerTemplate;
_footerTemplate;
_contentTemplate;
_closeIconTemplate;
_headlessTemplate;
templates;
onAfterContentInit() {
this.templates?.forEach((item) => {
switch (item.getType()) {
case 'content':
this._contentTemplate = item.template;
break;
case 'header':
this._headerTemplate = item.template;
break;
case 'footer':
this._footerTemplate = item.template;
break;
case 'closeicon':
this._closeIconTemplate = item.template;
break;
case 'headless':
this._headlessTemplate = item.template;
break;
default:
this._contentTemplate = item.template;
break;
}
});
}
onKeyDown(event) {
if (event.code === 'Escape') {
this.hide(false);
}
}
show() {
this.container?.setAttribute(this.$attrSelector, '');
if (this.autoZIndex) {
ZIndexUtils.set('modal', this.container, this.baseZIndex || this.config.zIndex.modal);
}
if (this.modal) {
this.enableModality();
}
this.onShow.emit({});
this.visibleChange.emit(true);
}
hide(emit = true) {
if (emit) {
this.onHide.emit({});
}
if (this.modal) {
this.disableModality();
}
}
close(event) {
this.hide();
this.visibleChange.emit(false);
event.preventDefault();
}
enableModality() {
const activeDrawers = this.document.querySelectorAll('[data-p-open="true"]');
const activeDrawersLength = activeDrawers.length;
const zIndex = activeDrawersLength == 1 ? String(parseInt(this.container.style.zIndex) - 1) : String(parseInt(activeDrawers[activeDrawersLength - 1].style.zIndex) - 1);
if (!this.mask) {
this.mask = this.renderer.createElement('div');
if (this.mask) {
const style = `z-index: ${zIndex};${this.getMaskStyle()}`;
setAttribute(this.mask, 'style', style);
setAttribute(this.mask, 'data-p', this.dataP);
addClass(this.mask, this.cx('mask'));
}
if (this.dismissible) {
this.maskClickListener = this.renderer.listen(this.mask, 'click', (event) => {
if (this.dismissible) {
this.close(event);
}
});
}
this.renderer.appendChild(this.document.body, this.mask);
if (this.blockScroll) {
blockBodyScroll();
}
}
}
getMaskStyle() {
return this.maskStyle
? Object.entries(this.maskStyle)
.map(([key, value]) => `${key}: ${value}`)
.join('; ')
: '';
}
disableModality() {
if (this.mask) {
!this.$unstyled() && removeClass(this.mask, 'p-overlay-mask-enter-active');
!this.$unstyled() && addClass(this.mask, 'p-overlay-mask-leave-active');
this.animationEndListener = this.renderer.listen(this.mask, 'animationend', this.destroyModal.bind(this));
}
}
destroyModal() {
this.unbindMaskClickListener();
if (this.mask) {
this.renderer.removeChild(this.document.body, this.mask);
}
if (this.blockScroll) {
unblockBodyScroll();
}
this.unbindAnimationEndListener();
this.mask = null;
}
onBeforeEnter(event) {
this.container = event.element;
this.appendContainer();
this.show();
if (this.closeOnEscape) {
this.bindDocumentEscapeListener();
}
}
onAfterLeave() {
this.hide(false);
ZIndexUtils.clear(this.container);
this.unbindGlobalListeners();
this.modalVisible = false;
this.container = null;
}
appendContainer() {
if (this.$appendTo() && this.$appendTo() !== 'self') {
if (this.$appendTo() === 'body') {
appendChild(this.document.body, this.container);
}
else {
appendChild(this.$appendTo(), this.container);
}
}
}
bindDocumentEscapeListener() {
const documentTarget = this.el ? this.el.nativeElement.ownerDocument : this.document;
this.documentEscapeListener = this.renderer.listen(documentTarget, 'keydown', (event) => {
if (event.which == 27) {
if (parseInt(this.container?.style.zIndex) === ZIndexUtils.get(this.container)) {
this.close(event);
}
}
});
}
unbindDocumentEscapeListener() {
if (this.documentEscapeListener) {
this.documentEscapeListener();
this.documentEscapeListener = null;
}
}
unbindMaskClickListener() {
if (this.maskClickListener) {
this.maskClickListener();
this.maskClickListener = null;
}
}
unbindGlobalListeners() {
this.unbindMaskClickListener();
this.unbindDocumentEscapeListener();
}
unbindAnimationEndListener() {
if (this.animationEndListener && this.mask) {
this.animationEndListener();
this.animationEndListener = null;
}
}
onDestroy() {
this.initialized = false;
if (this.visible && this.modal) {
this.destroyModal();
}
if (this.$appendTo() && this.container) {
this.renderer.appendChild(this.el.nativeElement, this.container);
}
if (this.container && this.autoZIndex) {
ZIndexUtils.clear(this.container);
}
this.container = null;
this.unbindGlobalListeners();
this.unbindAnimationEndListener();
}
get dataP() {
return this.cn({
'full-screen': this.position() === 'full',
[this.position()]: this.position(),
open: this.visible,
modal: this.modal
});
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: Drawer, deps: null, target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.5", type: Drawer, isStandalone: true, selector: "p-drawer", inputs: { appendTo: { classPropertyName: "appendTo", publicName: "appendTo", isSignal: true, isRequired: false, transformFunction: null }, motionOptions: { classPropertyName: "motionOptions", publicName: "motionOptions", isSignal: true, isRequired: false, transformFunction: null }, blockScroll: { classPropertyName: "blockScroll", publicName: "blockScroll", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, style: { classPropertyName: "style", publicName: "style", isSignal: false, isRequired: false, transformFunction: null }, styleClass: { classPropertyName: "styleClass", publicName: "styleClass", isSignal: false, isRequired: false, transformFunction: null }, ariaCloseLabel: { classPropertyName: "ariaCloseLabel", publicName: "ariaCloseLabel", isSignal: false, isRequired: false, transformFunction: null }, autoZIndex: { classPropertyName: "autoZIndex", publicName: "autoZIndex", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, baseZIndex: { classPropertyName: "baseZIndex", publicName: "baseZIndex", isSignal: false, isRequired: false, transformFunction: numberAttribute }, modal: { classPropertyName: "modal", publicName: "modal", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, closeButtonProps: { classPropertyName: "closeButtonProps", publicName: "closeButtonProps", isSignal: false, isRequired: false, transformFunction: null }, dismissible: { classPropertyName: "dismissible", publicName: "dismissible", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, showCloseIcon: { classPropertyName: "showCloseIcon", publicName: "showCloseIcon", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, closeOnEscape: { classPropertyName: "closeOnEscape", publicName: "closeOnEscape", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, transitionOptions: { classPropertyName: "transitionOptions", publicName: "transitionOptions", isSignal: false, isRequired: false, transformFunction: null }, visible: { classPropertyName: "visible", publicName: "visible", isSignal: false, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, fullScreen: { classPropertyName: "fullScreen", publicName: "fullScreen", isSignal: true, isRequired: false, transformFunction: null }, header: { classPropertyName: "header", publicName: "header", isSignal: false, isRequired: false, transformFunction: null }, maskStyle: { classPropertyName: "maskStyle", publicName: "maskStyle", isSignal: false, isRequired: false, transformFunction: null }, closable: { classPropertyName: "closable", publicName: "closable", isSignal: false, isRequired: false, transformFunction: booleanAttribute } }, outputs: { onShow: "onShow", onHide: "onHide", visibleChange: "visibleChange" }, providers: [DrawerStyle, { provide: DRAWER_INSTANCE, useExisting: Drawer }, { provide: PARENT_INSTANCE, useExisting: Drawer }], queries: [{ propertyName: "headerTemplate", first: true, predicate: ["header"] }, { propertyName: "footerTemplate", first: true, predicate: ["footer"] }, { propertyName: "contentTemplate", first: true, predicate: ["content"] }, { propertyName: "closeIconTemplate", first: true, predicate: ["closeicon"] }, { propertyName: "headlessTemplate", first: true, predicate: ["headless"] }, { propertyName: "templates", predicate: PrimeTemplate }], viewQueries: [{ propertyName: "containerViewChild", first: true, predicate: ["container"], descendants: true }, { propertyName: "closeButtonViewChild", first: true, predicate: ["closeButton"], descendants: true }], usesInheritance: true, hostDirectives: [{ directive: i1.Bind }], ngImport: i0, template: `
(modalVisible) {
<div
#container
[pBind]="ptm('root')"
[pMotion]="visible"
[pMotionAppear]="true"
[pMotionEnterActiveClass]="$enterAnimation()"
[pMotionLeaveActiveClass]="$leaveAnimation()"
[pMotionOptions]="computedMotionOptions()"
(pMotionOnBeforeEnter)="onBeforeEnter($event)"
(pMotionOnAfterLeave)="onAfterLeave($event)"
[class]="cn(cx('root'), styleClass)"
[style]="style"
role="complementary"
(keydown)="onKeyDown($event)"
pFocusTrap
[attr.data-p]="dataP"
[attr.data-p-open]="visible"
>
(headlessTemplate || _headlessTemplate) {
<ng-container *ngTemplateOutlet="headlessTemplate || _headlessTemplate"></ng-container>
} {
<div [pBind]="ptm('header')" [ngClass]="cx('header')" [attr.data-pc-section]="'header'">
<ng-container *ngTemplateOutlet="headerTemplate || _headerTemplate"></ng-container>
<div *ngIf="header" [pBind]="ptm('title')" [class]="cx('title')">{{ header }}</div>
<p-button
*ngIf="showCloseIcon && closable"
[pt]="ptm('pcCloseButton')"
[ngClass]="cx('pcCloseButton')"
(onClick)="close($event)"
(keydown.enter)="close($event)"
[buttonProps]="closeButtonProps"
[ariaLabel]="ariaCloseLabel"
[attr.data-pc-group-section]="'iconcontainer'"
[unstyled]="unstyled()"
>
<ng-template #icon>
<svg data-p-icon="times" *ngIf="!closeIconTemplate && !_closeIconTemplate" [attr.data-pc-section]="'closeicon'" />
<ng-template *ngTemplateOutlet="closeIconTemplate || _closeIconTemplate"></ng-template>
</ng-template>
</p-button>
</div>
<div [pBind]="ptm('content')" [ngClass]="cx('content')" [attr.data-pc-section]="'content'">
<ng-content></ng-content>
<ng-container *ngTemplateOutlet="contentTemplate || _contentTemplate"></ng-container>
</div>
<ng-container *ngIf="footerTemplate || _footerTemplate">
<div [pBind]="ptm('footer')" [ngClass]="cx('footer')" [attr.data-pc-section]="'footer'">
<ng-container *ngTemplateOutlet="footerTemplate || _footerTemplate"></ng-container>
</div>
</ng-container>
}
</div>
}
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: Button, selector: "p-button", inputs: ["hostName", "type", "badge", "disabled", "raised", "rounded", "text", "plain", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "iconPos", "icon", "label", "loading", "loadingIcon", "severity", "buttonProps", "fluid"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: TimesIcon, selector: "[data-p-icon=\"times\"]" }, { kind: "ngmodule", type: SharedModule }, { kind: "directive", type: Bind, selector: "[pBind]", inputs: ["pBind"] }, { kind: "ngmodule", type: FocusTrapModule }, { kind: "directive", type: i3.FocusTrap, selector: "[pFocusTrap]", inputs: ["pFocusTrapDisabled"] }, { kind: "ngmodule", type: MotionModule }, { kind: "directive", type: i4.MotionDirective, selector: "[pMotion]", inputs: ["pMotion", "pMotionName", "pMotionType", "pMotionSafe", "pMotionDisabled", "pMotionAppear", "pMotionEnter", "pMotionLeave", "pMotionDuration", "pMotionHideStrategy", "pMotionEnterFromClass", "pMotionEnterToClass", "pMotionEnterActiveClass", "pMotionLeaveFromClass", "pMotionLeaveToClass", "pMotionLeaveActiveClass", "pMotionOptions"], outputs: ["pMotionOnBeforeEnter", "pMotionOnEnter", "pMotionOnAfterEnter", "pMotionOnEnterCancelled", "pMotionOnBeforeLeave", "pMotionOnLeave", "pMotionOnAfterLeave", "pMotionOnLeaveCancelled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: Drawer, decorators: [{
type: Component,
args: [{
selector: 'p-drawer',
standalone: true,
imports: [CommonModule, Button, TimesIcon, SharedModule, Bind, FocusTrapModule, MotionModule],
providers: [DrawerStyle, { provide: DRAWER_INSTANCE, useExisting: Drawer }, { provide: PARENT_INSTANCE, useExisting: Drawer }],
hostDirectives: [Bind],
template: `
(modalVisible) {
<div
#container
[pBind]="ptm('root')"
[pMotion]="visible"
[pMotionAppear]="true"
[pMotionEnterActiveClass]="$enterAnimation()"
[pMotionLeaveActiveClass]="$leaveAnimation()"
[pMotionOptions]="computedMotionOptions()"
(pMotionOnBeforeEnter)="onBeforeEnter($event)"
(pMotionOnAfterLeave)="onAfterLeave($event)"
[class]="cn(cx('root'), styleClass)"
[style]="style"
role="complementary"
(keydown)="onKeyDown($event)"
pFocusTrap
[attr.data-p]="dataP"
[attr.data-p-open]="visible"
>
(headlessTemplate || _headlessTemplate) {
<ng-container *ngTemplateOutlet="headlessTemplate || _headlessTemplate"></ng-container>
} {
<div [pBind]="ptm('header')" [ngClass]="cx('header')" [attr.data-pc-section]="'header'">
<ng-container *ngTemplateOutlet="headerTemplate || _headerTemplate"></ng-container>
<div *ngIf="header" [pBind]="ptm('title')" [class]="cx('title')">{{ header }}</div>
<p-button
*ngIf="showCloseIcon && closable"
[pt]="ptm('pcCloseButton')"
[ngClass]="cx('pcCloseButton')"
(onClick)="close($event)"
(keydown.enter)="close($event)"
[buttonProps]="closeButtonProps"
[ariaLabel]="ariaCloseLabel"
[attr.data-pc-group-section]="'iconcontainer'"
[unstyled]="unstyled()"
>
<ng-template #icon>
<svg data-p-icon="times" *ngIf="!closeIconTemplate && !_closeIconTemplate" [attr.data-pc-section]="'closeicon'" />
<ng-template *ngTemplateOutlet="closeIconTemplate || _closeIconTemplate"></ng-template>
</ng-template>
</p-button>
</div>
<div [pBind]="ptm('content')" [ngClass]="cx('content')" [attr.data-pc-section]="'content'">
<ng-content></ng-content>
<ng-container *ngTemplateOutlet="contentTemplate || _contentTemplate"></ng-container>
</div>
<ng-container *ngIf="footerTemplate || _footerTemplate">
<div [pBind]="ptm('footer')" [ngClass]="cx('footer')" [attr.data-pc-section]="'footer'">
<ng-container *ngTemplateOutlet="footerTemplate || _footerTemplate"></ng-container>
</div>
</ng-container>
}
</div>
}
`,
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None
}]
}], propDecorators: { appendTo: [{ type: i0.Input, args: [{ isSignal: true, alias: "appendTo", required: false }] }], motionOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "motionOptions", required: false }] }], blockScroll: [{
type: Input,
args: [{ transform: booleanAttribute }]
}], style: [{
type: Input
}], styleClass: [{
type: Input
}], ariaCloseLabel: [{
type: Input
}], autoZIndex: [{
type: Input,
args: [{ transform: booleanAttribute }]
}], baseZIndex: [{
type: Input,
args: [{ transform: numberAttribute }]
}], modal: [{
type: Input,
args: [{ transform: booleanAttribute }]
}], closeButtonProps: [{
type: Input
}], dismissible: [{
type: Input,
args: [{ transform: booleanAttribute }]
}], showCloseIcon: [{
type: Input,
args: [{ transform: booleanAttribute }]
}], closeOnEscape: [{
type: Input,
args: [{ transform: booleanAttribute }]
}], transitionOptions: [{
type: Input
}], visible: [{
type: Input
}], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], fullScreen: [{ type: i0.Input, args: [{ isSignal: true, alias: "fullScreen", required: false }] }], header: [{
type: Input
}], maskStyle: [{
type: Input
}], closable: [{
type: Input,
args: [{ transform: booleanAttribute }]
}], onShow: [{
type: Output
}], onHide: [{
type: Output
}], visibleChange: [{
type: Output
}], containerViewChild: [{
type: ViewChild,
args: ['container']
}], closeButtonViewChild: [{
type: ViewChild,
args: ['closeButton']
}], headerTemplate: [{
type: ContentChild,
args: ['header', { descendants: false }]
}], footerTemplate: [{
type: ContentChild,
args: ['footer', { descendants: false }]
}], contentTemplate: [{
type: ContentChild,
args: ['content', { descendants: false }]
}], closeIconTemplate: [{
type: ContentChild,
args: ['closeicon', { descendants: false }]
}], headlessTemplate: [{
type: ContentChild,
args: ['headless', { descendants: false }]
}], templates: [{
type: ContentChildren,
args: [PrimeTemplate]
}] } });
class DrawerModule {
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: DrawerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.0.5", ngImport: i0, type: DrawerModule, imports: [Drawer, SharedModule], exports: [Drawer, SharedModule] });
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: DrawerModule, imports: [Drawer, SharedModule, SharedModule] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: DrawerModule, decorators: [{
type: NgModule,
args: [{
imports: [Drawer, SharedModule],
exports: [Drawer, SharedModule]
}]
}] });
/**
* Generated bundle index. Do not edit.
*/
export { Drawer, DrawerClasses, DrawerModule, DrawerStyle };
//# sourceMappingURL=primeng-drawer.mjs.map