1 | import * as i0 from '@angular/core';
|
2 | import { Directive, Component, ContentChildren, ElementRef, ViewChild, Injectable, Inject, EventEmitter, ChangeDetectionStrategy, Input, Output, NgModule } from '@angular/core';
|
3 | import * as i2 from '@angular/common';
|
4 | import { DOCUMENT, CommonModule } from '@angular/common';
|
5 | import * as i2$1 from '@angular/forms';
|
6 | import { FormsModule } from '@angular/forms';
|
7 | import * as i1 from '@angular/material/dialog';
|
8 | import { MatDialogConfig, MatDialogModule } from '@angular/material/dialog';
|
9 | import * as i4 from '@angular/material/input';
|
10 | import { MatInputModule } from '@angular/material/input';
|
11 | import * as i3 from '@angular/material/button';
|
12 | import { MatButtonModule } from '@angular/material/button';
|
13 | import { RIGHT_ARROW, LEFT_ARROW } from '@angular/cdk/keycodes';
|
14 | import { Subject, fromEvent, takeUntil, merge } from 'rxjs';
|
15 | import * as i5 from '@angular/material/form-field';
|
16 | import * as i4$1 from '@angular/material/icon';
|
17 | import { MatIconModule } from '@angular/material/icon';
|
18 | import * as i2$2 from '@angular/cdk/drag-drop';
|
19 | import * as i2$3 from '@angular/material/toolbar';
|
20 | import { MatToolbarModule } from '@angular/material/toolbar';
|
21 | import * as i3$1 from '@angular/material/tooltip';
|
22 | import { MatTooltipModule } from '@angular/material/tooltip';
|
23 |
|
24 | class TdDialogTitleDirective {
|
25 | static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: TdDialogTitleDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
26 | static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.1.2", type: TdDialogTitleDirective, selector: "[tdDialogTitle]", ngImport: i0 });
|
27 | }
|
28 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: TdDialogTitleDirective, decorators: [{
|
29 | type: Directive,
|
30 | args: [{ selector: '[tdDialogTitle]' }]
|
31 | }] });
|
32 | class TdDialogContentDirective {
|
33 | static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: TdDialogContentDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
34 | static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.1.2", type: TdDialogContentDirective, selector: "[tdDialogContent]", ngImport: i0 });
|
35 | }
|
36 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: TdDialogContentDirective, decorators: [{
|
37 | type: Directive,
|
38 | args: [{ selector: '[tdDialogContent]' }]
|
39 | }] });
|
40 | class TdDialogActionsDirective {
|
41 | static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: TdDialogActionsDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
42 | static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.1.2", type: TdDialogActionsDirective, selector: "[tdDialogActions]", ngImport: i0 });
|
43 | }
|
44 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: TdDialogActionsDirective, decorators: [{
|
45 | type: Directive,
|
46 | args: [{ selector: '[tdDialogActions]' }]
|
47 | }] });
|
48 | class TdDialogStatusDirective {
|
49 | static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: TdDialogStatusDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
50 | static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.1.2", type: TdDialogStatusDirective, selector: "[tdDialogStatus]", ngImport: i0 });
|
51 | }
|
52 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: TdDialogStatusDirective, decorators: [{
|
53 | type: Directive,
|
54 | args: [{ selector: '[tdDialogStatus]' }]
|
55 | }] });
|
56 | class TdDialogComponent {
|
57 | dialogTitle;
|
58 | dialogContent;
|
59 | dialogActions;
|
60 | dialogStatus;
|
61 | ngAfterContentInit() {
|
62 | if (this.dialogTitle.length > 1) {
|
63 | throw new Error('Duplicate td-dialog-title component at in td-dialog.');
|
64 | }
|
65 | if (this.dialogContent.length > 1) {
|
66 | throw new Error('Duplicate td-dialog-content component at in td-dialog.');
|
67 | }
|
68 | if (this.dialogActions.length > 1) {
|
69 | throw new Error('Duplicate td-dialog-actions component at in td-dialog.');
|
70 | }
|
71 | if (this.dialogStatus.length > 1) {
|
72 | throw new Error('Duplicate td-dialog-status component at in td-dialog.');
|
73 | }
|
74 | }
|
75 | static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: TdDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
76 | static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.2", type: TdDialogComponent, selector: "td-dialog", queries: [{ propertyName: "dialogTitle", predicate: TdDialogTitleDirective, descendants: true }, { propertyName: "dialogContent", predicate: TdDialogContentDirective, descendants: true }, { propertyName: "dialogActions", predicate: TdDialogActionsDirective, descendants: true }, { propertyName: "dialogStatus", predicate: TdDialogStatusDirective, descendants: true }], ngImport: i0, template: "<div class=\"td-dialog-wrapper\">\n <ng-content\n *ngIf=\"dialogStatus.length > 0\"\n select=\"[tdDialogStatus]\"\n ></ng-content>\n <section class=\"td-dialog\">\n <div mat-dialog-title *ngIf=\"dialogTitle.length > 0\">\n <ng-content select=\"[tdDialogTitle]\"></ng-content>\n </div>\n <mat-dialog-content\n class=\"td-dialog-content\"\n *ngIf=\"dialogContent.length > 0\"\n >\n <ng-content select=\"[tdDialogContent]\"></ng-content>\n </mat-dialog-content>\n <mat-dialog-actions\n class=\"td-dialog-actions\"\n *ngIf=\"dialogActions.length > 0\"\n >\n <span class=\"td-dialog-spacer\"></span>\n <ng-content select=\"[tdDialogActions]\"></ng-content>\n </mat-dialog-actions>\n </section>\n</div>\n", styles: [".td-dialog{width:100%}.td-dialog-wrapper{display:flex}.td-dialog-actions{flex-direction:row;box-sizing:border-box;display:flex}.td-dialog-actions .td-dialog-spacer{flex:1}.td-dialog-actions ::ng-deep button{text-transform:uppercase;margin-left:8px;padding-left:8px;padding-right:8px;min-width:64px}[dir=rtl] .td-dialog-actions ::ng-deep button{margin-right:8px;margin-left:inherit}.td-dialog-actions ::ng-deep .td-status-dialog___button{padding:9px 16px}@media screen and (max-width: 480px){.td-dialog-wrapper{flex-direction:column}}\n"], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }] });
|
77 | }
|
78 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: TdDialogComponent, decorators: [{
|
79 | type: Component,
|
80 | args: [{ selector: 'td-dialog', template: "<div class=\"td-dialog-wrapper\">\n <ng-content\n *ngIf=\"dialogStatus.length > 0\"\n select=\"[tdDialogStatus]\"\n ></ng-content>\n <section class=\"td-dialog\">\n <div mat-dialog-title *ngIf=\"dialogTitle.length > 0\">\n <ng-content select=\"[tdDialogTitle]\"></ng-content>\n </div>\n <mat-dialog-content\n class=\"td-dialog-content\"\n *ngIf=\"dialogContent.length > 0\"\n >\n <ng-content select=\"[tdDialogContent]\"></ng-content>\n </mat-dialog-content>\n <mat-dialog-actions\n class=\"td-dialog-actions\"\n *ngIf=\"dialogActions.length > 0\"\n >\n <span class=\"td-dialog-spacer\"></span>\n <ng-content select=\"[tdDialogActions]\"></ng-content>\n </mat-dialog-actions>\n </section>\n</div>\n", styles: [".td-dialog{width:100%}.td-dialog-wrapper{display:flex}.td-dialog-actions{flex-direction:row;box-sizing:border-box;display:flex}.td-dialog-actions .td-dialog-spacer{flex:1}.td-dialog-actions ::ng-deep button{text-transform:uppercase;margin-left:8px;padding-left:8px;padding-right:8px;min-width:64px}[dir=rtl] .td-dialog-actions ::ng-deep button{margin-right:8px;margin-left:inherit}.td-dialog-actions ::ng-deep .td-status-dialog___button{padding:9px 16px}@media screen and (max-width: 480px){.td-dialog-wrapper{flex-direction:column}}\n"] }]
|
81 | }], propDecorators: { dialogTitle: [{
|
82 | type: ContentChildren,
|
83 | args: [TdDialogTitleDirective, { descendants: true }]
|
84 | }], dialogContent: [{
|
85 | type: ContentChildren,
|
86 | args: [TdDialogContentDirective, { descendants: true }]
|
87 | }], dialogActions: [{
|
88 | type: ContentChildren,
|
89 | args: [TdDialogActionsDirective, { descendants: true }]
|
90 | }], dialogStatus: [{
|
91 | type: ContentChildren,
|
92 | args: [TdDialogStatusDirective, { descendants: true }]
|
93 | }] } });
|
94 |
|
95 | class TdAlertDialogComponent {
|
96 | _dialogRef;
|
97 | title;
|
98 | message;
|
99 | closeButton = 'CLOSE';
|
100 | constructor(_dialogRef) {
|
101 | this._dialogRef = _dialogRef;
|
102 | }
|
103 | close() {
|
104 | this._dialogRef.close();
|
105 | }
|
106 | static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: TdAlertDialogComponent, deps: [{ token: i1.MatDialogRef }], target: i0.ɵɵFactoryTarget.Component });
|
107 | static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.2", type: TdAlertDialogComponent, selector: "td-alert-dialog", ngImport: i0, template: "<td-dialog>\n <ng-container tdDialogTitle *ngIf=\"title\">{{ title }}</ng-container>\n <ng-container tdDialogContent>\n <span class=\"td-dialog-message\">{{ message }}</span>\n </ng-container>\n <ng-container tdDialogActions>\n <button mat-button color=\"accent\" (click)=\"close()\">\n {{ closeButton }}\n </button>\n </ng-container>\n</td-dialog>\n", styles: [".td-dialog-message{word-break:break-word}\n"], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: TdDialogComponent, selector: "td-dialog" }, { kind: "directive", type: TdDialogTitleDirective, selector: "[tdDialogTitle]" }, { kind: "directive", type: TdDialogActionsDirective, selector: "[tdDialogActions]" }, { kind: "directive", type: TdDialogContentDirective, selector: "[tdDialogContent]" }] });
|
108 | }
|
109 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: TdAlertDialogComponent, decorators: [{
|
110 | type: Component,
|
111 | args: [{ selector: 'td-alert-dialog', template: "<td-dialog>\n <ng-container tdDialogTitle *ngIf=\"title\">{{ title }}</ng-container>\n <ng-container tdDialogContent>\n <span class=\"td-dialog-message\">{{ message }}</span>\n </ng-container>\n <ng-container tdDialogActions>\n <button mat-button color=\"accent\" (click)=\"close()\">\n {{ closeButton }}\n </button>\n </ng-container>\n</td-dialog>\n", styles: [".td-dialog-message{word-break:break-word}\n"] }]
|
112 | }], ctorParameters: () => [{ type: i1.MatDialogRef }] });
|
113 |
|
114 | class TdConfirmDialogComponent {
|
115 | _dialogRef;
|
116 | title;
|
117 | message;
|
118 | cancelButton = 'CANCEL';
|
119 | acceptButton = 'ACCEPT';
|
120 | isDestructive = false;
|
121 | constructor(_dialogRef) {
|
122 | this._dialogRef = _dialogRef;
|
123 | }
|
124 | cancel() {
|
125 | this._dialogRef.close(false);
|
126 | }
|
127 | accept() {
|
128 | this._dialogRef.close(true);
|
129 | }
|
130 | static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: TdConfirmDialogComponent, deps: [{ token: i1.MatDialogRef }], target: i0.ɵɵFactoryTarget.Component });
|
131 | static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.2", type: TdConfirmDialogComponent, selector: "td-confirm-dialog", ngImport: i0, template: "<td-dialog>\n <ng-container tdDialogTitle *ngIf=\"title\">{{ title }}</ng-container>\n <ng-container tdDialogContent>\n <span class=\"td-dialog-message\">{{ message }}</span>\n </ng-container>\n <ng-container tdDialogActions>\n <button\n mat-button\n #closeBtn\n (keydown.arrowright)=\"acceptBtn.focus()\"\n (click)=\"cancel()\"\n >\n {{ cancelButton }}\n </button>\n <button\n mat-button\n [color]=\"isDestructive ? 'warn' : 'accent'\"\n #acceptBtn\n (keydown.arrowleft)=\"closeBtn.focus()\"\n (click)=\"accept()\"\n >\n {{ acceptButton }}\n </button>\n </ng-container>\n</td-dialog>\n", styles: [".td-dialog-message{word-break:break-word}\n"], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: TdDialogComponent, selector: "td-dialog" }, { kind: "directive", type: TdDialogTitleDirective, selector: "[tdDialogTitle]" }, { kind: "directive", type: TdDialogActionsDirective, selector: "[tdDialogActions]" }, { kind: "directive", type: TdDialogContentDirective, selector: "[tdDialogContent]" }] });
|
132 | }
|
133 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: TdConfirmDialogComponent, decorators: [{
|
134 | type: Component,
|
135 | args: [{ selector: 'td-confirm-dialog', template: "<td-dialog>\n <ng-container tdDialogTitle *ngIf=\"title\">{{ title }}</ng-container>\n <ng-container tdDialogContent>\n <span class=\"td-dialog-message\">{{ message }}</span>\n </ng-container>\n <ng-container tdDialogActions>\n <button\n mat-button\n #closeBtn\n (keydown.arrowright)=\"acceptBtn.focus()\"\n (click)=\"cancel()\"\n >\n {{ cancelButton }}\n </button>\n <button\n mat-button\n [color]=\"isDestructive ? 'warn' : 'accent'\"\n #acceptBtn\n (keydown.arrowleft)=\"closeBtn.focus()\"\n (click)=\"accept()\"\n >\n {{ acceptButton }}\n </button>\n </ng-container>\n</td-dialog>\n", styles: [".td-dialog-message{word-break:break-word}\n"] }]
|
136 | }], ctorParameters: () => [{ type: i1.MatDialogRef }] });
|
137 |
|
138 | class TdPromptDialogComponent {
|
139 | _ngZone;
|
140 | _dialogRef;
|
141 | title;
|
142 | message;
|
143 | value;
|
144 | cancelButton = 'CANCEL';
|
145 | acceptButton = 'ACCEPT';
|
146 |
|
147 | _input;
|
148 | _closeBtn;
|
149 | _acceptBtn;
|
150 | _destroy$ = new Subject();
|
151 | constructor(_ngZone, _dialogRef) {
|
152 | this._ngZone = _ngZone;
|
153 | this._dialogRef = _dialogRef;
|
154 | }
|
155 | ngAfterViewInit() {
|
156 | this._ngZone.runOutsideAngular(() => {
|
157 |
|
158 |
|
159 |
|
160 |
|
161 | requestAnimationFrame(() => this._input.nativeElement.focus());
|
162 | fromEvent(this._input.nativeElement, 'focus')
|
163 | .pipe(takeUntil(this._destroy$))
|
164 | .subscribe(() => {
|
165 |
|
166 | this._input.nativeElement.select();
|
167 | });
|
168 | fromEvent(this._closeBtn.nativeElement, 'keydown')
|
169 | .pipe(takeUntil(this._destroy$))
|
170 | .subscribe((event) => {
|
171 | if (event.keyCode === RIGHT_ARROW) {
|
172 | this._acceptBtn.nativeElement.focus();
|
173 | }
|
174 | });
|
175 | fromEvent(this._acceptBtn.nativeElement, 'keydown')
|
176 | .pipe(takeUntil(this._destroy$))
|
177 | .subscribe((event) => {
|
178 | if (event.keyCode === LEFT_ARROW) {
|
179 | this._closeBtn.nativeElement.focus();
|
180 | }
|
181 | });
|
182 | });
|
183 | }
|
184 | ngOnDestroy() {
|
185 | this._destroy$.next();
|
186 | }
|
187 | cancel() {
|
188 | this._dialogRef.close();
|
189 | }
|
190 | accept() {
|
191 | this._dialogRef.close(this.value);
|
192 | }
|
193 | static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: TdPromptDialogComponent, deps: [{ token: i0.NgZone }, { token: i1.MatDialogRef }], target: i0.ɵɵFactoryTarget.Component });
|
194 | static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.2", type: TdPromptDialogComponent, selector: "td-prompt-dialog", viewQueries: [{ propertyName: "_input", first: true, predicate: ["input"], descendants: true, static: true }, { propertyName: "_closeBtn", first: true, predicate: ["closeBtn"], descendants: true, read: ElementRef, static: true }, { propertyName: "_acceptBtn", first: true, predicate: ["acceptBtn"], descendants: true, read: ElementRef, static: true }], ngImport: i0, template: "<td-dialog>\n <ng-container tdDialogTitle *ngIf=\"title\">{{ title }}</ng-container>\n <ng-container tdDialogContent>\n <span class=\"td-dialog-message\">{{ message }}</span>\n <form #form=\"ngForm\" novalidate>\n <div class=\"td-dialog-input-wrapper\">\n <mat-form-field class=\"td-dialog-input\">\n <input\n matInput\n #input\n (keydown.enter)=\"$event.preventDefault(); form.valid && accept()\"\n [(ngModel)]=\"value\"\n name=\"value\"\n required\n />\n </mat-form-field>\n </div>\n </form>\n </ng-container>\n <ng-container tdDialogActions>\n <button mat-button #closeBtn (click)=\"cancel()\">{{ cancelButton }}</button>\n <button\n mat-button\n color=\"accent\"\n #acceptBtn\n [disabled]=\"!form.valid\"\n (click)=\"accept()\"\n >\n {{ acceptButton }}\n </button>\n </ng-container>\n</td-dialog>\n", styles: [".td-dialog-input-wrapper{flex-direction:row;box-sizing:border-box;display:flex}.td-dialog-input-wrapper .td-dialog-input{flex:1;box-sizing:border-box}.td-dialog-message{word-break:break-word}\n"], dependencies: [{ kind: "directive", type: i2$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i2$1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i5.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "component", type: i3.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: TdDialogComponent, selector: "td-dialog" }, { kind: "directive", type: TdDialogTitleDirective, selector: "[tdDialogTitle]" }, { kind: "directive", type: TdDialogActionsDirective, selector: "[tdDialogActions]" }, { kind: "directive", type: TdDialogContentDirective, selector: "[tdDialogContent]" }] });
|
195 | }
|
196 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: TdPromptDialogComponent, decorators: [{
|
197 | type: Component,
|
198 | args: [{ selector: 'td-prompt-dialog', template: "<td-dialog>\n <ng-container tdDialogTitle *ngIf=\"title\">{{ title }}</ng-container>\n <ng-container tdDialogContent>\n <span class=\"td-dialog-message\">{{ message }}</span>\n <form #form=\"ngForm\" novalidate>\n <div class=\"td-dialog-input-wrapper\">\n <mat-form-field class=\"td-dialog-input\">\n <input\n matInput\n #input\n (keydown.enter)=\"$event.preventDefault(); form.valid && accept()\"\n [(ngModel)]=\"value\"\n name=\"value\"\n required\n />\n </mat-form-field>\n </div>\n </form>\n </ng-container>\n <ng-container tdDialogActions>\n <button mat-button #closeBtn (click)=\"cancel()\">{{ cancelButton }}</button>\n <button\n mat-button\n color=\"accent\"\n #acceptBtn\n [disabled]=\"!form.valid\"\n (click)=\"accept()\"\n >\n {{ acceptButton }}\n </button>\n </ng-container>\n</td-dialog>\n", styles: [".td-dialog-input-wrapper{flex-direction:row;box-sizing:border-box;display:flex}.td-dialog-input-wrapper .td-dialog-input{flex:1;box-sizing:border-box}.td-dialog-message{word-break:break-word}\n"] }]
|
199 | }], ctorParameters: () => [{ type: i0.NgZone }, { type: i1.MatDialogRef }], propDecorators: { _input: [{
|
200 | type: ViewChild,
|
201 | args: ['input', { static: true }]
|
202 | }], _closeBtn: [{
|
203 | type: ViewChild,
|
204 | args: ['closeBtn', { static: true, read: ElementRef }]
|
205 | }], _acceptBtn: [{
|
206 | type: ViewChild,
|
207 | args: ['acceptBtn', { static: true, read: ElementRef }]
|
208 | }] } });
|
209 |
|
210 | class TdStatusDialogComponent {
|
211 | _dialogRef;
|
212 |
|
213 | closeButton = 'CLOSE';
|
214 |
|
215 | message;
|
216 |
|
217 | state = 'error';
|
218 |
|
219 | title;
|
220 |
|
221 | details;
|
222 |
|
223 | showDetails = false;
|
224 |
|
225 | detailsLabels = {
|
226 | showDetailsLabel: 'Show details',
|
227 | hideDetailsLabel: 'Hide details',
|
228 | };
|
229 | constructor(_dialogRef) {
|
230 | this._dialogRef = _dialogRef;
|
231 | }
|
232 | close() {
|
233 | this._dialogRef.close();
|
234 | }
|
235 | getStatusIcon() {
|
236 | switch (this.state) {
|
237 | case 'positive':
|
238 | return 'check';
|
239 | case 'error':
|
240 | case 'warning':
|
241 | return this.state;
|
242 | default:
|
243 | return 'error';
|
244 | }
|
245 | }
|
246 | toggleDetails() {
|
247 | this.showDetails = !this.showDetails;
|
248 | }
|
249 | static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: TdStatusDialogComponent, deps: [{ token: i1.MatDialogRef }], target: i0.ɵɵFactoryTarget.Component });
|
250 | static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.2", type: TdStatusDialogComponent, selector: "td-status-dialog", ngImport: i0, template: "<td-dialog class=\"td-status-dialog\">\n <!-- Displays the icon and background color according to the state -->\n <div tdDialogStatus class=\"td-status-dialog-state\" [ngClass]=\"state\">\n <mat-icon>\n {{ getStatusIcon() }}\n </mat-icon>\n </div>\n <!-- Dialog title and the close icon -->\n <ng-container tdDialogTitle>\n <div class=\"td-status-dialog-title\">\n <span *ngIf=\"title\" class=\"\">{{ title }}</span>\n <button\n mat-icon-button\n class=\"td-status-dialog__icon-button\"\n (click)=\"close()\"\n >\n <mat-icon>close</mat-icon>\n </button>\n </div>\n </ng-container>\n <!-- Dialog content with additonal information -->\n <ng-container tdDialogContent>\n <span class=\"td-dialog-message\">\n {{ message }}\n <div\n class=\"td-status-dialog__toggle-details\"\n role=\"button\"\n tabindex=\"0\"\n *ngIf=\"details\"\n (click)=\"toggleDetails()\"\n (keydown.enter)=\"toggleDetails()\"\n >\n {{\n showDetails\n ? detailsLabels?.hideDetailsLabel\n : detailsLabels?.showDetailsLabel\n }}\n <mat-icon\n [ngClass]=\"{\n 'td-status-dialog__arrow-icon': true,\n close: !showDetails,\n open: showDetails\n }\"\n >arrow_drop_down</mat-icon\n >\n </div>\n <div *ngIf=\"showDetails\">{{ details }}</div>\n </span>\n </ng-container>\n <ng-container tdDialogActions>\n <button\n mat-raised-button\n color=\"primary\"\n class=\"td-status-dialog___button\"\n (click)=\"close()\"\n >\n {{ closeButton }}\n </button>\n </ng-container>\n</td-dialog>\n", styles: ["::ng-deep .mat-mdc-dialog-container .mdc-dialog__surface{background-color:var(--cv-theme-surface-container-lowest);border-radius:12px}::ng-deep .td-status-dialog-title{align-items:flex-start;display:inline-flex;justify-content:space-between;width:100%;-webkit-font-smoothing:antialiased}::ng-deep .td-status-dialog-title :first-child{padding-right:40px}::ng-deep [mat-icon-button].td-status-dialog__icon-button{--mdc-icon-button-state-layer-size: 40px;padding:8px;position:absolute;right:8px;top:10px}::ng-deep .td-status-dialog___button{border-radius:8px}::ng-deep .mat-mdc-dialog-container .mdc-dialog__title{padding:18px 16px;line-height:var(--mdc-dialog-supporting-text-line-height)}::ng-deep .mat-mdc-dialog-container .mdc-dialog__title:before{display:none}::ng-deep .mat-mdc-icon-button .mat-mdc-button-base{padding:8px}::ng-deep .mdc-dialog .mdc-dialog__content{padding:0 16px;-webkit-font-smoothing:antialiased}::ng-deep .mdc-dialog__actions{padding:16px}.td-status-dialog{width:auto}.td-status-dialog:before{padding:14px 16px 0}.td-status-dialog .td-dialog-message{font-feature-settings:\"clig\" off,\"liga\" off;color:var(--cv-theme-on-surface-variant);line-height:var(--mdc-dialog-supporting-text-line-height)}.td-status-dialog-state{padding:14px 16px 0}.td-status-dialog-state .mat-icon{font-size:var(--mat-toolbar-title-text-line-height);height:var(--mat-toolbar-title-text-line-height);width:var(--mat-toolbar-title-text-line-height);font-variation-settings:\"FILL\" 1}.td-status-dialog-state.error{background-color:var(--cv-theme-negative-8)}.td-status-dialog-state.error .mat-icon{color:var(--cv-theme-negative)}.td-status-dialog-state.positive{background-color:var(--cv-theme-positive-8)}.td-status-dialog-state.positive .mat-icon{color:var(--cv-theme-positive)}.td-status-dialog-state.warning{background-color:var(--cv-theme-caution-8)}.td-status-dialog-state.warning .mat-icon{color:var(--cv-theme-caution)}.td-status-dialog__toggle-details{align-items:center;color:var(--cv-theme-primary);cursor:pointer;display:flex;font-size:var(--mat-expansion-container-text-size);letter-spacing:.25px;line-height:var(--mat-expansion-container-text-line-height);padding:16px 0}.td-status-dialog__arrow-icon{margin-top:2px}.td-status-dialog__arrow-icon.open{transform:rotate(0);transition:transform .25s ease-out}.td-status-dialog__arrow-icon.close{transform:rotate(180deg);transition:transform .25s ease-in}@media screen and (max-width: 480px){:host .td-status-dialog-state{padding:4px}:host .td-status-dialog-state .mat-icon{display:none}:host .td-status-dialog-state.error{background-color:var(--cv-theme-negative)}:host .td-status-dialog-state.positive{background-color:var(--cv-theme-positive)}:host .td-status-dialog-state.warning{background-color:var(--cv-theme-caution)}}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i3.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "component", type: i4$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: TdDialogComponent, selector: "td-dialog" }, { kind: "directive", type: TdDialogStatusDirective, selector: "[tdDialogStatus]" }, { kind: "directive", type: TdDialogTitleDirective, selector: "[tdDialogTitle]" }, { kind: "directive", type: TdDialogActionsDirective, selector: "[tdDialogActions]" }, { kind: "directive", type: TdDialogContentDirective, selector: "[tdDialogContent]" }] });
|
251 | }
|
252 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: TdStatusDialogComponent, decorators: [{
|
253 | type: Component,
|
254 | args: [{ selector: 'td-status-dialog', template: "<td-dialog class=\"td-status-dialog\">\n <!-- Displays the icon and background color according to the state -->\n <div tdDialogStatus class=\"td-status-dialog-state\" [ngClass]=\"state\">\n <mat-icon>\n {{ getStatusIcon() }}\n </mat-icon>\n </div>\n <!-- Dialog title and the close icon -->\n <ng-container tdDialogTitle>\n <div class=\"td-status-dialog-title\">\n <span *ngIf=\"title\" class=\"\">{{ title }}</span>\n <button\n mat-icon-button\n class=\"td-status-dialog__icon-button\"\n (click)=\"close()\"\n >\n <mat-icon>close</mat-icon>\n </button>\n </div>\n </ng-container>\n <!-- Dialog content with additonal information -->\n <ng-container tdDialogContent>\n <span class=\"td-dialog-message\">\n {{ message }}\n <div\n class=\"td-status-dialog__toggle-details\"\n role=\"button\"\n tabindex=\"0\"\n *ngIf=\"details\"\n (click)=\"toggleDetails()\"\n (keydown.enter)=\"toggleDetails()\"\n >\n {{\n showDetails\n ? detailsLabels?.hideDetailsLabel\n : detailsLabels?.showDetailsLabel\n }}\n <mat-icon\n [ngClass]=\"{\n 'td-status-dialog__arrow-icon': true,\n close: !showDetails,\n open: showDetails\n }\"\n >arrow_drop_down</mat-icon\n >\n </div>\n <div *ngIf=\"showDetails\">{{ details }}</div>\n </span>\n </ng-container>\n <ng-container tdDialogActions>\n <button\n mat-raised-button\n color=\"primary\"\n class=\"td-status-dialog___button\"\n (click)=\"close()\"\n >\n {{ closeButton }}\n </button>\n </ng-container>\n</td-dialog>\n", styles: ["::ng-deep .mat-mdc-dialog-container .mdc-dialog__surface{background-color:var(--cv-theme-surface-container-lowest);border-radius:12px}::ng-deep .td-status-dialog-title{align-items:flex-start;display:inline-flex;justify-content:space-between;width:100%;-webkit-font-smoothing:antialiased}::ng-deep .td-status-dialog-title :first-child{padding-right:40px}::ng-deep [mat-icon-button].td-status-dialog__icon-button{--mdc-icon-button-state-layer-size: 40px;padding:8px;position:absolute;right:8px;top:10px}::ng-deep .td-status-dialog___button{border-radius:8px}::ng-deep .mat-mdc-dialog-container .mdc-dialog__title{padding:18px 16px;line-height:var(--mdc-dialog-supporting-text-line-height)}::ng-deep .mat-mdc-dialog-container .mdc-dialog__title:before{display:none}::ng-deep .mat-mdc-icon-button .mat-mdc-button-base{padding:8px}::ng-deep .mdc-dialog .mdc-dialog__content{padding:0 16px;-webkit-font-smoothing:antialiased}::ng-deep .mdc-dialog__actions{padding:16px}.td-status-dialog{width:auto}.td-status-dialog:before{padding:14px 16px 0}.td-status-dialog .td-dialog-message{font-feature-settings:\"clig\" off,\"liga\" off;color:var(--cv-theme-on-surface-variant);line-height:var(--mdc-dialog-supporting-text-line-height)}.td-status-dialog-state{padding:14px 16px 0}.td-status-dialog-state .mat-icon{font-size:var(--mat-toolbar-title-text-line-height);height:var(--mat-toolbar-title-text-line-height);width:var(--mat-toolbar-title-text-line-height);font-variation-settings:\"FILL\" 1}.td-status-dialog-state.error{background-color:var(--cv-theme-negative-8)}.td-status-dialog-state.error .mat-icon{color:var(--cv-theme-negative)}.td-status-dialog-state.positive{background-color:var(--cv-theme-positive-8)}.td-status-dialog-state.positive .mat-icon{color:var(--cv-theme-positive)}.td-status-dialog-state.warning{background-color:var(--cv-theme-caution-8)}.td-status-dialog-state.warning .mat-icon{color:var(--cv-theme-caution)}.td-status-dialog__toggle-details{align-items:center;color:var(--cv-theme-primary);cursor:pointer;display:flex;font-size:var(--mat-expansion-container-text-size);letter-spacing:.25px;line-height:var(--mat-expansion-container-text-line-height);padding:16px 0}.td-status-dialog__arrow-icon{margin-top:2px}.td-status-dialog__arrow-icon.open{transform:rotate(0);transition:transform .25s ease-out}.td-status-dialog__arrow-icon.close{transform:rotate(180deg);transition:transform .25s ease-in}@media screen and (max-width: 480px){:host .td-status-dialog-state{padding:4px}:host .td-status-dialog-state .mat-icon{display:none}:host .td-status-dialog-state.error{background-color:var(--cv-theme-negative)}:host .td-status-dialog-state.positive{background-color:var(--cv-theme-positive)}:host .td-status-dialog-state.warning{background-color:var(--cv-theme-caution)}}\n"] }]
|
255 | }], ctorParameters: () => [{ type: i1.MatDialogRef }] });
|
256 |
|
257 | class TdDialogService {
|
258 | _document;
|
259 | _dialogService;
|
260 | _dragDrop;
|
261 | rendererFactory;
|
262 | _renderer2;
|
263 | constructor(_document, _dialogService, _dragDrop, rendererFactory) {
|
264 | this._document = _document;
|
265 | this._dialogService = _dialogService;
|
266 | this._dragDrop = _dragDrop;
|
267 | this.rendererFactory = rendererFactory;
|
268 | this._renderer2 = rendererFactory.createRenderer(undefined, null);
|
269 | }
|
270 | |
271 |
|
272 |
|
273 |
|
274 |
|
275 |
|
276 |
|
277 | open(component, config) {
|
278 | return this._dialogService.open(component, config);
|
279 | }
|
280 | |
281 |
|
282 |
|
283 |
|
284 | closeAll() {
|
285 | this._dialogService.closeAll();
|
286 | }
|
287 | |
288 |
|
289 |
|
290 |
|
291 |
|
292 |
|
293 |
|
294 |
|
295 |
|
296 |
|
297 |
|
298 |
|
299 | openAlert(config) {
|
300 | const dialogConfig = this._createConfig(config);
|
301 | const dialogRef = this._dialogService.open(TdAlertDialogComponent, dialogConfig);
|
302 | const alertDialogComponent = dialogRef.componentInstance;
|
303 | alertDialogComponent.title = config.title;
|
304 | alertDialogComponent.message = config.message;
|
305 | if (config.closeButton) {
|
306 | alertDialogComponent.closeButton = config.closeButton;
|
307 | }
|
308 | return dialogRef;
|
309 | }
|
310 | |
311 |
|
312 |
|
313 |
|
314 |
|
315 |
|
316 |
|
317 |
|
318 |
|
319 |
|
320 |
|
321 |
|
322 |
|
323 |
|
324 | openConfirm(config) {
|
325 | const dialogConfig = this._createConfig(config);
|
326 | const dialogRef = this._dialogService.open(TdConfirmDialogComponent, dialogConfig);
|
327 | const confirmDialogComponent = dialogRef.componentInstance;
|
328 | confirmDialogComponent.title = config.title;
|
329 | confirmDialogComponent.message = config.message;
|
330 | if (config.acceptButton) {
|
331 | confirmDialogComponent.acceptButton = config.acceptButton;
|
332 | }
|
333 | if (config.isDestructive) {
|
334 | confirmDialogComponent.isDestructive = config.isDestructive;
|
335 | }
|
336 | if (config.cancelButton) {
|
337 | confirmDialogComponent.cancelButton = config.cancelButton;
|
338 | }
|
339 | return dialogRef;
|
340 | }
|
341 | |
342 |
|
343 |
|
344 |
|
345 |
|
346 |
|
347 |
|
348 |
|
349 |
|
350 |
|
351 |
|
352 |
|
353 |
|
354 |
|
355 | openPrompt(config) {
|
356 | const dialogConfig = this._createConfig(config);
|
357 | const dialogRef = this._dialogService.open(TdPromptDialogComponent, dialogConfig);
|
358 | const promptDialogComponent = dialogRef.componentInstance;
|
359 | promptDialogComponent.title = config.title;
|
360 | promptDialogComponent.message = config.message;
|
361 | promptDialogComponent.value = config.value;
|
362 | if (config.acceptButton) {
|
363 | promptDialogComponent.acceptButton = config.acceptButton;
|
364 | }
|
365 | if (config.cancelButton) {
|
366 | promptDialogComponent.cancelButton = config.cancelButton;
|
367 | }
|
368 | return dialogRef;
|
369 | }
|
370 | |
371 |
|
372 |
|
373 | openDraggable({ component, config, dragHandleSelectors, draggableClass, }) {
|
374 | const matDialogRef = this._dialogService.open(component, config);
|
375 | const dragRefSubject = new Subject();
|
376 | const CDK_OVERLAY_PANE_SELECTOR = '.cdk-overlay-pane';
|
377 | const CDK_OVERLAY_CONTAINER_SELECTOR = '.cdk-overlay-container';
|
378 | matDialogRef.afterOpened().subscribe(() => {
|
379 | const dialogElement = (this._document.getElementById(matDialogRef.id));
|
380 | if (!dialogElement) {
|
381 | return;
|
382 | }
|
383 | const draggableElement = this._dragDrop.createDrag(dialogElement);
|
384 | if (draggableClass) {
|
385 | const childComponent = dialogElement.firstElementChild;
|
386 | this._renderer2.addClass(childComponent, draggableClass);
|
387 | }
|
388 | if (dragHandleSelectors && dragHandleSelectors.length) {
|
389 | const dragHandles = dragHandleSelectors.reduce((acc, curr) => [
|
390 | ...acc,
|
391 | ...Array.from(dialogElement.querySelectorAll(curr)),
|
392 | ], []);
|
393 | if (dragHandles.length > 0) {
|
394 | draggableElement.withHandles(dragHandles);
|
395 | }
|
396 | }
|
397 | const rootElement = dialogElement.closest(CDK_OVERLAY_PANE_SELECTOR);
|
398 | if (rootElement) {
|
399 | draggableElement.withRootElement(rootElement);
|
400 | }
|
401 | const boundaryElement = dialogElement.closest(CDK_OVERLAY_CONTAINER_SELECTOR);
|
402 | if (boundaryElement) {
|
403 | draggableElement.withBoundaryElement(boundaryElement);
|
404 | }
|
405 | dragRefSubject.next(draggableElement);
|
406 | });
|
407 | return { matDialogRef, dragRefSubject };
|
408 | }
|
409 | _createConfig(config) {
|
410 | const dialogConfig = new MatDialogConfig();
|
411 | dialogConfig.width = '400px';
|
412 | Object.assign(dialogConfig, config);
|
413 | return dialogConfig;
|
414 | }
|
415 | |
416 |
|
417 |
|
418 |
|
419 |
|
420 |
|
421 |
|
422 |
|
423 |
|
424 |
|
425 |
|
426 |
|
427 |
|
428 |
|
429 |
|
430 | openStatus(config) {
|
431 | config.panelClass = 'td-status-dialog';
|
432 | config.autoFocus = false;
|
433 | config.width = '575px';
|
434 | config.maxWidth = '96vw';
|
435 | const dialogConfig = this._createConfig(config);
|
436 | const dialogRef = this._dialogService.open(TdStatusDialogComponent, dialogConfig);
|
437 | const statusDialogComponent = dialogRef.componentInstance;
|
438 | statusDialogComponent.title = config.title;
|
439 | statusDialogComponent.message = config.message;
|
440 | statusDialogComponent.state = config.state;
|
441 | statusDialogComponent.details = config.details;
|
442 | if (config.detailsLabels) {
|
443 | statusDialogComponent.detailsLabels = config.detailsLabels;
|
444 | }
|
445 | if (config.closeButton) {
|
446 | statusDialogComponent.closeButton = config.closeButton;
|
447 | }
|
448 | return dialogRef;
|
449 | }
|
450 | static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: TdDialogService, deps: [{ token: DOCUMENT }, { token: i1.MatDialog }, { token: i2$2.DragDrop }, { token: i0.RendererFactory2 }], target: i0.ɵɵFactoryTarget.Injectable });
|
451 | static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: TdDialogService });
|
452 | }
|
453 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: TdDialogService, decorators: [{
|
454 | type: Injectable
|
455 | }], ctorParameters: () => [{ type: undefined, decorators: [{
|
456 | type: Inject,
|
457 | args: [DOCUMENT]
|
458 | }] }, { type: i1.MatDialog }, { type: i2$2.DragDrop }, { type: i0.RendererFactory2 }] });
|
459 |
|
460 | class TdWindowDialogComponent {
|
461 | toolbarColor;
|
462 | docked = false;
|
463 | title;
|
464 | toggleDockedStateLabel;
|
465 | closeLabel;
|
466 | dockToggled = new EventEmitter();
|
467 | closed = new EventEmitter();
|
468 | toolbarHeight = 56;
|
469 | toggleDockedState() {
|
470 | this.dockToggled.emit(this.docked);
|
471 | }
|
472 | static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: TdWindowDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
473 | static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.2", type: TdWindowDialogComponent, selector: "td-window-dialog", inputs: { toolbarColor: "toolbarColor", docked: "docked", title: "title", toggleDockedStateLabel: "toggleDockedStateLabel", closeLabel: "closeLabel" }, outputs: { dockToggled: "dockToggled", closed: "closed" }, ngImport: i0, template: "<mat-toolbar\n [color]=\"toolbarColor\"\n class=\"td-window-dialog-toolbar\"\n [style.min-height.px]=\"toolbarHeight\"\n [style.cursor]=\"docked ? 'inherit' : 'move'\"\n>\n <mat-toolbar-row [style.height.px]=\"toolbarHeight\">\n <div layout=\"row\" layout-align=\"start center\" flex>\n <span class=\"mat-title td-window-dialog-title truncate\" flex>\n {{ title }}\n </span>\n\n <button\n mat-icon-button\n [matTooltip]=\"toggleDockedStateLabel ?? ''\"\n (click)=\"toggleDockedState()\"\n >\n <mat-icon [attr.aria-label]=\"toggleDockedStateLabel\"\n >dock_to_right</mat-icon\n >\n </button>\n\n <button\n mat-icon-button\n [matTooltip]=\"closeLabel ?? ''\"\n (click)=\"closed.emit()\"\n class=\"td-window-dialog-close\"\n [attr.data-test]=\"'close-button'\"\n >\n <mat-icon [attr.aria-label]=\"closeLabel\">close</mat-icon>\n </button>\n </div>\n </mat-toolbar-row>\n</mat-toolbar>\n<ng-content></ng-content>\n", styles: [":host{height:100%;display:flex;flex-direction:column}.truncate{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.td-window-dialog-toolbar{background:none}.td-window-dialog-title{margin-bottom:0}.td-window-dialog-close{margin-right:-8px}::ng-deep .td-window-dialog .mat-dialog-container{padding:0}\n"], dependencies: [{ kind: "component", type: i3.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "component", type: i2$3.MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }, { kind: "directive", type: i2$3.MatToolbarRow, selector: "mat-toolbar-row", exportAs: ["matToolbarRow"] }, { kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: i4$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
474 | }
|
475 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: TdWindowDialogComponent, decorators: [{
|
476 | type: Component,
|
477 | args: [{ selector: 'td-window-dialog', changeDetection: ChangeDetectionStrategy.OnPush, template: "<mat-toolbar\n [color]=\"toolbarColor\"\n class=\"td-window-dialog-toolbar\"\n [style.min-height.px]=\"toolbarHeight\"\n [style.cursor]=\"docked ? 'inherit' : 'move'\"\n>\n <mat-toolbar-row [style.height.px]=\"toolbarHeight\">\n <div layout=\"row\" layout-align=\"start center\" flex>\n <span class=\"mat-title td-window-dialog-title truncate\" flex>\n {{ title }}\n </span>\n\n <button\n mat-icon-button\n [matTooltip]=\"toggleDockedStateLabel ?? ''\"\n (click)=\"toggleDockedState()\"\n >\n <mat-icon [attr.aria-label]=\"toggleDockedStateLabel\"\n >dock_to_right</mat-icon\n >\n </button>\n\n <button\n mat-icon-button\n [matTooltip]=\"closeLabel ?? ''\"\n (click)=\"closed.emit()\"\n class=\"td-window-dialog-close\"\n [attr.data-test]=\"'close-button'\"\n >\n <mat-icon [attr.aria-label]=\"closeLabel\">close</mat-icon>\n </button>\n </div>\n </mat-toolbar-row>\n</mat-toolbar>\n<ng-content></ng-content>\n", styles: [":host{height:100%;display:flex;flex-direction:column}.truncate{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.td-window-dialog-toolbar{background:none}.td-window-dialog-title{margin-bottom:0}.td-window-dialog-close{margin-right:-8px}::ng-deep .td-window-dialog .mat-dialog-container{padding:0}\n"] }]
|
478 | }], propDecorators: { toolbarColor: [{
|
479 | type: Input
|
480 | }], docked: [{
|
481 | type: Input
|
482 | }], title: [{
|
483 | type: Input
|
484 | }], toggleDockedStateLabel: [{
|
485 | type: Input
|
486 | }], closeLabel: [{
|
487 | type: Input
|
488 | }], dockToggled: [{
|
489 | type: Output
|
490 | }], closed: [{
|
491 | type: Output
|
492 | }] } });
|
493 |
|
494 | const TD_DIALOGS = [
|
495 | TdAlertDialogComponent,
|
496 | TdConfirmDialogComponent,
|
497 | TdPromptDialogComponent,
|
498 | TdDialogComponent,
|
499 | TdDialogStatusDirective,
|
500 | TdDialogTitleDirective,
|
501 | TdDialogActionsDirective,
|
502 | TdDialogContentDirective,
|
503 | TdWindowDialogComponent,
|
504 | TdAlertDialogComponent,
|
505 | TdConfirmDialogComponent,
|
506 | TdPromptDialogComponent,
|
507 | TdStatusDialogComponent,
|
508 | ];
|
509 | class CovalentDialogsModule {
|
510 | static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: CovalentDialogsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
511 | static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.1.2", ngImport: i0, type: CovalentDialogsModule, declarations: [TdAlertDialogComponent,
|
512 | TdConfirmDialogComponent,
|
513 | TdPromptDialogComponent,
|
514 | TdDialogComponent,
|
515 | TdDialogStatusDirective,
|
516 | TdDialogTitleDirective,
|
517 | TdDialogActionsDirective,
|
518 | TdDialogContentDirective,
|
519 | TdWindowDialogComponent,
|
520 | TdAlertDialogComponent,
|
521 | TdConfirmDialogComponent,
|
522 | TdPromptDialogComponent,
|
523 | TdStatusDialogComponent], imports: [FormsModule,
|
524 | CommonModule,
|
525 | MatDialogModule,
|
526 | MatInputModule,
|
527 | MatButtonModule,
|
528 | MatToolbarModule,
|
529 | MatTooltipModule,
|
530 | MatIconModule], exports: [TdAlertDialogComponent,
|
531 | TdConfirmDialogComponent,
|
532 | TdPromptDialogComponent,
|
533 | TdDialogComponent,
|
534 | TdDialogStatusDirective,
|
535 | TdDialogTitleDirective,
|
536 | TdDialogActionsDirective,
|
537 | TdDialogContentDirective,
|
538 | TdWindowDialogComponent,
|
539 | TdAlertDialogComponent,
|
540 | TdConfirmDialogComponent,
|
541 | TdPromptDialogComponent,
|
542 | TdStatusDialogComponent] });
|
543 | static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: CovalentDialogsModule, providers: [TdDialogService], imports: [FormsModule,
|
544 | CommonModule,
|
545 | MatDialogModule,
|
546 | MatInputModule,
|
547 | MatButtonModule,
|
548 | MatToolbarModule,
|
549 | MatTooltipModule,
|
550 | MatIconModule] });
|
551 | }
|
552 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: CovalentDialogsModule, decorators: [{
|
553 | type: NgModule,
|
554 | args: [{
|
555 | imports: [
|
556 | FormsModule,
|
557 | CommonModule,
|
558 | MatDialogModule,
|
559 | MatInputModule,
|
560 | MatButtonModule,
|
561 | MatToolbarModule,
|
562 | MatTooltipModule,
|
563 | MatIconModule,
|
564 | ],
|
565 | declarations: [...TD_DIALOGS],
|
566 | exports: [...TD_DIALOGS],
|
567 | providers: [TdDialogService],
|
568 | }]
|
569 | }] });
|
570 |
|
571 | var corners;
|
572 | (function (corners) {
|
573 | corners["topRight"] = "topRight";
|
574 | corners["bottomRight"] = "bottomRight";
|
575 | corners["bottomLeft"] = "bottomLeft";
|
576 | corners["topLeft"] = "topLeft";
|
577 | })(corners || (corners = {}));
|
578 | var cursors;
|
579 | (function (cursors) {
|
580 | cursors["nesw"] = "nesw-resize";
|
581 | cursors["nwse"] = "nwse-resize";
|
582 | })(cursors || (cursors = {}));
|
583 | var verticalAlignment;
|
584 | (function (verticalAlignment) {
|
585 | verticalAlignment["top"] = "top";
|
586 | verticalAlignment["bottom"] = "bottom";
|
587 | })(verticalAlignment || (verticalAlignment = {}));
|
588 | var horizontalAlignment;
|
589 | (function (horizontalAlignment) {
|
590 | horizontalAlignment["right"] = "right";
|
591 | horizontalAlignment["left"] = "left";
|
592 | })(horizontalAlignment || (horizontalAlignment = {}));
|
593 | const cornerWidth = '16px';
|
594 | const offset = '0px';
|
595 | const minWidth = 200;
|
596 | const minHeight = 200;
|
597 | function getPixels(sizeString) {
|
598 | return parseFloat((sizeString || '').replace('px', ''));
|
599 | }
|
600 | function clamp(min, num, max) {
|
601 | return Math.min(Math.max(num, min), max);
|
602 | }
|
603 | class ResizableDraggableDialog {
|
604 | _document;
|
605 | _renderer2;
|
606 | _dialogRef;
|
607 | _dragRef;
|
608 | cornerElements = [];
|
609 | pointerDownSubs = [];
|
610 | constructor(_document, _renderer2, _dialogRef, _dragRef) {
|
611 | this._document = _document;
|
612 | this._renderer2 = _renderer2;
|
613 | this._dialogRef = _dialogRef;
|
614 | this._dragRef = _dragRef;
|
615 | this._initialPositionReset();
|
616 | this._attachCorners();
|
617 | }
|
618 | attach() {
|
619 | this.detach();
|
620 | this._attachCorners();
|
621 | }
|
622 | detach() {
|
623 | this.pointerDownSubs.forEach((sub) => sub.unsubscribe());
|
624 | this.pointerDownSubs = [];
|
625 | this.cornerElements.forEach((elem) => this._renderer2.removeChild(this._getDialogWrapper(), elem));
|
626 | this.cornerElements = [];
|
627 | }
|
628 | _getDialogWrapper() {
|
629 | return (this._document.getElementById(this._dialogRef.id) || {}).parentElement;
|
630 | }
|
631 | _getViewportDimensions() {
|
632 | return this._getDialogWrapper()?.parentElement?.getBoundingClientRect();
|
633 | }
|
634 | _getDialogWrapperDimensions() {
|
635 | const wrapper = this._getDialogWrapper();
|
636 | if (!wrapper) {
|
637 | return { width: 0, height: 0 };
|
638 | }
|
639 | const dimensions = getComputedStyle(wrapper);
|
640 | return {
|
641 | width: getPixels(dimensions.width),
|
642 | height: getPixels(dimensions.height),
|
643 | };
|
644 | }
|
645 | _initialPositionReset() {
|
646 | const viewportWidth = this._getViewportDimensions()?.right ?? 0;
|
647 | const viewportHeight = this._getViewportDimensions()?.bottom ?? 0;
|
648 | const { width, height } = this._getDialogWrapperDimensions();
|
649 | const wrapperStyle = this._getDialogWrapper()?.style;
|
650 | const originalDialogRight = wrapperStyle?.marginRight;
|
651 | const originalDialogLeft = wrapperStyle?.marginLeft;
|
652 | const originalDialogBottom = wrapperStyle?.marginBottom;
|
653 | const originalDialogTop = wrapperStyle?.marginTop;
|
654 | let x;
|
655 | if (originalDialogLeft) {
|
656 | x = getPixels(originalDialogLeft);
|
657 | }
|
658 | else if (originalDialogRight) {
|
659 | x = viewportWidth - getPixels(originalDialogRight) - width;
|
660 | }
|
661 | else {
|
662 | x = (viewportWidth - width) / 2;
|
663 | }
|
664 | let y;
|
665 | if (originalDialogTop) {
|
666 | y = getPixels(originalDialogTop);
|
667 | }
|
668 | else if (originalDialogBottom) {
|
669 | y = viewportHeight - getPixels(originalDialogBottom) - height;
|
670 | }
|
671 | else {
|
672 | y = (viewportHeight - height) / 2;
|
673 | }
|
674 |
|
675 | this._dialogRef.updatePosition({
|
676 | top: '0px',
|
677 | right: '0px',
|
678 | bottom: '0px',
|
679 | left: '0px',
|
680 | });
|
681 | this._dragRef.setFreeDragPosition({ x, y });
|
682 | }
|
683 | _attachCorners() {
|
684 | Object.values(corners).forEach((corner) => {
|
685 | const element = this._renderer2.createElement('div');
|
686 | this.cornerElements = [...this.cornerElements, element];
|
687 | this._renderer2.setStyle(element, 'position', 'absolute');
|
688 | this._renderer2.setStyle(element, 'width', cornerWidth);
|
689 | this._renderer2.setStyle(element, 'height', cornerWidth);
|
690 | this._renderer2.setStyle(element, 'z-index', 1);
|
691 | this._renderer2.appendChild(this._getDialogWrapper(), element);
|
692 | let cursor;
|
693 | let topBottom;
|
694 | let rightLeft;
|
695 | if (corner === corners.topRight) {
|
696 | cursor = cursors.nesw;
|
697 | topBottom = verticalAlignment.top;
|
698 | rightLeft = horizontalAlignment.right;
|
699 | }
|
700 | else if (corner === corners.bottomRight) {
|
701 | cursor = cursors.nwse;
|
702 | topBottom = verticalAlignment.bottom;
|
703 | rightLeft = horizontalAlignment.right;
|
704 | const icon = this._renderer2.createElement('i');
|
705 | this._renderer2.addClass(icon, 'material-symbols-outlined');
|
706 | this._renderer2.appendChild(icon, this._renderer2.createText('filter_list'));
|
707 | this._renderer2.appendChild(element, icon);
|
708 | this._renderer2.setStyle(icon, 'transform', `rotate(${315}deg) translate(0px, ${offset})`);
|
709 | this._renderer2.setStyle(icon, 'font-size', cornerWidth);
|
710 | this._renderer2.setStyle(icon, 'z-index', 1);
|
711 | }
|
712 | else if (corner === corners.bottomLeft) {
|
713 | cursor = cursors.nesw;
|
714 | topBottom = verticalAlignment.bottom;
|
715 | rightLeft = horizontalAlignment.left;
|
716 | }
|
717 | else {
|
718 | cursor = cursors.nwse;
|
719 | topBottom = verticalAlignment.top;
|
720 | rightLeft = horizontalAlignment.left;
|
721 | }
|
722 | this._renderer2.setStyle(element, topBottom, offset);
|
723 | this._renderer2.setStyle(element, rightLeft, offset);
|
724 | this._renderer2.setStyle(element, 'cursor', cursor);
|
725 | const pointerDownSub = fromEvent(element, 'pointerdown').subscribe((event) => {
|
726 | this._handleMouseDown(event, corner);
|
727 | });
|
728 | this.pointerDownSubs = [...this.pointerDownSubs, pointerDownSub];
|
729 | });
|
730 | }
|
731 | _handleMouseDown(event, corner) {
|
732 | this._renderer2.setStyle(this._document.body, 'user-select', 'none');
|
733 | const { width: originalWidth, height: originalHeight } = this._getDialogWrapperDimensions();
|
734 | const originalMouseX = event.pageX;
|
735 | const originalMouseY = event.pageY;
|
736 | const { x: currentTransformX, y: currentTransformY } = this._dragRef.getFreeDragPosition();
|
737 | const wrapper = this._getDialogWrapper()?.getBoundingClientRect();
|
738 | const distanceFromBottom = wrapper?.bottom ?? 0;
|
739 | const distanceFromRight = wrapper?.right ?? 0;
|
740 | const viewportWidth = this._getViewportDimensions()?.right ?? 0;
|
741 | const viewportHeight = this._getViewportDimensions()?.bottom ?? 0;
|
742 | const mouseMoveSub = fromEvent(window, 'pointermove').subscribe((e) => {
|
743 | e.preventDefault();
|
744 | const yDelta = clamp(0, e.pageY, viewportHeight) - originalMouseY;
|
745 | const xDelta = clamp(0, e.pageX, viewportWidth) - originalMouseX;
|
746 | let newHeight;
|
747 | let newWidth;
|
748 | let newTransformY = 0;
|
749 | let newTransformX = 0;
|
750 |
|
751 | if (corner === corners.topRight) {
|
752 | newHeight = clamp(minHeight, originalHeight - yDelta, viewportHeight);
|
753 | newWidth = clamp(minWidth, originalWidth + xDelta, viewportWidth);
|
754 | newTransformY = clamp(0, currentTransformY + yDelta, distanceFromBottom - newHeight);
|
755 | newTransformX = currentTransformX;
|
756 | }
|
757 |
|
758 | else if (corner === corners.bottomRight) {
|
759 | newHeight = clamp(minHeight, originalHeight + yDelta, viewportHeight);
|
760 | newWidth = clamp(minWidth, originalWidth + xDelta, viewportWidth);
|
761 | newTransformY = currentTransformY;
|
762 | newTransformX = currentTransformX;
|
763 | }
|
764 |
|
765 | else if (corner === corners.bottomLeft) {
|
766 | newHeight = clamp(minHeight, originalHeight + yDelta, viewportHeight);
|
767 | newWidth = clamp(minWidth, originalWidth - xDelta, viewportWidth);
|
768 | newTransformY = currentTransformY;
|
769 | newTransformX = clamp(0, currentTransformX + xDelta, distanceFromRight - newWidth);
|
770 | }
|
771 |
|
772 | else {
|
773 | newHeight = clamp(minHeight, originalHeight - yDelta, viewportHeight);
|
774 | newWidth = clamp(minWidth, originalWidth - xDelta, viewportWidth);
|
775 | newTransformX = clamp(0, currentTransformX + xDelta, distanceFromRight - newWidth);
|
776 | newTransformY = clamp(0, currentTransformY + yDelta, distanceFromBottom - newHeight);
|
777 | }
|
778 | this._dialogRef.updateSize(`${newWidth}px`, `${newHeight}px`);
|
779 | this._dragRef.setFreeDragPosition({
|
780 | x: newTransformX,
|
781 | y: newTransformY,
|
782 | });
|
783 | });
|
784 | const mouseUpSub = merge(fromEvent(window, 'pointerup'), fromEvent(window, 'pointercancel')).subscribe(() => {
|
785 | this._renderer2.removeStyle(this._document.body, 'user-select');
|
786 | mouseMoveSub.unsubscribe();
|
787 | mouseUpSub.unsubscribe();
|
788 | });
|
789 | }
|
790 | }
|
791 |
|
792 |
|
793 |
|
794 |
|
795 |
|
796 | export { CovalentDialogsModule, ResizableDraggableDialog, TdAlertDialogComponent, TdConfirmDialogComponent, TdDialogActionsDirective, TdDialogComponent, TdDialogContentDirective, TdDialogService, TdDialogStatusDirective, TdDialogTitleDirective, TdPromptDialogComponent, TdStatusDialogComponent, TdWindowDialogComponent };
|
797 |
|