1 line
13 KiB
Plaintext
1 line
13 KiB
Plaintext
{"version":3,"file":"primeng-inplace.mjs","sources":["../../src/app/components/inplace/inplace.ts","../../src/app/components/inplace/primeng-inplace.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { AfterContentInit, ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChildren, EventEmitter, Input, NgModule, Output, QueryList, TemplateRef, ViewEncapsulation, booleanAttribute } from '@angular/core';\nimport { PrimeTemplate, SharedModule } from 'primeng/api';\nimport { ButtonModule } from 'primeng/button';\nimport { TimesIcon } from 'primeng/icons/times';\n\n@Component({\n selector: 'p-inplaceDisplay',\n template: '<ng-content></ng-content>',\n host: {\n class: 'p-element'\n }\n})\nexport class InplaceDisplay {}\n\n@Component({\n selector: 'p-inplaceContent',\n template: '<ng-content></ng-content>',\n host: {\n class: 'p-element'\n }\n})\nexport class InplaceContent {}\n/**\n * Inplace provides an easy to do editing and display at the same time where clicking the output displays the actual content.\n * @group Components\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\" [attr.aria-live]=\"'polite'\">\n <div class=\"p-inplace-display\" (click)=\"onActivateClick($event)\" tabindex=\"0\" role=\"button\" (keydown)=\"onKeydown($event)\" [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\n <ng-container *ngIf=\"closable\">\n <button *ngIf=\"closeIcon\" type=\"button\" [icon]=\"closeIcon\" pButton (click)=\"onDeactivateClick($event)\" [attr.aria-label]=\"closeAriaLabel\"></button>\n <button *ngIf=\"!closeIcon\" type=\"button\" pButton [ngClass]=\"'p-button-icon-only'\" (click)=\"onDeactivateClick($event)\" [attr.aria-label]=\"closeAriaLabel\">\n <TimesIcon *ngIf=\"!closeIconTemplate\" />\n <ng-template *ngTemplateOutlet=\"closeIconTemplate\"></ng-template>\n </button>\n </ng-container>\n </div>\n </div>\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n styleUrls: ['./inplace.css'],\n host: {\n class: 'p-element'\n }\n})\nexport class Inplace implements AfterContentInit {\n /**\n * Whether the content is displayed or not.\n * @group Props\n */\n @Input({ transform: booleanAttribute }) active: boolean | undefined = false;\n /**\n * Displays a button to switch back to display mode.\n * @group Props\n */\n @Input({ transform: booleanAttribute }) closable: boolean | undefined = false;\n /**\n * When present, it specifies that the element should be disabled.\n * @group Props\n */\n @Input({ transform: booleanAttribute }) disabled: boolean | undefined = false;\n /**\n * Allows to prevent clicking.\n * @group Props\n */\n @Input({ transform: booleanAttribute }) preventClick: boolean | undefined;\n /**\n * Inline style of the element.\n * @group Props\n */\n @Input() style: { [klass: string]: any } | null | undefined;\n /**\n * Class of the element.\n * @group Props\n */\n @Input() styleClass: string | undefined;\n /**\n * Icon to display in the close button.\n * @group Props\n */\n @Input() closeIcon: string | undefined;\n /**\n * Establishes a string value that labels the close button.\n * @group Props\n */\n @Input() closeAriaLabel: string | undefined;\n /**\n * Callback to invoke when inplace is opened.\n * @param {Event} event - Browser event.\n * @group Emits\n */\n @Output() onActivate: EventEmitter<Event> = new EventEmitter<Event>();\n /**\n * Callback to invoke when inplace is closed.\n * @param {Event} event - Browser event.\n * @group Emits\n */\n @Output() onDeactivate: EventEmitter<Event> = new EventEmitter<Event>();\n\n @ContentChildren(PrimeTemplate) templates: QueryList<PrimeTemplate> | undefined;\n\n hover!: boolean;\n\n displayTemplate: TemplateRef<any> | undefined;\n\n contentTemplate: TemplateRef<any> | undefined;\n\n closeIconTemplate: TemplateRef<any> | undefined;\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 'closeicon':\n this.closeIconTemplate = item.template;\n break;\n\n case 'content':\n this.contentTemplate = item.template;\n break;\n }\n });\n }\n\n onActivateClick(event: MouseEvent) {\n if (!this.preventClick) this.activate(event);\n }\n\n onDeactivateClick(event: MouseEvent) {\n if (!this.preventClick) this.deactivate(event);\n }\n /**\n * Activates the content.\n * @param {Event} event - Browser event.\n * @group Method\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 * Deactivates the content.\n * @param {Event} event - Browser event.\n * @group Method\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.code === 'Enter') {\n this.activate(event);\n event.preventDefault();\n }\n }\n}\n\n@NgModule({\n imports: [CommonModule, ButtonModule, SharedModule, TimesIcon],\n exports: [Inplace, InplaceDisplay, InplaceContent, ButtonModule, SharedModule],\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":[],"mappings":";;;;;;;;;MAaa,cAAc,CAAA;uGAAd,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAAd,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,cAAc,+FALb,2BAA2B,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,CAAA;;2FAK5B,cAAc,EAAA,UAAA,EAAA,CAAA;kBAP1B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AAC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