@meshmakers/shared-ui 0.0.0-0

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.
Files changed (40) hide show
  1. package/README.md +27 -0
  2. package/esm2020/lib/confirmation-dialog/confirmation-dialog.module.mjs +40 -0
  3. package/esm2020/lib/confirmation-dialog/confirmation-window/confirmation-window.component.mjs +65 -0
  4. package/esm2020/lib/confirmation-dialog/services/confirmation.service.mjs +68 -0
  5. package/esm2020/lib/confirmation-dialog/shared/confirmation.mjs +15 -0
  6. package/esm2020/lib/ia-shared-ui/ia-autocomplete-input/ia-autocomplete-input.mjs +263 -0
  7. package/esm2020/lib/ia-shared-ui/ia-entity-select-input/ia-entity-select-input.component.mjs +264 -0
  8. package/esm2020/lib/ia-shared-ui/ia-notification-bar/ia-notification-bar.component.mjs +35 -0
  9. package/esm2020/lib/ia-shared-ui/ia-shared-ui.module.mjs +66 -0
  10. package/esm2020/lib/ia-shared-ui/message-details/message-details.component.mjs +24 -0
  11. package/esm2020/lib/progress-notifier/progress-notifier.module.mjs +44 -0
  12. package/esm2020/lib/progress-notifier/progress-window/progress-window.component.mjs +33 -0
  13. package/esm2020/lib/progress-notifier/services/progress-notifier.service.mjs +58 -0
  14. package/esm2020/lib/progress-notifier/shared/progressValue.mjs +3 -0
  15. package/esm2020/lib/shared/abstractDetailsComponent.mjs +37 -0
  16. package/esm2020/lib/shared/commonValidators.mjs +29 -0
  17. package/esm2020/meshmakers-shared-ui.mjs +5 -0
  18. package/esm2020/public-api.mjs +15 -0
  19. package/fesm2015/meshmakers-shared-ui.mjs +991 -0
  20. package/fesm2015/meshmakers-shared-ui.mjs.map +1 -0
  21. package/fesm2020/meshmakers-shared-ui.mjs +982 -0
  22. package/fesm2020/meshmakers-shared-ui.mjs.map +1 -0
  23. package/index.d.ts +5 -0
  24. package/lib/confirmation-dialog/confirmation-dialog.module.d.ts +13 -0
  25. package/lib/confirmation-dialog/confirmation-window/confirmation-window.component.d.ts +21 -0
  26. package/lib/confirmation-dialog/services/confirmation.service.d.ts +14 -0
  27. package/lib/confirmation-dialog/shared/confirmation.d.ts +20 -0
  28. package/lib/ia-shared-ui/ia-autocomplete-input/ia-autocomplete-input.d.ts +69 -0
  29. package/lib/ia-shared-ui/ia-entity-select-input/ia-entity-select-input.component.d.ts +70 -0
  30. package/lib/ia-shared-ui/ia-notification-bar/ia-notification-bar.component.d.ts +15 -0
  31. package/lib/ia-shared-ui/ia-shared-ui.module.d.ts +19 -0
  32. package/lib/ia-shared-ui/message-details/message-details.component.d.ts +13 -0
  33. package/lib/progress-notifier/progress-notifier.module.d.ts +14 -0
  34. package/lib/progress-notifier/progress-window/progress-window.component.d.ts +23 -0
  35. package/lib/progress-notifier/services/progress-notifier.service.d.ts +17 -0
  36. package/lib/progress-notifier/shared/progressValue.d.ts +4 -0
  37. package/lib/shared/abstractDetailsComponent.d.ts +15 -0
  38. package/lib/shared/commonValidators.d.ts +10 -0
  39. package/package.json +27 -0
  40. package/public-api.d.ts +11 -0
