{"version":3,"file":"primeng-inplace.umd.js","sources":["../../src/app/components/inplace/inplace.ts","../../src/app/components/inplace/primeng-inplace.ts"],"sourcesContent":["import {NgModule,Component,Input,Output,EventEmitter,ChangeDetectionStrategy, ViewEncapsulation, ChangeDetectorRef, AfterContentInit, TemplateRef, QueryList, ContentChildren} from '@angular/core';\nimport {CommonModule} from '@angular/common';\nimport {ButtonModule} from 'primeng/button';\nimport {PrimeTemplate} from 'primeng/api';\n\n@Component({\n    selector: 'p-inplaceDisplay',\n    template: '<ng-content></ng-content>'\n})\nexport class InplaceDisplay {}\n\n@Component({\n    selector: 'p-inplaceContent',\n    template: '<ng-content></ng-content>'\n})\nexport class InplaceContent {}\n\n@Component({\n    selector: 'p-inplace',\n    template: `\n        <div [ngClass]=\"{'p-inplace p-component': true, 'p-inplace-closable': closable}\" [ngStyle]=\"style\" [class]=\"styleClass\">\n            <div class=\"p-inplace-display\" (click)=\"onActivateClick($event)\" tabindex=\"0\" (keydown)=\"onKeydown($event)\"   \n                [ngClass]=\"{'p-disabled':disabled}\" *ngIf=\"!active\">\n                <ng-content select=\"[pInplaceDisplay]\"></ng-content>\n                <ng-container *ngTemplateOutlet=\"displayTemplate\"></ng-container>\n            </div>\n            <div class=\"p-inplace-content\" *ngIf=\"active\">\n                <ng-content select=\"[pInplaceContent]\"></ng-content>\n                <ng-container *ngTemplateOutlet=\"contentTemplate\"></ng-container>\n                <button type=\"button\" [icon]=\"closeIcon\" pButton (click)=\"onDeactivateClick($event)\" *ngIf=\"closable\"></button>\n            </div>\n        </div>\n    `,\n    changeDetection: ChangeDetectionStrategy.OnPush,\n    encapsulation: ViewEncapsulation.None,\n    styleUrls: ['./inplace.css']\n})\nexport class Inplace implements AfterContentInit {\n\n    @Input() active: boolean;\n\n    @Input() closable: boolean;\n\n    @Input() disabled: boolean;\n\n    @Input() preventClick: boolean;\n\n    @Input() style: any;\n\n    @Input() styleClass: string;\n\n    @Input() closeIcon: string = 'pi pi-times';\n\n    @ContentChildren(PrimeTemplate) templates: QueryList<any>;\n\n    @Output() onActivate: EventEmitter<any> = new EventEmitter();\n\n    @Output() onDeactivate: EventEmitter<any> = new EventEmitter();\n\n    hover: boolean;\n\n    displayTemplate: TemplateRef<any>;\n\n    contentTemplate: TemplateRef<any>;\n\n    constructor(public cd: ChangeDetectorRef) {}\n\n    ngAfterContentInit() {\n        this.templates.forEach((item) => {\n            switch(item.getType()) {\n                case 'display':\n                    this.displayTemplate = item.template;\n                break;\n\n                case 'content':\n                    this.contentTemplate = item.template;\n                break;\n            }\n        });\n    }\n\n    onActivateClick(event) {\n        if (!this.preventClick)\n            this.activate(event);\n    }\n\n    onDeactivateClick(event) {\n        if (!this.preventClick)\n            this.deactivate(event);\n    }\n\n    activate(event?: Event) {\n        if (!this.disabled) {\n            this.active = true;\n            this.onActivate.emit(event);\n            this.cd.markForCheck();\n        }\n    }\n\n    deactivate(event?: Event) {\n        if (!this.disabled) {\n            this.active = false;\n            this.hover = false;\n            this.onDeactivate.emit(event);\n            this.cd.markForCheck();\n        }\n    }\n\n    onKeydown(event: KeyboardEvent) {\n        if (event.which === 13) {\n            this.activate(event);\n            event.preventDefault();\n        }\n    }\n}\n\n@NgModule({\n    imports: [CommonModule,ButtonModule],\n    exports: [Inplace,InplaceDisplay,InplaceContent,ButtonModule],\n    declarations: [Inplace,InplaceDisplay,InplaceContent]\n})\nexport class InplaceModule { }\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["Component","EventEmitter","PrimeTemplate","ChangeDetectionStrategy","ViewEncapsulation","Input","ContentChildren","Output","CommonModule","ButtonModule","NgModule"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QASA;;;;qIAAa,cAAc;8GAAd,cAAc,mEAFb,2BAA2B;qHAE5B,cAAc;sBAJ1BA,YAAS;uBAAC;wBACP,QAAQ,EAAE,kBAAkB;wBAC5B,QAAQ,EAAE,2BAA2B;qBACxC;;;QAOD;;;;qIAAa,cAAc;8GAAd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