import { Component, EventEmitter, ChangeDetectionStrategy, ViewEncapsulation, ChangeDetectorRef, Input, ContentChildren, Output, NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ButtonModule } from 'primeng/button';
import { PrimeTemplate } from 'primeng/api';
class InplaceDisplay {
}
InplaceDisplay.decorators = [
{ type: Component, args: [{
selector: 'p-inplaceDisplay',
template: ''
},] }
];
class InplaceContent {
}
InplaceContent.decorators = [
{ type: Component, args: [{
selector: 'p-inplaceContent',
template: ''
},] }
];
class Inplace {
constructor(cd) {
this.cd = cd;
this.closeIcon = 'pi pi-times';
this.onActivate = new EventEmitter();
this.onDeactivate = new EventEmitter();
}
ngAfterContentInit() {
this.templates.forEach((item) => {
switch (item.getType()) {
case 'display':
this.displayTemplate = item.template;
break;
case 'content':
this.contentTemplate = item.template;
break;
}
});
}
onActivateClick(event) {
if (!this.preventClick)
this.activate(event);
}
onDeactivateClick(event) {
if (!this.preventClick)
this.deactivate(event);
}
activate(event) {
if (!this.disabled) {
this.active = true;
this.onActivate.emit(event);
this.cd.markForCheck();
}
}
deactivate(event) {
if (!this.disabled) {
this.active = false;
this.hover = false;
this.onDeactivate.emit(event);
this.cd.markForCheck();
}
}
onKeydown(event) {
if (event.which === 13) {
this.activate(event);
event.preventDefault();
}
}
}
Inplace.decorators = [
{ type: Component, args: [{
selector: 'p-inplace',
template: `
`,
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
styles: [".p-inplace .p-inplace-display{cursor:pointer;display:inline}.p-inplace .p-inplace-content{display:inline}.p-fluid .p-inplace.p-inplace-closable .p-inplace-content{display:flex}.p-fluid .p-inplace.p-inplace-closable .p-inplace-content>.p-inputtext{flex:1 1 auto;width:1%}"]
},] }
];
Inplace.ctorParameters = () => [
{ type: ChangeDetectorRef }
];
Inplace.propDecorators = {
active: [{ type: Input }],
closable: [{ type: Input }],
disabled: [{ type: Input }],
preventClick: [{ type: Input }],
style: [{ type: Input }],
styleClass: [{ type: Input }],
closeIcon: [{ type: Input }],
templates: [{ type: ContentChildren, args: [PrimeTemplate,] }],
onActivate: [{ type: Output }],
onDeactivate: [{ type: Output }]
};
class InplaceModule {
}
InplaceModule.decorators = [
{ type: NgModule, args: [{
imports: [CommonModule, ButtonModule],
exports: [Inplace, InplaceDisplay, InplaceContent, ButtonModule],
declarations: [Inplace, InplaceDisplay, InplaceContent]
},] }
];
/**
* Generated bundle index. Do not edit.
*/
export { Inplace, InplaceContent, InplaceDisplay, InplaceModule };
//# sourceMappingURL=primeng-inplace.js.map