@@ -0,0 +1,982 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Component, Inject, EventEmitter, forwardRef, HostBinding, ViewChild, Input, NgModule, Injectable } from '@angular/core';
3
+ import * as i2 from '@angular/common';
4
+ import { CommonModule } from '@angular/common';
5
+ import * as i1 from '@angular/material/dialog';
6
+ import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
7
+ import * as i4 from '@angular/material/button';
8
+ import { MatButtonModule } from '@angular/material/button';
9
+ import * as i1$1 from '@meshmakers/shared-services';
10
+ import { IsoDateTime } from '@meshmakers/shared-services';
11
+ import * as i3 from '@angular/material/toolbar';
12
+ import { MatToolbarModule } from '@angular/material/toolbar';
13
+ import { MatSnackBarModule } from '@angular/material/snack-bar';
14
+ import { MatFormFieldControl } from '@angular/material/form-field';
15
+ import * as i7 from '@angular/forms';
16
+ import { FormControl, NgControl, NG_VALUE_ACCESSOR, NG_VALIDATORS, ReactiveFormsModule, Validators } from '@angular/forms';
17
+ import { coerceBooleanProperty } from '@angular/cdk/coercion';
18
+ import { debounceTime, filter, tap, map, switchMap } from 'rxjs/operators';
19
+ import { Subject, BehaviorSubject } from 'rxjs';
20
+ import * as i1$2 from '@angular/cdk/a11y';
21
+ import * as i3$1 from '@angular/material/autocomplete';
22
+ import { MatAutocompleteModule } from '@angular/material/autocomplete';
23
+ import * as i4$1 from '@angular/material/core';
24
+ import * as i5 from '@angular/material/input';
25
+ import { MatInputModule } from '@angular/material/input';
26
+ import * as i6 from '@angular/material/progress-spinner';
27
+ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
28
+ import * as i3$2 from '@angular/flex-layout/flex';
29
+ import * as i5$1 from '@angular/material/progress-bar';
30
+ import { MatProgressBarModule } from '@angular/material/progress-bar';
31
+ import { FlexLayoutModule } from '@angular/flex-layout';
32
+
33
+ class MessageDetailsComponent {
34
+ constructor(dialogRef, data) {
35
+ this.dialogRef = dialogRef;
36
+ this.data = data;
37
+ this.errorMessage = data.errorMessage;
38
+ }
39
+ ngOnInit() {
40
+ }
41
+ }
42
+ MessageDetailsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: MessageDetailsComponent, deps: [{ token: i1.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component });
43
+ MessageDetailsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.2", type: MessageDetailsComponent, selector: "app-message-details", ngImport: i0, template: "<mat-dialog-content>\n\n <h2>{{errorMessage.title}}</h2>\n <p>{{errorMessage.message}}</p>\n\n\n</mat-dialog-content>\n<mat-dialog-actions align=\"end\">\n <button color=\"primary\" mat-dialog-close mat-raised-button>OK</button>\n</mat-dialog-actions>\n", styles: [""], dependencies: [{ kind: "component", type: i4.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"] }, { kind: "directive", type: i1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "directive", type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }] });
44
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: MessageDetailsComponent, decorators: [{
45
+ type: Component,
46
+ args: [{ selector: 'app-message-details', template: "<mat-dialog-content>\n\n <h2>{{errorMessage.title}}</h2>\n <p>{{errorMessage.message}}</p>\n\n\n</mat-dialog-content>\n<mat-dialog-actions align=\"end\">\n <button color=\"primary\" mat-dialog-close mat-raised-button>OK</button>\n</mat-dialog-actions>\n" }]
47
+ }], ctorParameters: function () { return [{ type: i1.MatDialogRef }, { type: undefined, decorators: [{
48
+ type: Inject,
49
+ args: [MAT_DIALOG_DATA]
50
+ }] }]; } });
51
+
52
+ class IaNotificationBarComponent {
53
+ constructor(messageService, dialog) {
54
+ this.messageService = messageService;
55
+ this.dialog = dialog;
56
+ }
57
+ ngOnInit() {
58
+ this.messageService.getLatestErrorMessage().subscribe(value => {
59
+ this.errorMessage = value;
60
+ });
61
+ }
62
+ onHide() {
63
+ this.errorMessage = null;
64
+ }
65
+ onShowDetails() {
66
+ this.dialog.open(MessageDetailsComponent, {
67
+ data: {
68
+ errorMessage: this.errorMessage
69
+ }
70
+ });
71
+ }
72
+ }
73
+ IaNotificationBarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: IaNotificationBarComponent, deps: [{ token: i1$1.MessageService }, { token: i1.MatDialog }], target: i0.ɵɵFactoryTarget.Component });
74
+ IaNotificationBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.2", type: IaNotificationBarComponent, selector: "ia-notification-bar", ngImport: i0, template: "<mat-toolbar [hidden]=\"!errorMessage\" color=\"warn\">\n <a (click)=\"onShowDetails()\"><span class=\"mat-small\"><u>{{ errorMessage?.title }}</u></span></a>\n\n <!-- This fills the remaining space of the current row -->\n <span class=\"notification-fill-remaining-space\"></span>\n\n <button (click)=\"onHide()\" color=\"warn\" mat-raised-button><i class=\"pi pi-angle-double-up\"></i></button>\n</mat-toolbar>\n", styles: [".notification-fill-remaining-space{flex:1 1 auto}\n"], dependencies: [{ kind: "component", type: i3.MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }, { kind: "component", type: i4.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"] }] });
75
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: IaNotificationBarComponent, decorators: [{
76
+ type: Component,
77
+ args: [{ selector: 'ia-notification-bar', template: "<mat-toolbar [hidden]=\"!errorMessage\" color=\"warn\">\n <a (click)=\"onShowDetails()\"><span class=\"mat-small\"><u>{{ errorMessage?.title }}</u></span></a>\n\n <!-- This fills the remaining space of the current row -->\n <span class=\"notification-fill-remaining-space\"></span>\n\n <button (click)=\"onHide()\" color=\"warn\" mat-raised-button><i class=\"pi pi-angle-double-up\"></i></button>\n</mat-toolbar>\n", styles: [".notification-fill-remaining-space{flex:1 1 auto}\n"] }]
78
+ }], ctorParameters: function () { return [{ type: i1$1.MessageService }, { type: i1.MatDialog }]; } });
79
+
80
+ class IaAutocompleteInput {
81
+ constructor(elRef, injector, fm) {
82
+ this.elRef = elRef;
83
+ this.injector = injector;
84
+ this.fm = fm;
85
+ this.filteredStrings = [];
86
+ this.stateChanges = new Subject();
87
+ this.id = `ia-autocomplete-${IaAutocompleteInput.nextId++}`;
88
+ this.valueChange = new EventEmitter();
89
+ this.describedBy = '';
90
+ this._disabled = false;
91
+ this._required = false;
92
+ this._propagateChange = (_) => {
93
+ };
94
+ this._onTouched = () => {
95
+ };
96
+ this.searchFormControl = new FormControl();
97
+ this.isLoading = false;
98
+ this._disabled = false;
99
+ this.focused = false;
100
+ fm.monitor(elRef.nativeElement, true).subscribe(origin => {
101
+ this.focused = !!origin;
102
+ this.stateChanges.next();
103
+ });
104
+ }
105
+ get dataSource() {
106
+ return this._dataSource;
107
+ }
108
+ set dataSource(value) {
109
+ this._dataSource = value;
110
+ }
111
+ get disabled() {
112
+ return this._disabled;
113
+ }
114
+ set disabled(dis) {
115
+ this._disabled = coerceBooleanProperty(dis);
116
+ this._disabled ? this.searchFormControl.disable() : this.searchFormControl.enable();
117
+ this.stateChanges.next();
118
+ }
119
+ get placeholder() {
120
+ return this._placeholder;
121
+ }
122
+ set placeholder(plh) {
123
+ this._placeholder = plh;
124
+ this.stateChanges.next();
125
+ }
126
+ get required() {
127
+ return this._required;
128
+ }
129
+ set required(req) {
130
+ this._required = coerceBooleanProperty(req);
131
+ this.inputField.required = this._required;
132
+ this.stateChanges.next();
133
+ }
134
+ get prefix() {
135
+ return this._prefix;
136
+ }
137
+ set prefix(value) {
138
+ if (value !== this._prefix) {
139
+ this._prefix = value;
140
+ }
141
+ }
142
+ get value() {
143
+ return this._selectedString;
144
+ }
145
+ set value(value) {
146
+ if (value !== this._selectedString) {
147
+ this._selectedString = value;
148
+ this.searchFormControl.setValue(value);
149
+ this.valueChange.emit(value);
150
+ this._propagateChange(this._selectedString);
151
+ this.stateChanges.next();
152
+ }
153
+ }
154
+ get empty() {
155
+ let n = this.searchFormControl.value;
156
+ return !!!n;
157
+ }
158
+ get shouldLabelFloat() {
159
+ return this.focused || !this.empty;
160
+ }
161
+ ngOnInit() {
162
+ this.ngControl = this.injector.get(NgControl, null);
163
+ if (this.ngControl != null) {
164
+ this.ngControl.valueAccessor = this;
165
+ }
166
+ // If prefix defined, usually this is used for a code scanner.
167
+ // The goal is to select the entity in direct way.
168
+ if (this._prefix) {
169
+ this.searchFormControl
170
+ .valueChanges
171
+ .pipe(debounceTime(300), filter(value => typeof value === 'string'), filter(value => value.startsWith(this._prefix)), tap(() => this.value = null), tap(() => this.isLoading = true), map(value => this._dataSource.onPreprocessSearchString(value)), switchMap(value => this._dataSource.onFilter(value)))
172
+ .subscribe(resultSet => {
173
+ if (resultSet.list.length === 1) {
174
+ this.value = resultSet[0];
175
+ }
176
+ else {
177
+ this.filteredStrings = resultSet.list;
178
+ this.searchFormControl.patchValue(resultSet.searchTerm, { emitEvent: false });
179
+ }
180
+ this.isLoading = false;
181
+ });
182
+ }
183
+ // This is the search functionality when search by human.
184
+ this.searchFormControl
185
+ .valueChanges
186
+ .pipe(debounceTime(300), tap(value => {
187
+ this.filteredStrings = [];
188
+ }), filter(value => value != null && value.toString().length >= 1), tap(() => this.isLoading = true), map(value => this._dataSource.onPreprocessSearchString(value)), tap(value => this.value = value), switchMap(value => this._dataSource.onFilter(value)))
189
+ .subscribe(resultSet => {
190
+ this.filteredStrings = resultSet.list;
191
+ this.searchFormControl.patchValue(resultSet.searchTerm, { emitEvent: false });
192
+ this.isLoading = false;
193
+ });
194
+ }
195
+ ngOnDestroy() {
196
+ this.stateChanges.complete();
197
+ this.fm.stopMonitoring(this.elRef.nativeElement);
198
+ }
199
+ ngDoCheck() {
200
+ if (this.ngControl) {
201
+ this.errorState = this.ngControl.invalid && this.ngControl.touched;
202
+ this.stateChanges.next();
203
+ }
204
+ }
205
+ clear() {
206
+ this.filteredStrings = [];
207
+ this.searchFormControl.reset(null);
208
+ }
209
+ focus() {
210
+ this.elRef.nativeElement.querySelector('input').focus();
211
+ }
212
+ onOptionSelected(event) {
213
+ this.value = event.option.value;
214
+ this.filteredStrings = [];
215
+ }
216
+ onOptionActivated(event) {
217
+ this.activatedValue = event.option?.value;
218
+ }
219
+ onAutoCompleteClosed() {
220
+ if (this.activatedValue) {
221
+ this.value = this.activatedValue;
222
+ this.activatedValue = null;
223
+ }
224
+ }
225
+ reset() {
226
+ this.value = null;
227
+ }
228
+ onFocusOut() {
229
+ if (this.filteredStrings.length === 1) {
230
+ this.activatedValue = this.filteredStrings[0];
231
+ this.value = this.filteredStrings[0];
232
+ }
233
+ }
234
+ onTouched() {
235
+ this._onTouched();
236
+ this.stateChanges.next();
237
+ }
238
+ registerOnChange(fn) {
239
+ this._propagateChange = fn;
240
+ }
241
+ registerOnTouched(fn) {
242
+ this.onTouched = fn;
243
+ }
244
+ writeValue(obj) {
245
+ this.clear();
246
+ this.value = obj;
247
+ }
248
+ setDisabledState(isDisabled) {
249
+ this.disabled = isDisabled;
250
+ }
251
+ onContainerClick(event) {
252
+ if (event.target.tagName.toLowerCase() != 'input') {
253
+ this.focus();
254
+ }
255
+ }
256
+ setDescribedByIds(ids) {
257
+ this.describedBy = ids.join(' ');
258
+ }
259
+ validate(control) {
260
+ const selection = control.value;
261
+ if (typeof selection === 'string' && selection.length < 1) {
262
+ return { incorrect: true };
263
+ }
264
+ return null;
265
+ }
266
+ }
267
+ IaAutocompleteInput.nextId = 0;
268
+ IaAutocompleteInput.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: IaAutocompleteInput, deps: [{ token: i0.ElementRef }, { token: i0.Injector }, { token: i1$2.FocusMonitor }], target: i0.ɵɵFactoryTarget.Component });
269
+ IaAutocompleteInput.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.2", type: IaAutocompleteInput, selector: "ia-autocomplete", inputs: { dataSource: "dataSource", disabled: "disabled", placeholder: "placeholder", required: "required", prefix: "prefix" }, host: { properties: { "id": "this.id", "attr.aria-describedby": "this.describedBy", "class.floating": "this.shouldLabelFloat" } }, providers: [
270
+ {
271
+ provide: NG_VALUE_ACCESSOR,
272
+ useExisting: forwardRef(() => IaAutocompleteInput),
273
+ multi: true
274
+ },
275
+ {
276
+ provide: MatFormFieldControl,
277
+ useExisting: IaAutocompleteInput
278
+ },
279
+ {
280
+ provide: NG_VALIDATORS,
281
+ useExisting: forwardRef(() => IaAutocompleteInput),
282
+ multi: true
283
+ }
284
+ ], viewQueries: [{ propertyName: "inputField", first: true, predicate: ["input"], descendants: true }], ngImport: i0, template: "<input #input (blur)=\"onTouched()\" (focusout)=\"onFocusOut()\" [formControl]=\"searchFormControl\" [matAutocomplete]=\"auto\"\n [placeholder]=\"placeholder\" matInput>\n<mat-autocomplete #auto=\"matAutocomplete\"\n (closed)=\"onAutoCompleteClosed()\" (optionActivated)=\"onOptionActivated($event)\"\n (optionSelected)=\"onOptionSelected($event)\">\n <mat-option *ngIf=\"isLoading\" class=\"is-loading\">\n <mat-spinner diameter=\"50\"></mat-spinner>\n </mat-option>\n <ng-container *ngIf=\"!isLoading\">\n <mat-option *ngFor=\"let str of filteredStrings\" [value]=\"str\">\n {{str}}\n </mat-option>\n </ng-container>\n</mat-autocomplete>\n", styles: ["span{opacity:0;transition:opacity .2s}:host.floating span{opacity:1}\n"], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3$1.MatAutocomplete, selector: "mat-autocomplete", inputs: ["disableRipple"], exportAs: ["matAutocomplete"] }, { kind: "directive", type: i3$1.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }, { kind: "component", type: i4$1.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "directive", type: i5.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: i6.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "diameter", "strokeWidth", "mode", "value"], exportAs: ["matProgressSpinner"] }, { kind: "directive", type: i7.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: i7.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i7.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] });
285
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: IaAutocompleteInput, decorators: [{
286
+ type: Component,
287
+ args: [{ selector: 'ia-autocomplete', host: {
288
+ '[id]': 'id',
289
+ '[attr.aria-describedby]': 'describedBy'
290
+ }, providers: [
291
+ {
292
+ provide: NG_VALUE_ACCESSOR,
293
+ useExisting: forwardRef(() => IaAutocompleteInput),
294
+ multi: true
295
+ },
296
+ {
297
+ provide: MatFormFieldControl,
298
+ useExisting: IaAutocompleteInput
299
+ },
300
+ {
301
+ provide: NG_VALIDATORS,
302
+ useExisting: forwardRef(() => IaAutocompleteInput),
303
+ multi: true
304
+ }
305
+ ], template: "<input #input (blur)=\"onTouched()\" (focusout)=\"onFocusOut()\" [formControl]=\"searchFormControl\" [matAutocomplete]=\"auto\"\n [placeholder]=\"placeholder\" matInput>\n<mat-autocomplete #auto=\"matAutocomplete\"\n (closed)=\"onAutoCompleteClosed()\" (optionActivated)=\"onOptionActivated($event)\"\n (optionSelected)=\"onOptionSelected($event)\">\n <mat-option *ngIf=\"isLoading\" class=\"is-loading\">\n <mat-spinner diameter=\"50\"></mat-spinner>\n </mat-option>\n <ng-container *ngIf=\"!isLoading\">\n <mat-option *ngFor=\"let str of filteredStrings\" [value]=\"str\">\n {{str}}\n </mat-option>\n </ng-container>\n</mat-autocomplete>\n", styles: ["span{opacity:0;transition:opacity .2s}:host.floating span{opacity:1}\n"] }]
306
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Injector }, { type: i1$2.FocusMonitor }]; }, propDecorators: { id: [{
307
+ type: HostBinding
308
+ }], inputField: [{
309
+ type: ViewChild,
310
+ args: ['input']
311
+ }], describedBy: [{
312
+ type: HostBinding,
313
+ args: ['attr.aria-describedby']
314
+ }], dataSource: [{
315
+ type: Input
316
+ }], disabled: [{
317
+ type: Input
318
+ }], placeholder: [{
319
+ type: Input
320
+ }], required: [{
321
+ type: Input
322
+ }], prefix: [{
323
+ type: Input
324
+ }], shouldLabelFloat: [{
325
+ type: HostBinding,
326
+ args: ['class.floating']
327
+ }] } });
328
+
329
+ class IaEntitySelectInput {
330
+ constructor(elRef, injector, fm) {
331
+ this.elRef = elRef;
332
+ this.injector = injector;
333
+ this.fm = fm;
334
+ this.filteredEntities = [];
335
+ this.stateChanges = new Subject();
336
+ this.id = `ia-entity-select-${IaEntitySelectInput.nextId++}`;
337
+ this.valueChange = new EventEmitter();
338
+ this.describedBy = '';
339
+ this._disabled = false;
340
+ this._required = false;
341
+ this._propagateChange = (_) => {
342
+ };
343
+ this._onTouched = () => {
344
+ };
345
+ this.searchFormControl = new FormControl();
346
+ this.isLoading = false;
347
+ this._disabled = false;
348
+ this.focused = false;
349
+ fm.monitor(elRef.nativeElement, true).subscribe(origin => {
350
+ this.focused = !!origin;
351
+ this.stateChanges.next();
352
+ });
353
+ }
354
+ get dataSource() {
355
+ return this._dataSource;
356
+ }
357
+ set dataSource(value) {
358
+ this._dataSource = value;
359
+ }
360
+ get disabled() {
361
+ return this._disabled;
362
+ }
363
+ set disabled(dis) {
364
+ this._disabled = coerceBooleanProperty(dis);
365
+ this._disabled ? this.searchFormControl.disable() : this.searchFormControl.enable();
366
+ this.stateChanges.next();
367
+ }
368
+ get placeholder() {
369
+ return this._placeholder;
370
+ }
371
+ set placeholder(plh) {
372
+ this._placeholder = plh;
373
+ this.stateChanges.next();
374
+ }
375
+ get required() {
376
+ return this._required;
377
+ }
378
+ set required(req) {
379
+ this._required = coerceBooleanProperty(req);
380
+ this.inputField.required = this._required;
381
+ this.stateChanges.next();
382
+ }
383
+ get prefix() {
384
+ return this._prefix;
385
+ }
386
+ set prefix(value) {
387
+ if (value !== this._prefix) {
388
+ this._prefix = value;
389
+ }
390
+ }
391
+ get value() {
392
+ return this._selectedEntity;
393
+ }
394
+ set value(value) {
395
+ if (value !== this._selectedEntity) {
396
+ this.searchFormControl.setValue(value);
397
+ this.setValue(value);
398
+ }
399
+ }
400
+ get empty() {
401
+ let n = this.searchFormControl.value;
402
+ return !!!n;
403
+ }
404
+ get shouldLabelFloat() {
405
+ return this.focused || !this.empty;
406
+ }
407
+ ngOnInit() {
408
+ this.ngControl = this.injector.get(NgControl, null);
409
+ if (this.ngControl != null) {
410
+ this.ngControl.valueAccessor = this;
411
+ }
412
+ // If prefix defined, usually this is used for a code scanner.
413
+ // The goal is to select the entity in direct way.
414
+ if (this._prefix) {
415
+ this.searchFormControl
416
+ .valueChanges
417
+ .pipe(debounceTime(300), filter(value => typeof value === 'string'), filter(value => value.startsWith(this._prefix)), tap(() => this.value = null), tap(() => this.isLoading = true), switchMap(value => this._dataSource.onFilter(value.replace(this._prefix, "").trim())))
418
+ .subscribe(resultSet => {
419
+ if (resultSet.list.length === 1) {
420
+ this.value = resultSet.list[0];
421
+ }
422
+ else {
423
+ this.filteredEntities = resultSet.list;
424
+ }
425
+ this.isLoading = false;
426
+ });
427
+ }
428
+ // This is the search functionality when search by human.
429
+ this.searchFormControl
430
+ .valueChanges
431
+ .pipe(debounceTime(300), tap(() => this.filteredEntities = []), filter(value => typeof value === 'string'), tap(() => this.setValue(null)), filter(value => value.toString().length >= 3), tap(() => this.isLoading = true), switchMap(value => this._dataSource.onFilter(value)))
432
+ .subscribe(resultSet => {
433
+ this.filteredEntities = resultSet.list;
434
+ this.isLoading = false;
435
+ });
436
+ }
437
+ ngOnDestroy() {
438
+ this.stateChanges.complete();
439
+ this.fm.stopMonitoring(this.elRef.nativeElement);
440
+ }
441
+ ngDoCheck() {
442
+ if (this.ngControl) {
443
+ this.errorState = this.ngControl.invalid && this.ngControl.touched;
444
+ this.stateChanges.next();
445
+ }
446
+ }
447
+ clear() {
448
+ this.filteredEntities = [];
449
+ this.searchFormControl.reset(null);
450
+ }
451
+ focus() {
452
+ this.elRef.nativeElement.querySelector('input').focus();
453
+ }
454
+ onEntitySelected(event) {
455
+ this.value = event.option.value;
456
+ this.filteredEntities = [];
457
+ }
458
+ onEntityActivated(event) {
459
+ this.activatedValue = event.option?.value;
460
+ }
461
+ onEntityClosed() {
462
+ if (this.activatedValue) {
463
+ this.value = this.activatedValue;
464
+ this.activatedValue = null;
465
+ }
466
+ }
467
+ reset() {
468
+ this.value = null;
469
+ }
470
+ onFocusOut() {
471
+ if (this.filteredEntities.length === 1) {
472
+ this.activatedValue = this.filteredEntities[0];
473
+ this.value = this.filteredEntities[0];
474
+ }
475
+ }
476
+ onTouched() {
477
+ this._onTouched();
478
+ this.stateChanges.next();
479
+ }
480
+ registerOnChange(fn) {
481
+ this._propagateChange = fn;
482
+ }
483
+ registerOnTouched(fn) {
484
+ this.onTouched = fn;
485
+ }
486
+ writeValue(obj) {
487
+ this.clear();
488
+ this.value = obj;
489
+ }
490
+ setDisabledState(isDisabled) {
491
+ this.disabled = isDisabled;
492
+ }
493
+ onContainerClick(event) {
494
+ if (event.target.tagName.toLowerCase() != 'input') {
495
+ this.focus();
496
+ }
497
+ }
498
+ setDescribedByIds(ids) {
499
+ this.describedBy = ids.join(' ');
500
+ }
501
+ validate(control) {
502
+ const selection = control.value;
503
+ if (typeof selection === 'string') {
504
+ return { incorrect: true };
505
+ }
506
+ return null;
507
+ }
508
+ setValue(value) {
509
+ if (value !== this._selectedEntity) {
510
+ this._selectedEntity = value;
511
+ this.valueChange.emit(value);
512
+ this._propagateChange(this._selectedEntity);
513
+ this.stateChanges.next();
514
+ }
515
+ }
516
+ }
517
+ IaEntitySelectInput.nextId = 0;
518
+ IaEntitySelectInput.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: IaEntitySelectInput, deps: [{ token: i0.ElementRef }, { token: i0.Injector }, { token: i1$2.FocusMonitor }], target: i0.ɵɵFactoryTarget.Component });
519
+ IaEntitySelectInput.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.2", type: IaEntitySelectInput, selector: "ia-entity-select", inputs: { dataSource: "dataSource", disabled: "disabled", placeholder: "placeholder", required: "required", prefix: "prefix" }, host: { properties: { "id": "this.id", "attr.aria-describedby": "this.describedBy", "class.floating": "this.shouldLabelFloat" } }, providers: [
520
+ {
521
+ provide: NG_VALUE_ACCESSOR,
522
+ useExisting: forwardRef(() => IaEntitySelectInput),
523
+ multi: true
524
+ },
525
+ {
526
+ provide: MatFormFieldControl,
527
+ useExisting: IaEntitySelectInput
528
+ },
529
+ {
530
+ provide: NG_VALIDATORS,
531
+ useExisting: forwardRef(() => IaEntitySelectInput),
532
+ multi: true
533
+ }
534
+ ], viewQueries: [{ propertyName: "inputField", first: true, predicate: ["input"], descendants: true }], ngImport: i0, template: "<input #input (blur)=\"onTouched()\" (focusout)=\"onFocusOut()\" [formControl]=\"searchFormControl\" [matAutocomplete]=\"auto\"\n [placeholder]=\"placeholder\" matInput>\n<mat-autocomplete #auto=\"matAutocomplete\" (closed)=\"onEntityClosed()\"\n (optionActivated)=\"onEntityActivated($event)\" (optionSelected)=\"onEntitySelected($event)\"\n [displayWith]=\"dataSource.onDisplayEntity\">\n <mat-option *ngIf=\"isLoading\" class=\"is-loading\">\n <mat-spinner diameter=\"50\"></mat-spinner>\n </mat-option>\n <ng-container *ngIf=\"!isLoading\">\n <mat-option *ngFor=\"let entity of filteredEntities\" [value]=\"entity\">\n {{dataSource.onDisplayEntity(entity)}}\n </mat-option>\n </ng-container>\n</mat-autocomplete>\n", styles: ["span{opacity:0;transition:opacity .2s}:host.floating span{opacity:1}\n"], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3$1.MatAutocomplete, selector: "mat-autocomplete", inputs: ["disableRipple"], exportAs: ["matAutocomplete"] }, { kind: "directive", type: i3$1.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }, { kind: "component", type: i4$1.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "directive", type: i5.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: i6.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "diameter", "strokeWidth", "mode", "value"], exportAs: ["matProgressSpinner"] }, { kind: "directive", type: i7.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: i7.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i7.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] });
535
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: IaEntitySelectInput, decorators: [{
536
+ type: Component,
537
+ args: [{ selector: 'ia-entity-select', host: {
538
+ '[id]': 'id',
539
+ '[attr.aria-describedby]': 'describedBy'
540
+ }, providers: [
541
+ {
542
+ provide: NG_VALUE_ACCESSOR,
543
+ useExisting: forwardRef(() => IaEntitySelectInput),
544
+ multi: true
545
+ },
546
+ {
547
+ provide: MatFormFieldControl,
548
+ useExisting: IaEntitySelectInput
549
+ },
550
+ {
551
+ provide: NG_VALIDATORS,
552
+ useExisting: forwardRef(() => IaEntitySelectInput),
553
+ multi: true
554
+ }
555
+ ], template: "<input #input (blur)=\"onTouched()\" (focusout)=\"onFocusOut()\" [formControl]=\"searchFormControl\" [matAutocomplete]=\"auto\"\n [placeholder]=\"placeholder\" matInput>\n<mat-autocomplete #auto=\"matAutocomplete\" (closed)=\"onEntityClosed()\"\n (optionActivated)=\"onEntityActivated($event)\" (optionSelected)=\"onEntitySelected($event)\"\n [displayWith]=\"dataSource.onDisplayEntity\">\n <mat-option *ngIf=\"isLoading\" class=\"is-loading\">\n <mat-spinner diameter=\"50\"></mat-spinner>\n </mat-option>\n <ng-container *ngIf=\"!isLoading\">\n <mat-option *ngFor=\"let entity of filteredEntities\" [value]=\"entity\">\n {{dataSource.onDisplayEntity(entity)}}\n </mat-option>\n </ng-container>\n</mat-autocomplete>\n", styles: ["span{opacity:0;transition:opacity .2s}:host.floating span{opacity:1}\n"] }]
556
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Injector }, { type: i1$2.FocusMonitor }]; }, propDecorators: { id: [{
557
+ type: HostBinding
558
+ }], inputField: [{
559
+ type: ViewChild,
560
+ args: ['input']
561
+ }], describedBy: [{
562
+ type: HostBinding,
563
+ args: ['attr.aria-describedby']
564
+ }], dataSource: [{
565
+ type: Input
566
+ }], disabled: [{
567
+ type: Input
568
+ }], placeholder: [{
569
+ type: Input
570
+ }], required: [{
571
+ type: Input
572
+ }], prefix: [{
573
+ type: Input
574
+ }], shouldLabelFloat: [{
575
+ type: HostBinding,
576
+ args: ['class.floating']
577
+ }] } });
578
+
579
+ class IaSharedUIModule {
580
+ }
581
+ IaSharedUIModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: IaSharedUIModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
582
+ IaSharedUIModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.2", ngImport: i0, type: IaSharedUIModule, declarations: [IaNotificationBarComponent, MessageDetailsComponent, IaAutocompleteInput, IaEntitySelectInput], imports: [CommonModule,
583
+ MatToolbarModule,
584
+ MatButtonModule,
585
+ MatSnackBarModule,
586
+ MatDialogModule,
587
+ MatAutocompleteModule,
588
+ MatInputModule,
589
+ MatProgressSpinnerModule,
590
+ ReactiveFormsModule], exports: [IaNotificationBarComponent,
591
+ IaAutocompleteInput,
592
+ IaEntitySelectInput] });
593
+ IaSharedUIModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: IaSharedUIModule, imports: [CommonModule,
594
+ MatToolbarModule,
595
+ MatButtonModule,
596
+ MatSnackBarModule,
597
+ MatDialogModule,
598
+ MatAutocompleteModule,
599
+ MatInputModule,
600
+ MatProgressSpinnerModule,
601
+ ReactiveFormsModule] });
602
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: IaSharedUIModule, decorators: [{
603
+ type: NgModule,
604
+ args: [{
605
+ declarations: [IaNotificationBarComponent, MessageDetailsComponent, IaAutocompleteInput, IaEntitySelectInput],
606
+ exports: [
607
+ IaNotificationBarComponent,
608
+ IaAutocompleteInput,
609
+ IaEntitySelectInput
610
+ ],
611
+ entryComponents: [
612
+ MessageDetailsComponent,
613
+ IaAutocompleteInput,
614
+ IaEntitySelectInput
615
+ ],
616
+ imports: [
617
+ CommonModule,
618
+ MatToolbarModule,
619
+ MatButtonModule,
620
+ MatSnackBarModule,
621
+ MatDialogModule,
622
+ MatAutocompleteModule,
623
+ MatInputModule,
624
+ MatProgressSpinnerModule,
625
+ ReactiveFormsModule
626
+ ]
627
+ }]
628
+ }] });
629
+
630
+ class ProgressWindowComponent {
631
+ constructor(data) {
632
+ this.data = data;
633
+ this.statusText = null;
634
+ data.progress.subscribe(value => {
635
+ this.statusText = value.statusText;
636
+ this.progressValue = value.progressValue;
637
+ });
638
+ }
639
+ ngOnInit() {
640
+ }
641
+ onCancelClick() {
642
+ this.data.cancelOperation();
643
+ }
644
+ }
645
+ ProgressWindowComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: ProgressWindowComponent, deps: [{ token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component });
646
+ ProgressWindowComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.2", type: ProgressWindowComponent, selector: "lib-progress-window", ngImport: i0, template: "<h1 mat-dialog-title>{{data.title}}</h1>\n<div mat-dialog-content>\n <div fxLayout=\"column\">\n <mat-progress-bar *ngIf=\"data.isDeterminate\" [value]=\"progressValue\" mode=\"determinate\"></mat-progress-bar>\n <mat-progress-bar *ngIf=\"!data.isDeterminate\" mode=\"indeterminate\"></mat-progress-bar>\n <p>{{statusText}}</p>\n </div>\n</div>\n<div fxLayoutAlign=\"end\" mat-dialog-actions>\n <button (click)=\"onCancelClick()\" *ngIf=\"data.isCancelOperationAvailable\" mat-button>Cancel</button>\n</div>\n", styles: [""], 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.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i3$2.DefaultLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg]", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { kind: "directive", type: i3$2.DefaultLayoutAlignDirective, selector: " [fxLayoutAlign], [fxLayoutAlign.xs], [fxLayoutAlign.sm], [fxLayoutAlign.md], [fxLayoutAlign.lg], [fxLayoutAlign.xl], [fxLayoutAlign.lt-sm], [fxLayoutAlign.lt-md], [fxLayoutAlign.lt-lg], [fxLayoutAlign.lt-xl], [fxLayoutAlign.gt-xs], [fxLayoutAlign.gt-sm], [fxLayoutAlign.gt-md], [fxLayoutAlign.gt-lg]", inputs: ["fxLayoutAlign", "fxLayoutAlign.xs", "fxLayoutAlign.sm", "fxLayoutAlign.md", "fxLayoutAlign.lg", "fxLayoutAlign.xl", "fxLayoutAlign.lt-sm", "fxLayoutAlign.lt-md", "fxLayoutAlign.lt-lg", "fxLayoutAlign.lt-xl", "fxLayoutAlign.gt-xs", "fxLayoutAlign.gt-sm", "fxLayoutAlign.gt-md", "fxLayoutAlign.gt-lg"] }, { kind: "component", type: i4.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"] }, { kind: "component", type: i5$1.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }] });
647
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: ProgressWindowComponent, decorators: [{
648
+ type: Component,
649
+ args: [{ selector: 'lib-progress-window', template: "<h1 mat-dialog-title>{{data.title}}</h1>\n<div mat-dialog-content>\n <div fxLayout=\"column\">\n <mat-progress-bar *ngIf=\"data.isDeterminate\" [value]=\"progressValue\" mode=\"determinate\"></mat-progress-bar>\n <mat-progress-bar *ngIf=\"!data.isDeterminate\" mode=\"indeterminate\"></mat-progress-bar>\n <p>{{statusText}}</p>\n </div>\n</div>\n<div fxLayoutAlign=\"end\" mat-dialog-actions>\n <button (click)=\"onCancelClick()\" *ngIf=\"data.isCancelOperationAvailable\" mat-button>Cancel</button>\n</div>\n" }]
650
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
651
+ type: Inject,
652
+ args: [MAT_DIALOG_DATA]
653
+ }] }]; } });
654
+
655
+ class ProgressNotifierService {
656
+ constructor(dialog) {
657
+ this.dialog = dialog;
658
+ this._currentProgressValue = new BehaviorSubject(null);
659
+ this.isCanceled = false;
660
+ }
661
+ get isCanceled() {
662
+ return this._isCanceled;
663
+ }
664
+ set isCanceled(value) {
665
+ this._isCanceled = value;
666
+ }
667
+ start(title, isDeterminate, isCancelOperationAvailable) {
668
+ this.isCanceled = false;
669
+ this.reportProgressDeterminate(0, 100, "Working...");
670
+ this.currentDialogRef = this.dialog.open(ProgressWindowComponent, {
671
+ width: '50vw',
672
+ maxWidth: '50vw',
673
+ data: {
674
+ title: title,
675
+ isDeterminate: isDeterminate,
676
+ progress: this._currentProgressValue.asObservable(),
677
+ isCancelOperationAvailable: isCancelOperationAvailable,
678
+ cancelOperation: () => {
679
+ this.reportProgressIndeterminate("Canceling operation...");
680
+ this.isCanceled = true;
681
+ }
682
+ }
683
+ });
684
+ }
685
+ reportProgressDeterminate(progressCurrent, progressMax, statusText) {
686
+ const progressPercentage = (progressMax / 100) * progressCurrent;
687
+ this._currentProgressValue.next({
688
+ statusText: statusText,
689
+ progressValue: progressPercentage
690
+ });
691
+ }
692
+ reportProgressIndeterminate(statusText) {
693
+ this._currentProgressValue.next({
694
+ statusText: statusText,
695
+ progressValue: 0
696
+ });
697
+ }
698
+ complete() {
699
+ this.currentDialogRef.close();
700
+ }
701
+ }
702
+ ProgressNotifierService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: ProgressNotifierService, deps: [{ token: i1.MatDialog }], target: i0.ɵɵFactoryTarget.Injectable });
703
+ ProgressNotifierService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: ProgressNotifierService });
704
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: ProgressNotifierService, decorators: [{
705
+ type: Injectable
706
+ }], ctorParameters: function () { return [{ type: i1.MatDialog }]; } });
707
+
708
+ class ProgressNotifierModule {
709
+ static forRoot() {
710
+ return {
711
+ ngModule: ProgressNotifierModule,
712
+ providers: [
713
+ ProgressNotifierService
714
+ ]
715
+ };
716
+ }
717
+ }
718
+ ProgressNotifierModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: ProgressNotifierModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
719
+ ProgressNotifierModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.2", ngImport: i0, type: ProgressNotifierModule, declarations: [ProgressWindowComponent], imports: [CommonModule,
720
+ MatDialogModule,
721
+ FlexLayoutModule,
722
+ MatButtonModule,
723
+ MatProgressBarModule] });
724
+ ProgressNotifierModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: ProgressNotifierModule, imports: [CommonModule,
725
+ MatDialogModule,
726
+ FlexLayoutModule,
727
+ MatButtonModule,
728
+ MatProgressBarModule] });
729
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: ProgressNotifierModule, decorators: [{
730
+ type: NgModule,
731
+ args: [{
732
+ declarations: [ProgressWindowComponent],
733
+ imports: [
734
+ CommonModule,
735
+ MatDialogModule,
736
+ FlexLayoutModule,
737
+ MatButtonModule,
738
+ MatProgressBarModule
739
+ ]
740
+ }]
741
+ }] });
742
+
743
+ var ButtonTypes;
744
+ (function (ButtonTypes) {
745
+ ButtonTypes[ButtonTypes["Ok"] = 0] = "Ok";
746
+ ButtonTypes[ButtonTypes["Cancel"] = 1] = "Cancel";
747
+ ButtonTypes[ButtonTypes["Yes"] = 2] = "Yes";
748
+ ButtonTypes[ButtonTypes["No"] = 3] = "No";
749
+ })(ButtonTypes || (ButtonTypes = {}));
750
+ var DialogType;
751
+ (function (DialogType) {
752
+ DialogType[DialogType["YesNo"] = 0] = "YesNo";
753
+ DialogType[DialogType["YesNoCancel"] = 1] = "YesNoCancel";
754
+ DialogType[DialogType["OkCancel"] = 2] = "OkCancel";
755
+ DialogType[DialogType["Ok"] = 3] = "Ok";
756
+ })(DialogType || (DialogType = {}));
757
+
758
+ class ConfirmationWindowComponent {
759
+ constructor(dialogRef, data) {
760
+ this.dialogRef = dialogRef;
761
+ this.data = data;
762
+ if (data.dialogType === DialogType.OkCancel) {
763
+ this.button1Text = "OK";
764
+ this.button1Result = ButtonTypes.Ok;
765
+ this.button2Text = "Cancel";
766
+ this.button2Result = ButtonTypes.Cancel;
767
+ }
768
+ else if (data.dialogType === DialogType.YesNoCancel) {
769
+ this.button1Text = "Yes";
770
+ this.button1Result = ButtonTypes.Yes;
771
+ this.button2Text = "No";
772
+ this.button2Result = ButtonTypes.No;
773
+ this.button3Text = "Cancel";
774
+ this.button3Result = ButtonTypes.Cancel;
775
+ }
776
+ else if (data.dialogType === DialogType.Ok) {
777
+ this.button1Text = "OK";
778
+ this.button1Result = ButtonTypes.Ok;
779
+ }
780
+ else {
781
+ this.button1Text = "Yes";
782
+ this.button1Result = ButtonTypes.Yes;
783
+ this.button2Text = "No";
784
+ this.button2Result = ButtonTypes.No;
785
+ }
786
+ }
787
+ ngOnInit() {
788
+ }
789
+ onButton1() {
790
+ this.dialogRef.close({
791
+ result: this.button1Result
792
+ });
793
+ }
794
+ onButton2() {
795
+ this.dialogRef.close({
796
+ result: this.button2Result
797
+ });
798
+ }
799
+ onButton3() {
800
+ this.dialogRef.close({
801
+ result: this.button3Result
802
+ });
803
+ }
804
+ }
805
+ ConfirmationWindowComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: ConfirmationWindowComponent, deps: [{ token: i1.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component });
806
+ ConfirmationWindowComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.2", type: ConfirmationWindowComponent, selector: "lib-shared-ui-confirmation-window", ngImport: i0, template: "<h1 mat-dialog-title>{{data.title}}</h1>\n<div mat-dialog-content>{{data.message}}</div>\n<div fxLayoutAlign=\"end\" mat-dialog-actions>\n <button (click)=\"onButton1()\" color=\"primary\" mat-button>{{button1Text}}</button>\n <button (click)=\"onButton2()\" *ngIf=\"button2Text\" mat-button>{{button2Text}}</button>\n <button (click)=\"onButton3()\" *ngIf=\"button3Text\" mat-button>{{button3Text}}</button>\n</div>\n", styles: [""], 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.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i3$2.DefaultLayoutAlignDirective, selector: " [fxLayoutAlign], [fxLayoutAlign.xs], [fxLayoutAlign.sm], [fxLayoutAlign.md], [fxLayoutAlign.lg], [fxLayoutAlign.xl], [fxLayoutAlign.lt-sm], [fxLayoutAlign.lt-md], [fxLayoutAlign.lt-lg], [fxLayoutAlign.lt-xl], [fxLayoutAlign.gt-xs], [fxLayoutAlign.gt-sm], [fxLayoutAlign.gt-md], [fxLayoutAlign.gt-lg]", inputs: ["fxLayoutAlign", "fxLayoutAlign.xs", "fxLayoutAlign.sm", "fxLayoutAlign.md", "fxLayoutAlign.lg", "fxLayoutAlign.xl", "fxLayoutAlign.lt-sm", "fxLayoutAlign.lt-md", "fxLayoutAlign.lt-lg", "fxLayoutAlign.lt-xl", "fxLayoutAlign.gt-xs", "fxLayoutAlign.gt-sm", "fxLayoutAlign.gt-md", "fxLayoutAlign.gt-lg"] }, { kind: "component", type: i4.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"] }] });
807
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: ConfirmationWindowComponent, decorators: [{
808
+ type: Component,
809
+ args: [{ selector: 'lib-shared-ui-confirmation-window', template: "<h1 mat-dialog-title>{{data.title}}</h1>\n<div mat-dialog-content>{{data.message}}</div>\n<div fxLayoutAlign=\"end\" mat-dialog-actions>\n <button (click)=\"onButton1()\" color=\"primary\" mat-button>{{button1Text}}</button>\n <button (click)=\"onButton2()\" *ngIf=\"button2Text\" mat-button>{{button2Text}}</button>\n <button (click)=\"onButton3()\" *ngIf=\"button3Text\" mat-button>{{button3Text}}</button>\n</div>\n" }]
810
+ }], ctorParameters: function () { return [{ type: i1.MatDialogRef }, { type: undefined, decorators: [{
811
+ type: Inject,
812
+ args: [MAT_DIALOG_DATA]
813
+ }] }]; } });
814
+
815
+ class ConfirmationService {
816
+ constructor(dialog) {
817
+ this.dialog = dialog;
818
+ }
819
+ showYesNoConfirmationDialog(title, message) {
820
+ const dialogRef = this.dialog.open(ConfirmationWindowComponent, {
821
+ width: '50vw',
822
+ maxWidth: '50vw',
823
+ data: {
824
+ title: title,
825
+ message: message,
826
+ dialogType: DialogType.YesNo
827
+ }
828
+ });
829
+ return dialogRef.afterClosed().pipe(map(value => value.result == ButtonTypes.Yes));
830
+ }
831
+ showYesNoCancelConfirmationDialog(title, message) {
832
+ const dialogRef = this.dialog.open(ConfirmationWindowComponent, {
833
+ width: '50vw',
834
+ maxWidth: '50vw',
835
+ data: {
836
+ title: title,
837
+ message: message,
838
+ dialogType: DialogType.YesNoCancel
839
+ }
840
+ });
841
+ return dialogRef.afterClosed();
842
+ }
843
+ showOkCancelConfirmationDialog(title, message) {
844
+ const dialogRef = this.dialog.open(ConfirmationWindowComponent, {
845
+ width: '50vw',
846
+ maxWidth: '50vw',
847
+ data: {
848
+ title: title,
849
+ message: message,
850
+ dialogType: DialogType.OkCancel
851
+ }
852
+ });
853
+ return dialogRef.afterClosed().pipe(map(value => value.result == ButtonTypes.Ok));
854
+ }
855
+ showOkDialog(title, message) {
856
+ const dialogRef = this.dialog.open(ConfirmationWindowComponent, {
857
+ width: '50vw',
858
+ maxWidth: '50vw',
859
+ data: {
860
+ title: title,
861
+ message: message,
862
+ dialogType: DialogType.Ok
863
+ }
864
+ });
865
+ return dialogRef.afterClosed().pipe(map(value => value.result == ButtonTypes.Ok));
866
+ }
867
+ }
868
+ ConfirmationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: ConfirmationService, deps: [{ token: i1.MatDialog }], target: i0.ɵɵFactoryTarget.Injectable });
869
+ ConfirmationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: ConfirmationService, providedIn: 'root' });
870
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: ConfirmationService, decorators: [{
871
+ type: Injectable,
872
+ args: [{
873
+ providedIn: 'root'
874
+ }]
875
+ }], ctorParameters: function () { return [{ type: i1.MatDialog }]; } });
876
+
877
+ class ConfirmationDialogModule {
878
+ static forRoot() {
879
+ return {
880
+ ngModule: ConfirmationDialogModule,
881
+ providers: [
882
+ ConfirmationService
883
+ ]
884
+ };
885
+ }
886
+ }
887
+ ConfirmationDialogModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: ConfirmationDialogModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
888
+ ConfirmationDialogModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.2", ngImport: i0, type: ConfirmationDialogModule, declarations: [ConfirmationWindowComponent], imports: [CommonModule,
889
+ MatDialogModule,
890
+ FlexLayoutModule,
891
+ MatButtonModule] });
892
+ ConfirmationDialogModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: ConfirmationDialogModule, imports: [CommonModule,
893
+ MatDialogModule,
894
+ FlexLayoutModule,
895
+ MatButtonModule] });
896
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: ConfirmationDialogModule, decorators: [{
897
+ type: NgModule,
898
+ args: [{
899
+ declarations: [ConfirmationWindowComponent],
900
+ imports: [
901
+ CommonModule,
902
+ MatDialogModule,
903
+ FlexLayoutModule,
904
+ MatButtonModule,
905
+ ]
906
+ }]
907
+ }] });
908
+
909
+ function isEmptyInputValue(value) {
910
+ // we don't check for string here so it also works with arrays
911
+ return value == null || value.length === 0;
912
+ }
913
+ class CommonValidators {
914
+ static phoneNumber() {
915
+ return Validators.pattern('^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\\s\\./0-9]*$');
916
+ }
917
+ static httpUri() {
918
+ return Validators.pattern("^(http:\\/\\/|https:\\/\\/)([a-zA-Z0-9-_]+\\.)*[a-zA-Z0-9][a-zA-Z0-9-_]+(\\.[a-zA-Z]{2,11}?)*(:[0-9]{2,5}){0,1}\\/{0,1}$");
919
+ }
920
+ static conditionalRequired(sourceControlName, sourceValueCompareExpression) {
921
+ return (control) => {
922
+ if (control.parent && sourceValueCompareExpression(control.parent.get(sourceControlName).value)) {
923
+ return isEmptyInputValue(control.value) ? { 'required': true } : null;
924
+ }
925
+ };
926
+ }
927
+ static dependentControls(controlNames) {
928
+ return (control) => {
929
+ controlNames.forEach(controlName => {
930
+ control.parent?.get(controlName).updateValueAndValidity();
931
+ });
932
+ return null;
933
+ };
934
+ }
935
+ }
936
+
937
+ class AbstractDetailsComponent {
938
+ constructor() {
939
+ this.hasError = (controlName, errorName) => {
940
+ return this.ownerForm.controls[controlName].hasError(errorName);
941
+ };
942
+ this.hasFormError = (errorName) => {
943
+ return this.ownerForm.hasError(errorName);
944
+ };
945
+ this.loading = true;
946
+ this.entity = null;
947
+ }
948
+ get ownerForm() {
949
+ return this._ownerForm;
950
+ }
951
+ get isLoaded() {
952
+ return this.entity !== null;
953
+ }
954
+ updateDateTime(controlName) {
955
+ this.ownerForm.get(controlName).setValue(IsoDateTime.utcToLocalDateTimeIso(IsoDateTime.currentUtcDateTimeIso()));
956
+ }
957
+ copyInputMessage(inputElement) {
958
+ inputElement.select();
959
+ document.execCommand('copy');
960
+ inputElement.setSelectionRange(0, 0);
961
+ }
962
+ onProgressStarting() {
963
+ this.loading = true;
964
+ this.ownerForm.disable();
965
+ this.ownerForm.updateValueAndValidity();
966
+ }
967
+ onProgressCompleted() {
968
+ this.ownerForm.enable();
969
+ this.loading = false;
970
+ }
971
+ }
972
+
973
+ /*
974
+ * Public API Surface of shared-ui
975
+ */
976
+
977
+ /**
978
+ * Generated bundle index. Do not edit.
979
+ */
980
+
981
+ export { AbstractDetailsComponent, ButtonTypes, CommonValidators, ConfirmationDialogModule, ConfirmationService, DialogType, IaAutocompleteInput, IaEntitySelectInput, IaNotificationBarComponent, IaSharedUIModule, ProgressNotifierModule, ProgressNotifierService };
982
+ //# sourceMappingURL=meshmakers-shared-ui.mjs.map