@huntsman-cancer-institute/dialog 12.11.9-SNAPSHOT
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/README.md +24 -0
- package/alert/alert-dialog.component.d.ts +31 -0
- package/bundles/huntsman-cancer-institute-dialog.umd.js +1049 -0
- package/bundles/huntsman-cancer-institute-dialog.umd.js.map +1 -0
- package/bundles/huntsman-cancer-institute-dialog.umd.min.js +2 -0
- package/bundles/huntsman-cancer-institute-dialog.umd.min.js.map +1 -0
- package/confirm/confirm-dialog.component.d.ts +18 -0
- package/custom/custom-dialog.component.d.ts +35 -0
- package/dialog.module.d.ts +27 -0
- package/esm2015/alert/alert-dialog.component.js +243 -0
- package/esm2015/confirm/confirm-dialog.component.js +130 -0
- package/esm2015/custom/custom-dialog.component.js +231 -0
- package/esm2015/dialog.module.js +157 -0
- package/esm2015/generic/generic-container-dialog.component.js +158 -0
- package/esm2015/huntsman-cancer-institute-dialog.js +5 -0
- package/esm2015/index.js +13 -0
- package/esm2015/model/base-generic-container-dialog.js +26 -0
- package/esm2015/model/confirm-type.model.js +12 -0
- package/esm2015/model/dialog-type.model.js +12 -0
- package/esm2015/model/generic-dialog-action.model.js +6 -0
- package/esm2015/save-footer/save-footer.component.js +135 -0
- package/esm2015/service/dialog.service.js +272 -0
- package/esm2015/spinner/spinner-dialog.component.js +69 -0
- package/esm5/alert/alert-dialog.component.js +105 -0
- package/esm5/confirm/confirm-dialog.component.js +101 -0
- package/esm5/custom/custom-dialog.component.js +118 -0
- package/esm5/dialog.module.js +161 -0
- package/esm5/generic/generic-container-dialog.component.js +128 -0
- package/esm5/huntsman-cancer-institute-dialog.js +5 -0
- package/esm5/index.js +13 -0
- package/esm5/model/base-generic-container-dialog.js +28 -0
- package/esm5/model/confirm-type.model.js +12 -0
- package/esm5/model/dialog-type.model.js +12 -0
- package/esm5/model/generic-dialog-action.model.js +6 -0
- package/esm5/save-footer/save-footer.component.js +86 -0
- package/esm5/service/dialog.service.js +307 -0
- package/esm5/spinner/spinner-dialog.component.js +47 -0
- package/fesm2015/huntsman-cancer-institute-dialog.js +1396 -0
- package/fesm2015/huntsman-cancer-institute-dialog.js.map +1 -0
- package/fesm5/huntsman-cancer-institute-dialog.js +1047 -0
- package/fesm5/huntsman-cancer-institute-dialog.js.map +1 -0
- package/generic/generic-container-dialog.component.d.ts +38 -0
- package/huntsman-cancer-institute-dialog.d.ts +5 -0
- package/index.d.ts +14 -0
- package/model/base-generic-container-dialog.d.ts +13 -0
- package/model/confirm-type.model.d.ts +10 -0
- package/model/dialog-type.model.d.ts +10 -0
- package/model/generic-dialog-action.model.d.ts +18 -0
- package/package.json +34 -0
- package/save-footer/save-footer.component.d.ts +24 -0
- package/service/dialog.service.d.ts +45 -0
- package/spinner/spinner-dialog.component.d.ts +12 -0
|
@@ -0,0 +1,1396 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { ɵɵngDeclareFactory, ChangeDetectorRef, ɵɵFactoryTarget, ɵɵngDeclareComponent, ɵɵngDeclareClassMetadata, Component, Inject, ViewChild, HostListener, Input, ViewContainerRef, HostBinding, ɵɵngDeclareInjectable, Injectable, EventEmitter, Output, ɵɵngDeclareNgModule, ɵɵngDeclareInjector, NgModule } from '@angular/core';
|
|
3
|
+
import { NgIf, NgForOf, NgClass, CommonModule } from '@angular/common';
|
|
4
|
+
import { FormsModule } from '@angular/forms';
|
|
5
|
+
import { MatDialogRef, MAT_DIALOG_DATA, MatDialogTitle, MatDialogContent, MatDialogActions, MatDialog, MatDialogConfig, MatDialogModule } from '@angular/material/dialog';
|
|
6
|
+
import { MatSpinner, MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
7
|
+
import { Router } from '@angular/router';
|
|
8
|
+
import { DynamicComponent, DynamicIoDirective, DynamicModule } from 'ng-dynamic-component';
|
|
9
|
+
import { MatExpansionPanel, MatExpansionPanelHeader, MatExpansionPanelTitle, MatExpansionModule } from '@angular/material/expansion';
|
|
10
|
+
import { MatButton, MatButtonModule } from '@angular/material/button';
|
|
11
|
+
|
|
12
|
+
var DialogType;
|
|
13
|
+
(function (DialogType) {
|
|
14
|
+
DialogType["ERROR"] = "Error";
|
|
15
|
+
DialogType["WARNING"] = "Warning";
|
|
16
|
+
DialogType["ALERT"] = "Alert";
|
|
17
|
+
DialogType["SUCCESS"] = "Succeed";
|
|
18
|
+
DialogType["FAILED"] = "Failed";
|
|
19
|
+
DialogType["CONFIRM"] = "Confirm";
|
|
20
|
+
DialogType["INFO"] = "Info";
|
|
21
|
+
DialogType["VALIDATION"] = "Validation Error";
|
|
22
|
+
})(DialogType || (DialogType = {}));
|
|
23
|
+
|
|
24
|
+
var ActionType;
|
|
25
|
+
(function (ActionType) {
|
|
26
|
+
ActionType["PRIMARY"] = "primary";
|
|
27
|
+
ActionType["SECONDARY"] = "accent";
|
|
28
|
+
})(ActionType || (ActionType = {}));
|
|
29
|
+
|
|
30
|
+
class AlertDialogComponent {
|
|
31
|
+
constructor(dialogRef, data, changeDetector) {
|
|
32
|
+
this.dialogRef = dialogRef;
|
|
33
|
+
this.data = data;
|
|
34
|
+
this.changeDetector = changeDetector;
|
|
35
|
+
this.type = DialogType;
|
|
36
|
+
this.message = null;
|
|
37
|
+
this.title = '';
|
|
38
|
+
this.icon = '';
|
|
39
|
+
this.dialogType = '';
|
|
40
|
+
this.defaultTitle = '';
|
|
41
|
+
this.actionType = ActionType.SECONDARY;
|
|
42
|
+
this.originalXClick = 0;
|
|
43
|
+
this.originalYClick = 0;
|
|
44
|
+
this.positionX = 0;
|
|
45
|
+
this.positionY = 0;
|
|
46
|
+
this.movingDialog = false;
|
|
47
|
+
if (data) {
|
|
48
|
+
this.message = Array.isArray(data.message) ? data.message : [data.message];
|
|
49
|
+
this.title = data.title;
|
|
50
|
+
this.icon = data.icon;
|
|
51
|
+
this.dialogType = data.dialogType;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
ngOnInit() {
|
|
55
|
+
if (this.dialogType) {
|
|
56
|
+
this.defaultTitle = this.dialogType;
|
|
57
|
+
}
|
|
58
|
+
for (let i = 0; i < this.message.length; i++) {
|
|
59
|
+
this.message[i] = this.message[i].replace(/\n/g, '<br>') + '<br>';
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
onClickOk() {
|
|
63
|
+
this.dialogRef.close(true);
|
|
64
|
+
}
|
|
65
|
+
onClickYes() {
|
|
66
|
+
this.dialogRef.close(true);
|
|
67
|
+
}
|
|
68
|
+
onClickNo() {
|
|
69
|
+
this.dialogRef.close();
|
|
70
|
+
}
|
|
71
|
+
onMouseDownHeader(event) {
|
|
72
|
+
if (!event) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
this.positionX = this.topmostLeftmost.nativeElement.offsetLeft;
|
|
76
|
+
this.positionY = this.topmostLeftmost.nativeElement.offsetTop;
|
|
77
|
+
this.originalXClick = event.screenX;
|
|
78
|
+
this.originalYClick = event.screenY;
|
|
79
|
+
this.movingDialog = true;
|
|
80
|
+
this.changeDetector.detach();
|
|
81
|
+
}
|
|
82
|
+
onMouseMove(event) {
|
|
83
|
+
if (!event) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (this.movingDialog) {
|
|
87
|
+
this.positionX += event.screenX - this.originalXClick;
|
|
88
|
+
this.positionY += event.screenY - this.originalYClick;
|
|
89
|
+
this.originalXClick = event.screenX;
|
|
90
|
+
this.originalYClick = event.screenY;
|
|
91
|
+
const newDialogPosition = {
|
|
92
|
+
left: '' + this.positionX + 'px',
|
|
93
|
+
top: '' + this.positionY + 'px',
|
|
94
|
+
};
|
|
95
|
+
this.dialogRef.updatePosition(newDialogPosition);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
onMouseUp() {
|
|
99
|
+
this.movingDialog = false;
|
|
100
|
+
this.changeDetector.reattach();
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
AlertDialogComponent.ɵfac = ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: AlertDialogComponent, deps: [{ token: MatDialogRef }, { token: MAT_DIALOG_DATA }, { token: ChangeDetectorRef }], target: ɵɵFactoryTarget.Component });
|
|
104
|
+
AlertDialogComponent.ɵcmp = ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: AlertDialogComponent, selector: "hci-alert-dialog", host: { listeners: { "window:mousemove": "onMouseMove($event)", "window:mouseup": "onMouseUp($event)" } }, viewQueries: [{ propertyName: "topmostLeftmost", first: true, predicate: ["topmostLeftmost"], descendants: true }], ngImport: i0, template: `
|
|
105
|
+
<div class="full-height full-width d-flex flex-column">
|
|
106
|
+
<div class="full-width dialog-header-colors no-margin no-padding">
|
|
107
|
+
<div #topmostLeftmost mat-dialog-title (mousedown)="onMouseDownHeader($event)"
|
|
108
|
+
class="force-flex-container-row align-center full-width padding {{ movingDialog ? 'grabbed' : 'grabbable' }}">
|
|
109
|
+
<div class="d-flex flex-row align-items-center padded">
|
|
110
|
+
<img *ngIf="icon" class="icon" [src]="this.icon">
|
|
111
|
+
<div *ngIf="!icon">
|
|
112
|
+
<i *ngIf="dialogType === type.ALERT" class="fa fa-exclamation fa-2x i-margin i-color-blue"></i>
|
|
113
|
+
<i *ngIf="dialogType === type.SUCCESS" class="fa fa-check-circle fa-2x i-margin i-color-blue"></i>
|
|
114
|
+
<i *ngIf="dialogType === type.FAILED || dialogType === type.ERROR" class="fa fa-exclamation-triangle fa-2x i-margin i-color-red"></i>
|
|
115
|
+
<i *ngIf="dialogType === type.WARNING || dialogType === type.VALIDATION" class="fa fa-exclamation-triangle fa-2x i-margin i-color-blue"></i>
|
|
116
|
+
<i *ngIf="dialogType === type.INFO" class="fa fa-info-circle fa-2x i-margin i-color-blue"></i>
|
|
117
|
+
<i *ngIf="dialogType === type.CONFIRM" class="fa fa-check fa-2x i-margin i-color-blue"></i>
|
|
118
|
+
</div>
|
|
119
|
+
<h1 *ngIf="dialogType !== type.ERROR"
|
|
120
|
+
style="margin:0;">{{this.title ? this.title : defaultTitle}}</h1>
|
|
121
|
+
<h1 *ngIf="dialogType === type.ERROR"
|
|
122
|
+
style="margin:0; color: Red">{{this.title ? this.title : defaultTitle}}</h1>
|
|
123
|
+
</div>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
<mat-dialog-content class="flex-grow-1 no-margin no-padding">
|
|
127
|
+
<hr>
|
|
128
|
+
<div class="flex-grow-1 full-width extra-padded message">
|
|
129
|
+
<div *ngFor="let line of message" class="full-width"
|
|
130
|
+
[innerHTML]="line" style="white-space: pre-line">
|
|
131
|
+
</div>
|
|
132
|
+
</div>
|
|
133
|
+
<br>
|
|
134
|
+
</mat-dialog-content>
|
|
135
|
+
<mat-dialog-actions class="d-flex justify-content-center no-margin no-padding">
|
|
136
|
+
<save-footer *ngIf="dialogType !== type.CONFIRM" class="centered-text large-size"
|
|
137
|
+
(saveClicked)="onClickOk()" name="Ok"></save-footer>
|
|
138
|
+
<save-footer *ngIf="dialogType === type.CONFIRM" class="centered-text large-size"
|
|
139
|
+
(saveClicked)="onClickYes()" name="Yes"></save-footer>
|
|
140
|
+
<save-footer *ngIf="dialogType === type.CONFIRM" [actionType]="actionType"
|
|
141
|
+
class="centered-text large-size" (saveClicked)="onClickNo()"
|
|
142
|
+
name="No"></save-footer>
|
|
143
|
+
</mat-dialog-actions>
|
|
144
|
+
</div>
|
|
145
|
+
`, isInline: true, styles: ["\n hr {\n width: 98%;\n }\n\n .i-margin {\n margin-left: 0.3em;\n margin-right: 0.3em;\n }\n .i-color-blue {\n color: #0077B3FF;\n }\n .i-color-red {\n color: red;\n }\n\n .centered-text { text-align: center; }\n\n .no-padding{\n padding:0;\n\n }\n\n .no-margin{\n margin: 0;\n }\n\n .grabbable {\n cursor: move;\n cursor: grab;\n cursor: -moz-grab;\n cursor: -webkit-grab;\n }\n .grabbed {\n cursor: move;\n cursor: grabbing;\n cursor: -moz-grabbing;\n cursor: -webkit-grabbing;\n }\n\n .force-flex-container-row{\n display:flex !important;\n }\n .extra-padded {\n padding: 0.6em 0.9em 0.6em 0.9em;\n }\n .large-size {\n font-size: large;\n }\n .primary-action {\n font-size: large;\n }\n .secondary-action {\n font-size: large;\n }\n .message {\n color: #0F244DFF;\n }\n "], directives: [{ type: MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { type: NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }] });
|
|
146
|
+
ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: AlertDialogComponent, decorators: [{
|
|
147
|
+
type: Component,
|
|
148
|
+
args: [{
|
|
149
|
+
selector: 'hci-alert-dialog',
|
|
150
|
+
template: `
|
|
151
|
+
<div class="full-height full-width d-flex flex-column">
|
|
152
|
+
<div class="full-width dialog-header-colors no-margin no-padding">
|
|
153
|
+
<div #topmostLeftmost mat-dialog-title (mousedown)="onMouseDownHeader($event)"
|
|
154
|
+
class="force-flex-container-row align-center full-width padding {{ movingDialog ? 'grabbed' : 'grabbable' }}">
|
|
155
|
+
<div class="d-flex flex-row align-items-center padded">
|
|
156
|
+
<img *ngIf="icon" class="icon" [src]="this.icon">
|
|
157
|
+
<div *ngIf="!icon">
|
|
158
|
+
<i *ngIf="dialogType === type.ALERT" class="fa fa-exclamation fa-2x i-margin i-color-blue"></i>
|
|
159
|
+
<i *ngIf="dialogType === type.SUCCESS" class="fa fa-check-circle fa-2x i-margin i-color-blue"></i>
|
|
160
|
+
<i *ngIf="dialogType === type.FAILED || dialogType === type.ERROR" class="fa fa-exclamation-triangle fa-2x i-margin i-color-red"></i>
|
|
161
|
+
<i *ngIf="dialogType === type.WARNING || dialogType === type.VALIDATION" class="fa fa-exclamation-triangle fa-2x i-margin i-color-blue"></i>
|
|
162
|
+
<i *ngIf="dialogType === type.INFO" class="fa fa-info-circle fa-2x i-margin i-color-blue"></i>
|
|
163
|
+
<i *ngIf="dialogType === type.CONFIRM" class="fa fa-check fa-2x i-margin i-color-blue"></i>
|
|
164
|
+
</div>
|
|
165
|
+
<h1 *ngIf="dialogType !== type.ERROR"
|
|
166
|
+
style="margin:0;">{{this.title ? this.title : defaultTitle}}</h1>
|
|
167
|
+
<h1 *ngIf="dialogType === type.ERROR"
|
|
168
|
+
style="margin:0; color: Red">{{this.title ? this.title : defaultTitle}}</h1>
|
|
169
|
+
</div>
|
|
170
|
+
</div>
|
|
171
|
+
</div>
|
|
172
|
+
<mat-dialog-content class="flex-grow-1 no-margin no-padding">
|
|
173
|
+
<hr>
|
|
174
|
+
<div class="flex-grow-1 full-width extra-padded message">
|
|
175
|
+
<div *ngFor="let line of message" class="full-width"
|
|
176
|
+
[innerHTML]="line" style="white-space: pre-line">
|
|
177
|
+
</div>
|
|
178
|
+
</div>
|
|
179
|
+
<br>
|
|
180
|
+
</mat-dialog-content>
|
|
181
|
+
<mat-dialog-actions class="d-flex justify-content-center no-margin no-padding">
|
|
182
|
+
<save-footer *ngIf="dialogType !== type.CONFIRM" class="centered-text large-size"
|
|
183
|
+
(saveClicked)="onClickOk()" name="Ok"></save-footer>
|
|
184
|
+
<save-footer *ngIf="dialogType === type.CONFIRM" class="centered-text large-size"
|
|
185
|
+
(saveClicked)="onClickYes()" name="Yes"></save-footer>
|
|
186
|
+
<save-footer *ngIf="dialogType === type.CONFIRM" [actionType]="actionType"
|
|
187
|
+
class="centered-text large-size" (saveClicked)="onClickNo()"
|
|
188
|
+
name="No"></save-footer>
|
|
189
|
+
</mat-dialog-actions>
|
|
190
|
+
</div>
|
|
191
|
+
`,
|
|
192
|
+
styles: [`
|
|
193
|
+
hr {
|
|
194
|
+
width: 98%;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.i-margin {
|
|
198
|
+
margin-left: 0.3em;
|
|
199
|
+
margin-right: 0.3em;
|
|
200
|
+
}
|
|
201
|
+
.i-color-blue {
|
|
202
|
+
color: #0077B3FF;
|
|
203
|
+
}
|
|
204
|
+
.i-color-red {
|
|
205
|
+
color: red;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.centered-text { text-align: center; }
|
|
209
|
+
|
|
210
|
+
.no-padding{
|
|
211
|
+
padding:0;
|
|
212
|
+
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.no-margin{
|
|
216
|
+
margin: 0;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.grabbable {
|
|
220
|
+
cursor: move;
|
|
221
|
+
cursor: grab;
|
|
222
|
+
cursor: -moz-grab;
|
|
223
|
+
cursor: -webkit-grab;
|
|
224
|
+
}
|
|
225
|
+
.grabbed {
|
|
226
|
+
cursor: move;
|
|
227
|
+
cursor: grabbing;
|
|
228
|
+
cursor: -moz-grabbing;
|
|
229
|
+
cursor: -webkit-grabbing;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.force-flex-container-row{
|
|
233
|
+
display:flex !important;
|
|
234
|
+
}
|
|
235
|
+
.extra-padded {
|
|
236
|
+
padding: 0.6em 0.9em 0.6em 0.9em;
|
|
237
|
+
}
|
|
238
|
+
.large-size {
|
|
239
|
+
font-size: large;
|
|
240
|
+
}
|
|
241
|
+
.primary-action {
|
|
242
|
+
font-size: large;
|
|
243
|
+
}
|
|
244
|
+
.secondary-action {
|
|
245
|
+
font-size: large;
|
|
246
|
+
}
|
|
247
|
+
.message {
|
|
248
|
+
color: #0F244DFF;
|
|
249
|
+
}
|
|
250
|
+
`]
|
|
251
|
+
}]
|
|
252
|
+
}], ctorParameters: function () { return [{ type: MatDialogRef }, { type: undefined, decorators: [{
|
|
253
|
+
type: Inject,
|
|
254
|
+
args: [MAT_DIALOG_DATA]
|
|
255
|
+
}] }, { type: ChangeDetectorRef }]; }, propDecorators: { topmostLeftmost: [{
|
|
256
|
+
type: ViewChild,
|
|
257
|
+
args: ['topmostLeftmost', { static: false }]
|
|
258
|
+
}], onMouseMove: [{
|
|
259
|
+
type: HostListener,
|
|
260
|
+
args: ['window:mousemove', ['$event']]
|
|
261
|
+
}], onMouseUp: [{
|
|
262
|
+
type: HostListener,
|
|
263
|
+
args: ['window:mouseup', ['$event']]
|
|
264
|
+
}] } });
|
|
265
|
+
|
|
266
|
+
class SpinnerDialogComponent {
|
|
267
|
+
constructor(dialogRef, data) {
|
|
268
|
+
this.dialogRef = dialogRef;
|
|
269
|
+
this.data = data;
|
|
270
|
+
this.strokeWidth = 3;
|
|
271
|
+
this.diameter = 30;
|
|
272
|
+
this.message = 'Loading...';
|
|
273
|
+
if (this.data) {
|
|
274
|
+
if (!!this.data.message) {
|
|
275
|
+
this.message = this.data.message;
|
|
276
|
+
}
|
|
277
|
+
if (!!this.data.diameter) {
|
|
278
|
+
this.diameter = this.data.diameter;
|
|
279
|
+
}
|
|
280
|
+
if (!!this.data.strokeWidth) {
|
|
281
|
+
this.strokeWidth = this.data.strokeWidth;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
SpinnerDialogComponent.ɵfac = ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SpinnerDialogComponent, deps: [{ token: MatDialogRef }, { token: MAT_DIALOG_DATA }], target: ɵɵFactoryTarget.Component });
|
|
287
|
+
SpinnerDialogComponent.ɵcmp = ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: SpinnerDialogComponent, selector: "hci-spinner-dialog", inputs: { strokeWidth: "strokeWidth", diameter: "diameter", message: "message" }, ngImport: i0, template: "<div mat-dialog-title class=\"not-rendered\">\r\n<!--<div mat-dialog-title>-->\r\n</div>\r\n<div mat-dialog-content class=\"full-height padded\">\r\n <div class=\"full-width full-height t\">\r\n <div class=\"tr\">\r\n <div class=\"td vertical-center\" [style.height.px]=\"diameter + 5\">\r\n <mat-spinner [hidden]=\"false\" strokeWidth=\"{{strokeWidth}}\" [diameter]=\"diameter\"></mat-spinner>\r\n </div>\r\n <div class=\"td vertical-center\">\r\n {{message}}\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n<div mat-dialog-actions class=\"not-rendered\">\r\n<!--<div mat-dialog-actions>-->\r\n</div>\r\n", styles: ["\n .t { display: table; }\n .tr { display: table-row; }\n .td { display: table-cell; }\n\n .full-height { height: 100%; }\n .full-width { width: 100%; }\n\n .vertical-center { vertical-align: middle; }\n\n .padded {\n padding-top: 0.4em;\n padding-bottom: 0.4em;\n }\n\n .not-rendered {\n padding: 0;\n margin: 0;\n\n min-height: 0;\n max-height: 0;\n height: 0;\n }\n\n "], components: [{ type: MatSpinner, selector: "mat-spinner", inputs: ["color"] }], directives: [{ type: MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { type: MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { type: MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }] });
|
|
288
|
+
ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SpinnerDialogComponent, decorators: [{
|
|
289
|
+
type: Component,
|
|
290
|
+
args: [{
|
|
291
|
+
selector: 'hci-spinner-dialog',
|
|
292
|
+
templateUrl: 'spinner-dialog.component.html',
|
|
293
|
+
styles: [`
|
|
294
|
+
.t { display: table; }
|
|
295
|
+
.tr { display: table-row; }
|
|
296
|
+
.td { display: table-cell; }
|
|
297
|
+
|
|
298
|
+
.full-height { height: 100%; }
|
|
299
|
+
.full-width { width: 100%; }
|
|
300
|
+
|
|
301
|
+
.vertical-center { vertical-align: middle; }
|
|
302
|
+
|
|
303
|
+
.padded {
|
|
304
|
+
padding-top: 0.4em;
|
|
305
|
+
padding-bottom: 0.4em;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
.not-rendered {
|
|
309
|
+
padding: 0;
|
|
310
|
+
margin: 0;
|
|
311
|
+
|
|
312
|
+
min-height: 0;
|
|
313
|
+
max-height: 0;
|
|
314
|
+
height: 0;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
`]
|
|
318
|
+
}]
|
|
319
|
+
}], ctorParameters: function () { return [{ type: MatDialogRef }, { type: undefined, decorators: [{
|
|
320
|
+
type: Inject,
|
|
321
|
+
args: [MAT_DIALOG_DATA]
|
|
322
|
+
}] }]; }, propDecorators: { strokeWidth: [{
|
|
323
|
+
type: Input
|
|
324
|
+
}], diameter: [{
|
|
325
|
+
type: Input
|
|
326
|
+
}], message: [{
|
|
327
|
+
type: Input
|
|
328
|
+
}] } });
|
|
329
|
+
|
|
330
|
+
class CustomDialogComponent {
|
|
331
|
+
constructor(dialogRef, data, changeDetector) {
|
|
332
|
+
this.dialogRef = dialogRef;
|
|
333
|
+
this.data = data;
|
|
334
|
+
this.changeDetector = changeDetector;
|
|
335
|
+
this.title = '';
|
|
336
|
+
this.icon = '';
|
|
337
|
+
this.actionType = ActionType;
|
|
338
|
+
this.originalXClick = 0;
|
|
339
|
+
this.originalYClick = 0;
|
|
340
|
+
this.movingDialog = false;
|
|
341
|
+
this.positionX = 0;
|
|
342
|
+
this.positionY = 0;
|
|
343
|
+
this.actions = [];
|
|
344
|
+
this.title = data.title;
|
|
345
|
+
this.tempRef = data.templateRef;
|
|
346
|
+
this.icon = data.icon;
|
|
347
|
+
this.context = data.context;
|
|
348
|
+
const actionConfig = data.actionConfig ? data.actionConfig : null;
|
|
349
|
+
this.actions = actionConfig ? actionConfig.actions : [];
|
|
350
|
+
this.form = actionConfig && actionConfig.formSource ? actionConfig.formSource : null;
|
|
351
|
+
}
|
|
352
|
+
get primaryDisable() {
|
|
353
|
+
return this.form && this.form.invalid;
|
|
354
|
+
}
|
|
355
|
+
// todo need make this customizable
|
|
356
|
+
get secondaryDisable() {
|
|
357
|
+
return false;
|
|
358
|
+
}
|
|
359
|
+
ngOnInit() {
|
|
360
|
+
this.context.dialog = this.dialogRef;
|
|
361
|
+
this.vcr.createEmbeddedView(this.tempRef, this.context);
|
|
362
|
+
}
|
|
363
|
+
onClose() {
|
|
364
|
+
this.dialogRef.close();
|
|
365
|
+
}
|
|
366
|
+
onMouseDownHeader(event) {
|
|
367
|
+
if (!event) {
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
this.positionX = this.topmostLeftmost.nativeElement.offsetLeft;
|
|
371
|
+
this.positionY = this.topmostLeftmost.nativeElement.offsetTop;
|
|
372
|
+
this.originalXClick = event.screenX;
|
|
373
|
+
this.originalYClick = event.screenY;
|
|
374
|
+
this.movingDialog = true;
|
|
375
|
+
this.changeDetector.detach();
|
|
376
|
+
}
|
|
377
|
+
onMouseMove(event) {
|
|
378
|
+
if (!event) {
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
381
|
+
if (this.movingDialog) {
|
|
382
|
+
this.positionX += event.screenX - this.originalXClick;
|
|
383
|
+
this.positionY += event.screenY - this.originalYClick;
|
|
384
|
+
this.originalXClick = event.screenX;
|
|
385
|
+
this.originalYClick = event.screenY;
|
|
386
|
+
const newDialogPosition = {
|
|
387
|
+
left: '' + this.positionX + 'px',
|
|
388
|
+
top: '' + this.positionY + 'px',
|
|
389
|
+
};
|
|
390
|
+
this.dialogRef.updatePosition(newDialogPosition);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
onMouseUp() {
|
|
394
|
+
this.movingDialog = false;
|
|
395
|
+
this.changeDetector.reattach();
|
|
396
|
+
}
|
|
397
|
+
executeAction(action) {
|
|
398
|
+
if (action.externalAction) {
|
|
399
|
+
action.externalAction(this.dialogRef);
|
|
400
|
+
}
|
|
401
|
+
if (action.internalAction && action.internalAction === 'onClose') {
|
|
402
|
+
this.onClose();
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
CustomDialogComponent.ɵfac = ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: CustomDialogComponent, deps: [{ token: MatDialogRef }, { token: MAT_DIALOG_DATA }, { token: ChangeDetectorRef }], target: ɵɵFactoryTarget.Component });
|
|
407
|
+
CustomDialogComponent.ɵcmp = ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: CustomDialogComponent, selector: "hci-custom-dialog", host: { listeners: { "window:mousemove": "onMouseMove($event)", "window:mouseup": "onMouseUp($event)" } }, viewQueries: [{ propertyName: "vcr", first: true, predicate: ["anchor"], descendants: true, read: ViewContainerRef, static: true }, { propertyName: "topmostLeftmost", first: true, predicate: ["topmostLeftmost"], descendants: true }], ngImport: i0, template: `
|
|
408
|
+
<div class="d-flex full-height full-width flex-column">
|
|
409
|
+
<div *ngIf="this.title" class="full-width generic-dialog-header-colors no-margin no-padding">
|
|
410
|
+
<div #topmostLeftmost mat-dialog-title (mousedown)="onMouseDownHeader($event)"
|
|
411
|
+
class="force-flex-container-row align-items-center full-width p-2 {{ movingDialog ? 'grabbed' : 'grabbable' }}">
|
|
412
|
+
<div class="-flex flex-row align-items-center padded">
|
|
413
|
+
<img *ngIf="icon" class="icon" [src]="this.icon">
|
|
414
|
+
<div *ngIf="icon && icon.substr(0, 2) === '<i'" class="i-class" [innerHTML]="icon" ></div>
|
|
415
|
+
<h3 style="margin:0;">{{this.title}}</h3>
|
|
416
|
+
</div>
|
|
417
|
+
<div class="flex-grow-1"></div>
|
|
418
|
+
<div class="padded" (click)="onClose()">
|
|
419
|
+
<i class="exit fas fa-times"></i>
|
|
420
|
+
</div>
|
|
421
|
+
</div>
|
|
422
|
+
</div>
|
|
423
|
+
<mat-dialog-content class="flex-grow-1 full-width no-margin p-2" style="min-height: 6em;">
|
|
424
|
+
<div #anchor></div>
|
|
425
|
+
</mat-dialog-content>
|
|
426
|
+
<mat-dialog-actions *ngIf="actions && actions.length > 0"
|
|
427
|
+
class="d-flex flex-row justify-content-end no-margin no-padding generic-dialog-footer-colors">
|
|
428
|
+
<div *ngFor="let action of actions">
|
|
429
|
+
<save-footer *ngIf="action.type === actionType.PRIMARY;else secondary"
|
|
430
|
+
[actionType]="action.type"
|
|
431
|
+
[icon]="action.icon"
|
|
432
|
+
[disableSave]="primaryDisable"
|
|
433
|
+
(saveClicked)="executeAction(action)"
|
|
434
|
+
[name]="action.name">
|
|
435
|
+
</save-footer>
|
|
436
|
+
<!-- to avoid issue with multiple spinner or dirty notes-->
|
|
437
|
+
<ng-template #secondary>
|
|
438
|
+
<save-footer [actionType]="action.type"
|
|
439
|
+
(saveClicked)="executeAction(action)"
|
|
440
|
+
[icon]="action.icon"
|
|
441
|
+
[disableSave]="secondaryDisable"
|
|
442
|
+
[name]="action.name">
|
|
443
|
+
</save-footer>
|
|
444
|
+
</ng-template>
|
|
445
|
+
</div>
|
|
446
|
+
</mat-dialog-actions>
|
|
447
|
+
</div>
|
|
448
|
+
`, isInline: true, styles: ["\n .centered-text { text-align: center; }\n\n .no-padding{\n padding:0;\n\n }\n\n .no-margin{\n margin: 0;\n }\n\n .grabbable {\n cursor: move;\n cursor: grab;\n cursor: -moz-grab;\n cursor: -webkit-grab;\n }\n .grabbed:active {\n cursor: grabbing;\n cursor: -moz-grabbing;\n cursor: -webkit-grabbing;\n }\n\n .force-flex-container-row{\n display:flex !important;\n }\n\n .exit{\n max-width: 20px;\n cursor: pointer;\n }\n\n .i-class {\n margin-left: 0.3em;\n margin-right: 0.3em;\n }\n mat-dialog-content {\n max-height: 100vh !important;\n max-width: 100vw !important ;\n }\n "], directives: [{ type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { type: MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { type: MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }, { type: NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
|
|
449
|
+
ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: CustomDialogComponent, decorators: [{
|
|
450
|
+
type: Component,
|
|
451
|
+
args: [{
|
|
452
|
+
selector: 'hci-custom-dialog',
|
|
453
|
+
template: `
|
|
454
|
+
<div class="d-flex full-height full-width flex-column">
|
|
455
|
+
<div *ngIf="this.title" class="full-width generic-dialog-header-colors no-margin no-padding">
|
|
456
|
+
<div #topmostLeftmost mat-dialog-title (mousedown)="onMouseDownHeader($event)"
|
|
457
|
+
class="force-flex-container-row align-items-center full-width p-2 {{ movingDialog ? 'grabbed' : 'grabbable' }}">
|
|
458
|
+
<div class="-flex flex-row align-items-center padded">
|
|
459
|
+
<img *ngIf="icon" class="icon" [src]="this.icon">
|
|
460
|
+
<div *ngIf="icon && icon.substr(0, 2) === '<i'" class="i-class" [innerHTML]="icon" ></div>
|
|
461
|
+
<h3 style="margin:0;">{{this.title}}</h3>
|
|
462
|
+
</div>
|
|
463
|
+
<div class="flex-grow-1"></div>
|
|
464
|
+
<div class="padded" (click)="onClose()">
|
|
465
|
+
<i class="exit fas fa-times"></i>
|
|
466
|
+
</div>
|
|
467
|
+
</div>
|
|
468
|
+
</div>
|
|
469
|
+
<mat-dialog-content class="flex-grow-1 full-width no-margin p-2" style="min-height: 6em;">
|
|
470
|
+
<div #anchor></div>
|
|
471
|
+
</mat-dialog-content>
|
|
472
|
+
<mat-dialog-actions *ngIf="actions && actions.length > 0"
|
|
473
|
+
class="d-flex flex-row justify-content-end no-margin no-padding generic-dialog-footer-colors">
|
|
474
|
+
<div *ngFor="let action of actions">
|
|
475
|
+
<save-footer *ngIf="action.type === actionType.PRIMARY;else secondary"
|
|
476
|
+
[actionType]="action.type"
|
|
477
|
+
[icon]="action.icon"
|
|
478
|
+
[disableSave]="primaryDisable"
|
|
479
|
+
(saveClicked)="executeAction(action)"
|
|
480
|
+
[name]="action.name">
|
|
481
|
+
</save-footer>
|
|
482
|
+
<!-- to avoid issue with multiple spinner or dirty notes-->
|
|
483
|
+
<ng-template #secondary>
|
|
484
|
+
<save-footer [actionType]="action.type"
|
|
485
|
+
(saveClicked)="executeAction(action)"
|
|
486
|
+
[icon]="action.icon"
|
|
487
|
+
[disableSave]="secondaryDisable"
|
|
488
|
+
[name]="action.name">
|
|
489
|
+
</save-footer>
|
|
490
|
+
</ng-template>
|
|
491
|
+
</div>
|
|
492
|
+
</mat-dialog-actions>
|
|
493
|
+
</div>
|
|
494
|
+
`,
|
|
495
|
+
styles: [`
|
|
496
|
+
.centered-text { text-align: center; }
|
|
497
|
+
|
|
498
|
+
.no-padding{
|
|
499
|
+
padding:0;
|
|
500
|
+
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
.no-margin{
|
|
504
|
+
margin: 0;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
.grabbable {
|
|
508
|
+
cursor: move;
|
|
509
|
+
cursor: grab;
|
|
510
|
+
cursor: -moz-grab;
|
|
511
|
+
cursor: -webkit-grab;
|
|
512
|
+
}
|
|
513
|
+
.grabbed:active {
|
|
514
|
+
cursor: grabbing;
|
|
515
|
+
cursor: -moz-grabbing;
|
|
516
|
+
cursor: -webkit-grabbing;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
.force-flex-container-row{
|
|
520
|
+
display:flex !important;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
.exit{
|
|
524
|
+
max-width: 20px;
|
|
525
|
+
cursor: pointer;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
.i-class {
|
|
529
|
+
margin-left: 0.3em;
|
|
530
|
+
margin-right: 0.3em;
|
|
531
|
+
}
|
|
532
|
+
mat-dialog-content {
|
|
533
|
+
max-height: 100vh !important;
|
|
534
|
+
max-width: 100vw !important ;
|
|
535
|
+
}
|
|
536
|
+
`]
|
|
537
|
+
}]
|
|
538
|
+
}], ctorParameters: function () { return [{ type: MatDialogRef }, { type: undefined, decorators: [{
|
|
539
|
+
type: Inject,
|
|
540
|
+
args: [MAT_DIALOG_DATA]
|
|
541
|
+
}] }, { type: ChangeDetectorRef }]; }, propDecorators: { vcr: [{
|
|
542
|
+
type: ViewChild,
|
|
543
|
+
args: ['anchor', { read: ViewContainerRef, static: true }]
|
|
544
|
+
}], topmostLeftmost: [{
|
|
545
|
+
type: ViewChild,
|
|
546
|
+
args: ['topmostLeftmost', { static: false }]
|
|
547
|
+
}], onMouseMove: [{
|
|
548
|
+
type: HostListener,
|
|
549
|
+
args: ['window:mousemove', ['$event']]
|
|
550
|
+
}], onMouseUp: [{
|
|
551
|
+
type: HostListener,
|
|
552
|
+
args: ['window:mouseup', ['$event']]
|
|
553
|
+
}] } });
|
|
554
|
+
|
|
555
|
+
class GenericContainerDialogComponent {
|
|
556
|
+
constructor(dialog, router, changeDetector, dialogRef, data) {
|
|
557
|
+
this.dialog = dialog;
|
|
558
|
+
this.router = router;
|
|
559
|
+
this.changeDetector = changeDetector;
|
|
560
|
+
this.dialogRef = dialogRef;
|
|
561
|
+
this.data = data;
|
|
562
|
+
this.classList = 'd-flex flex-column flex-grow-1 flex-shrink-1';
|
|
563
|
+
this.type = ActionType;
|
|
564
|
+
this.actions = [];
|
|
565
|
+
this.originalXClick = 0;
|
|
566
|
+
this.originalYClick = 0;
|
|
567
|
+
this.positionX = 0;
|
|
568
|
+
this.positionY = 0;
|
|
569
|
+
this.movingDialog = false;
|
|
570
|
+
if (data) {
|
|
571
|
+
this.dialogContentBluePrint = data.dialogContent;
|
|
572
|
+
this.icon = data.icon;
|
|
573
|
+
this.title = data.title;
|
|
574
|
+
this.useSaveFooter = data.actionConfig ? data.actionConfig.useSaveFooter : false;
|
|
575
|
+
this.actions = data.actionConfig ? data.actionConfig.actions : [];
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
ngOnInit() {
|
|
579
|
+
}
|
|
580
|
+
createdComponent(event) {
|
|
581
|
+
this.dialogContent = event.instance;
|
|
582
|
+
}
|
|
583
|
+
executeAction(action) {
|
|
584
|
+
if (action.externalAction) {
|
|
585
|
+
action.externalAction();
|
|
586
|
+
}
|
|
587
|
+
if (action.internalAction) {
|
|
588
|
+
const internalAction = action.internalAction;
|
|
589
|
+
if (action.internalAction === 'cancel' || action.internalAction === 'onClose') {
|
|
590
|
+
if (this.dialogContent[internalAction]) {
|
|
591
|
+
this.dialogContent[internalAction]();
|
|
592
|
+
}
|
|
593
|
+
else {
|
|
594
|
+
this.onClose();
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
else {
|
|
598
|
+
if (typeof action.internalActionReturnValue !== 'undefined') {
|
|
599
|
+
if (action.internalActionReturnValue) {
|
|
600
|
+
this.dialogContent[internalAction](action.internalActionReturnValue);
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
else {
|
|
604
|
+
this.dialogContent[internalAction]();
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
onMouseDownHeader(event) {
|
|
610
|
+
if (!event) {
|
|
611
|
+
return;
|
|
612
|
+
}
|
|
613
|
+
this.positionX = this.topmostLeftmost.nativeElement.offsetLeft;
|
|
614
|
+
this.positionY = this.topmostLeftmost.nativeElement.offsetTop;
|
|
615
|
+
this.originalXClick = event.screenX;
|
|
616
|
+
this.originalYClick = event.screenY;
|
|
617
|
+
this.movingDialog = true;
|
|
618
|
+
this.changeDetector.detach();
|
|
619
|
+
}
|
|
620
|
+
onMouseMove(event) {
|
|
621
|
+
if (!event) {
|
|
622
|
+
return;
|
|
623
|
+
}
|
|
624
|
+
if (this.movingDialog) {
|
|
625
|
+
this.positionX += event.screenX - this.originalXClick;
|
|
626
|
+
this.positionY += event.screenY - this.originalYClick;
|
|
627
|
+
this.originalXClick = event.screenX;
|
|
628
|
+
this.originalYClick = event.screenY;
|
|
629
|
+
const newDialogPosition = {
|
|
630
|
+
left: '' + this.positionX + 'px',
|
|
631
|
+
top: '' + this.positionY + 'px',
|
|
632
|
+
};
|
|
633
|
+
this.dialogRef.updatePosition(newDialogPosition);
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
onMouseUp() {
|
|
637
|
+
this.movingDialog = false;
|
|
638
|
+
this.changeDetector.reattach();
|
|
639
|
+
}
|
|
640
|
+
onClose() {
|
|
641
|
+
this.dialogRef.close();
|
|
642
|
+
}
|
|
643
|
+
ngOnDestroy() {
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
GenericContainerDialogComponent.ɵfac = ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GenericContainerDialogComponent, deps: [{ token: MatDialog }, { token: Router }, { token: ChangeDetectorRef }, { token: MatDialogRef }, { token: MAT_DIALOG_DATA }], target: ɵɵFactoryTarget.Component });
|
|
647
|
+
GenericContainerDialogComponent.ɵcmp = ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: GenericContainerDialogComponent, selector: "hci-generic-container-dialog", host: { listeners: { "window:mousemove": "onMouseMove($event)", "window:mouseup": "onMouseUp($event)" }, properties: { "class": "this.classList" } }, viewQueries: [{ propertyName: "topmostLeftmost", first: true, predicate: ["topmostLeftmost"], descendants: true }], ngImport: i0, template: "<div class=\"full-height full-width d-flex flex-column\" style=\"height: 100%;\">\r\n <div class=\"full-width generic-dialog-header-colors no-margin no-padding\">\r\n <div #topmostLeftmost mat-dialog-title (mousedown)=\"onMouseDownHeader($event)\"\r\n class=\"d-flex align-items-center full-width\" [ngClass]=\"{'grabbed':movingDialog, 'grabbable': !movingDialog}\">\r\n <div class=\"d-flex flex-row align-items-center p-2\">\r\n <img class=\"icon\" *ngIf=\"icon && icon.substr(0, 2) !== '<i'\" [src]=\"icon\">\r\n <div *ngIf=\"icon && icon.substr(0, 2) === '<i'\" class=\"i-class\" [innerHTML]=\"icon\" ></div>\r\n <h3 style=\"margin:0;\">{{this.title ? this.title : this.dialogContent.innerTitle}}</h3>\r\n </div>\r\n <div class=\"flex-grow-1\"></div>\r\n <div class=\"padded\" (click)=\"onClose()\">\r\n <i class=\"exit fas fa-times\"></i>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <mat-dialog-content class=\"flex-grow-1 no-margin no-padding\">\r\n <div class=\"flex-grow-1 full-height full-width padded\">\r\n <ndc-dynamic [ndcDynamicComponent]=\"this.dialogContentBluePrint\"\r\n [ndcDynamicInputs]=\"this.data\"\r\n (ndcDynamicCreated)=\"createdComponent($event)\">\r\n </ndc-dynamic>\r\n </div>\r\n </mat-dialog-content>\r\n <mat-dialog-actions *ngIf=\"actions && actions.length > 0\"\r\n class=\"d-flex flex-row justify-content-end no-margin no-padding generic-dialog-footer-colors\">\r\n <div *ngFor=\"let action of actions\">\r\n <save-footer *ngIf=\"action.type === type.PRIMARY;else secondary\"\r\n [actionType]=\"action.type\"\r\n [icon]=\"action.icon\"\r\n (saveClicked)=\"executeAction(action)\"\r\n [disableSave]=\"this.dialogContent.primaryDisable(action)\"\r\n [dirty]=\"this.dialogContent.dirty()\"\r\n [name]=\"action.name\"\r\n [showSpinner]=\"this.dialogContent.showSpinner\">\r\n </save-footer>\r\n <!-- to avoid issue with multiple spinner or dirty notes-->\r\n <ng-template #secondary>\r\n <save-footer [actionType]=\"action.type\"\r\n (saveClicked)=\"executeAction(action)\"\r\n [icon]=\"action.icon\"\r\n [disableSave]=\"this.dialogContent.secondaryDisable(action)\"\r\n [name]=\"action.name\">\r\n\r\n </save-footer>\r\n </ng-template>\r\n </div>\r\n </mat-dialog-actions>\r\n</div>\r\n", styles: ["\n\n .no-padding{\n padding:0;\n }\n .no-margin{\n margin: 0;\n }\n .grabbable {\n cursor: move;\n cursor: grab;\n cursor: -moz-grab;\n cursor: -webkit-grab;\n }\n .grabbed:active {\n cursor: move;\n cursor: grabbing;\n cursor: -moz-grabbing;\n cursor: -webkit-grabbing;\n }\n .exit{\n max-width: 20px;\n cursor: pointer;\n }\n .i-class {\n margin-left: 0.3em;\n margin-right: 0.3em;\n }\n mat-dialog-content {\n max-height: 100% !important;\n }\n\n "], components: [{ type: DynamicComponent, selector: "ndc-dynamic", inputs: ["ndcDynamicComponent", "ndcDynamicInjector", "ndcDynamicProviders", "ndcDynamicContent"], outputs: ["ndcDynamicCreated"] }], directives: [{ type: MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { type: DynamicIoDirective, selector: "[ndcDynamicInputs],[ndcDynamicOutputs],[ngComponentOutletNdcDynamicInputs],[ngComponentOutletNdcDynamicOutputs]", inputs: ["ndcDynamicInputs", "ngComponentOutletNdcDynamicInputs", "ndcDynamicOutputs", "ngComponentOutletNdcDynamicOutputs"] }, { type: MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }, { type: NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
|
|
648
|
+
ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GenericContainerDialogComponent, decorators: [{
|
|
649
|
+
type: Component,
|
|
650
|
+
args: [{
|
|
651
|
+
selector: 'hci-generic-container-dialog',
|
|
652
|
+
templateUrl: './generic-container-dialog.component.html',
|
|
653
|
+
styles: [`
|
|
654
|
+
|
|
655
|
+
.no-padding{
|
|
656
|
+
padding:0;
|
|
657
|
+
}
|
|
658
|
+
.no-margin{
|
|
659
|
+
margin: 0;
|
|
660
|
+
}
|
|
661
|
+
.grabbable {
|
|
662
|
+
cursor: move;
|
|
663
|
+
cursor: grab;
|
|
664
|
+
cursor: -moz-grab;
|
|
665
|
+
cursor: -webkit-grab;
|
|
666
|
+
}
|
|
667
|
+
.grabbed:active {
|
|
668
|
+
cursor: move;
|
|
669
|
+
cursor: grabbing;
|
|
670
|
+
cursor: -moz-grabbing;
|
|
671
|
+
cursor: -webkit-grabbing;
|
|
672
|
+
}
|
|
673
|
+
.exit{
|
|
674
|
+
max-width: 20px;
|
|
675
|
+
cursor: pointer;
|
|
676
|
+
}
|
|
677
|
+
.i-class {
|
|
678
|
+
margin-left: 0.3em;
|
|
679
|
+
margin-right: 0.3em;
|
|
680
|
+
}
|
|
681
|
+
mat-dialog-content {
|
|
682
|
+
max-height: 100% !important;
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
`]
|
|
686
|
+
}]
|
|
687
|
+
}], ctorParameters: function () { return [{ type: MatDialog }, { type: Router }, { type: ChangeDetectorRef }, { type: MatDialogRef }, { type: undefined, decorators: [{
|
|
688
|
+
type: Inject,
|
|
689
|
+
args: [MAT_DIALOG_DATA]
|
|
690
|
+
}] }]; }, propDecorators: { classList: [{
|
|
691
|
+
type: HostBinding,
|
|
692
|
+
args: ['class']
|
|
693
|
+
}], topmostLeftmost: [{
|
|
694
|
+
type: ViewChild,
|
|
695
|
+
args: ['topmostLeftmost', { static: false }]
|
|
696
|
+
}], onMouseMove: [{
|
|
697
|
+
type: HostListener,
|
|
698
|
+
args: ['window:mousemove', ['$event']]
|
|
699
|
+
}], onMouseUp: [{
|
|
700
|
+
type: HostListener,
|
|
701
|
+
args: ['window:mouseup', ['$event']]
|
|
702
|
+
}] } });
|
|
703
|
+
|
|
704
|
+
var ConfirmType;
|
|
705
|
+
(function (ConfirmType) {
|
|
706
|
+
ConfirmType["DELETE"] = "delete";
|
|
707
|
+
ConfirmType["DELETE_W_MESSAGE"] = "deleteMessage";
|
|
708
|
+
ConfirmType["DELETE_W_PROMPT"] = "deletePrompt";
|
|
709
|
+
ConfirmType["DISCARD"] = "discard";
|
|
710
|
+
ConfirmType["CONFIRM_AND_CLOSE"] = "confirmAndClose";
|
|
711
|
+
ConfirmType["ADD"] = "add";
|
|
712
|
+
ConfirmType["ALERT"] = "alert";
|
|
713
|
+
ConfirmType["GENERIC"] = "generic";
|
|
714
|
+
})(ConfirmType || (ConfirmType = {}));
|
|
715
|
+
|
|
716
|
+
class BaseGenericContainerDialog {
|
|
717
|
+
constructor() {
|
|
718
|
+
this.showSpinner = false;
|
|
719
|
+
this.innerTitle = '';
|
|
720
|
+
this.primaryDisable = (action) => {
|
|
721
|
+
return false;
|
|
722
|
+
};
|
|
723
|
+
this.secondaryDisable = (action) => {
|
|
724
|
+
return false;
|
|
725
|
+
};
|
|
726
|
+
this.dirty = () => { return false; };
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
BaseGenericContainerDialog.ɵfac = ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: BaseGenericContainerDialog, deps: [], target: ɵɵFactoryTarget.Component });
|
|
730
|
+
BaseGenericContainerDialog.ɵcmp = ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: BaseGenericContainerDialog, selector: "ng-component", inputs: { inputData: "inputData" }, ngImport: i0, template: '', isInline: true });
|
|
731
|
+
ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: BaseGenericContainerDialog, decorators: [{
|
|
732
|
+
type: Component,
|
|
733
|
+
args: [{
|
|
734
|
+
template: ''
|
|
735
|
+
}]
|
|
736
|
+
}], ctorParameters: function () { return []; }, propDecorators: { inputData: [{
|
|
737
|
+
type: Input
|
|
738
|
+
}] } });
|
|
739
|
+
|
|
740
|
+
class ConfirmDialogComponent extends BaseGenericContainerDialog {
|
|
741
|
+
constructor(dialogRef, data) {
|
|
742
|
+
super();
|
|
743
|
+
this.dialogRef = dialogRef;
|
|
744
|
+
this.data = data;
|
|
745
|
+
this.ConfirmType = ConfirmType; // make enum available in template
|
|
746
|
+
this.prompt = '';
|
|
747
|
+
this.message1 = '';
|
|
748
|
+
this.message2 = '';
|
|
749
|
+
this.confirmType = ConfirmType.GENERIC;
|
|
750
|
+
const temp = data.confirmType ? data.confirmType : ConfirmType.GENERIC;
|
|
751
|
+
if (Object.values(ConfirmType).includes(temp)) {
|
|
752
|
+
this.confirmType = temp;
|
|
753
|
+
}
|
|
754
|
+
this.prompt = data.prompt ? data.prompt : '';
|
|
755
|
+
this.message1 = data.message1 ? data.message1 : '';
|
|
756
|
+
this.message2 = data.message2 ? data.message2 : '';
|
|
757
|
+
this.setupMessagesByType();
|
|
758
|
+
}
|
|
759
|
+
setupMessagesByType() {
|
|
760
|
+
// by enum type, setup the messages/prompt
|
|
761
|
+
switch (this.confirmType) {
|
|
762
|
+
case ConfirmType.DELETE:
|
|
763
|
+
this.prompt = 'The following will be deleted:';
|
|
764
|
+
this.message2 = 'Continue?';
|
|
765
|
+
break;
|
|
766
|
+
case ConfirmType.DELETE_W_MESSAGE:
|
|
767
|
+
this.prompt = 'The following will be deleted:';
|
|
768
|
+
break;
|
|
769
|
+
case ConfirmType.DELETE_W_PROMPT:
|
|
770
|
+
// noop, take all of what was passed in
|
|
771
|
+
break;
|
|
772
|
+
case ConfirmType.DISCARD:
|
|
773
|
+
this.prompt = '';
|
|
774
|
+
this.message2 = 'Continue?';
|
|
775
|
+
break;
|
|
776
|
+
case ConfirmType.CONFIRM_AND_CLOSE:
|
|
777
|
+
this.prompt = '';
|
|
778
|
+
this.message2 = '';
|
|
779
|
+
break;
|
|
780
|
+
case ConfirmType.ADD:
|
|
781
|
+
this.prompt = 'The following will be added:';
|
|
782
|
+
this.message2 = 'Continue?';
|
|
783
|
+
break;
|
|
784
|
+
case ConfirmType.ALERT:
|
|
785
|
+
// noop, will only use the message1 in a special template, and just ignore rest
|
|
786
|
+
break;
|
|
787
|
+
case ConfirmType.GENERIC:
|
|
788
|
+
// TODO: either only use message 1 or just take all passed in...
|
|
789
|
+
this.prompt = '';
|
|
790
|
+
this.message2 = '';
|
|
791
|
+
break;
|
|
792
|
+
default:
|
|
793
|
+
throw new Error('Confirm type doesn\'t exist');
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
onConfirmClick(value) {
|
|
797
|
+
this.dialogRef.close(value);
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
ConfirmDialogComponent.ɵfac = ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ConfirmDialogComponent, deps: [{ token: MatDialogRef }, { token: MAT_DIALOG_DATA }], target: ɵɵFactoryTarget.Component });
|
|
801
|
+
ConfirmDialogComponent.ɵcmp = ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: ConfirmDialogComponent, selector: "hci-confirm-dialog", usesInheritance: true, ngImport: i0, template: `
|
|
802
|
+
<div class="ri-confirm-body">
|
|
803
|
+
|
|
804
|
+
<div *ngIf="confirmType !== ConfirmType.ALERT; else alertBlock">
|
|
805
|
+
{{prompt}}
|
|
806
|
+
<div class="ri-confirm-text-delete">{{ message1 }}</div>
|
|
807
|
+
{{message2}}
|
|
808
|
+
</div>
|
|
809
|
+
|
|
810
|
+
|
|
811
|
+
<div #alertBlock>
|
|
812
|
+
<p>We are working to correct it. Contact CODE support if the error persists.</p>
|
|
813
|
+
<mat-expansion-panel>
|
|
814
|
+
<mat-expansion-panel-header>
|
|
815
|
+
<mat-panel-title>
|
|
816
|
+
<strong>Show details</strong>
|
|
817
|
+
</mat-panel-title>
|
|
818
|
+
</mat-expansion-panel-header>
|
|
819
|
+
<div>{{ message1 }}</div>
|
|
820
|
+
</mat-expansion-panel>
|
|
821
|
+
</div>
|
|
822
|
+
|
|
823
|
+
</div>
|
|
824
|
+
`, isInline: true, styles: ["\n\n "], components: [{ type: MatExpansionPanel, selector: "mat-expansion-panel", inputs: ["disabled", "expanded", "hideToggle", "togglePosition"], outputs: ["opened", "closed", "expandedChange", "afterExpand", "afterCollapse"], exportAs: ["matExpansionPanel"] }, { type: MatExpansionPanelHeader, selector: "mat-expansion-panel-header", inputs: ["tabIndex", "expandedHeight", "collapsedHeight"] }], directives: [{ type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: MatExpansionPanelTitle, selector: "mat-panel-title" }] });
|
|
825
|
+
ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ConfirmDialogComponent, decorators: [{
|
|
826
|
+
type: Component,
|
|
827
|
+
args: [{
|
|
828
|
+
selector: 'hci-confirm-dialog',
|
|
829
|
+
template: `
|
|
830
|
+
<div class="ri-confirm-body">
|
|
831
|
+
|
|
832
|
+
<div *ngIf="confirmType !== ConfirmType.ALERT; else alertBlock">
|
|
833
|
+
{{prompt}}
|
|
834
|
+
<div class="ri-confirm-text-delete">{{ message1 }}</div>
|
|
835
|
+
{{message2}}
|
|
836
|
+
</div>
|
|
837
|
+
|
|
838
|
+
|
|
839
|
+
<div #alertBlock>
|
|
840
|
+
<p>We are working to correct it. Contact CODE support if the error persists.</p>
|
|
841
|
+
<mat-expansion-panel>
|
|
842
|
+
<mat-expansion-panel-header>
|
|
843
|
+
<mat-panel-title>
|
|
844
|
+
<strong>Show details</strong>
|
|
845
|
+
</mat-panel-title>
|
|
846
|
+
</mat-expansion-panel-header>
|
|
847
|
+
<div>{{ message1 }}</div>
|
|
848
|
+
</mat-expansion-panel>
|
|
849
|
+
</div>
|
|
850
|
+
|
|
851
|
+
</div>
|
|
852
|
+
`,
|
|
853
|
+
styles: [`
|
|
854
|
+
|
|
855
|
+
`]
|
|
856
|
+
}]
|
|
857
|
+
}], ctorParameters: function () { return [{ type: MatDialogRef }, { type: undefined, decorators: [{
|
|
858
|
+
type: Inject,
|
|
859
|
+
args: [MAT_DIALOG_DATA]
|
|
860
|
+
}] }]; } });
|
|
861
|
+
|
|
862
|
+
class DialogService {
|
|
863
|
+
constructor(dialog) {
|
|
864
|
+
this.dialog = dialog;
|
|
865
|
+
this._spinnerDialogIsOpen = false;
|
|
866
|
+
this.spinnerWorkItemCount = 0;
|
|
867
|
+
this.checkingSpinnerWorkItems = false;
|
|
868
|
+
this.spinnerDialogRefs = [];
|
|
869
|
+
}
|
|
870
|
+
get spinnerDialogIsOpen() {
|
|
871
|
+
return this._spinnerDialogIsOpen;
|
|
872
|
+
}
|
|
873
|
+
alert(message, title, dialogType, icon, config) {
|
|
874
|
+
return this.openDialog(message, title, dialogType ? dialogType : DialogType.ALERT, icon, config);
|
|
875
|
+
}
|
|
876
|
+
confirm(message, title, icon, config) {
|
|
877
|
+
return this.openDialog(message, title, DialogType.CONFIRM, icon, config);
|
|
878
|
+
}
|
|
879
|
+
/**
|
|
880
|
+
* Creates a ConfirmDialogComponent with different display depending on
|
|
881
|
+
* the ConfirmType.
|
|
882
|
+
* @param title defaults to 'Confirm'
|
|
883
|
+
* @param icon defaults to 'fa fa-info-circle'
|
|
884
|
+
* @param config config.data can contain a prompt, message1 and/or
|
|
885
|
+
* message2 according to the ConfirmType chosen
|
|
886
|
+
* @param actionConfig sets up the dialog buttons and actions if you want
|
|
887
|
+
* to override the defaults
|
|
888
|
+
*/
|
|
889
|
+
confirmByType(confirmType, title, icon, config, actionConfig) {
|
|
890
|
+
if (!title) {
|
|
891
|
+
title = 'Confirm';
|
|
892
|
+
}
|
|
893
|
+
if (!icon) {
|
|
894
|
+
icon = 'fa fa-info-circle';
|
|
895
|
+
}
|
|
896
|
+
// set up a default if needed
|
|
897
|
+
if (!config) {
|
|
898
|
+
config = new MatDialogConfig();
|
|
899
|
+
config.width = '33vw';
|
|
900
|
+
config.minWidth = '300px';
|
|
901
|
+
config.disableClose = true;
|
|
902
|
+
}
|
|
903
|
+
if (config.data) {
|
|
904
|
+
config.data.confirmType = confirmType;
|
|
905
|
+
}
|
|
906
|
+
else {
|
|
907
|
+
config.data = {
|
|
908
|
+
confirmType
|
|
909
|
+
};
|
|
910
|
+
}
|
|
911
|
+
// if no actions passed in, set up the defaults
|
|
912
|
+
if (!actionConfig) {
|
|
913
|
+
// default actions
|
|
914
|
+
let primary = { type: ActionType.PRIMARY, name: 'YES',
|
|
915
|
+
internalAction: 'onConfirmClick', internalActionReturnValue: true };
|
|
916
|
+
let secondary = { type: ActionType.SECONDARY, name: 'GO BACK',
|
|
917
|
+
internalAction: 'onClose' };
|
|
918
|
+
// by enum type, setup the messages/prompt
|
|
919
|
+
// only two need different defaults than generic defaults
|
|
920
|
+
switch (confirmType) {
|
|
921
|
+
case ConfirmType.CONFIRM_AND_CLOSE:
|
|
922
|
+
primary = { type: ActionType.PRIMARY, name: 'CONFIRM AND CLOSE',
|
|
923
|
+
internalAction: 'onConfirmClick', internalActionReturnValue: true };
|
|
924
|
+
break;
|
|
925
|
+
case ConfirmType.ALERT:
|
|
926
|
+
primary = undefined;
|
|
927
|
+
secondary = { type: ActionType.SECONDARY, name: 'CLOSE',
|
|
928
|
+
internalAction: 'onClose' };
|
|
929
|
+
break;
|
|
930
|
+
// case ConfirmType.DELETE:
|
|
931
|
+
// case ConfirmType.DELETE_W_MESSAGE:
|
|
932
|
+
// case ConfirmType.DELETE_W_PROMPT:
|
|
933
|
+
// case ConfirmType.DISCARD:
|
|
934
|
+
// case ConfirmType.ADD:
|
|
935
|
+
// case ConfirmType.GENERIC:
|
|
936
|
+
default:
|
|
937
|
+
throw new Error('Confirm type doesn\'t exist');
|
|
938
|
+
}
|
|
939
|
+
const actions = [];
|
|
940
|
+
if (primary) {
|
|
941
|
+
actions.push(primary);
|
|
942
|
+
}
|
|
943
|
+
if (secondary) {
|
|
944
|
+
actions.push(secondary);
|
|
945
|
+
}
|
|
946
|
+
actionConfig = {
|
|
947
|
+
actions
|
|
948
|
+
};
|
|
949
|
+
}
|
|
950
|
+
return this.genericDialogContainer(ConfirmDialogComponent, title, icon, config, actionConfig);
|
|
951
|
+
}
|
|
952
|
+
error(message, title, icon, config) {
|
|
953
|
+
return this.openDialog(message, title, DialogType.ERROR, icon, config);
|
|
954
|
+
}
|
|
955
|
+
info(message, title, icon, config) {
|
|
956
|
+
return this.openDialog(message, title, DialogType.INFO, icon, config);
|
|
957
|
+
}
|
|
958
|
+
createCustomDialog(tempRef, context, title, icon, config, actionConfig) {
|
|
959
|
+
let configuration = null;
|
|
960
|
+
if (!config) {
|
|
961
|
+
configuration = new MatDialogConfig();
|
|
962
|
+
}
|
|
963
|
+
else {
|
|
964
|
+
configuration = config;
|
|
965
|
+
}
|
|
966
|
+
configuration.data = configuration.data ? configuration.data : {};
|
|
967
|
+
configuration.data.templateRef = tempRef;
|
|
968
|
+
configuration.data.title = title ? title : '';
|
|
969
|
+
configuration.data.icon = icon ? icon : '';
|
|
970
|
+
configuration.data.context = context;
|
|
971
|
+
if (actionConfig) {
|
|
972
|
+
configuration.data.actionConfig = actionConfig;
|
|
973
|
+
}
|
|
974
|
+
configuration.minWidth = configuration.minWidth ? configuration.minWidth : '10em';
|
|
975
|
+
configuration.width = configuration.width ? configuration.width : '30em';
|
|
976
|
+
configuration.panelClass = ['mx-sized-dialog', 'no-padding'];
|
|
977
|
+
configuration.disableClose = true;
|
|
978
|
+
configuration.hasBackdrop = true;
|
|
979
|
+
const dialogRef = this.dialog.open(CustomDialogComponent, configuration);
|
|
980
|
+
return dialogRef;
|
|
981
|
+
}
|
|
982
|
+
startDefaultSpinnerDialog() {
|
|
983
|
+
return this.startSpinnerDialog('Please wait...', 3, 30);
|
|
984
|
+
}
|
|
985
|
+
startSpinnerDialog(message, strokeWidth, diameter) {
|
|
986
|
+
if (this._spinnerDialogIsOpen) {
|
|
987
|
+
return null;
|
|
988
|
+
}
|
|
989
|
+
this._spinnerDialogIsOpen = true;
|
|
990
|
+
const configuration = new MatDialogConfig();
|
|
991
|
+
configuration.data = {
|
|
992
|
+
message,
|
|
993
|
+
strokeWidth,
|
|
994
|
+
diameter
|
|
995
|
+
};
|
|
996
|
+
configuration.width = '13em';
|
|
997
|
+
configuration.disableClose = true;
|
|
998
|
+
const dialogRef = this.dialog.open(SpinnerDialogComponent, configuration);
|
|
999
|
+
dialogRef.afterClosed().subscribe(() => {
|
|
1000
|
+
this._spinnerDialogIsOpen = false;
|
|
1001
|
+
});
|
|
1002
|
+
this.spinnerDialogRefs.push(dialogRef);
|
|
1003
|
+
return dialogRef;
|
|
1004
|
+
}
|
|
1005
|
+
startNonModalSpinnerDialog(message, strokeWidth, diameter) {
|
|
1006
|
+
if (this._spinnerDialogIsOpen) {
|
|
1007
|
+
return null;
|
|
1008
|
+
}
|
|
1009
|
+
this._spinnerDialogIsOpen = true;
|
|
1010
|
+
const configuration = new MatDialogConfig();
|
|
1011
|
+
configuration.data = {
|
|
1012
|
+
message,
|
|
1013
|
+
strokeWidth,
|
|
1014
|
+
diameter
|
|
1015
|
+
};
|
|
1016
|
+
configuration.width = '13em';
|
|
1017
|
+
configuration.disableClose = true;
|
|
1018
|
+
configuration.hasBackdrop = false;
|
|
1019
|
+
const dialogRef = this.dialog.open(SpinnerDialogComponent, configuration);
|
|
1020
|
+
dialogRef.afterClosed().subscribe(() => {
|
|
1021
|
+
this._spinnerDialogIsOpen = false;
|
|
1022
|
+
});
|
|
1023
|
+
this.spinnerDialogRefs.push(dialogRef);
|
|
1024
|
+
return dialogRef;
|
|
1025
|
+
}
|
|
1026
|
+
// Let there be an alternative, global way to stop all active spinner dialogs.
|
|
1027
|
+
stopAllSpinnerDialogs() {
|
|
1028
|
+
this.spinnerWorkItemCount = 0;
|
|
1029
|
+
for (const dialogRef of this.spinnerDialogRefs) {
|
|
1030
|
+
setTimeout(() => {
|
|
1031
|
+
dialogRef.close();
|
|
1032
|
+
});
|
|
1033
|
+
}
|
|
1034
|
+
this.spinnerDialogRefs = [];
|
|
1035
|
+
}
|
|
1036
|
+
addSpinnerWorkItem() {
|
|
1037
|
+
this.spinnerWorkItemCount++;
|
|
1038
|
+
if (!this.checkingSpinnerWorkItems) {
|
|
1039
|
+
this.checkingSpinnerWorkItems = true;
|
|
1040
|
+
setTimeout(() => {
|
|
1041
|
+
this.checkSpinnerWorkItems();
|
|
1042
|
+
});
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
removeSpinnerWorkItem() {
|
|
1046
|
+
this.spinnerWorkItemCount--;
|
|
1047
|
+
if (this.spinnerWorkItemCount < 0) {
|
|
1048
|
+
this.spinnerWorkItemCount = 0;
|
|
1049
|
+
}
|
|
1050
|
+
if (!this.checkingSpinnerWorkItems) {
|
|
1051
|
+
this.checkingSpinnerWorkItems = true;
|
|
1052
|
+
setTimeout(() => {
|
|
1053
|
+
this.checkSpinnerWorkItems();
|
|
1054
|
+
});
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
checkSpinnerWorkItems() {
|
|
1058
|
+
this.checkingSpinnerWorkItems = false;
|
|
1059
|
+
if (this.spinnerWorkItemCount) {
|
|
1060
|
+
if (!this._spinnerDialogIsOpen) {
|
|
1061
|
+
this.startDefaultSpinnerDialog();
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
else if (this._spinnerDialogIsOpen) {
|
|
1065
|
+
this.stopAllSpinnerDialogs();
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
genericDialogContainer(dialogContent, title, icon, config, actionConfig) {
|
|
1069
|
+
let configuration = null;
|
|
1070
|
+
if (!config) {
|
|
1071
|
+
configuration = new MatDialogConfig();
|
|
1072
|
+
}
|
|
1073
|
+
else {
|
|
1074
|
+
configuration = config;
|
|
1075
|
+
}
|
|
1076
|
+
configuration.data = configuration.data ? configuration.data : {};
|
|
1077
|
+
configuration.data.dialogContent = dialogContent;
|
|
1078
|
+
configuration.data.title = title;
|
|
1079
|
+
if (icon) {
|
|
1080
|
+
configuration.data.icon = icon;
|
|
1081
|
+
}
|
|
1082
|
+
if (actionConfig) {
|
|
1083
|
+
configuration.data.actionConfig = actionConfig;
|
|
1084
|
+
}
|
|
1085
|
+
configuration.panelClass = ['mx-sized-dialog', 'no-padding'];
|
|
1086
|
+
configuration.disableClose = true;
|
|
1087
|
+
configuration.hasBackdrop = true;
|
|
1088
|
+
const dialogRef = this.dialog.open(GenericContainerDialogComponent, configuration);
|
|
1089
|
+
return dialogRef.afterClosed();
|
|
1090
|
+
}
|
|
1091
|
+
openDialog(message, title, type, icon, config) {
|
|
1092
|
+
let configuration = null;
|
|
1093
|
+
if (!config) {
|
|
1094
|
+
configuration = new MatDialogConfig();
|
|
1095
|
+
}
|
|
1096
|
+
else {
|
|
1097
|
+
configuration = config;
|
|
1098
|
+
}
|
|
1099
|
+
configuration.data = configuration.data ? configuration.data : {};
|
|
1100
|
+
configuration.data.message = message;
|
|
1101
|
+
configuration.data.title = title ? title : '';
|
|
1102
|
+
configuration.data.icon = icon ? icon : '';
|
|
1103
|
+
configuration.data.dialogType = type ? type : '';
|
|
1104
|
+
configuration.maxWidth = configuration.maxWidth ? configuration.maxWidth : '80vw';
|
|
1105
|
+
configuration.maxHeight = configuration.maxHeight ? configuration.maxHeight : '80vh';
|
|
1106
|
+
configuration.minWidth = configuration.minWidth ? configuration.minWidth : '30em';
|
|
1107
|
+
configuration.panelClass = 'no-padding';
|
|
1108
|
+
configuration.disableClose = true;
|
|
1109
|
+
configuration.autoFocus = false;
|
|
1110
|
+
configuration.hasBackdrop = false;
|
|
1111
|
+
let dialogRef;
|
|
1112
|
+
dialogRef = this.dialog.open(AlertDialogComponent, configuration);
|
|
1113
|
+
return dialogRef.afterClosed();
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
DialogService.ɵfac = ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: DialogService, deps: [{ token: MatDialog }], target: ɵɵFactoryTarget.Injectable });
|
|
1117
|
+
DialogService.ɵprov = ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: DialogService });
|
|
1118
|
+
ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: DialogService, decorators: [{
|
|
1119
|
+
type: Injectable
|
|
1120
|
+
}], ctorParameters: function () { return [{ type: MatDialog }]; } });
|
|
1121
|
+
|
|
1122
|
+
class SaveFooterComponent {
|
|
1123
|
+
constructor(dialogService) {
|
|
1124
|
+
this.dialogService = dialogService;
|
|
1125
|
+
this.actionType = ActionType.PRIMARY;
|
|
1126
|
+
this.message = 'Your changes have not been saved';
|
|
1127
|
+
this.name = 'Save';
|
|
1128
|
+
this.disableSave = false;
|
|
1129
|
+
this.saveClicked = new EventEmitter();
|
|
1130
|
+
this.type = ActionType;
|
|
1131
|
+
}
|
|
1132
|
+
set dirty(data) {
|
|
1133
|
+
if (data) {
|
|
1134
|
+
this._dirty = data;
|
|
1135
|
+
}
|
|
1136
|
+
else {
|
|
1137
|
+
this._dirty = false;
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
get dirty() {
|
|
1141
|
+
return this._dirty;
|
|
1142
|
+
}
|
|
1143
|
+
set showSpinner(showSpinner) {
|
|
1144
|
+
setTimeout(() => {
|
|
1145
|
+
if (showSpinner) {
|
|
1146
|
+
this.dialogService.startDefaultSpinnerDialog();
|
|
1147
|
+
}
|
|
1148
|
+
else {
|
|
1149
|
+
this.dialogService.stopAllSpinnerDialogs();
|
|
1150
|
+
}
|
|
1151
|
+
});
|
|
1152
|
+
}
|
|
1153
|
+
ngOnInit() {
|
|
1154
|
+
// console.log(this.disableSave);
|
|
1155
|
+
}
|
|
1156
|
+
notifySave() {
|
|
1157
|
+
this.saveClicked.emit();
|
|
1158
|
+
}
|
|
1159
|
+
ngOnDestroy() {
|
|
1160
|
+
this.saveClicked.unsubscribe();
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
SaveFooterComponent.ɵfac = ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SaveFooterComponent, deps: [{ token: DialogService }], target: ɵɵFactoryTarget.Component });
|
|
1164
|
+
SaveFooterComponent.ɵcmp = ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: SaveFooterComponent, selector: "hci-save-footer", inputs: { actionType: "actionType", icon: "icon", message: "message", name: "name", dirty: "dirty", showSpinner: "showSpinner", disableSave: "disableSave" }, outputs: { saveClicked: "saveClicked" }, ngImport: i0, template: `
|
|
1165
|
+
<div class="full-height full-width" style="margin-bottom: 8px;">
|
|
1166
|
+
<div class="d-flex flex-row align-items-center right-align padded">
|
|
1167
|
+
<div *ngIf="dirty" class="warning-background padded">
|
|
1168
|
+
{{ message }}
|
|
1169
|
+
</div>
|
|
1170
|
+
<div class="major-left-right-margin">
|
|
1171
|
+
<button mat-raised-button [disabled]="disableSave"
|
|
1172
|
+
[color]="actionType" (click)="notifySave()"
|
|
1173
|
+
[ngClass]="{'primary-action': actionType === type.PRIMARY,
|
|
1174
|
+
'secondary-action': actionType === type.SECONDARY && !disableSave }">
|
|
1175
|
+
<img *ngIf="icon" [src]="icon" alt="">
|
|
1176
|
+
{{ name }}
|
|
1177
|
+
</button>
|
|
1178
|
+
</div>
|
|
1179
|
+
</div>
|
|
1180
|
+
</div>
|
|
1181
|
+
`, isInline: true, styles: ["\n .primary-action{\n background-color: #0077B3FF;\n font-weight: bolder;\n color: white;\n }\n .secondary-action{\n background-color: #DEF4FFFF;\n font-weight: bolder;\n color: #0077B3FF;\n border: #0077B3FF solid 1px;\n }\n\n .major-left-right-margin {\n margin-left: 0.5em;\n margin-right: 0.5em;\n }\n\n .right-align {\n text-align: right;\n justify-content: flex-end;\n }\n\n\n .warning-background { background:#feec89; }\n\n "], components: [{ type: MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
1182
|
+
ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SaveFooterComponent, decorators: [{
|
|
1183
|
+
type: Component,
|
|
1184
|
+
args: [{
|
|
1185
|
+
selector: 'hci-save-footer',
|
|
1186
|
+
template: `
|
|
1187
|
+
<div class="full-height full-width" style="margin-bottom: 8px;">
|
|
1188
|
+
<div class="d-flex flex-row align-items-center right-align padded">
|
|
1189
|
+
<div *ngIf="dirty" class="warning-background padded">
|
|
1190
|
+
{{ message }}
|
|
1191
|
+
</div>
|
|
1192
|
+
<div class="major-left-right-margin">
|
|
1193
|
+
<button mat-raised-button [disabled]="disableSave"
|
|
1194
|
+
[color]="actionType" (click)="notifySave()"
|
|
1195
|
+
[ngClass]="{'primary-action': actionType === type.PRIMARY,
|
|
1196
|
+
'secondary-action': actionType === type.SECONDARY && !disableSave }">
|
|
1197
|
+
<img *ngIf="icon" [src]="icon" alt="">
|
|
1198
|
+
{{ name }}
|
|
1199
|
+
</button>
|
|
1200
|
+
</div>
|
|
1201
|
+
</div>
|
|
1202
|
+
</div>
|
|
1203
|
+
`,
|
|
1204
|
+
styles: [`
|
|
1205
|
+
.primary-action{
|
|
1206
|
+
background-color: #0077B3FF;
|
|
1207
|
+
font-weight: bolder;
|
|
1208
|
+
color: white;
|
|
1209
|
+
}
|
|
1210
|
+
.secondary-action{
|
|
1211
|
+
background-color: #DEF4FFFF;
|
|
1212
|
+
font-weight: bolder;
|
|
1213
|
+
color: #0077B3FF;
|
|
1214
|
+
border: #0077B3FF solid 1px;
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
.major-left-right-margin {
|
|
1218
|
+
margin-left: 0.5em;
|
|
1219
|
+
margin-right: 0.5em;
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
.right-align {
|
|
1223
|
+
text-align: right;
|
|
1224
|
+
justify-content: flex-end;
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
|
|
1228
|
+
.warning-background { background:#feec89; }
|
|
1229
|
+
|
|
1230
|
+
`]
|
|
1231
|
+
}]
|
|
1232
|
+
}], ctorParameters: function () { return [{ type: DialogService }]; }, propDecorators: { actionType: [{
|
|
1233
|
+
type: Input
|
|
1234
|
+
}], icon: [{
|
|
1235
|
+
type: Input
|
|
1236
|
+
}], message: [{
|
|
1237
|
+
type: Input
|
|
1238
|
+
}], name: [{
|
|
1239
|
+
type: Input
|
|
1240
|
+
}], dirty: [{
|
|
1241
|
+
type: Input
|
|
1242
|
+
}], showSpinner: [{
|
|
1243
|
+
type: Input
|
|
1244
|
+
}], disableSave: [{
|
|
1245
|
+
type: Input
|
|
1246
|
+
}], saveClicked: [{
|
|
1247
|
+
type: Output
|
|
1248
|
+
}] } });
|
|
1249
|
+
|
|
1250
|
+
/*
|
|
1251
|
+
* Copyright (c) 2016 Huntsman Cancer Institute at the University of Utah, Confidential and Proprietary
|
|
1252
|
+
*/
|
|
1253
|
+
// import {RouterModule} from "@angular/router";
|
|
1254
|
+
// import {MatButtonToggleModule} from "@angular/material/button-toggle";
|
|
1255
|
+
// import {MatInputModule} from "@angular/material/input";
|
|
1256
|
+
// import {MatIconModule} from "@angular/material/icon";
|
|
1257
|
+
// import {TreeModule} from "@circlon/angular-tree-component";
|
|
1258
|
+
// import {MatDatepickerModule} from "@angular/material/datepicker";
|
|
1259
|
+
// import {MatSelectModule} from "@angular/material/select";
|
|
1260
|
+
// import {NgbModule, NgbNavModule} from "@ng-bootstrap/ng-bootstrap";
|
|
1261
|
+
// import {MiscModule} from "@huntsman-cancer-institute/misc";
|
|
1262
|
+
// import { MatNativeDateModule } from "@angular/material/core";
|
|
1263
|
+
// import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
1264
|
+
/**
|
|
1265
|
+
* The main @huntsman-cancer-institute/dialog module. The module exports all components that an implementation might use
|
|
1266
|
+
* and the forRoot() provides a global service for an implementing application.
|
|
1267
|
+
*
|
|
1268
|
+
* @since 1.0.0
|
|
1269
|
+
*/
|
|
1270
|
+
class DialogModule {
|
|
1271
|
+
static forRoot() {
|
|
1272
|
+
return {
|
|
1273
|
+
providers: [
|
|
1274
|
+
DialogService
|
|
1275
|
+
],
|
|
1276
|
+
ngModule: DialogModule
|
|
1277
|
+
};
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
DialogModule.ɵfac = ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: DialogModule, deps: [], target: ɵɵFactoryTarget.NgModule });
|
|
1281
|
+
DialogModule.ɵmod = ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: DialogModule, declarations: [AlertDialogComponent,
|
|
1282
|
+
ConfirmDialogComponent,
|
|
1283
|
+
CustomDialogComponent,
|
|
1284
|
+
GenericContainerDialogComponent,
|
|
1285
|
+
SaveFooterComponent,
|
|
1286
|
+
SpinnerDialogComponent], imports: [CommonModule,
|
|
1287
|
+
FormsModule,
|
|
1288
|
+
DynamicModule,
|
|
1289
|
+
MatButtonModule,
|
|
1290
|
+
MatDialogModule,
|
|
1291
|
+
MatExpansionModule,
|
|
1292
|
+
MatProgressSpinnerModule
|
|
1293
|
+
// RouterModule,
|
|
1294
|
+
// MiscModule,
|
|
1295
|
+
// NgbModule,
|
|
1296
|
+
// MatButtonToggleModule,
|
|
1297
|
+
// MatInputModule,
|
|
1298
|
+
// MatIconModule,
|
|
1299
|
+
// MatDatepickerModule,
|
|
1300
|
+
// MatNativeDateModule,
|
|
1301
|
+
// MatCheckboxModule,
|
|
1302
|
+
// MatRadioModule,
|
|
1303
|
+
// MatSelectModule,
|
|
1304
|
+
// TreeModule,
|
|
1305
|
+
// NgbNavModule
|
|
1306
|
+
], exports: [AlertDialogComponent,
|
|
1307
|
+
ConfirmDialogComponent,
|
|
1308
|
+
CustomDialogComponent,
|
|
1309
|
+
GenericContainerDialogComponent,
|
|
1310
|
+
SaveFooterComponent,
|
|
1311
|
+
SpinnerDialogComponent] });
|
|
1312
|
+
DialogModule.ɵinj = ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: DialogModule, providers: [
|
|
1313
|
+
// MatDatepickerModule,
|
|
1314
|
+
], imports: [[
|
|
1315
|
+
CommonModule,
|
|
1316
|
+
FormsModule,
|
|
1317
|
+
DynamicModule,
|
|
1318
|
+
MatButtonModule,
|
|
1319
|
+
MatDialogModule,
|
|
1320
|
+
MatExpansionModule,
|
|
1321
|
+
MatProgressSpinnerModule
|
|
1322
|
+
// RouterModule,
|
|
1323
|
+
// MiscModule,
|
|
1324
|
+
// NgbModule,
|
|
1325
|
+
// MatButtonToggleModule,
|
|
1326
|
+
// MatInputModule,
|
|
1327
|
+
// MatIconModule,
|
|
1328
|
+
// MatDatepickerModule,
|
|
1329
|
+
// MatNativeDateModule,
|
|
1330
|
+
// MatCheckboxModule,
|
|
1331
|
+
// MatRadioModule,
|
|
1332
|
+
// MatSelectModule,
|
|
1333
|
+
// TreeModule,
|
|
1334
|
+
// NgbNavModule
|
|
1335
|
+
]] });
|
|
1336
|
+
ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: DialogModule, decorators: [{
|
|
1337
|
+
type: NgModule,
|
|
1338
|
+
args: [{
|
|
1339
|
+
imports: [
|
|
1340
|
+
CommonModule,
|
|
1341
|
+
FormsModule,
|
|
1342
|
+
DynamicModule,
|
|
1343
|
+
MatButtonModule,
|
|
1344
|
+
MatDialogModule,
|
|
1345
|
+
MatExpansionModule,
|
|
1346
|
+
MatProgressSpinnerModule
|
|
1347
|
+
// RouterModule,
|
|
1348
|
+
// MiscModule,
|
|
1349
|
+
// NgbModule,
|
|
1350
|
+
// MatButtonToggleModule,
|
|
1351
|
+
// MatInputModule,
|
|
1352
|
+
// MatIconModule,
|
|
1353
|
+
// MatDatepickerModule,
|
|
1354
|
+
// MatNativeDateModule,
|
|
1355
|
+
// MatCheckboxModule,
|
|
1356
|
+
// MatRadioModule,
|
|
1357
|
+
// MatSelectModule,
|
|
1358
|
+
// TreeModule,
|
|
1359
|
+
// NgbNavModule
|
|
1360
|
+
],
|
|
1361
|
+
providers: [
|
|
1362
|
+
// MatDatepickerModule,
|
|
1363
|
+
],
|
|
1364
|
+
declarations: [
|
|
1365
|
+
AlertDialogComponent,
|
|
1366
|
+
ConfirmDialogComponent,
|
|
1367
|
+
CustomDialogComponent,
|
|
1368
|
+
GenericContainerDialogComponent,
|
|
1369
|
+
SaveFooterComponent,
|
|
1370
|
+
SpinnerDialogComponent
|
|
1371
|
+
],
|
|
1372
|
+
entryComponents: [
|
|
1373
|
+
AlertDialogComponent,
|
|
1374
|
+
ConfirmDialogComponent,
|
|
1375
|
+
CustomDialogComponent,
|
|
1376
|
+
GenericContainerDialogComponent,
|
|
1377
|
+
SaveFooterComponent,
|
|
1378
|
+
SpinnerDialogComponent
|
|
1379
|
+
],
|
|
1380
|
+
exports: [
|
|
1381
|
+
AlertDialogComponent,
|
|
1382
|
+
ConfirmDialogComponent,
|
|
1383
|
+
CustomDialogComponent,
|
|
1384
|
+
GenericContainerDialogComponent,
|
|
1385
|
+
SaveFooterComponent,
|
|
1386
|
+
SpinnerDialogComponent
|
|
1387
|
+
]
|
|
1388
|
+
}]
|
|
1389
|
+
}] });
|
|
1390
|
+
|
|
1391
|
+
/**
|
|
1392
|
+
* Generated bundle index. Do not edit.
|
|
1393
|
+
*/
|
|
1394
|
+
|
|
1395
|
+
export { ActionType, AlertDialogComponent, BaseGenericContainerDialog, ConfirmDialogComponent, ConfirmType, CustomDialogComponent, DialogModule, DialogService, DialogType, GenericContainerDialogComponent, SaveFooterComponent, SpinnerDialogComponent };
|
|
1396
|
+
//# sourceMappingURL=huntsman-cancer-institute-dialog.js.map
|