1 | import * as i0 from '@angular/core';
|
---|
2 | import { Component, EventEmitter, ChangeDetectionStrategy, ViewEncapsulation, Input, ContentChildren, Output, NgModule } from '@angular/core';
|
---|
3 | import * as i1 from '@angular/common';
|
---|
4 | import { CommonModule } from '@angular/common';
|
---|
5 | import * as i2 from 'primeng/button';
|
---|
6 | import { ButtonModule } from 'primeng/button';
|
---|
7 | import { PrimeTemplate } from 'primeng/api';
|
---|
8 |
|
---|
9 | class InplaceDisplay {
|
---|
10 | }
|
---|
11 | InplaceDisplay.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: InplaceDisplay, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
---|
12 | InplaceDisplay.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.0", type: InplaceDisplay, selector: "p-inplaceDisplay", host: { classAttribute: "p-element" }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true });
|
---|
13 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: InplaceDisplay, decorators: [{
|
---|
14 | type: Component,
|
---|
15 | args: [{
|
---|
16 | selector: 'p-inplaceDisplay',
|
---|
17 | template: '<ng-content></ng-content>',
|
---|
18 | host: {
|
---|
19 | 'class': 'p-element'
|
---|
20 | }
|
---|
21 | }]
|
---|
22 | }] });
|
---|
23 | class InplaceContent {
|
---|
24 | }
|
---|
25 | InplaceContent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: InplaceContent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
---|
26 | InplaceContent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.0", type: InplaceContent, selector: "p-inplaceContent", host: { classAttribute: "p-element" }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true });
|
---|
27 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: InplaceContent, decorators: [{
|
---|
28 | type: Component,
|
---|
29 | args: [{
|
---|
30 | selector: 'p-inplaceContent',
|
---|
31 | template: '<ng-content></ng-content>',
|
---|
32 | host: {
|
---|
33 | 'class': 'p-element'
|
---|
34 | }
|
---|
35 | }]
|
---|
36 | }] });
|
---|
37 | class Inplace {
|
---|
38 | constructor(cd) {
|
---|
39 | this.cd = cd;
|
---|
40 | this.closeIcon = 'pi pi-times';
|
---|
41 | this.onActivate = new EventEmitter();
|
---|
42 | this.onDeactivate = new EventEmitter();
|
---|
43 | }
|
---|
44 | ngAfterContentInit() {
|
---|
45 | this.templates.forEach((item) => {
|
---|
46 | switch (item.getType()) {
|
---|
47 | case 'display':
|
---|
48 | this.displayTemplate = item.template;
|
---|
49 | break;
|
---|
50 | case 'content':
|
---|
51 | this.contentTemplate = item.template;
|
---|
52 | break;
|
---|
53 | }
|
---|
54 | });
|
---|
55 | }
|
---|
56 | onActivateClick(event) {
|
---|
57 | if (!this.preventClick)
|
---|
58 | this.activate(event);
|
---|
59 | }
|
---|
60 | onDeactivateClick(event) {
|
---|
61 | if (!this.preventClick)
|
---|
62 | this.deactivate(event);
|
---|
63 | }
|
---|
64 | activate(event) {
|
---|
65 | if (!this.disabled) {
|
---|
66 | this.active = true;
|
---|
67 | this.onActivate.emit(event);
|
---|
68 | this.cd.markForCheck();
|
---|
69 | }
|
---|
70 | }
|
---|
71 | deactivate(event) {
|
---|
72 | if (!this.disabled) {
|
---|
73 | this.active = false;
|
---|
74 | this.hover = false;
|
---|
75 | this.onDeactivate.emit(event);
|
---|
76 | this.cd.markForCheck();
|
---|
77 | }
|
---|
78 | }
|
---|
79 | onKeydown(event) {
|
---|
80 | if (event.which === 13) {
|
---|
81 | this.activate(event);
|
---|
82 | event.preventDefault();
|
---|
83 | }
|
---|
84 | }
|
---|
85 | }
|
---|
86 | Inplace.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: Inplace, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
---|
87 | Inplace.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.0", type: Inplace, selector: "p-inplace", inputs: { active: "active", closable: "closable", disabled: "disabled", preventClick: "preventClick", style: "style", styleClass: "styleClass", closeIcon: "closeIcon" }, outputs: { onActivate: "onActivate", onDeactivate: "onDeactivate" }, host: { classAttribute: "p-element" }, queries: [{ propertyName: "templates", predicate: PrimeTemplate }], ngImport: i0, template: `
|
---|
88 | <div [ngClass]="{'p-inplace p-component': true, 'p-inplace-closable': closable}" [ngStyle]="style" [class]="styleClass">
|
---|
89 | <div class="p-inplace-display" (click)="onActivateClick($event)" tabindex="0" (keydown)="onKeydown($event)"
|
---|
90 | [ngClass]="{'p-disabled':disabled}" *ngIf="!active">
|
---|
91 | <ng-content select="[pInplaceDisplay]"></ng-content>
|
---|
92 | <ng-container *ngTemplateOutlet="displayTemplate"></ng-container>
|
---|
93 | </div>
|
---|
94 | <div class="p-inplace-content" *ngIf="active">
|
---|
95 | <ng-content select="[pInplaceContent]"></ng-content>
|
---|
96 | <ng-container *ngTemplateOutlet="contentTemplate"></ng-container>
|
---|
97 | <button type="button" [icon]="closeIcon" pButton (click)="onDeactivateClick($event)" *ngIf="closable"></button>
|
---|
98 | </div>
|
---|
99 | </div>
|
---|
100 | `, isInline: true, styles: [".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"], directives: [{ type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i2.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
---|
101 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: Inplace, decorators: [{
|
---|
102 | type: Component,
|
---|
103 | args: [{ selector: 'p-inplace', template: `
|
---|
104 | <div [ngClass]="{'p-inplace p-component': true, 'p-inplace-closable': closable}" [ngStyle]="style" [class]="styleClass">
|
---|
105 | <div class="p-inplace-display" (click)="onActivateClick($event)" tabindex="0" (keydown)="onKeydown($event)"
|
---|
106 | [ngClass]="{'p-disabled':disabled}" *ngIf="!active">
|
---|
107 | <ng-content select="[pInplaceDisplay]"></ng-content>
|
---|
108 | <ng-container *ngTemplateOutlet="displayTemplate"></ng-container>
|
---|
109 | </div>
|
---|
110 | <div class="p-inplace-content" *ngIf="active">
|
---|
111 | <ng-content select="[pInplaceContent]"></ng-content>
|
---|
112 | <ng-container *ngTemplateOutlet="contentTemplate"></ng-container>
|
---|
113 | <button type="button" [icon]="closeIcon" pButton (click)="onDeactivateClick($event)" *ngIf="closable"></button>
|
---|
114 | </div>
|
---|
115 | </div>
|
---|
116 | `, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
---|
117 | 'class': 'p-element'
|
---|
118 | }, styles: [".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"] }]
|
---|
119 | }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { active: [{
|
---|
120 | type: Input
|
---|
121 | }], closable: [{
|
---|
122 | type: Input
|
---|
123 | }], disabled: [{
|
---|
124 | type: Input
|
---|
125 | }], preventClick: [{
|
---|
126 | type: Input
|
---|
127 | }], style: [{
|
---|
128 | type: Input
|
---|
129 | }], styleClass: [{
|
---|
130 | type: Input
|
---|
131 | }], closeIcon: [{
|
---|
132 | type: Input
|
---|
133 | }], templates: [{
|
---|
134 | type: ContentChildren,
|
---|
135 | args: [PrimeTemplate]
|
---|
136 | }], onActivate: [{
|
---|
137 | type: Output
|
---|
138 | }], onDeactivate: [{
|
---|
139 | type: Output
|
---|
140 | }] } });
|
---|
141 | class InplaceModule {
|
---|
142 | }
|
---|
143 | InplaceModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: InplaceModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
---|
144 | InplaceModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: InplaceModule, declarations: [Inplace, InplaceDisplay, InplaceContent], imports: [CommonModule, ButtonModule], exports: [Inplace, InplaceDisplay, InplaceContent, ButtonModule] });
|
---|
145 | InplaceModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: InplaceModule, imports: [[CommonModule, ButtonModule], ButtonModule] });
|
---|
146 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: InplaceModule, decorators: [{
|
---|
147 | type: NgModule,
|
---|
148 | args: [{
|
---|
149 | imports: [CommonModule, ButtonModule],
|
---|
150 | exports: [Inplace, InplaceDisplay, InplaceContent, ButtonModule],
|
---|
151 | declarations: [Inplace, InplaceDisplay, InplaceContent]
|
---|
152 | }]
|
---|
153 | }] });
|
---|
154 |
|
---|
155 | /**
|
---|
156 | * Generated bundle index. Do not edit.
|
---|
157 | */
|
---|
158 |
|
---|
159 | export { Inplace, InplaceContent, InplaceDisplay, InplaceModule };
|
---|