import * as i1 from '@angular/common'; import { CommonModule } from '@angular/common'; import * as i0 from '@angular/core'; import { Component, EventEmitter, booleanAttribute, ChangeDetectionStrategy, ViewEncapsulation, Input, Output, ContentChildren, NgModule } from '@angular/core'; import { PrimeTemplate, SharedModule } from 'primeng/api'; import * as i2 from 'primeng/button'; import { ButtonModule } from 'primeng/button'; import { TimesIcon } from 'primeng/icons/times'; class InplaceDisplay { static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: InplaceDisplay, deps: [], target: i0.ɵɵFactoryTarget.Component }); static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.7", type: InplaceDisplay, selector: "p-inplaceDisplay", host: { classAttribute: "p-element" }, ngImport: i0, template: '', isInline: true }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: InplaceDisplay, decorators: [{ type: Component, args: [{ selector: 'p-inplaceDisplay', template: '', host: { class: 'p-element' } }] }] }); class InplaceContent { static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: InplaceContent, deps: [], target: i0.ɵɵFactoryTarget.Component }); static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.7", type: InplaceContent, selector: "p-inplaceContent", host: { classAttribute: "p-element" }, ngImport: i0, template: '', isInline: true }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: InplaceContent, decorators: [{ type: Component, args: [{ selector: 'p-inplaceContent', template: '', host: { class: 'p-element' } }] }] }); /** * Inplace provides an easy to do editing and display at the same time where clicking the output displays the actual content. * @group Components */ class Inplace { cd; /** * Whether the content is displayed or not. * @group Props */ active = false; /** * Displays a button to switch back to display mode. * @group Props */ closable = false; /** * When present, it specifies that the element should be disabled. * @group Props */ disabled = false; /** * Allows to prevent clicking. * @group Props */ preventClick; /** * Inline style of the element. * @group Props */ style; /** * Class of the element. * @group Props */ styleClass; /** * Icon to display in the close button. * @group Props */ closeIcon; /** * Establishes a string value that labels the close button. * @group Props */ closeAriaLabel; /** * Callback to invoke when inplace is opened. * @param {Event} event - Browser event. * @group Emits */ onActivate = new EventEmitter(); /** * Callback to invoke when inplace is closed. * @param {Event} event - Browser event. * @group Emits */ onDeactivate = new EventEmitter(); templates; hover; displayTemplate; contentTemplate; closeIconTemplate; constructor(cd) { this.cd = cd; } ngAfterContentInit() { this.templates?.forEach((item) => { switch (item.getType()) { case 'display': this.displayTemplate = item.template; break; case 'closeicon': this.closeIconTemplate = 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); } /** * Activates the content. * @param {Event} event - Browser event. * @group Method */ activate(event) { if (!this.disabled) { this.active = true; this.onActivate.emit(event); this.cd.markForCheck(); } } /** * Deactivates the content. * @param {Event} event - Browser event. * @group Method */ deactivate(event) { if (!this.disabled) { this.active = false; this.hover = false; this.onDeactivate.emit(event); this.cd.markForCheck(); } } onKeydown(event) { if (event.code === 'Enter') { this.activate(event); event.preventDefault(); } } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: Inplace, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "17.3.7", type: Inplace, selector: "p-inplace", inputs: { active: ["active", "active", booleanAttribute], closable: ["closable", "closable", booleanAttribute], disabled: ["disabled", "disabled", booleanAttribute], preventClick: ["preventClick", "preventClick", booleanAttribute], style: "style", styleClass: "styleClass", closeIcon: "closeIcon", closeAriaLabel: "closeAriaLabel" }, outputs: { onActivate: "onActivate", onDeactivate: "onDeactivate" }, host: { classAttribute: "p-element" }, queries: [{ propertyName: "templates", predicate: PrimeTemplate }], ngImport: i0, template: `
`, isInline: true, styles: ["@layer primeng{.p-inplace .p-inplace-display{display:inline;cursor:pointer}.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%}}\n"], dependencies: [{ kind: "directive", type: i0.forwardRef(() => i1.NgClass), selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i0.forwardRef(() => i1.NgIf), selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i0.forwardRef(() => i1.NgTemplateOutlet), selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i0.forwardRef(() => i1.NgStyle), selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i0.forwardRef(() => i2.ButtonDirective), selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain"] }, { kind: "component", type: i0.forwardRef(() => TimesIcon), selector: "TimesIcon" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: Inplace, decorators: [{ type: Component, args: [{ selector: 'p-inplace', template: `
`, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: { class: 'p-element' }, styles: ["@layer primeng{.p-inplace .p-inplace-display{display:inline;cursor:pointer}.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%}}\n"] }] }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { active: [{ type: Input, args: [{ transform: booleanAttribute }] }], closable: [{ type: Input, args: [{ transform: booleanAttribute }] }], disabled: [{ type: Input, args: [{ transform: booleanAttribute }] }], preventClick: [{ type: Input, args: [{ transform: booleanAttribute }] }], style: [{ type: Input }], styleClass: [{ type: Input }], closeIcon: [{ type: Input }], closeAriaLabel: [{ type: Input }], onActivate: [{ type: Output }], onDeactivate: [{ type: Output }], templates: [{ type: ContentChildren, args: [PrimeTemplate] }] } }); class InplaceModule { static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: InplaceModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.7", ngImport: i0, type: InplaceModule, declarations: [Inplace, InplaceDisplay, InplaceContent], imports: [CommonModule, ButtonModule, SharedModule, TimesIcon], exports: [Inplace, InplaceDisplay, InplaceContent, ButtonModule, SharedModule] }); static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: InplaceModule, imports: [CommonModule, ButtonModule, SharedModule, TimesIcon, ButtonModule, SharedModule] }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: InplaceModule, decorators: [{ type: NgModule, args: [{ imports: [CommonModule, ButtonModule, SharedModule, TimesIcon], exports: [Inplace, InplaceDisplay, InplaceContent, ButtonModule, SharedModule], declarations: [Inplace, InplaceDisplay, InplaceContent] }] }] }); /** * Generated bundle index. Do not edit. */ export { Inplace, InplaceContent, InplaceDisplay, InplaceModule }; //# sourceMappingURL=primeng-inplace.mjs.map