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