[59329aa] | 1 | import * as i0 from '@angular/core';
|
---|
| 2 | import { EventEmitter, Component, ChangeDetectionStrategy, ViewEncapsulation, Input, Output, ContentChild, ViewChild, ContentChildren, NgModule } from '@angular/core';
|
---|
| 3 | import { animation, style, animate, trigger, transition, useAnimation } from '@angular/animations';
|
---|
| 4 | import * as i2 from '@angular/common';
|
---|
| 5 | import { CommonModule } from '@angular/common';
|
---|
| 6 | import { DomHandler } from 'primeng/dom';
|
---|
| 7 | import * as i1 from 'primeng/api';
|
---|
| 8 | import { ConfirmEventType, TranslationKeys, Footer, PrimeTemplate, SharedModule } from 'primeng/api';
|
---|
| 9 | import * as i4 from 'primeng/button';
|
---|
| 10 | import { ButtonModule } from 'primeng/button';
|
---|
| 11 | import { UniqueComponentId, ZIndexUtils } from 'primeng/utils';
|
---|
| 12 | import * as i3 from 'primeng/ripple';
|
---|
| 13 | import { RippleModule } from 'primeng/ripple';
|
---|
| 14 |
|
---|
| 15 | const showAnimation = animation([
|
---|
| 16 | style({ transform: '{{transform}}', opacity: 0 }),
|
---|
| 17 | animate('{{transition}}', style({ transform: 'none', opacity: 1 }))
|
---|
| 18 | ]);
|
---|
| 19 | const hideAnimation = animation([
|
---|
| 20 | animate('{{transition}}', style({ transform: '{{transform}}', opacity: 0 }))
|
---|
| 21 | ]);
|
---|
| 22 | class ConfirmDialog {
|
---|
| 23 | constructor(el, renderer, confirmationService, zone, cd, config) {
|
---|
| 24 | this.el = el;
|
---|
| 25 | this.renderer = renderer;
|
---|
| 26 | this.confirmationService = confirmationService;
|
---|
| 27 | this.zone = zone;
|
---|
| 28 | this.cd = cd;
|
---|
| 29 | this.config = config;
|
---|
| 30 | this.acceptIcon = 'pi pi-check';
|
---|
| 31 | this.acceptVisible = true;
|
---|
| 32 | this.rejectIcon = 'pi pi-times';
|
---|
| 33 | this.rejectVisible = true;
|
---|
| 34 | this.closeOnEscape = true;
|
---|
| 35 | this.blockScroll = true;
|
---|
| 36 | this.closable = true;
|
---|
| 37 | this.autoZIndex = true;
|
---|
| 38 | this.baseZIndex = 0;
|
---|
| 39 | this.transitionOptions = '150ms cubic-bezier(0, 0, 0.2, 1)';
|
---|
| 40 | this.focusTrap = true;
|
---|
| 41 | this.defaultFocus = 'accept';
|
---|
| 42 | this.onHide = new EventEmitter();
|
---|
| 43 | this._position = "center";
|
---|
| 44 | this.transformOptions = "scale(0.7)";
|
---|
| 45 | this.id = UniqueComponentId();
|
---|
| 46 | this.subscription = this.confirmationService.requireConfirmation$.subscribe(confirmation => {
|
---|
| 47 | if (!confirmation) {
|
---|
| 48 | this.hide();
|
---|
| 49 | return;
|
---|
| 50 | }
|
---|
| 51 | if (confirmation.key === this.key) {
|
---|
| 52 | this.confirmation = confirmation;
|
---|
| 53 | this.confirmationOptions = {
|
---|
| 54 | message: this.confirmation.message || this.message,
|
---|
| 55 | icon: this.confirmation.icon || this.icon,
|
---|
| 56 | header: this.confirmation.header || this.header,
|
---|
| 57 | rejectVisible: this.confirmation.rejectVisible == null ? this.rejectVisible : this.confirmation.rejectVisible,
|
---|
| 58 | acceptVisible: this.confirmation.acceptVisible == null ? this.acceptVisible : this.confirmation.acceptVisible,
|
---|
| 59 | acceptLabel: this.confirmation.acceptLabel || this.acceptLabel,
|
---|
| 60 | rejectLabel: this.confirmation.rejectLabel || this.rejectLabel,
|
---|
| 61 | acceptIcon: this.confirmation.acceptIcon || this.acceptIcon,
|
---|
| 62 | rejectIcon: this.confirmation.rejectIcon || this.rejectIcon,
|
---|
| 63 | acceptButtonStyleClass: this.confirmation.acceptButtonStyleClass || this.acceptButtonStyleClass,
|
---|
| 64 | rejectButtonStyleClass: this.confirmation.rejectButtonStyleClass || this.rejectButtonStyleClass,
|
---|
| 65 | defaultFocus: this.confirmation.defaultFocus || this.defaultFocus,
|
---|
| 66 | blockScroll: (this.confirmation.blockScroll === false || this.confirmation.blockScroll === true) ? this.confirmation.blockScroll : this.blockScroll,
|
---|
| 67 | closeOnEscape: (this.confirmation.closeOnEscape === false || this.confirmation.closeOnEscape === true) ? this.confirmation.closeOnEscape : this.closeOnEscape,
|
---|
| 68 | dismissableMask: (this.confirmation.dismissableMask === false || this.confirmation.dismissableMask === true) ? this.confirmation.dismissableMask : this.dismissableMask
|
---|
| 69 | };
|
---|
| 70 | if (this.confirmation.accept) {
|
---|
| 71 | this.confirmation.acceptEvent = new EventEmitter();
|
---|
| 72 | this.confirmation.acceptEvent.subscribe(this.confirmation.accept);
|
---|
| 73 | }
|
---|
| 74 | if (this.confirmation.reject) {
|
---|
| 75 | this.confirmation.rejectEvent = new EventEmitter();
|
---|
| 76 | this.confirmation.rejectEvent.subscribe(this.confirmation.reject);
|
---|
| 77 | }
|
---|
| 78 | this.visible = true;
|
---|
| 79 | }
|
---|
| 80 | });
|
---|
| 81 | }
|
---|
| 82 | get visible() {
|
---|
| 83 | return this._visible;
|
---|
| 84 | }
|
---|
| 85 | set visible(value) {
|
---|
| 86 | this._visible = value;
|
---|
| 87 | if (this._visible && !this.maskVisible) {
|
---|
| 88 | this.maskVisible = true;
|
---|
| 89 | }
|
---|
| 90 | this.cd.markForCheck();
|
---|
| 91 | }
|
---|
| 92 | get position() {
|
---|
| 93 | return this._position;
|
---|
| 94 | }
|
---|
| 95 | ;
|
---|
| 96 | set position(value) {
|
---|
| 97 | this._position = value;
|
---|
| 98 | switch (value) {
|
---|
| 99 | case 'top-left':
|
---|
| 100 | case 'bottom-left':
|
---|
| 101 | case 'left':
|
---|
| 102 | this.transformOptions = "translate3d(-100%, 0px, 0px)";
|
---|
| 103 | break;
|
---|
| 104 | case 'top-right':
|
---|
| 105 | case 'bottom-right':
|
---|
| 106 | case 'right':
|
---|
| 107 | this.transformOptions = "translate3d(100%, 0px, 0px)";
|
---|
| 108 | break;
|
---|
| 109 | case 'bottom':
|
---|
| 110 | this.transformOptions = "translate3d(0px, 100%, 0px)";
|
---|
| 111 | break;
|
---|
| 112 | case 'top':
|
---|
| 113 | this.transformOptions = "translate3d(0px, -100%, 0px)";
|
---|
| 114 | break;
|
---|
| 115 | default:
|
---|
| 116 | this.transformOptions = "scale(0.7)";
|
---|
| 117 | break;
|
---|
| 118 | }
|
---|
| 119 | }
|
---|
| 120 | ngAfterContentInit() {
|
---|
| 121 | this.templates.forEach((item) => {
|
---|
| 122 | switch (item.getType()) {
|
---|
| 123 | case 'header':
|
---|
| 124 | this.headerTemplate = item.template;
|
---|
| 125 | break;
|
---|
| 126 | case 'footer':
|
---|
| 127 | this.footerTemplate = item.template;
|
---|
| 128 | break;
|
---|
| 129 | }
|
---|
| 130 | });
|
---|
| 131 | }
|
---|
| 132 | ngOnInit() {
|
---|
| 133 | if (this.breakpoints) {
|
---|
| 134 | this.createStyle();
|
---|
| 135 | }
|
---|
| 136 | this.translationSubscription = this.config.translationObserver.subscribe(() => {
|
---|
| 137 | if (this.visible) {
|
---|
| 138 | this.cd.markForCheck();
|
---|
| 139 | }
|
---|
| 140 | });
|
---|
| 141 | }
|
---|
| 142 | option(name) {
|
---|
| 143 | const source = this.confirmationOptions || this;
|
---|
| 144 | if (source.hasOwnProperty(name)) {
|
---|
| 145 | return source[name];
|
---|
| 146 | }
|
---|
| 147 | return undefined;
|
---|
| 148 | }
|
---|
| 149 | onAnimationStart(event) {
|
---|
| 150 | switch (event.toState) {
|
---|
| 151 | case 'visible':
|
---|
| 152 | this.container = event.element;
|
---|
| 153 | this.wrapper = this.container.parentElement;
|
---|
| 154 | this.contentContainer = DomHandler.findSingle(this.container, '.p-dialog-content');
|
---|
| 155 | this.container.setAttribute(this.id, '');
|
---|
| 156 | this.appendContainer();
|
---|
| 157 | this.moveOnTop();
|
---|
| 158 | this.bindGlobalListeners();
|
---|
| 159 | this.enableModality();
|
---|
| 160 | const element = this.getElementToFocus();
|
---|
| 161 | if (element) {
|
---|
| 162 | element.focus();
|
---|
| 163 | }
|
---|
| 164 | break;
|
---|
| 165 | }
|
---|
| 166 | }
|
---|
| 167 | onAnimationEnd(event) {
|
---|
| 168 | switch (event.toState) {
|
---|
| 169 | case 'void':
|
---|
| 170 | this.onOverlayHide();
|
---|
| 171 | break;
|
---|
| 172 | }
|
---|
| 173 | }
|
---|
| 174 | getElementToFocus() {
|
---|
| 175 | switch (this.option('defaultFocus')) {
|
---|
| 176 | case 'accept':
|
---|
| 177 | return DomHandler.findSingle(this.container, '.p-confirm-dialog-accept');
|
---|
| 178 | case 'reject':
|
---|
| 179 | return DomHandler.findSingle(this.container, '.p-confirm-dialog-reject');
|
---|
| 180 | case 'close':
|
---|
| 181 | return DomHandler.findSingle(this.container, '.p-dialog-header-close');
|
---|
| 182 | case 'none':
|
---|
| 183 | return null;
|
---|
| 184 | //backward compatibility
|
---|
| 185 | default:
|
---|
| 186 | return DomHandler.findSingle(this.container, '.p-confirm-dialog-accept');
|
---|
| 187 | }
|
---|
| 188 | }
|
---|
| 189 | appendContainer() {
|
---|
| 190 | if (this.appendTo) {
|
---|
| 191 | if (this.appendTo === 'body')
|
---|
| 192 | document.body.appendChild(this.wrapper);
|
---|
| 193 | else
|
---|
| 194 | DomHandler.appendChild(this.wrapper, this.appendTo);
|
---|
| 195 | }
|
---|
| 196 | }
|
---|
| 197 | restoreAppend() {
|
---|
| 198 | if (this.wrapper && this.appendTo) {
|
---|
| 199 | this.el.nativeElement.appendChild(this.wrapper);
|
---|
| 200 | }
|
---|
| 201 | }
|
---|
| 202 | enableModality() {
|
---|
| 203 | if (this.option('blockScroll')) {
|
---|
| 204 | DomHandler.addClass(document.body, 'p-overflow-hidden');
|
---|
| 205 | }
|
---|
| 206 | if (this.option('dismissableMask')) {
|
---|
| 207 | this.maskClickListener = this.renderer.listen(this.wrapper, 'mousedown', (event) => {
|
---|
| 208 | if (this.wrapper && this.wrapper.isSameNode(event.target)) {
|
---|
| 209 | this.close(event);
|
---|
| 210 | }
|
---|
| 211 | });
|
---|
| 212 | }
|
---|
| 213 | }
|
---|
| 214 | disableModality() {
|
---|
| 215 | this.maskVisible = false;
|
---|
| 216 | if (this.option('blockScroll')) {
|
---|
| 217 | DomHandler.removeClass(document.body, 'p-overflow-hidden');
|
---|
| 218 | }
|
---|
| 219 | if (this.dismissableMask) {
|
---|
| 220 | this.unbindMaskClickListener();
|
---|
| 221 | }
|
---|
| 222 | if (this.container && !this.cd['destroyed']) {
|
---|
| 223 | this.cd.detectChanges();
|
---|
| 224 | }
|
---|
| 225 | }
|
---|
| 226 | createStyle() {
|
---|
| 227 | if (!this.styleElement) {
|
---|
| 228 | this.styleElement = document.createElement('style');
|
---|
| 229 | this.styleElement.type = 'text/css';
|
---|
| 230 | document.head.appendChild(this.styleElement);
|
---|
| 231 | let innerHTML = '';
|
---|
| 232 | for (let breakpoint in this.breakpoints) {
|
---|
| 233 | innerHTML += `
|
---|
| 234 | @media screen and (max-width: ${breakpoint}) {
|
---|
| 235 | .p-dialog[${this.id}] {
|
---|
| 236 | width: ${this.breakpoints[breakpoint]} !important;
|
---|
| 237 | }
|
---|
| 238 | }
|
---|
| 239 | `;
|
---|
| 240 | }
|
---|
| 241 | this.styleElement.innerHTML = innerHTML;
|
---|
| 242 | }
|
---|
| 243 | }
|
---|
| 244 | close(event) {
|
---|
| 245 | if (this.confirmation.rejectEvent) {
|
---|
| 246 | this.confirmation.rejectEvent.emit(ConfirmEventType.CANCEL);
|
---|
| 247 | }
|
---|
| 248 | this.hide(ConfirmEventType.CANCEL);
|
---|
| 249 | event.preventDefault();
|
---|
| 250 | }
|
---|
| 251 | hide(type) {
|
---|
| 252 | this.onHide.emit(type);
|
---|
| 253 | this.visible = false;
|
---|
| 254 | this.confirmation = null;
|
---|
| 255 | this.confirmationOptions = null;
|
---|
| 256 | }
|
---|
| 257 | moveOnTop() {
|
---|
| 258 | if (this.autoZIndex) {
|
---|
| 259 | ZIndexUtils.set('modal', this.container, this.baseZIndex + this.config.zIndex.modal);
|
---|
| 260 | this.wrapper.style.zIndex = String(parseInt(this.container.style.zIndex, 10) - 1);
|
---|
| 261 | }
|
---|
| 262 | }
|
---|
| 263 | getMaskClass() {
|
---|
| 264 | let maskClass = { 'p-dialog-mask p-component-overlay': true, 'p-dialog-mask-scrollblocker': this.blockScroll };
|
---|
| 265 | maskClass[this.getPositionClass().toString()] = true;
|
---|
| 266 | return maskClass;
|
---|
| 267 | }
|
---|
| 268 | getPositionClass() {
|
---|
| 269 | const positions = ['left', 'right', 'top', 'top-left', 'top-right', 'bottom', 'bottom-left', 'bottom-right'];
|
---|
| 270 | const pos = positions.find(item => item === this.position);
|
---|
| 271 | return pos ? `p-dialog-${pos}` : '';
|
---|
| 272 | }
|
---|
| 273 | bindGlobalListeners() {
|
---|
| 274 | if ((this.option('closeOnEscape') && this.closable) || this.focusTrap && !this.documentEscapeListener) {
|
---|
| 275 | const documentTarget = this.el ? this.el.nativeElement.ownerDocument : 'document';
|
---|
| 276 | this.documentEscapeListener = this.renderer.listen(documentTarget, 'keydown', (event) => {
|
---|
| 277 | if (event.which == 27 && (this.option('closeOnEscape') && this.closable)) {
|
---|
| 278 | if (parseInt(this.container.style.zIndex) === ZIndexUtils.get(this.container) && this.visible) {
|
---|
| 279 | this.close(event);
|
---|
| 280 | }
|
---|
| 281 | }
|
---|
| 282 | if (event.which === 9 && this.focusTrap) {
|
---|
| 283 | event.preventDefault();
|
---|
| 284 | let focusableElements = DomHandler.getFocusableElements(this.container);
|
---|
| 285 | if (focusableElements && focusableElements.length > 0) {
|
---|
| 286 | if (!focusableElements[0].ownerDocument.activeElement) {
|
---|
| 287 | focusableElements[0].focus();
|
---|
| 288 | }
|
---|
| 289 | else {
|
---|
| 290 | let focusedIndex = focusableElements.indexOf(focusableElements[0].ownerDocument.activeElement);
|
---|
| 291 | if (event.shiftKey) {
|
---|
| 292 | if (focusedIndex == -1 || focusedIndex === 0)
|
---|
| 293 | focusableElements[focusableElements.length - 1].focus();
|
---|
| 294 | else
|
---|
| 295 | focusableElements[focusedIndex - 1].focus();
|
---|
| 296 | }
|
---|
| 297 | else {
|
---|
| 298 | if (focusedIndex == -1 || focusedIndex === (focusableElements.length - 1))
|
---|
| 299 | focusableElements[0].focus();
|
---|
| 300 | else
|
---|
| 301 | focusableElements[focusedIndex + 1].focus();
|
---|
| 302 | }
|
---|
| 303 | }
|
---|
| 304 | }
|
---|
| 305 | }
|
---|
| 306 | });
|
---|
| 307 | }
|
---|
| 308 | }
|
---|
| 309 | unbindGlobalListeners() {
|
---|
| 310 | if (this.documentEscapeListener) {
|
---|
| 311 | this.documentEscapeListener();
|
---|
| 312 | this.documentEscapeListener = null;
|
---|
| 313 | }
|
---|
| 314 | }
|
---|
| 315 | unbindMaskClickListener() {
|
---|
| 316 | if (this.maskClickListener) {
|
---|
| 317 | this.maskClickListener();
|
---|
| 318 | this.maskClickListener = null;
|
---|
| 319 | }
|
---|
| 320 | }
|
---|
| 321 | onOverlayHide() {
|
---|
| 322 | if (this.container && this.autoZIndex) {
|
---|
| 323 | ZIndexUtils.clear(this.container);
|
---|
| 324 | }
|
---|
| 325 | this.disableModality();
|
---|
| 326 | this.unbindGlobalListeners();
|
---|
| 327 | this.container = null;
|
---|
| 328 | }
|
---|
| 329 | destroyStyle() {
|
---|
| 330 | if (this.styleElement) {
|
---|
| 331 | document.head.removeChild(this.styleElement);
|
---|
| 332 | this.styleElement = null;
|
---|
| 333 | }
|
---|
| 334 | }
|
---|
| 335 | ngOnDestroy() {
|
---|
| 336 | this.restoreAppend();
|
---|
| 337 | this.onOverlayHide();
|
---|
| 338 | this.subscription.unsubscribe();
|
---|
| 339 | if (this.translationSubscription) {
|
---|
| 340 | this.translationSubscription.unsubscribe();
|
---|
| 341 | }
|
---|
| 342 | this.destroyStyle();
|
---|
| 343 | }
|
---|
| 344 | accept() {
|
---|
| 345 | if (this.confirmation && this.confirmation.acceptEvent) {
|
---|
| 346 | this.confirmation.acceptEvent.emit();
|
---|
| 347 | }
|
---|
| 348 | this.hide(ConfirmEventType.ACCEPT);
|
---|
| 349 | }
|
---|
| 350 | reject() {
|
---|
| 351 | if (this.confirmation && this.confirmation.rejectEvent) {
|
---|
| 352 | this.confirmation.rejectEvent.emit(ConfirmEventType.REJECT);
|
---|
| 353 | }
|
---|
| 354 | this.hide(ConfirmEventType.REJECT);
|
---|
| 355 | }
|
---|
| 356 | get acceptButtonLabel() {
|
---|
| 357 | return this.option('acceptLabel') || this.config.getTranslation(TranslationKeys.ACCEPT);
|
---|
| 358 | }
|
---|
| 359 | get rejectButtonLabel() {
|
---|
| 360 | return this.option('rejectLabel') || this.config.getTranslation(TranslationKeys.REJECT);
|
---|
| 361 | }
|
---|
| 362 | }
|
---|
| 363 | ConfirmDialog.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: ConfirmDialog, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i1.ConfirmationService }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }, { token: i1.PrimeNGConfig }], target: i0.ɵɵFactoryTarget.Component });
|
---|
| 364 | ConfirmDialog.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.0", type: ConfirmDialog, selector: "p-confirmDialog", inputs: { header: "header", icon: "icon", message: "message", style: "style", styleClass: "styleClass", maskStyleClass: "maskStyleClass", acceptIcon: "acceptIcon", acceptLabel: "acceptLabel", acceptAriaLabel: "acceptAriaLabel", acceptVisible: "acceptVisible", rejectIcon: "rejectIcon", rejectLabel: "rejectLabel", rejectAriaLabel: "rejectAriaLabel", rejectVisible: "rejectVisible", acceptButtonStyleClass: "acceptButtonStyleClass", rejectButtonStyleClass: "rejectButtonStyleClass", closeOnEscape: "closeOnEscape", dismissableMask: "dismissableMask", blockScroll: "blockScroll", rtl: "rtl", closable: "closable", appendTo: "appendTo", key: "key", autoZIndex: "autoZIndex", baseZIndex: "baseZIndex", transitionOptions: "transitionOptions", focusTrap: "focusTrap", defaultFocus: "defaultFocus", breakpoints: "breakpoints", visible: "visible", position: "position" }, outputs: { onHide: "onHide" }, host: { classAttribute: "p-element" }, queries: [{ propertyName: "footer", first: true, predicate: Footer, descendants: true }, { propertyName: "templates", predicate: PrimeTemplate }], viewQueries: [{ propertyName: "contentViewChild", first: true, predicate: ["content"], descendants: true }], ngImport: i0, template: `
|
---|
| 365 | <div [class]="maskStyleClass" [ngClass]="getMaskClass()" *ngIf="maskVisible">
|
---|
| 366 | <div [ngClass]="{'p-dialog p-confirm-dialog p-component':true,'p-dialog-rtl':rtl}" [ngStyle]="style" [class]="styleClass" (mousedown)="moveOnTop()"
|
---|
| 367 | [@animation]="{value: 'visible', params: {transform: transformOptions, transition: transitionOptions}}" (@animation.start)="onAnimationStart($event)" (@animation.done)="onAnimationEnd($event)" *ngIf="visible">
|
---|
| 368 | <div class="p-dialog-header" *ngIf="headerTemplate">
|
---|
| 369 | <ng-container *ngTemplateOutlet="headerTemplate"></ng-container>
|
---|
| 370 | </div>
|
---|
| 371 | <div class="p-dialog-header" *ngIf="!headerTemplate">
|
---|
| 372 | <span class="p-dialog-title" *ngIf="option('header')">{{option('header')}}</span>
|
---|
| 373 | <div class="p-dialog-header-icons">
|
---|
| 374 | <button *ngIf="closable" type="button" [ngClass]="{'p-dialog-header-icon p-dialog-header-close p-link':true}" (click)="close($event)" (keydown.enter)="close($event)">
|
---|
| 375 | <span class="pi pi-times"></span>
|
---|
| 376 | </button>
|
---|
| 377 | </div>
|
---|
| 378 | </div>
|
---|
| 379 | <div #content class="p-dialog-content">
|
---|
| 380 | <i [ngClass]="'p-confirm-dialog-icon'" [class]="option('icon')" *ngIf="option('icon')"></i>
|
---|
| 381 | <span class="p-confirm-dialog-message" [innerHTML]="option('message')"></span>
|
---|
| 382 | </div>
|
---|
| 383 | <div class="p-dialog-footer" *ngIf="footer || footerTemplate">
|
---|
| 384 | <ng-content select="p-footer"></ng-content>
|
---|
| 385 | <ng-container *ngTemplateOutlet="footerTemplate"></ng-container>
|
---|
| 386 | </div>
|
---|
| 387 | <div class="p-dialog-footer" *ngIf="!footer && !footerTemplate">
|
---|
| 388 | <button type="button" pRipple pButton [icon]="option('rejectIcon')" [label]="rejectButtonLabel" (click)="reject()" [ngClass]="'p-confirm-dialog-reject'" [class]="option('rejectButtonStyleClass')" *ngIf="option('rejectVisible')" [attr.aria-label]="rejectAriaLabel"></button>
|
---|
| 389 | <button type="button" pRipple pButton [icon]="option('acceptIcon')" [label]="acceptButtonLabel" (click)="accept()" [ngClass]="'p-confirm-dialog-accept'" [class]="option('acceptButtonStyleClass')" *ngIf="option('acceptVisible')" [attr.aria-label]="acceptAriaLabel"></button>
|
---|
| 390 | </div>
|
---|
| 391 | </div>
|
---|
| 392 | </div>
|
---|
| 393 | `, isInline: true, styles: [".p-dialog-mask{position:fixed;top:0;left:0;width:100%;height:100%;display:flex;justify-content:center;align-items:center;pointer-events:none}.p-dialog-mask.p-component-overlay{pointer-events:auto}.p-dialog{display:flex;flex-direction:column;pointer-events:auto;max-height:90%;transform:scale(1);position:relative}.p-dialog-content{overflow-y:auto;flex-grow:1}.p-dialog-header{display:flex;align-items:center;justify-content:space-between;flex-shrink:0}.p-dialog-footer{flex-shrink:0}.p-dialog .p-dialog-header-icons{display:flex;align-items:center}.p-dialog .p-dialog-header-icon{display:flex;align-items:center;justify-content:center;overflow:hidden;position:relative}.p-fluid .p-dialog-footer .p-button{width:auto}.p-dialog-top .p-dialog,.p-dialog-bottom .p-dialog,.p-dialog-left .p-dialog,.p-dialog-right .p-dialog,.p-dialog-top-left .p-dialog,.p-dialog-top-right .p-dialog,.p-dialog-bottom-left .p-dialog,.p-dialog-bottom-right .p-dialog{margin:.75rem;transform:translate(0)}.p-dialog-maximized{transition:none;transform:none;width:100vw!important;height:100vh!important;top:0px!important;left:0px!important;max-height:100%;height:100%}.p-dialog-maximized .p-dialog-content{flex-grow:1}.p-dialog-left{justify-content:flex-start}.p-dialog-right{justify-content:flex-end}.p-dialog-top{align-items:flex-start}.p-dialog-top-left{justify-content:flex-start;align-items:flex-start}.p-dialog-top-right{justify-content:flex-end;align-items:flex-start}.p-dialog-bottom{align-items:flex-end}.p-dialog-bottom-left{justify-content:flex-start;align-items:flex-end}.p-dialog-bottom-right{justify-content:flex-end;align-items:flex-end}.p-dialog .p-resizable-handle{position:absolute;font-size:.1px;display:block;cursor:se-resize;width:12px;height:12px;right:1px;bottom:1px}.p-confirm-dialog .p-dialog-content{display:flex;align-items:center}\n"], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i3.Ripple, selector: "[pRipple]" }, { type: i4.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }], animations: [
|
---|
| 394 | trigger('animation', [
|
---|
| 395 | transition('void => visible', [
|
---|
| 396 | useAnimation(showAnimation)
|
---|
| 397 | ]),
|
---|
| 398 | transition('visible => void', [
|
---|
| 399 | useAnimation(hideAnimation)
|
---|
| 400 | ])
|
---|
| 401 | ])
|
---|
| 402 | ], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
---|
| 403 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: ConfirmDialog, decorators: [{
|
---|
| 404 | type: Component,
|
---|
| 405 | args: [{ selector: 'p-confirmDialog', template: `
|
---|
| 406 | <div [class]="maskStyleClass" [ngClass]="getMaskClass()" *ngIf="maskVisible">
|
---|
| 407 | <div [ngClass]="{'p-dialog p-confirm-dialog p-component':true,'p-dialog-rtl':rtl}" [ngStyle]="style" [class]="styleClass" (mousedown)="moveOnTop()"
|
---|
| 408 | [@animation]="{value: 'visible', params: {transform: transformOptions, transition: transitionOptions}}" (@animation.start)="onAnimationStart($event)" (@animation.done)="onAnimationEnd($event)" *ngIf="visible">
|
---|
| 409 | <div class="p-dialog-header" *ngIf="headerTemplate">
|
---|
| 410 | <ng-container *ngTemplateOutlet="headerTemplate"></ng-container>
|
---|
| 411 | </div>
|
---|
| 412 | <div class="p-dialog-header" *ngIf="!headerTemplate">
|
---|
| 413 | <span class="p-dialog-title" *ngIf="option('header')">{{option('header')}}</span>
|
---|
| 414 | <div class="p-dialog-header-icons">
|
---|
| 415 | <button *ngIf="closable" type="button" [ngClass]="{'p-dialog-header-icon p-dialog-header-close p-link':true}" (click)="close($event)" (keydown.enter)="close($event)">
|
---|
| 416 | <span class="pi pi-times"></span>
|
---|
| 417 | </button>
|
---|
| 418 | </div>
|
---|
| 419 | </div>
|
---|
| 420 | <div #content class="p-dialog-content">
|
---|
| 421 | <i [ngClass]="'p-confirm-dialog-icon'" [class]="option('icon')" *ngIf="option('icon')"></i>
|
---|
| 422 | <span class="p-confirm-dialog-message" [innerHTML]="option('message')"></span>
|
---|
| 423 | </div>
|
---|
| 424 | <div class="p-dialog-footer" *ngIf="footer || footerTemplate">
|
---|
| 425 | <ng-content select="p-footer"></ng-content>
|
---|
| 426 | <ng-container *ngTemplateOutlet="footerTemplate"></ng-container>
|
---|
| 427 | </div>
|
---|
| 428 | <div class="p-dialog-footer" *ngIf="!footer && !footerTemplate">
|
---|
| 429 | <button type="button" pRipple pButton [icon]="option('rejectIcon')" [label]="rejectButtonLabel" (click)="reject()" [ngClass]="'p-confirm-dialog-reject'" [class]="option('rejectButtonStyleClass')" *ngIf="option('rejectVisible')" [attr.aria-label]="rejectAriaLabel"></button>
|
---|
| 430 | <button type="button" pRipple pButton [icon]="option('acceptIcon')" [label]="acceptButtonLabel" (click)="accept()" [ngClass]="'p-confirm-dialog-accept'" [class]="option('acceptButtonStyleClass')" *ngIf="option('acceptVisible')" [attr.aria-label]="acceptAriaLabel"></button>
|
---|
| 431 | </div>
|
---|
| 432 | </div>
|
---|
| 433 | </div>
|
---|
| 434 | `, animations: [
|
---|
| 435 | trigger('animation', [
|
---|
| 436 | transition('void => visible', [
|
---|
| 437 | useAnimation(showAnimation)
|
---|
| 438 | ]),
|
---|
| 439 | transition('visible => void', [
|
---|
| 440 | useAnimation(hideAnimation)
|
---|
| 441 | ])
|
---|
| 442 | ])
|
---|
| 443 | ], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
---|
| 444 | 'class': 'p-element'
|
---|
| 445 | }, styles: [".p-dialog-mask{position:fixed;top:0;left:0;width:100%;height:100%;display:flex;justify-content:center;align-items:center;pointer-events:none}.p-dialog-mask.p-component-overlay{pointer-events:auto}.p-dialog{display:flex;flex-direction:column;pointer-events:auto;max-height:90%;transform:scale(1);position:relative}.p-dialog-content{overflow-y:auto;flex-grow:1}.p-dialog-header{display:flex;align-items:center;justify-content:space-between;flex-shrink:0}.p-dialog-footer{flex-shrink:0}.p-dialog .p-dialog-header-icons{display:flex;align-items:center}.p-dialog .p-dialog-header-icon{display:flex;align-items:center;justify-content:center;overflow:hidden;position:relative}.p-fluid .p-dialog-footer .p-button{width:auto}.p-dialog-top .p-dialog,.p-dialog-bottom .p-dialog,.p-dialog-left .p-dialog,.p-dialog-right .p-dialog,.p-dialog-top-left .p-dialog,.p-dialog-top-right .p-dialog,.p-dialog-bottom-left .p-dialog,.p-dialog-bottom-right .p-dialog{margin:.75rem;transform:translate(0)}.p-dialog-maximized{transition:none;transform:none;width:100vw!important;height:100vh!important;top:0px!important;left:0px!important;max-height:100%;height:100%}.p-dialog-maximized .p-dialog-content{flex-grow:1}.p-dialog-left{justify-content:flex-start}.p-dialog-right{justify-content:flex-end}.p-dialog-top{align-items:flex-start}.p-dialog-top-left{justify-content:flex-start;align-items:flex-start}.p-dialog-top-right{justify-content:flex-end;align-items:flex-start}.p-dialog-bottom{align-items:flex-end}.p-dialog-bottom-left{justify-content:flex-start;align-items:flex-end}.p-dialog-bottom-right{justify-content:flex-end;align-items:flex-end}.p-dialog .p-resizable-handle{position:absolute;font-size:.1px;display:block;cursor:se-resize;width:12px;height:12px;right:1px;bottom:1px}.p-confirm-dialog .p-dialog-content{display:flex;align-items:center}\n"] }]
|
---|
| 446 | }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i1.ConfirmationService }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }, { type: i1.PrimeNGConfig }]; }, propDecorators: { header: [{
|
---|
| 447 | type: Input
|
---|
| 448 | }], icon: [{
|
---|
| 449 | type: Input
|
---|
| 450 | }], message: [{
|
---|
| 451 | type: Input
|
---|
| 452 | }], style: [{
|
---|
| 453 | type: Input
|
---|
| 454 | }], styleClass: [{
|
---|
| 455 | type: Input
|
---|
| 456 | }], maskStyleClass: [{
|
---|
| 457 | type: Input
|
---|
| 458 | }], acceptIcon: [{
|
---|
| 459 | type: Input
|
---|
| 460 | }], acceptLabel: [{
|
---|
| 461 | type: Input
|
---|
| 462 | }], acceptAriaLabel: [{
|
---|
| 463 | type: Input
|
---|
| 464 | }], acceptVisible: [{
|
---|
| 465 | type: Input
|
---|
| 466 | }], rejectIcon: [{
|
---|
| 467 | type: Input
|
---|
| 468 | }], rejectLabel: [{
|
---|
| 469 | type: Input
|
---|
| 470 | }], rejectAriaLabel: [{
|
---|
| 471 | type: Input
|
---|
| 472 | }], rejectVisible: [{
|
---|
| 473 | type: Input
|
---|
| 474 | }], acceptButtonStyleClass: [{
|
---|
| 475 | type: Input
|
---|
| 476 | }], rejectButtonStyleClass: [{
|
---|
| 477 | type: Input
|
---|
| 478 | }], closeOnEscape: [{
|
---|
| 479 | type: Input
|
---|
| 480 | }], dismissableMask: [{
|
---|
| 481 | type: Input
|
---|
| 482 | }], blockScroll: [{
|
---|
| 483 | type: Input
|
---|
| 484 | }], rtl: [{
|
---|
| 485 | type: Input
|
---|
| 486 | }], closable: [{
|
---|
| 487 | type: Input
|
---|
| 488 | }], appendTo: [{
|
---|
| 489 | type: Input
|
---|
| 490 | }], key: [{
|
---|
| 491 | type: Input
|
---|
| 492 | }], autoZIndex: [{
|
---|
| 493 | type: Input
|
---|
| 494 | }], baseZIndex: [{
|
---|
| 495 | type: Input
|
---|
| 496 | }], transitionOptions: [{
|
---|
| 497 | type: Input
|
---|
| 498 | }], focusTrap: [{
|
---|
| 499 | type: Input
|
---|
| 500 | }], defaultFocus: [{
|
---|
| 501 | type: Input
|
---|
| 502 | }], breakpoints: [{
|
---|
| 503 | type: Input
|
---|
| 504 | }], visible: [{
|
---|
| 505 | type: Input
|
---|
| 506 | }], position: [{
|
---|
| 507 | type: Input
|
---|
| 508 | }], onHide: [{
|
---|
| 509 | type: Output
|
---|
| 510 | }], footer: [{
|
---|
| 511 | type: ContentChild,
|
---|
| 512 | args: [Footer]
|
---|
| 513 | }], contentViewChild: [{
|
---|
| 514 | type: ViewChild,
|
---|
| 515 | args: ['content']
|
---|
| 516 | }], templates: [{
|
---|
| 517 | type: ContentChildren,
|
---|
| 518 | args: [PrimeTemplate]
|
---|
| 519 | }] } });
|
---|
| 520 | class ConfirmDialogModule {
|
---|
| 521 | }
|
---|
| 522 | ConfirmDialogModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: ConfirmDialogModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
---|
| 523 | ConfirmDialogModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: ConfirmDialogModule, declarations: [ConfirmDialog], imports: [CommonModule, ButtonModule, RippleModule], exports: [ConfirmDialog, ButtonModule, SharedModule] });
|
---|
| 524 | ConfirmDialogModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: ConfirmDialogModule, imports: [[CommonModule, ButtonModule, RippleModule], ButtonModule, SharedModule] });
|
---|
| 525 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: ConfirmDialogModule, decorators: [{
|
---|
| 526 | type: NgModule,
|
---|
| 527 | args: [{
|
---|
| 528 | imports: [CommonModule, ButtonModule, RippleModule],
|
---|
| 529 | exports: [ConfirmDialog, ButtonModule, SharedModule],
|
---|
| 530 | declarations: [ConfirmDialog]
|
---|
| 531 | }]
|
---|
| 532 | }] });
|
---|
| 533 |
|
---|
| 534 | /**
|
---|
| 535 | * Generated bundle index. Do not edit.
|
---|
| 536 | */
|
---|
| 537 |
|
---|
| 538 | export { ConfirmDialog, ConfirmDialogModule };
|
---|