@meshmakers/shared-ui 2.0.2304-14001 → 2.0.2304-23001

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 (42) hide show
  1. package/README.md +24 -27
  2. package/esm2020/lib/confirmation-dialog/confirmation-dialog.module.mjs +40 -40
  3. package/esm2020/lib/confirmation-dialog/confirmation-window/confirmation-window.component.mjs +69 -65
  4. package/esm2020/lib/confirmation-dialog/services/confirmation.service.mjs +68 -68
  5. package/esm2020/lib/confirmation-dialog/shared/confirmation.mjs +15 -15
  6. package/esm2020/lib/ia-shared-ui/ia-autocomplete-input/ia-autocomplete-input.mjs +276 -263
  7. package/esm2020/lib/ia-shared-ui/ia-entity-select-input/ia-entity-select-input.component.mjs +276 -264
  8. package/esm2020/lib/ia-shared-ui/ia-multiple-entity-select-input/ia-multiple-entity-select-input.component.mjs +300 -285
  9. package/esm2020/lib/ia-shared-ui/ia-notification-bar/ia-notification-bar.component.mjs +36 -35
  10. package/esm2020/lib/ia-shared-ui/ia-shared-ui.module.mjs +88 -88
  11. package/esm2020/lib/ia-shared-ui/message-details/message-details.component.mjs +24 -24
  12. package/esm2020/lib/progress-notifier/progress-notifier.module.mjs +44 -44
  13. package/esm2020/lib/progress-notifier/progress-window/progress-window.component.mjs +34 -33
  14. package/esm2020/lib/progress-notifier/services/progress-notifier.service.mjs +59 -58
  15. package/esm2020/lib/progress-notifier/shared/progressValue.mjs +7 -3
  16. package/esm2020/lib/shared/abstractDetailsComponent.mjs +38 -37
  17. package/esm2020/lib/shared/commonValidators.mjs +30 -29
  18. package/esm2020/meshmakers-shared-ui.mjs +4 -4
  19. package/esm2020/public-api.mjs +16 -16
  20. package/fesm2015/meshmakers-shared-ui.mjs +1273 -1212
  21. package/fesm2015/meshmakers-shared-ui.mjs.map +1 -1
  22. package/fesm2020/meshmakers-shared-ui.mjs +1251 -1202
  23. package/fesm2020/meshmakers-shared-ui.mjs.map +1 -1
  24. package/index.d.ts +5 -5
  25. package/lib/confirmation-dialog/confirmation-dialog.module.d.ts +13 -13
  26. package/lib/confirmation-dialog/confirmation-window/confirmation-window.component.d.ts +21 -21
  27. package/lib/confirmation-dialog/services/confirmation.service.d.ts +14 -14
  28. package/lib/confirmation-dialog/shared/confirmation.d.ts +20 -20
  29. package/lib/ia-shared-ui/ia-autocomplete-input/ia-autocomplete-input.d.ts +69 -69
  30. package/lib/ia-shared-ui/ia-entity-select-input/ia-entity-select-input.component.d.ts +70 -70
  31. package/lib/ia-shared-ui/ia-multiple-entity-select-input/ia-multiple-entity-select-input.component.d.ts +73 -73
  32. package/lib/ia-shared-ui/ia-notification-bar/ia-notification-bar.component.d.ts +15 -15
  33. package/lib/ia-shared-ui/ia-shared-ui.module.d.ts +22 -22
  34. package/lib/ia-shared-ui/message-details/message-details.component.d.ts +13 -13
  35. package/lib/progress-notifier/progress-notifier.module.d.ts +14 -14
  36. package/lib/progress-notifier/progress-window/progress-window.component.d.ts +23 -23
  37. package/lib/progress-notifier/services/progress-notifier.service.d.ts +17 -17
  38. package/lib/progress-notifier/shared/progressValue.d.ts +5 -4
  39. package/lib/shared/abstractDetailsComponent.d.ts +15 -15
  40. package/lib/shared/commonValidators.d.ts +10 -10
  41. package/package.json +8 -4
  42. package/public-api.d.ts +12 -12
@@ -16,7 +16,7 @@ import * as i7 from '@angular/forms';
16
16
  import { FormControl, NgControl, NG_VALUE_ACCESSOR, NG_VALIDATORS, ReactiveFormsModule, Validators } from '@angular/forms';
17
17
  import { coerceBooleanProperty } from '@angular/cdk/coercion';
18
18
  import { debounceTime, filter, tap, map, switchMap } from 'rxjs/operators';
19
- import { Subject, BehaviorSubject } from 'rxjs';
19
+ import { Subject, of, BehaviorSubject } from 'rxjs';
20
20
  import * as i1$2 from '@angular/cdk/a11y';
21
21
  import * as i3$1 from '@angular/material/autocomplete';
22
22
  import { MatAutocompleteModule } from '@angular/material/autocomplete';
@@ -35,1239 +35,1288 @@ import * as i5$1 from '@angular/material/progress-bar';
35
35
  import { MatProgressBarModule } from '@angular/material/progress-bar';
36
36
  import { FlexLayoutModule } from '@angular/flex-layout';
37
37
 
38
- class MessageDetailsComponent {
39
- constructor(dialogRef, data) {
40
- this.dialogRef = dialogRef;
41
- this.data = data;
42
- this.errorMessage = data.errorMessage;
43
- }
44
- ngOnInit() {
45
- }
46
- }
47
- MessageDetailsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: MessageDetailsComponent, deps: [{ token: i1.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component });
48
- MessageDetailsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.3", type: MessageDetailsComponent, selector: "app-message-details", ngImport: i0, template: "<mat-dialog-content>\r\n\r\n <h2>{{errorMessage.title}}</h2>\r\n <p>{{errorMessage.message}}</p>\r\n\r\n\r\n</mat-dialog-content>\r\n<mat-dialog-actions align=\"end\">\r\n <button color=\"primary\" mat-dialog-close mat-raised-button>OK</button>\r\n</mat-dialog-actions>\r\n", styles: [""], dependencies: [{ kind: "component", type: i4.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-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"] }] });
49
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: MessageDetailsComponent, decorators: [{
50
- type: Component,
51
- args: [{ selector: 'app-message-details', template: "<mat-dialog-content>\r\n\r\n <h2>{{errorMessage.title}}</h2>\r\n <p>{{errorMessage.message}}</p>\r\n\r\n\r\n</mat-dialog-content>\r\n<mat-dialog-actions align=\"end\">\r\n <button color=\"primary\" mat-dialog-close mat-raised-button>OK</button>\r\n</mat-dialog-actions>\r\n" }]
52
- }], ctorParameters: function () { return [{ type: i1.MatDialogRef }, { type: undefined, decorators: [{
53
- type: Inject,
54
- args: [MAT_DIALOG_DATA]
38
+ class MessageDetailsComponent {
39
+ constructor(dialogRef, data) {
40
+ this.dialogRef = dialogRef;
41
+ this.data = data;
42
+ this.errorMessage = data.errorMessage;
43
+ }
44
+ ngOnInit() {
45
+ }
46
+ }
47
+ MessageDetailsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: MessageDetailsComponent, deps: [{ token: i1.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component });
48
+ MessageDetailsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.8", 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-flat-button], button[mat-stroked-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"] }] });
49
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: MessageDetailsComponent, decorators: [{
50
+ type: Component,
51
+ 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" }]
52
+ }], ctorParameters: function () { return [{ type: i1.MatDialogRef }, { type: undefined, decorators: [{
53
+ type: Inject,
54
+ args: [MAT_DIALOG_DATA]
55
55
  }] }]; } });
56
56
 
57
- class IaNotificationBarComponent {
58
- constructor(messageService, dialog) {
59
- this.messageService = messageService;
60
- this.dialog = dialog;
61
- }
62
- ngOnInit() {
63
- this.messageService.getLatestErrorMessage().subscribe(value => {
64
- this.errorMessage = value;
65
- });
66
- }
67
- onHide() {
68
- this.errorMessage = null;
69
- }
70
- onShowDetails() {
71
- this.dialog.open(MessageDetailsComponent, {
72
- data: {
73
- errorMessage: this.errorMessage
74
- }
75
- });
76
- }
77
- }
78
- IaNotificationBarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: IaNotificationBarComponent, deps: [{ token: i1$1.MessageService }, { token: i1.MatDialog }], target: i0.ɵɵFactoryTarget.Component });
79
- IaNotificationBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.3", type: IaNotificationBarComponent, selector: "ia-notification-bar", ngImport: i0, template: "<mat-toolbar [hidden]=\"!errorMessage\" color=\"warn\">\r\n <a (click)=\"onShowDetails()\"><span class=\"mat-small\"><u>{{ errorMessage?.title }}</u></span></a>\r\n\r\n <!-- This fills the remaining space of the current row -->\r\n <span class=\"notification-fill-remaining-space\"></span>\r\n\r\n <button (click)=\"onHide()\" color=\"warn\" mat-raised-button><i class=\"pi pi-angle-double-up\"></i></button>\r\n</mat-toolbar>\r\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-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }] });
80
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: IaNotificationBarComponent, decorators: [{
81
- type: Component,
82
- args: [{ selector: 'ia-notification-bar', template: "<mat-toolbar [hidden]=\"!errorMessage\" color=\"warn\">\r\n <a (click)=\"onShowDetails()\"><span class=\"mat-small\"><u>{{ errorMessage?.title }}</u></span></a>\r\n\r\n <!-- This fills the remaining space of the current row -->\r\n <span class=\"notification-fill-remaining-space\"></span>\r\n\r\n <button (click)=\"onHide()\" color=\"warn\" mat-raised-button><i class=\"pi pi-angle-double-up\"></i></button>\r\n</mat-toolbar>\r\n", styles: [".notification-fill-remaining-space{flex:1 1 auto}\n"] }]
57
+ class IaNotificationBarComponent {
58
+ constructor(messageService, dialog) {
59
+ this.messageService = messageService;
60
+ this.dialog = dialog;
61
+ this.errorMessage = null;
62
+ }
63
+ ngOnInit() {
64
+ this.messageService.getLatestErrorMessage().subscribe(value => {
65
+ this.errorMessage = value;
66
+ });
67
+ }
68
+ onHide() {
69
+ this.errorMessage = null;
70
+ }
71
+ onShowDetails() {
72
+ this.dialog.open(MessageDetailsComponent, {
73
+ data: {
74
+ errorMessage: this.errorMessage
75
+ }
76
+ });
77
+ }
78
+ }
79
+ IaNotificationBarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: IaNotificationBarComponent, deps: [{ token: i1$1.MessageService }, { token: i1.MatDialog }], target: i0.ɵɵFactoryTarget.Component });
80
+ IaNotificationBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.8", 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-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }] });
81
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: IaNotificationBarComponent, decorators: [{
82
+ type: Component,
83
+ 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"] }]
83
84
  }], ctorParameters: function () { return [{ type: i1$1.MessageService }, { type: i1.MatDialog }]; } });
84
85
 
85
- class IaAutocompleteInput {
86
- constructor(elRef, injector, fm) {
87
- this.elRef = elRef;
88
- this.injector = injector;
89
- this.fm = fm;
90
- this.filteredStrings = [];
91
- this.stateChanges = new Subject();
92
- this.id = `ia-autocomplete-${IaAutocompleteInput.nextId++}`;
93
- this.valueChange = new EventEmitter();
94
- this.describedBy = '';
95
- this._disabled = false;
96
- this._required = false;
97
- this._propagateChange = (_) => {
98
- };
99
- this._onTouched = () => {
100
- };
101
- this.searchFormControl = new FormControl();
102
- this.isLoading = false;
103
- this._disabled = false;
104
- this.focused = false;
105
- fm.monitor(elRef.nativeElement, true).subscribe(origin => {
106
- this.focused = !!origin;
107
- this.stateChanges.next();
108
- });
109
- }
110
- get dataSource() {
111
- return this._dataSource;
112
- }
113
- set dataSource(value) {
114
- this._dataSource = value;
115
- }
116
- get disabled() {
117
- return this._disabled;
118
- }
119
- set disabled(dis) {
120
- this._disabled = coerceBooleanProperty(dis);
121
- this._disabled ? this.searchFormControl.disable() : this.searchFormControl.enable();
122
- this.stateChanges.next();
123
- }
124
- get placeholder() {
125
- return this._placeholder;
126
- }
127
- set placeholder(plh) {
128
- this._placeholder = plh;
129
- this.stateChanges.next();
130
- }
131
- get required() {
132
- return this._required;
133
- }
134
- set required(req) {
135
- this._required = coerceBooleanProperty(req);
136
- this.inputField.required = this._required;
137
- this.stateChanges.next();
138
- }
139
- get prefix() {
140
- return this._prefix;
141
- }
142
- set prefix(value) {
143
- if (value !== this._prefix) {
144
- this._prefix = value;
145
- }
146
- }
147
- get value() {
148
- return this._selectedString;
149
- }
150
- set value(value) {
151
- if (value !== this._selectedString) {
152
- this._selectedString = value;
153
- this.searchFormControl.setValue(value);
154
- this.valueChange.emit(value);
155
- this._propagateChange(this._selectedString);
156
- this.stateChanges.next();
157
- }
158
- }
159
- get empty() {
160
- let n = this.searchFormControl.value;
161
- return !!!n;
162
- }
163
- get shouldLabelFloat() {
164
- return this.focused || !this.empty;
165
- }
166
- ngOnInit() {
167
- this.ngControl = this.injector.get(NgControl, null);
168
- if (this.ngControl != null) {
169
- this.ngControl.valueAccessor = this;
170
- }
171
- // If prefix defined, usually this is used for a code scanner.
172
- // The goal is to select the entity in direct way.
173
- if (this._prefix) {
174
- this.searchFormControl
175
- .valueChanges
176
- .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)))
177
- .subscribe(resultSet => {
178
- if (resultSet.list.length === 1) {
179
- this.value = resultSet[0];
180
- }
181
- else {
182
- this.filteredStrings = resultSet.list;
183
- this.searchFormControl.patchValue(resultSet.searchTerm, { emitEvent: false });
184
- }
185
- this.isLoading = false;
186
- });
187
- }
188
- // This is the search functionality when search by human.
189
- this.searchFormControl
190
- .valueChanges
191
- .pipe(debounceTime(300), tap(value => {
192
- this.filteredStrings = [];
193
- }), 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)))
194
- .subscribe(resultSet => {
195
- this.filteredStrings = resultSet.list;
196
- this.searchFormControl.patchValue(resultSet.searchTerm, { emitEvent: false });
197
- this.isLoading = false;
198
- });
199
- }
200
- ngOnDestroy() {
201
- this.stateChanges.complete();
202
- this.fm.stopMonitoring(this.elRef.nativeElement);
203
- }
204
- ngDoCheck() {
205
- if (this.ngControl) {
206
- this.errorState = this.ngControl.invalid && this.ngControl.touched;
207
- this.stateChanges.next();
208
- }
209
- }
210
- clear() {
211
- this.filteredStrings = [];
212
- this.searchFormControl.reset(null);
213
- }
214
- focus() {
215
- this.elRef.nativeElement.querySelector('input').focus();
216
- }
217
- onOptionSelected(event) {
218
- this.value = event.option.value;
219
- this.filteredStrings = [];
220
- }
221
- onOptionActivated(event) {
222
- this.activatedValue = event.option?.value;
223
- }
224
- onAutoCompleteClosed() {
225
- if (this.activatedValue) {
226
- this.value = this.activatedValue;
227
- this.activatedValue = null;
228
- }
229
- }
230
- reset() {
231
- this.value = null;
232
- }
233
- onFocusOut() {
234
- if (this.filteredStrings.length === 1) {
235
- this.activatedValue = this.filteredStrings[0];
236
- this.value = this.filteredStrings[0];
237
- }
238
- }
239
- onTouched() {
240
- this._onTouched();
241
- this.stateChanges.next();
242
- }
243
- registerOnChange(fn) {
244
- this._propagateChange = fn;
245
- }
246
- registerOnTouched(fn) {
247
- this.onTouched = fn;
248
- }
249
- writeValue(obj) {
250
- this.clear();
251
- this.value = obj;
252
- }
253
- setDisabledState(isDisabled) {
254
- this.disabled = isDisabled;
255
- }
256
- onContainerClick(event) {
257
- if (event.target.tagName.toLowerCase() != 'input') {
258
- this.focus();
259
- }
260
- }
261
- setDescribedByIds(ids) {
262
- this.describedBy = ids.join(' ');
263
- }
264
- validate(control) {
265
- const selection = control.value;
266
- if (typeof selection === 'string' && selection.length < 1) {
267
- return { incorrect: true };
268
- }
269
- return null;
270
- }
271
- }
272
- IaAutocompleteInput.nextId = 0;
273
- IaAutocompleteInput.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: IaAutocompleteInput, deps: [{ token: i0.ElementRef }, { token: i0.Injector }, { token: i1$2.FocusMonitor }], target: i0.ɵɵFactoryTarget.Component });
274
- IaAutocompleteInput.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.3", 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: [
275
- {
276
- provide: NG_VALUE_ACCESSOR,
277
- useExisting: forwardRef(() => IaAutocompleteInput),
278
- multi: true
279
- },
280
- {
281
- provide: MatFormFieldControl,
282
- useExisting: IaAutocompleteInput
283
- },
284
- {
285
- provide: NG_VALIDATORS,
286
- useExisting: forwardRef(() => IaAutocompleteInput),
287
- multi: true
288
- }
289
- ], viewQueries: [{ propertyName: "inputField", first: true, predicate: ["input"], descendants: true }], ngImport: i0, template: "<input #input (blur)=\"onTouched()\" (focusout)=\"onFocusOut()\" [formControl]=\"searchFormControl\" [matAutocomplete]=\"auto\"\r\n [placeholder]=\"placeholder\" matInput>\r\n<mat-autocomplete #auto=\"matAutocomplete\"\r\n (closed)=\"onAutoCompleteClosed()\" (optionActivated)=\"onOptionActivated($event)\"\r\n (optionSelected)=\"onOptionSelected($event)\">\r\n <mat-option *ngIf=\"isLoading\" class=\"is-loading\">\r\n <mat-spinner diameter=\"50\"></mat-spinner>\r\n </mat-option>\r\n <ng-container *ngIf=\"!isLoading\">\r\n <mat-option *ngFor=\"let str of filteredStrings\" [value]=\"str\">\r\n {{str}}\r\n </mat-option>\r\n </ng-container>\r\n</mat-autocomplete>\r\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", "hideSingleSelectionIndicator"], exportAs: ["matAutocomplete"] }, { kind: "component", type: i4$1.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "directive", type: i3$1.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }, { 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", "mode", "value", "diameter", "strokeWidth"], 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"] }] });
290
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: IaAutocompleteInput, decorators: [{
291
- type: Component,
292
- args: [{ selector: 'ia-autocomplete', host: {
293
- '[id]': 'id',
294
- '[attr.aria-describedby]': 'describedBy'
295
- }, providers: [
296
- {
297
- provide: NG_VALUE_ACCESSOR,
298
- useExisting: forwardRef(() => IaAutocompleteInput),
299
- multi: true
300
- },
301
- {
302
- provide: MatFormFieldControl,
303
- useExisting: IaAutocompleteInput
304
- },
305
- {
306
- provide: NG_VALIDATORS,
307
- useExisting: forwardRef(() => IaAutocompleteInput),
308
- multi: true
309
- }
310
- ], template: "<input #input (blur)=\"onTouched()\" (focusout)=\"onFocusOut()\" [formControl]=\"searchFormControl\" [matAutocomplete]=\"auto\"\r\n [placeholder]=\"placeholder\" matInput>\r\n<mat-autocomplete #auto=\"matAutocomplete\"\r\n (closed)=\"onAutoCompleteClosed()\" (optionActivated)=\"onOptionActivated($event)\"\r\n (optionSelected)=\"onOptionSelected($event)\">\r\n <mat-option *ngIf=\"isLoading\" class=\"is-loading\">\r\n <mat-spinner diameter=\"50\"></mat-spinner>\r\n </mat-option>\r\n <ng-container *ngIf=\"!isLoading\">\r\n <mat-option *ngFor=\"let str of filteredStrings\" [value]=\"str\">\r\n {{str}}\r\n </mat-option>\r\n </ng-container>\r\n</mat-autocomplete>\r\n", styles: ["span{opacity:0;transition:opacity .2s}:host.floating span{opacity:1}\n"] }]
311
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Injector }, { type: i1$2.FocusMonitor }]; }, propDecorators: { id: [{
312
- type: HostBinding
313
- }], inputField: [{
314
- type: ViewChild,
315
- args: ['input']
316
- }], describedBy: [{
317
- type: HostBinding,
318
- args: ['attr.aria-describedby']
319
- }], dataSource: [{
320
- type: Input
321
- }], disabled: [{
322
- type: Input
323
- }], placeholder: [{
324
- type: Input
325
- }], required: [{
326
- type: Input
327
- }], prefix: [{
328
- type: Input
329
- }], shouldLabelFloat: [{
330
- type: HostBinding,
331
- args: ['class.floating']
86
+ class IaAutocompleteInput {
87
+ constructor(elRef, injector, fm) {
88
+ this.elRef = elRef;
89
+ this.injector = injector;
90
+ this.fm = fm;
91
+ this.filteredStrings = [];
92
+ this.stateChanges = new Subject();
93
+ this.id = `ia-autocomplete-${IaAutocompleteInput.nextId++}`;
94
+ this.valueChange = new EventEmitter();
95
+ this.describedBy = '';
96
+ this._disabled = false;
97
+ this._required = false;
98
+ this._propagateChange = (_) => {
99
+ };
100
+ this._onTouched = () => {
101
+ };
102
+ this.ngControl = null;
103
+ this.errorState = false;
104
+ this._selectedString = null;
105
+ this.inputField = null;
106
+ this._dataSource = null;
107
+ this._placeholder = "";
108
+ this._prefix = "";
109
+ this.searchFormControl = new FormControl();
110
+ this.isLoading = false;
111
+ this._disabled = false;
112
+ this.focused = false;
113
+ fm.monitor(elRef.nativeElement, true).subscribe(origin => {
114
+ this.focused = !!origin;
115
+ this.stateChanges.next();
116
+ });
117
+ }
118
+ get dataSource() {
119
+ return this._dataSource;
120
+ }
121
+ set dataSource(value) {
122
+ this._dataSource = value;
123
+ }
124
+ get disabled() {
125
+ return this._disabled;
126
+ }
127
+ set disabled(dis) {
128
+ this._disabled = coerceBooleanProperty(dis);
129
+ this._disabled ? this.searchFormControl.disable() : this.searchFormControl.enable();
130
+ this.stateChanges.next();
131
+ }
132
+ get placeholder() {
133
+ return this._placeholder;
134
+ }
135
+ set placeholder(plh) {
136
+ this._placeholder = plh;
137
+ this.stateChanges.next();
138
+ }
139
+ get required() {
140
+ return this._required;
141
+ }
142
+ set required(req) {
143
+ this._required = coerceBooleanProperty(req);
144
+ if (this.inputField) {
145
+ this.inputField.required = this._required;
146
+ }
147
+ this.stateChanges.next();
148
+ }
149
+ get prefix() {
150
+ return this._prefix;
151
+ }
152
+ set prefix(value) {
153
+ if (value !== this._prefix) {
154
+ this._prefix = value;
155
+ }
156
+ }
157
+ get value() {
158
+ return this._selectedString;
159
+ }
160
+ set value(value) {
161
+ if (value !== this._selectedString) {
162
+ this._selectedString = value;
163
+ this.searchFormControl.setValue(value);
164
+ this.valueChange.emit(value);
165
+ this._propagateChange(this._selectedString);
166
+ this.stateChanges.next();
167
+ }
168
+ }
169
+ get empty() {
170
+ let n = this.searchFormControl.value;
171
+ return !n;
172
+ }
173
+ get shouldLabelFloat() {
174
+ return this.focused || !this.empty;
175
+ }
176
+ ngOnInit() {
177
+ this.ngControl = this.injector.get(NgControl, null);
178
+ if (this.ngControl != null) {
179
+ this.ngControl.valueAccessor = this;
180
+ }
181
+ // If prefix defined, usually this is used for a code scanner.
182
+ // The goal is to select the entity in direct way.
183
+ if (this._prefix) {
184
+ this.searchFormControl
185
+ .valueChanges
186
+ .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) ?? of(null)))
187
+ .subscribe(resultSet => {
188
+ if (resultSet && resultSet.list) {
189
+ if (resultSet.list.length === 1) {
190
+ this.value = resultSet.list[0];
191
+ }
192
+ else {
193
+ this.filteredStrings = resultSet.list;
194
+ this.searchFormControl.patchValue(resultSet.searchTerm, { emitEvent: false });
195
+ }
196
+ }
197
+ this.isLoading = false;
198
+ });
199
+ }
200
+ // This is the search functionality when search by human.
201
+ this.searchFormControl
202
+ .valueChanges
203
+ .pipe(debounceTime(300), tap(_ => {
204
+ this.filteredStrings = [];
205
+ }), 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) ?? of(null)))
206
+ .subscribe(resultSet => {
207
+ if (resultSet && resultSet.list) {
208
+ this.filteredStrings = resultSet.list;
209
+ this.searchFormControl.patchValue(resultSet.searchTerm, { emitEvent: false });
210
+ }
211
+ this.isLoading = false;
212
+ });
213
+ }
214
+ ngOnDestroy() {
215
+ this.stateChanges.complete();
216
+ this.fm.stopMonitoring(this.elRef.nativeElement);
217
+ }
218
+ ngDoCheck() {
219
+ if (this.ngControl) {
220
+ this.errorState = (this.ngControl.invalid && this.ngControl.touched) ?? false;
221
+ this.stateChanges.next();
222
+ }
223
+ }
224
+ clear() {
225
+ this.filteredStrings = [];
226
+ this.searchFormControl.reset(null);
227
+ }
228
+ focus() {
229
+ this.elRef.nativeElement.querySelector('input').focus();
230
+ }
231
+ onOptionSelected(event) {
232
+ this.value = event.option.value;
233
+ this.filteredStrings = [];
234
+ }
235
+ onOptionActivated(event) {
236
+ this.activatedValue = event.option?.value;
237
+ }
238
+ onAutoCompleteClosed() {
239
+ if (this.activatedValue) {
240
+ this.value = this.activatedValue;
241
+ this.activatedValue = null;
242
+ }
243
+ }
244
+ reset() {
245
+ this.value = null;
246
+ }
247
+ onFocusOut() {
248
+ if (this.filteredStrings.length === 1) {
249
+ this.activatedValue = this.filteredStrings[0];
250
+ this.value = this.filteredStrings[0];
251
+ }
252
+ }
253
+ onTouched() {
254
+ this._onTouched();
255
+ this.stateChanges.next();
256
+ }
257
+ registerOnChange(fn) {
258
+ this._propagateChange = fn;
259
+ }
260
+ registerOnTouched(fn) {
261
+ this.onTouched = fn;
262
+ }
263
+ writeValue(obj) {
264
+ this.clear();
265
+ this.value = obj;
266
+ }
267
+ setDisabledState(isDisabled) {
268
+ this.disabled = isDisabled;
269
+ }
270
+ onContainerClick(event) {
271
+ if (event.target.tagName.toLowerCase() != 'input') {
272
+ this.focus();
273
+ }
274
+ }
275
+ setDescribedByIds(ids) {
276
+ this.describedBy = ids.join(' ');
277
+ }
278
+ validate(control) {
279
+ const selection = control.value;
280
+ if (typeof selection === 'string' && selection.length < 1) {
281
+ return { incorrect: true };
282
+ }
283
+ return null;
284
+ }
285
+ }
286
+ IaAutocompleteInput.nextId = 0;
287
+ IaAutocompleteInput.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: IaAutocompleteInput, deps: [{ token: i0.ElementRef }, { token: i0.Injector }, { token: i1$2.FocusMonitor }], target: i0.ɵɵFactoryTarget.Component });
288
+ IaAutocompleteInput.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.8", 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: [
289
+ {
290
+ provide: NG_VALUE_ACCESSOR,
291
+ useExisting: forwardRef(() => IaAutocompleteInput),
292
+ multi: true
293
+ },
294
+ {
295
+ provide: MatFormFieldControl,
296
+ useExisting: IaAutocompleteInput
297
+ },
298
+ {
299
+ provide: NG_VALIDATORS,
300
+ useExisting: forwardRef(() => IaAutocompleteInput),
301
+ multi: true
302
+ }
303
+ ], 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", "hideSingleSelectionIndicator"], exportAs: ["matAutocomplete"] }, { kind: "component", type: i4$1.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "directive", type: i3$1.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }, { 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", "mode", "value", "diameter", "strokeWidth"], 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"] }] });
304
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: IaAutocompleteInput, decorators: [{
305
+ type: Component,
306
+ args: [{ selector: 'ia-autocomplete', host: {
307
+ '[id]': 'id',
308
+ '[attr.aria-describedby]': 'describedBy'
309
+ }, providers: [
310
+ {
311
+ provide: NG_VALUE_ACCESSOR,
312
+ useExisting: forwardRef(() => IaAutocompleteInput),
313
+ multi: true
314
+ },
315
+ {
316
+ provide: MatFormFieldControl,
317
+ useExisting: IaAutocompleteInput
318
+ },
319
+ {
320
+ provide: NG_VALIDATORS,
321
+ useExisting: forwardRef(() => IaAutocompleteInput),
322
+ multi: true
323
+ }
324
+ ], 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"] }]
325
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Injector }, { type: i1$2.FocusMonitor }]; }, propDecorators: { id: [{
326
+ type: HostBinding
327
+ }], inputField: [{
328
+ type: ViewChild,
329
+ args: ['input']
330
+ }], describedBy: [{
331
+ type: HostBinding,
332
+ args: ['attr.aria-describedby']
333
+ }], dataSource: [{
334
+ type: Input
335
+ }], disabled: [{
336
+ type: Input
337
+ }], placeholder: [{
338
+ type: Input
339
+ }], required: [{
340
+ type: Input
341
+ }], prefix: [{
342
+ type: Input
343
+ }], shouldLabelFloat: [{
344
+ type: HostBinding,
345
+ args: ['class.floating']
332
346
  }] } });
333
347
 
334
- class IaEntitySelectInput {
335
- constructor(elRef, injector, fm) {
336
- this.elRef = elRef;
337
- this.injector = injector;
338
- this.fm = fm;
339
- this.filteredEntities = [];
340
- this.stateChanges = new Subject();
341
- this.id = `ia-entity-select-${IaEntitySelectInput.nextId++}`;
342
- this.valueChange = new EventEmitter();
343
- this.describedBy = '';
344
- this._disabled = false;
345
- this._required = false;
346
- this._propagateChange = (_) => {
347
- };
348
- this._onTouched = () => {
349
- };
350
- this.searchFormControl = new FormControl();
351
- this.isLoading = false;
352
- this._disabled = false;
353
- this.focused = false;
354
- fm.monitor(elRef.nativeElement, true).subscribe(origin => {
355
- this.focused = !!origin;
356
- this.stateChanges.next();
357
- });
358
- }
359
- get dataSource() {
360
- return this._dataSource;
361
- }
362
- set dataSource(value) {
363
- this._dataSource = value;
364
- }
365
- get disabled() {
366
- return this._disabled;
367
- }
368
- set disabled(dis) {
369
- this._disabled = coerceBooleanProperty(dis);
370
- this._disabled ? this.searchFormControl.disable() : this.searchFormControl.enable();
371
- this.stateChanges.next();
372
- }
373
- get placeholder() {
374
- return this._placeholder;
375
- }
376
- set placeholder(plh) {
377
- this._placeholder = plh;
378
- this.stateChanges.next();
379
- }
380
- get required() {
381
- return this._required;
382
- }
383
- set required(req) {
384
- this._required = coerceBooleanProperty(req);
385
- this.inputField.required = this._required;
386
- this.stateChanges.next();
387
- }
388
- get prefix() {
389
- return this._prefix;
390
- }
391
- set prefix(value) {
392
- if (value !== this._prefix) {
393
- this._prefix = value;
394
- }
395
- }
396
- get value() {
397
- return this._selectedEntity;
398
- }
399
- set value(value) {
400
- if (value !== this._selectedEntity) {
401
- this.searchFormControl.setValue(value);
402
- this.setValue(value);
403
- }
404
- }
405
- get empty() {
406
- let n = this.searchFormControl.value;
407
- return !!!n;
408
- }
409
- get shouldLabelFloat() {
410
- return this.focused || !this.empty;
411
- }
412
- ngOnInit() {
413
- this.ngControl = this.injector.get(NgControl, null);
414
- if (this.ngControl != null) {
415
- this.ngControl.valueAccessor = this;
416
- }
417
- // If prefix defined, usually this is used for a code scanner.
418
- // The goal is to select the entity in direct way.
419
- if (this._prefix) {
420
- this.searchFormControl
421
- .valueChanges
422
- .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())))
423
- .subscribe(resultSet => {
424
- if (resultSet.list.length === 1) {
425
- this.value = resultSet.list[0];
426
- }
427
- else {
428
- this.filteredEntities = resultSet.list;
429
- }
430
- this.isLoading = false;
431
- });
432
- }
433
- // This is the search functionality when search by human.
434
- this.searchFormControl
435
- .valueChanges
436
- .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)))
437
- .subscribe(resultSet => {
438
- this.filteredEntities = resultSet.list;
439
- this.isLoading = false;
440
- });
441
- }
442
- ngOnDestroy() {
443
- this.stateChanges.complete();
444
- this.fm.stopMonitoring(this.elRef.nativeElement);
445
- }
446
- ngDoCheck() {
447
- if (this.ngControl) {
448
- this.errorState = this.ngControl.invalid && this.ngControl.touched;
449
- this.stateChanges.next();
450
- }
451
- }
452
- clear() {
453
- this.filteredEntities = [];
454
- this.searchFormControl.reset(null);
455
- }
456
- focus() {
457
- this.elRef.nativeElement.querySelector('input').focus();
458
- }
459
- onEntitySelected(event) {
460
- this.value = event.option.value;
461
- this.filteredEntities = [];
462
- }
463
- onEntityActivated(event) {
464
- this.activatedValue = event.option?.value;
465
- }
466
- onEntityClosed() {
467
- if (this.activatedValue) {
468
- this.value = this.activatedValue;
469
- this.activatedValue = null;
470
- }
471
- }
472
- reset() {
473
- this.value = null;
474
- }
475
- onFocusOut() {
476
- if (this.filteredEntities.length === 1) {
477
- this.activatedValue = this.filteredEntities[0];
478
- this.value = this.filteredEntities[0];
479
- }
480
- }
481
- onTouched() {
482
- this._onTouched();
483
- this.stateChanges.next();
484
- }
485
- registerOnChange(fn) {
486
- this._propagateChange = fn;
487
- }
488
- registerOnTouched(fn) {
489
- this.onTouched = fn;
490
- }
491
- writeValue(obj) {
492
- this.clear();
493
- this.value = obj;
494
- }
495
- setDisabledState(isDisabled) {
496
- this.disabled = isDisabled;
497
- }
498
- onContainerClick(event) {
499
- if (event.target.tagName.toLowerCase() != 'input') {
500
- this.focus();
501
- }
502
- }
503
- setDescribedByIds(ids) {
504
- this.describedBy = ids.join(' ');
505
- }
506
- validate(control) {
507
- const selection = control.value;
508
- if (typeof selection === 'string') {
509
- return { incorrect: true };
510
- }
511
- return null;
512
- }
513
- setValue(value) {
514
- if (value !== this._selectedEntity) {
515
- this._selectedEntity = value;
516
- this.valueChange.emit(value);
517
- this._propagateChange(this._selectedEntity);
518
- this.stateChanges.next();
519
- }
520
- }
521
- }
522
- IaEntitySelectInput.nextId = 0;
523
- IaEntitySelectInput.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: IaEntitySelectInput, deps: [{ token: i0.ElementRef }, { token: i0.Injector }, { token: i1$2.FocusMonitor }], target: i0.ɵɵFactoryTarget.Component });
524
- IaEntitySelectInput.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.3", 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: [
525
- {
526
- provide: NG_VALUE_ACCESSOR,
527
- useExisting: forwardRef(() => IaEntitySelectInput),
528
- multi: true
529
- },
530
- {
531
- provide: MatFormFieldControl,
532
- useExisting: IaEntitySelectInput
533
- },
534
- {
535
- provide: NG_VALIDATORS,
536
- useExisting: forwardRef(() => IaEntitySelectInput),
537
- multi: true
538
- }
539
- ], viewQueries: [{ propertyName: "inputField", first: true, predicate: ["input"], descendants: true }], ngImport: i0, template: "<input #input (blur)=\"onTouched()\" (focusout)=\"onFocusOut()\" [formControl]=\"searchFormControl\" [matAutocomplete]=\"auto\"\r\n [placeholder]=\"placeholder\" matInput>\r\n<mat-autocomplete #auto=\"matAutocomplete\" (closed)=\"onEntityClosed()\"\r\n (optionActivated)=\"onEntityActivated($event)\" (optionSelected)=\"onEntitySelected($event)\"\r\n [displayWith]=\"dataSource.onDisplayEntity\">\r\n <mat-option *ngIf=\"isLoading\" class=\"is-loading\">\r\n <mat-spinner diameter=\"50\"></mat-spinner>\r\n </mat-option>\r\n <ng-container *ngIf=\"!isLoading\">\r\n <mat-option *ngFor=\"let entity of filteredEntities\" [value]=\"entity\">\r\n {{dataSource.onDisplayEntity(entity)}}\r\n </mat-option>\r\n </ng-container>\r\n</mat-autocomplete>\r\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", "hideSingleSelectionIndicator"], exportAs: ["matAutocomplete"] }, { kind: "component", type: i4$1.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "directive", type: i3$1.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }, { 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", "mode", "value", "diameter", "strokeWidth"], 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"] }] });
540
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: IaEntitySelectInput, decorators: [{
541
- type: Component,
542
- args: [{ selector: 'ia-entity-select', host: {
543
- '[id]': 'id',
544
- '[attr.aria-describedby]': 'describedBy'
545
- }, providers: [
546
- {
547
- provide: NG_VALUE_ACCESSOR,
548
- useExisting: forwardRef(() => IaEntitySelectInput),
549
- multi: true
550
- },
551
- {
552
- provide: MatFormFieldControl,
553
- useExisting: IaEntitySelectInput
554
- },
555
- {
556
- provide: NG_VALIDATORS,
557
- useExisting: forwardRef(() => IaEntitySelectInput),
558
- multi: true
559
- }
560
- ], template: "<input #input (blur)=\"onTouched()\" (focusout)=\"onFocusOut()\" [formControl]=\"searchFormControl\" [matAutocomplete]=\"auto\"\r\n [placeholder]=\"placeholder\" matInput>\r\n<mat-autocomplete #auto=\"matAutocomplete\" (closed)=\"onEntityClosed()\"\r\n (optionActivated)=\"onEntityActivated($event)\" (optionSelected)=\"onEntitySelected($event)\"\r\n [displayWith]=\"dataSource.onDisplayEntity\">\r\n <mat-option *ngIf=\"isLoading\" class=\"is-loading\">\r\n <mat-spinner diameter=\"50\"></mat-spinner>\r\n </mat-option>\r\n <ng-container *ngIf=\"!isLoading\">\r\n <mat-option *ngFor=\"let entity of filteredEntities\" [value]=\"entity\">\r\n {{dataSource.onDisplayEntity(entity)}}\r\n </mat-option>\r\n </ng-container>\r\n</mat-autocomplete>\r\n", styles: ["span{opacity:0;transition:opacity .2s}:host.floating span{opacity:1}\n"] }]
561
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Injector }, { type: i1$2.FocusMonitor }]; }, propDecorators: { id: [{
562
- type: HostBinding
563
- }], inputField: [{
564
- type: ViewChild,
565
- args: ['input']
566
- }], describedBy: [{
567
- type: HostBinding,
568
- args: ['attr.aria-describedby']
569
- }], dataSource: [{
570
- type: Input
571
- }], disabled: [{
572
- type: Input
573
- }], placeholder: [{
574
- type: Input
575
- }], required: [{
576
- type: Input
577
- }], prefix: [{
578
- type: Input
579
- }], shouldLabelFloat: [{
580
- type: HostBinding,
581
- args: ['class.floating']
348
+ class IaEntitySelectInput {
349
+ constructor(elRef, injector, fm) {
350
+ this.elRef = elRef;
351
+ this.injector = injector;
352
+ this.fm = fm;
353
+ this.filteredEntities = [];
354
+ this.stateChanges = new Subject();
355
+ this.id = `ia-entity-select-${IaEntitySelectInput.nextId++}`;
356
+ this.valueChange = new EventEmitter();
357
+ this.describedBy = '';
358
+ this._disabled = false;
359
+ this._required = false;
360
+ this._propagateChange = (_) => {
361
+ };
362
+ this._onTouched = () => {
363
+ };
364
+ this.ngControl = null;
365
+ this.errorState = false;
366
+ this.inputField = null;
367
+ this._dataSource = null;
368
+ this._placeholder = "";
369
+ this._prefix = "";
370
+ this.searchFormControl = new FormControl();
371
+ this.isLoading = false;
372
+ this._disabled = false;
373
+ this.focused = false;
374
+ fm.monitor(elRef.nativeElement, true).subscribe(origin => {
375
+ this.focused = !!origin;
376
+ this.stateChanges.next();
377
+ });
378
+ }
379
+ get dataSource() {
380
+ return this._dataSource;
381
+ }
382
+ set dataSource(value) {
383
+ this._dataSource = value;
384
+ }
385
+ get disabled() {
386
+ return this._disabled;
387
+ }
388
+ set disabled(dis) {
389
+ this._disabled = coerceBooleanProperty(dis);
390
+ this._disabled ? this.searchFormControl.disable() : this.searchFormControl.enable();
391
+ this.stateChanges.next();
392
+ }
393
+ get placeholder() {
394
+ return this._placeholder;
395
+ }
396
+ set placeholder(plh) {
397
+ this._placeholder = plh;
398
+ this.stateChanges.next();
399
+ }
400
+ get required() {
401
+ return this._required;
402
+ }
403
+ set required(req) {
404
+ this._required = coerceBooleanProperty(req);
405
+ if (this.inputField) {
406
+ this.inputField.required = this._required;
407
+ }
408
+ this.stateChanges.next();
409
+ }
410
+ get prefix() {
411
+ return this._prefix;
412
+ }
413
+ set prefix(value) {
414
+ if (value !== this._prefix) {
415
+ this._prefix = value;
416
+ }
417
+ }
418
+ get value() {
419
+ return this._selectedEntity;
420
+ }
421
+ set value(value) {
422
+ if (value !== this._selectedEntity) {
423
+ this.searchFormControl.setValue(value);
424
+ this.setValue(value);
425
+ }
426
+ }
427
+ get empty() {
428
+ let n = this.searchFormControl.value;
429
+ return !n;
430
+ }
431
+ get shouldLabelFloat() {
432
+ return this.focused || !this.empty;
433
+ }
434
+ ngOnInit() {
435
+ this.ngControl = this.injector.get(NgControl, null);
436
+ if (this.ngControl != null) {
437
+ this.ngControl.valueAccessor = this;
438
+ }
439
+ // If prefix defined, usually this is used for a code scanner.
440
+ // The goal is to select the entity in direct way.
441
+ if (this._prefix) {
442
+ this.searchFormControl
443
+ .valueChanges
444
+ .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()) ?? of(null)))
445
+ .subscribe(resultSet => {
446
+ if (resultSet && resultSet.list) {
447
+ if (resultSet.list.length === 1) {
448
+ this.value = resultSet.list[0];
449
+ }
450
+ else {
451
+ this.filteredEntities = resultSet.list;
452
+ }
453
+ }
454
+ this.isLoading = false;
455
+ });
456
+ }
457
+ // This is the search functionality when search by human.
458
+ this.searchFormControl
459
+ .valueChanges
460
+ .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) ?? of(null)))
461
+ .subscribe(resultSet => {
462
+ if (resultSet && resultSet.list) {
463
+ this.filteredEntities = resultSet.list;
464
+ }
465
+ this.isLoading = false;
466
+ });
467
+ }
468
+ ngOnDestroy() {
469
+ this.stateChanges.complete();
470
+ this.fm.stopMonitoring(this.elRef.nativeElement);
471
+ }
472
+ ngDoCheck() {
473
+ if (this.ngControl) {
474
+ this.errorState = (this.ngControl.invalid && this.ngControl.touched) ?? false;
475
+ this.stateChanges.next();
476
+ }
477
+ }
478
+ clear() {
479
+ this.filteredEntities = [];
480
+ this.searchFormControl.reset(null);
481
+ }
482
+ focus() {
483
+ this.elRef.nativeElement.querySelector('input').focus();
484
+ }
485
+ onEntitySelected(event) {
486
+ this.value = event.option.value;
487
+ this.filteredEntities = [];
488
+ }
489
+ onEntityActivated(event) {
490
+ this.activatedValue = event.option?.value;
491
+ }
492
+ onEntityClosed() {
493
+ if (this.activatedValue) {
494
+ this.value = this.activatedValue;
495
+ this.activatedValue = null;
496
+ }
497
+ }
498
+ reset() {
499
+ this.value = null;
500
+ }
501
+ onFocusOut() {
502
+ if (this.filteredEntities.length === 1) {
503
+ this.activatedValue = this.filteredEntities[0];
504
+ this.value = this.filteredEntities[0];
505
+ }
506
+ }
507
+ onTouched() {
508
+ this._onTouched();
509
+ this.stateChanges.next();
510
+ }
511
+ registerOnChange(fn) {
512
+ this._propagateChange = fn;
513
+ }
514
+ registerOnTouched(fn) {
515
+ this.onTouched = fn;
516
+ }
517
+ writeValue(obj) {
518
+ this.clear();
519
+ this.value = obj;
520
+ }
521
+ setDisabledState(isDisabled) {
522
+ this.disabled = isDisabled;
523
+ }
524
+ onContainerClick(event) {
525
+ if (event.target.tagName.toLowerCase() != 'input') {
526
+ this.focus();
527
+ }
528
+ }
529
+ setDescribedByIds(ids) {
530
+ this.describedBy = ids.join(' ');
531
+ }
532
+ validate(control) {
533
+ const selection = control.value;
534
+ if (typeof selection === 'string') {
535
+ return { incorrect: true };
536
+ }
537
+ return null;
538
+ }
539
+ setValue(value) {
540
+ if (value !== this._selectedEntity) {
541
+ this._selectedEntity = value;
542
+ this.valueChange.emit(value);
543
+ this._propagateChange(this._selectedEntity);
544
+ this.stateChanges.next();
545
+ }
546
+ }
547
+ }
548
+ IaEntitySelectInput.nextId = 0;
549
+ IaEntitySelectInput.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: IaEntitySelectInput, deps: [{ token: i0.ElementRef }, { token: i0.Injector }, { token: i1$2.FocusMonitor }], target: i0.ɵɵFactoryTarget.Component });
550
+ IaEntitySelectInput.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.8", 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: [
551
+ {
552
+ provide: NG_VALUE_ACCESSOR,
553
+ useExisting: forwardRef(() => IaEntitySelectInput),
554
+ multi: true
555
+ },
556
+ {
557
+ provide: MatFormFieldControl,
558
+ useExisting: IaEntitySelectInput
559
+ },
560
+ {
561
+ provide: NG_VALIDATORS,
562
+ useExisting: forwardRef(() => IaEntitySelectInput),
563
+ multi: true
564
+ }
565
+ ], 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 ?? null\">\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) ?? null}}\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", "hideSingleSelectionIndicator"], exportAs: ["matAutocomplete"] }, { kind: "component", type: i4$1.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "directive", type: i3$1.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }, { 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", "mode", "value", "diameter", "strokeWidth"], 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"] }] });
566
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: IaEntitySelectInput, decorators: [{
567
+ type: Component,
568
+ args: [{ selector: 'ia-entity-select', host: {
569
+ '[id]': 'id',
570
+ '[attr.aria-describedby]': 'describedBy'
571
+ }, providers: [
572
+ {
573
+ provide: NG_VALUE_ACCESSOR,
574
+ useExisting: forwardRef(() => IaEntitySelectInput),
575
+ multi: true
576
+ },
577
+ {
578
+ provide: MatFormFieldControl,
579
+ useExisting: IaEntitySelectInput
580
+ },
581
+ {
582
+ provide: NG_VALIDATORS,
583
+ useExisting: forwardRef(() => IaEntitySelectInput),
584
+ multi: true
585
+ }
586
+ ], 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 ?? null\">\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) ?? null}}\n </mat-option>\n </ng-container>\n</mat-autocomplete>\n", styles: ["span{opacity:0;transition:opacity .2s}:host.floating span{opacity:1}\n"] }]
587
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Injector }, { type: i1$2.FocusMonitor }]; }, propDecorators: { id: [{
588
+ type: HostBinding
589
+ }], inputField: [{
590
+ type: ViewChild,
591
+ args: ['input']
592
+ }], describedBy: [{
593
+ type: HostBinding,
594
+ args: ['attr.aria-describedby']
595
+ }], dataSource: [{
596
+ type: Input
597
+ }], disabled: [{
598
+ type: Input
599
+ }], placeholder: [{
600
+ type: Input
601
+ }], required: [{
602
+ type: Input
603
+ }], prefix: [{
604
+ type: Input
605
+ }], shouldLabelFloat: [{
606
+ type: HostBinding,
607
+ args: ['class.floating']
582
608
  }] } });
583
609
 
584
- class IaMultipleEntitySelectInput {
585
- constructor(elRef, injector, fm) {
586
- this.elRef = elRef;
587
- this.injector = injector;
588
- this.fm = fm;
589
- this.filteredEntities = [];
590
- this.stateChanges = new Subject();
591
- this.id = `ia-multiple-entity-select-${IaMultipleEntitySelectInput.nextId++}`;
592
- this.valuesChange = new EventEmitter();
593
- this.describedBy = '';
594
- this.separatorKeysCodes = [ENTER, COMMA];
595
- this._disabled = false;
596
- this._required = false;
597
- this._propagateChange = (_) => {
598
- };
599
- this._onTouched = () => {
600
- };
601
- this.valuesFormControl = new FormControl();
602
- this.searchFormControl = new FormControl();
603
- this.isLoading = false;
604
- this._disabled = false;
605
- this.focused = false;
606
- fm.monitor(elRef.nativeElement, true).subscribe(origin => {
607
- this.focused = !!origin;
608
- this.stateChanges.next();
609
- });
610
- }
611
- get dataSource() {
612
- return this._dataSource;
613
- }
614
- set dataSource(value) {
615
- this._dataSource = value;
616
- }
617
- get disabled() {
618
- return this._disabled;
619
- }
620
- set disabled(dis) {
621
- this._disabled = coerceBooleanProperty(dis);
622
- this._disabled ? this.searchFormControl.disable() : this.searchFormControl.enable();
623
- this.stateChanges.next();
624
- }
625
- get placeholder() {
626
- return this._placeholder;
627
- }
628
- set placeholder(plh) {
629
- this._placeholder = plh;
630
- this.stateChanges.next();
631
- }
632
- get required() {
633
- return this._required;
634
- }
635
- set required(req) {
636
- this._required = coerceBooleanProperty(req);
637
- this.inputField.required = this._required;
638
- this.stateChanges.next();
639
- }
640
- get prefix() {
641
- return this._prefix;
642
- }
643
- set prefix(value) {
644
- if (value !== this._prefix) {
645
- this._prefix = value;
646
- }
647
- }
648
- get value() {
649
- return this._selectedEntities;
650
- }
651
- set value(value) {
652
- if (value !== this._selectedEntities) {
653
- this.valuesFormControl.setValue(value);
654
- this.setValue(value);
655
- }
656
- }
657
- get empty() {
658
- let n = this.valuesFormControl.value;
659
- return !!!n;
660
- }
661
- get shouldLabelFloat() {
662
- return this.focused || !this.empty;
663
- }
664
- ngOnInit() {
665
- this.ngControl = this.injector.get(NgControl, null);
666
- if (this.ngControl != null) {
667
- this.ngControl.valueAccessor = this;
668
- }
669
- // If prefix defined, usually this is used for a code scanner.
670
- // The goal is to select the entity in direct way.
671
- if (this._prefix) {
672
- this.searchFormControl
673
- .valueChanges
674
- .pipe(debounceTime(300), filter(value => typeof value === 'string'), filter(value => value.startsWith(this._prefix)), tap(() => this.isLoading = true), switchMap(value => this._dataSource.onFilter(value.replace(this._prefix, "").trim())))
675
- .subscribe(resultSet => {
676
- this.filteredEntities = resultSet.list;
677
- this.isLoading = false;
678
- });
679
- }
680
- // This is the search functionality when search by human.
681
- this.searchFormControl
682
- .valueChanges
683
- .pipe(debounceTime(300), tap(() => this.filteredEntities = []), filter(value => typeof value === 'string'), filter(value => value.toString().length >= 3), tap(() => this.isLoading = true), switchMap(value => this._dataSource.onFilter(value)))
684
- .subscribe(resultSet => {
685
- const resultList = new Array();
686
- resultSet.list.forEach(value1 => {
687
- if (!this.value.find(value2 => this._dataSource.getIdEntity(value2) === this._dataSource.getIdEntity(value1))) {
688
- resultList.push(value1);
689
- }
690
- });
691
- this.filteredEntities = resultList;
692
- this.isLoading = false;
693
- });
694
- }
695
- ngOnDestroy() {
696
- this.stateChanges.complete();
697
- this.fm.stopMonitoring(this.elRef.nativeElement);
698
- }
699
- ngDoCheck() {
700
- if (this.ngControl) {
701
- this.errorState = this.ngControl.invalid && this.ngControl.touched;
702
- this.stateChanges.next();
703
- }
704
- }
705
- clear() {
706
- this.filteredEntities = [];
707
- this.searchFormControl.reset(null);
708
- }
709
- focus() {
710
- this.elRef.nativeElement.querySelector('input').focus();
711
- }
712
- onEntitySelected(event) {
713
- let list = this.value;
714
- if (!list) {
715
- list = new Array();
716
- }
717
- list.push(event.option.value);
718
- this.value = list;
719
- this.filteredEntities = [];
720
- this.searchFormControl.setValue(null);
721
- this.valuesFormControl.updateValueAndValidity();
722
- }
723
- onEntityActivated(event) {
724
- this.activatedValue = event.option?.value;
725
- }
726
- onEntityClosed() {
727
- if (this.activatedValue) {
728
- this.value = this.activatedValue;
729
- this.activatedValue = null;
730
- }
731
- }
732
- reset() {
733
- this.value = new Array();
734
- }
735
- onFocusOut() {
736
- // if (this.filteredEntities.length === 1) {
737
- // this.activatedValue = this.filteredEntities[0];
738
- // this.value = this.filteredEntities[0];
739
- // }
740
- }
741
- onTouched() {
742
- this._onTouched();
743
- this.stateChanges.next();
744
- }
745
- registerOnChange(fn) {
746
- this._propagateChange = fn;
747
- }
748
- registerOnTouched(fn) {
749
- this.onTouched = fn;
750
- }
751
- writeValue(obj) {
752
- this.clear();
753
- this.value = obj;
754
- }
755
- setDisabledState(isDisabled) {
756
- this.disabled = isDisabled;
757
- }
758
- onContainerClick(event) {
759
- if (event.target.tagName.toLowerCase() != 'input') {
760
- this.focus();
761
- }
762
- }
763
- setDescribedByIds(ids) {
764
- this.describedBy = ids.join(' ');
765
- }
766
- validate(control) {
767
- const selection = control.value;
768
- if (typeof selection === 'string') {
769
- return { incorrect: true };
770
- }
771
- return null;
772
- }
773
- remove(value) {
774
- const list = this.value;
775
- const index = list.indexOf(value);
776
- if (index !== -1) {
777
- list.splice(index, 1);
778
- }
779
- this.valuesFormControl.updateValueAndValidity();
780
- }
781
- setValue(values) {
782
- if (values !== this._selectedEntities) {
783
- this._selectedEntities = values;
784
- this.valuesChange.emit(values);
785
- this._propagateChange(this._selectedEntities);
786
- this.stateChanges.next();
787
- }
788
- }
789
- }
790
- IaMultipleEntitySelectInput.nextId = 0;
791
- IaMultipleEntitySelectInput.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: IaMultipleEntitySelectInput, deps: [{ token: i0.ElementRef }, { token: i0.Injector }, { token: i1$2.FocusMonitor }], target: i0.ɵɵFactoryTarget.Component });
792
- IaMultipleEntitySelectInput.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.3", type: IaMultipleEntitySelectInput, selector: "ia-multiple-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: [
793
- {
794
- provide: NG_VALUE_ACCESSOR,
795
- useExisting: forwardRef(() => IaMultipleEntitySelectInput),
796
- multi: true
797
- },
798
- {
799
- provide: MatFormFieldControl,
800
- useExisting: IaMultipleEntitySelectInput
801
- },
802
- {
803
- provide: NG_VALIDATORS,
804
- useExisting: forwardRef(() => IaMultipleEntitySelectInput),
805
- multi: true
806
- }
807
- ], viewQueries: [{ propertyName: "inputField", first: true, predicate: ["input"], descendants: true }], ngImport: i0, template: "<mat-chip-grid #list>\r\n <mat-chip-row *ngFor=\"let entity of valuesFormControl.value\"\r\n (removed)=\"remove(entity)\"\r\n [editable]=\"false\"\r\n [aria-description]=\"'press enter to edit ' + dataSource.onDisplayEntity(entity)\">\r\n {{dataSource.onDisplayEntity(entity)}}\r\n <button matChipRemove [attr.aria-label]=\"'remove ' + dataSource.onDisplayEntity(entity)\">\r\n <mat-icon>cancel</mat-icon>\r\n </button>\r\n </mat-chip-row>\r\n <input #input (blur)=\"onTouched()\" (focusout)=\"onFocusOut()\" [formControl]=\"searchFormControl\"\r\n [matAutocomplete]=\"auto\"\r\n [matChipInputFor]=\"list\"\r\n matChipInputAddOnBlur=\"true\"\r\n [matChipInputSeparatorKeyCodes]=\"separatorKeysCodes\"\r\n [placeholder]=\"placeholder\" matInput>\r\n <mat-autocomplete #auto=\"matAutocomplete\" (closed)=\"onEntityClosed()\"\r\n (optionActivated)=\"onEntityActivated($event)\" (optionSelected)=\"onEntitySelected($event)\"\r\n [displayWith]=\"dataSource.onDisplayEntity\">\r\n <mat-option *ngIf=\"isLoading\" class=\"is-loading\">\r\n <mat-spinner diameter=\"50\"></mat-spinner>\r\n </mat-option>\r\n <ng-container *ngIf=\"!isLoading\">\r\n <mat-option *ngFor=\"let entity of filteredEntities\" [value]=\"entity\">\r\n {{dataSource.onDisplayEntity(entity)}}\r\n </mat-option>\r\n </ng-container>\r\n </mat-autocomplete>\r\n</mat-chip-grid>\r\n", styles: [""], 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", "hideSingleSelectionIndicator"], exportAs: ["matAutocomplete"] }, { kind: "component", type: i4$1.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "directive", type: i3$1.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }, { 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", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "component", type: i7$1.MatChipGrid, selector: "mat-chip-grid", inputs: ["tabIndex", "disabled", "placeholder", "required", "value", "errorStateMatcher"], outputs: ["change", "valueChange"] }, { kind: "directive", type: i7$1.MatChipInput, selector: "input[matChipInputFor]", inputs: ["matChipInputFor", "matChipInputAddOnBlur", "matChipInputSeparatorKeyCodes", "placeholder", "id", "disabled"], outputs: ["matChipInputTokenEnd"], exportAs: ["matChipInput", "matChipInputFor"] }, { kind: "directive", type: i7$1.MatChipRemove, selector: "[matChipRemove]" }, { kind: "component", type: i7$1.MatChipRow, selector: "mat-chip-row, [mat-chip-row], mat-basic-chip-row, [mat-basic-chip-row]", inputs: ["color", "disabled", "disableRipple", "tabIndex", "editable"], outputs: ["edited"] }, { kind: "component", type: i8.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { 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"] }] });
808
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: IaMultipleEntitySelectInput, decorators: [{
809
- type: Component,
810
- args: [{ selector: 'ia-multiple-entity-select', host: {
811
- '[id]': 'id',
812
- '[attr.aria-describedby]': 'describedBy'
813
- }, providers: [
814
- {
815
- provide: NG_VALUE_ACCESSOR,
816
- useExisting: forwardRef(() => IaMultipleEntitySelectInput),
817
- multi: true
818
- },
819
- {
820
- provide: MatFormFieldControl,
821
- useExisting: IaMultipleEntitySelectInput
822
- },
823
- {
824
- provide: NG_VALIDATORS,
825
- useExisting: forwardRef(() => IaMultipleEntitySelectInput),
826
- multi: true
827
- }
828
- ], template: "<mat-chip-grid #list>\r\n <mat-chip-row *ngFor=\"let entity of valuesFormControl.value\"\r\n (removed)=\"remove(entity)\"\r\n [editable]=\"false\"\r\n [aria-description]=\"'press enter to edit ' + dataSource.onDisplayEntity(entity)\">\r\n {{dataSource.onDisplayEntity(entity)}}\r\n <button matChipRemove [attr.aria-label]=\"'remove ' + dataSource.onDisplayEntity(entity)\">\r\n <mat-icon>cancel</mat-icon>\r\n </button>\r\n </mat-chip-row>\r\n <input #input (blur)=\"onTouched()\" (focusout)=\"onFocusOut()\" [formControl]=\"searchFormControl\"\r\n [matAutocomplete]=\"auto\"\r\n [matChipInputFor]=\"list\"\r\n matChipInputAddOnBlur=\"true\"\r\n [matChipInputSeparatorKeyCodes]=\"separatorKeysCodes\"\r\n [placeholder]=\"placeholder\" matInput>\r\n <mat-autocomplete #auto=\"matAutocomplete\" (closed)=\"onEntityClosed()\"\r\n (optionActivated)=\"onEntityActivated($event)\" (optionSelected)=\"onEntitySelected($event)\"\r\n [displayWith]=\"dataSource.onDisplayEntity\">\r\n <mat-option *ngIf=\"isLoading\" class=\"is-loading\">\r\n <mat-spinner diameter=\"50\"></mat-spinner>\r\n </mat-option>\r\n <ng-container *ngIf=\"!isLoading\">\r\n <mat-option *ngFor=\"let entity of filteredEntities\" [value]=\"entity\">\r\n {{dataSource.onDisplayEntity(entity)}}\r\n </mat-option>\r\n </ng-container>\r\n </mat-autocomplete>\r\n</mat-chip-grid>\r\n" }]
829
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Injector }, { type: i1$2.FocusMonitor }]; }, propDecorators: { id: [{
830
- type: HostBinding
831
- }], inputField: [{
832
- type: ViewChild,
833
- args: ['input']
834
- }], describedBy: [{
835
- type: HostBinding,
836
- args: ['attr.aria-describedby']
837
- }], dataSource: [{
838
- type: Input
839
- }], disabled: [{
840
- type: Input
841
- }], placeholder: [{
842
- type: Input
843
- }], required: [{
844
- type: Input
845
- }], prefix: [{
846
- type: Input
847
- }], shouldLabelFloat: [{
848
- type: HostBinding,
849
- args: ['class.floating']
610
+ class IaMultipleEntitySelectInput {
611
+ constructor(elRef, injector, fm) {
612
+ this.elRef = elRef;
613
+ this.injector = injector;
614
+ this.fm = fm;
615
+ this.filteredEntities = [];
616
+ this.stateChanges = new Subject();
617
+ this.id = `ia-multiple-entity-select-${IaMultipleEntitySelectInput.nextId++}`;
618
+ this.valuesChange = new EventEmitter();
619
+ this.describedBy = '';
620
+ this.separatorKeysCodes = [ENTER, COMMA];
621
+ this._disabled = false;
622
+ this._required = false;
623
+ this._propagateChange = (_) => {
624
+ };
625
+ this._onTouched = () => {
626
+ };
627
+ this.ngControl = null;
628
+ this.errorState = false;
629
+ this.inputField = null;
630
+ this._dataSource = null;
631
+ this._placeholder = "";
632
+ this._prefix = "";
633
+ this._selectedEntities = null;
634
+ this.valuesFormControl = new FormControl();
635
+ this.searchFormControl = new FormControl();
636
+ this.isLoading = false;
637
+ this._disabled = false;
638
+ this.focused = false;
639
+ fm.monitor(elRef.nativeElement, true).subscribe(origin => {
640
+ this.focused = !!origin;
641
+ this.stateChanges.next();
642
+ });
643
+ }
644
+ get dataSource() {
645
+ return this._dataSource;
646
+ }
647
+ set dataSource(value) {
648
+ this._dataSource = value;
649
+ }
650
+ get disabled() {
651
+ return this._disabled;
652
+ }
653
+ set disabled(dis) {
654
+ this._disabled = coerceBooleanProperty(dis);
655
+ this._disabled ? this.searchFormControl.disable() : this.searchFormControl.enable();
656
+ this.stateChanges.next();
657
+ }
658
+ get placeholder() {
659
+ return this._placeholder;
660
+ }
661
+ set placeholder(plh) {
662
+ this._placeholder = plh;
663
+ this.stateChanges.next();
664
+ }
665
+ get required() {
666
+ return this._required;
667
+ }
668
+ set required(req) {
669
+ this._required = coerceBooleanProperty(req);
670
+ if (this.inputField) {
671
+ this.inputField.required = this._required;
672
+ }
673
+ this.stateChanges.next();
674
+ }
675
+ get prefix() {
676
+ return this._prefix;
677
+ }
678
+ set prefix(value) {
679
+ if (value !== this._prefix) {
680
+ this._prefix = value;
681
+ }
682
+ }
683
+ get value() {
684
+ return this._selectedEntities;
685
+ }
686
+ set value(value) {
687
+ if (value !== this._selectedEntities) {
688
+ this.valuesFormControl.setValue(value);
689
+ this.setValue(value);
690
+ }
691
+ }
692
+ get empty() {
693
+ let n = this.valuesFormControl.value;
694
+ return !n;
695
+ }
696
+ get shouldLabelFloat() {
697
+ return this.focused || !this.empty;
698
+ }
699
+ ngOnInit() {
700
+ this.ngControl = this.injector.get(NgControl, null);
701
+ if (this.ngControl != null) {
702
+ this.ngControl.valueAccessor = this;
703
+ }
704
+ // If prefix defined, usually this is used for a code scanner.
705
+ // The goal is to select the entity in direct way.
706
+ if (this._prefix) {
707
+ this.searchFormControl
708
+ .valueChanges
709
+ .pipe(debounceTime(300), filter(value => typeof value === 'string'), filter(value => value.startsWith(this._prefix)), tap(() => this.isLoading = true), switchMap(value => this._dataSource?.onFilter(value.replace(this._prefix, "").trim()) ?? of(null)))
710
+ .subscribe(resultSet => {
711
+ if (resultSet && resultSet.list) {
712
+ this.filteredEntities = resultSet.list;
713
+ }
714
+ this.isLoading = false;
715
+ });
716
+ }
717
+ // This is the search functionality when search by human.
718
+ this.searchFormControl
719
+ .valueChanges
720
+ .pipe(debounceTime(300), tap(() => this.filteredEntities = []), filter(value => typeof value === 'string'), filter(value => value.toString().length >= 3), tap(() => this.isLoading = true), switchMap(value => this._dataSource?.onFilter(value) ?? of(null)))
721
+ .subscribe(resultSet => {
722
+ const resultList = new Array();
723
+ if (resultSet && resultSet.list) {
724
+ resultSet.list.forEach(value1 => {
725
+ if (!this.value?.find(value2 => this._dataSource?.getIdEntity(value2) === this._dataSource?.getIdEntity(value1))) {
726
+ resultList.push(value1);
727
+ }
728
+ });
729
+ }
730
+ this.filteredEntities = resultList;
731
+ this.isLoading = false;
732
+ });
733
+ }
734
+ ngOnDestroy() {
735
+ this.stateChanges.complete();
736
+ this.fm.stopMonitoring(this.elRef.nativeElement);
737
+ }
738
+ ngDoCheck() {
739
+ if (this.ngControl) {
740
+ this.errorState = (this.ngControl.invalid && this.ngControl.touched) ?? false;
741
+ this.stateChanges.next();
742
+ }
743
+ }
744
+ clear() {
745
+ this.filteredEntities = [];
746
+ this.searchFormControl.reset(null);
747
+ }
748
+ focus() {
749
+ this.elRef.nativeElement.querySelector('input').focus();
750
+ }
751
+ onEntitySelected(event) {
752
+ let list = this.value;
753
+ if (!list) {
754
+ list = new Array();
755
+ }
756
+ list.push(event.option.value);
757
+ this.value = list;
758
+ this.filteredEntities = [];
759
+ this.searchFormControl.setValue(null);
760
+ this.valuesFormControl.updateValueAndValidity();
761
+ }
762
+ onEntityActivated(event) {
763
+ this.activatedValue = event.option?.value;
764
+ }
765
+ onEntityClosed() {
766
+ if (this.activatedValue) {
767
+ this.value = this.activatedValue;
768
+ this.activatedValue = null;
769
+ }
770
+ }
771
+ reset() {
772
+ this.value = new Array();
773
+ }
774
+ onFocusOut() {
775
+ // if (this.filteredEntities.length === 1) {
776
+ // this.activatedValue = this.filteredEntities[0];
777
+ // this.value = this.filteredEntities[0];
778
+ // }
779
+ }
780
+ onTouched() {
781
+ this._onTouched();
782
+ this.stateChanges.next();
783
+ }
784
+ registerOnChange(fn) {
785
+ this._propagateChange = fn;
786
+ }
787
+ registerOnTouched(fn) {
788
+ this.onTouched = fn;
789
+ }
790
+ writeValue(obj) {
791
+ this.clear();
792
+ this.value = obj;
793
+ }
794
+ setDisabledState(isDisabled) {
795
+ this.disabled = isDisabled;
796
+ }
797
+ onContainerClick(event) {
798
+ if (event.target.tagName.toLowerCase() != 'input') {
799
+ this.focus();
800
+ }
801
+ }
802
+ setDescribedByIds(ids) {
803
+ this.describedBy = ids.join(' ');
804
+ }
805
+ validate(control) {
806
+ const selection = control.value;
807
+ if (typeof selection === 'string') {
808
+ return { incorrect: true };
809
+ }
810
+ return null;
811
+ }
812
+ remove(value) {
813
+ const list = this.value;
814
+ if (list) {
815
+ const index = list.indexOf(value);
816
+ if (index !== -1) {
817
+ list.splice(index, 1);
818
+ }
819
+ this.valuesFormControl.updateValueAndValidity();
820
+ }
821
+ }
822
+ setValue(values) {
823
+ if (values !== this._selectedEntities) {
824
+ this._selectedEntities = values;
825
+ this.valuesChange.emit(values ?? []);
826
+ this._propagateChange(this._selectedEntities ?? []);
827
+ this.stateChanges.next();
828
+ }
829
+ }
830
+ }
831
+ IaMultipleEntitySelectInput.nextId = 0;
832
+ IaMultipleEntitySelectInput.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: IaMultipleEntitySelectInput, deps: [{ token: i0.ElementRef }, { token: i0.Injector }, { token: i1$2.FocusMonitor }], target: i0.ɵɵFactoryTarget.Component });
833
+ IaMultipleEntitySelectInput.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.8", type: IaMultipleEntitySelectInput, selector: "ia-multiple-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: [
834
+ {
835
+ provide: NG_VALUE_ACCESSOR,
836
+ useExisting: forwardRef(() => IaMultipleEntitySelectInput),
837
+ multi: true
838
+ },
839
+ {
840
+ provide: MatFormFieldControl,
841
+ useExisting: IaMultipleEntitySelectInput
842
+ },
843
+ {
844
+ provide: NG_VALIDATORS,
845
+ useExisting: forwardRef(() => IaMultipleEntitySelectInput),
846
+ multi: true
847
+ }
848
+ ], viewQueries: [{ propertyName: "inputField", first: true, predicate: ["input"], descendants: true }], ngImport: i0, template: "<mat-chip-grid #list>\n <mat-chip-row *ngFor=\"let entity of valuesFormControl.value\"\n (removed)=\"remove(entity)\"\n [editable]=\"false\"\n [aria-description]=\"'press enter to edit ' + dataSource?.onDisplayEntity(entity) ?? null\">\n {{dataSource?.onDisplayEntity(entity) ?? null}}\n <button matChipRemove [attr.aria-label]=\"'remove ' + dataSource?.onDisplayEntity(entity) ?? null\">\n <mat-icon>cancel</mat-icon>\n </button>\n </mat-chip-row>\n <input #input (blur)=\"onTouched()\" (focusout)=\"onFocusOut()\" [formControl]=\"searchFormControl\"\n [matAutocomplete]=\"auto\"\n [matChipInputFor]=\"list\"\n matChipInputAddOnBlur=\"true\"\n [matChipInputSeparatorKeyCodes]=\"separatorKeysCodes\"\n [placeholder]=\"placeholder\" matInput>\n <mat-autocomplete #auto=\"matAutocomplete\" (closed)=\"onEntityClosed()\"\n (optionActivated)=\"onEntityActivated($event)\" (optionSelected)=\"onEntitySelected($event)\"\n [displayWith]=\"dataSource?.onDisplayEntity ?? null\">\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) ?? null}}\n </mat-option>\n </ng-container>\n </mat-autocomplete>\n</mat-chip-grid>\n", styles: [""], 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", "hideSingleSelectionIndicator"], exportAs: ["matAutocomplete"] }, { kind: "component", type: i4$1.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "directive", type: i3$1.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }, { 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", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "component", type: i7$1.MatChipGrid, selector: "mat-chip-grid", inputs: ["tabIndex", "disabled", "placeholder", "required", "value", "errorStateMatcher"], outputs: ["change", "valueChange"] }, { kind: "directive", type: i7$1.MatChipInput, selector: "input[matChipInputFor]", inputs: ["matChipInputFor", "matChipInputAddOnBlur", "matChipInputSeparatorKeyCodes", "placeholder", "id", "disabled"], outputs: ["matChipInputTokenEnd"], exportAs: ["matChipInput", "matChipInputFor"] }, { kind: "directive", type: i7$1.MatChipRemove, selector: "[matChipRemove]" }, { kind: "component", type: i7$1.MatChipRow, selector: "mat-chip-row, [mat-chip-row], mat-basic-chip-row, [mat-basic-chip-row]", inputs: ["color", "disabled", "disableRipple", "tabIndex", "editable"], outputs: ["edited"] }, { kind: "component", type: i8.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { 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"] }] });
849
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: IaMultipleEntitySelectInput, decorators: [{
850
+ type: Component,
851
+ args: [{ selector: 'ia-multiple-entity-select', host: {
852
+ '[id]': 'id',
853
+ '[attr.aria-describedby]': 'describedBy'
854
+ }, providers: [
855
+ {
856
+ provide: NG_VALUE_ACCESSOR,
857
+ useExisting: forwardRef(() => IaMultipleEntitySelectInput),
858
+ multi: true
859
+ },
860
+ {
861
+ provide: MatFormFieldControl,
862
+ useExisting: IaMultipleEntitySelectInput
863
+ },
864
+ {
865
+ provide: NG_VALIDATORS,
866
+ useExisting: forwardRef(() => IaMultipleEntitySelectInput),
867
+ multi: true
868
+ }
869
+ ], template: "<mat-chip-grid #list>\n <mat-chip-row *ngFor=\"let entity of valuesFormControl.value\"\n (removed)=\"remove(entity)\"\n [editable]=\"false\"\n [aria-description]=\"'press enter to edit ' + dataSource?.onDisplayEntity(entity) ?? null\">\n {{dataSource?.onDisplayEntity(entity) ?? null}}\n <button matChipRemove [attr.aria-label]=\"'remove ' + dataSource?.onDisplayEntity(entity) ?? null\">\n <mat-icon>cancel</mat-icon>\n </button>\n </mat-chip-row>\n <input #input (blur)=\"onTouched()\" (focusout)=\"onFocusOut()\" [formControl]=\"searchFormControl\"\n [matAutocomplete]=\"auto\"\n [matChipInputFor]=\"list\"\n matChipInputAddOnBlur=\"true\"\n [matChipInputSeparatorKeyCodes]=\"separatorKeysCodes\"\n [placeholder]=\"placeholder\" matInput>\n <mat-autocomplete #auto=\"matAutocomplete\" (closed)=\"onEntityClosed()\"\n (optionActivated)=\"onEntityActivated($event)\" (optionSelected)=\"onEntitySelected($event)\"\n [displayWith]=\"dataSource?.onDisplayEntity ?? null\">\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) ?? null}}\n </mat-option>\n </ng-container>\n </mat-autocomplete>\n</mat-chip-grid>\n" }]
870
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Injector }, { type: i1$2.FocusMonitor }]; }, propDecorators: { id: [{
871
+ type: HostBinding
872
+ }], inputField: [{
873
+ type: ViewChild,
874
+ args: ['input']
875
+ }], describedBy: [{
876
+ type: HostBinding,
877
+ args: ['attr.aria-describedby']
878
+ }], dataSource: [{
879
+ type: Input
880
+ }], disabled: [{
881
+ type: Input
882
+ }], placeholder: [{
883
+ type: Input
884
+ }], required: [{
885
+ type: Input
886
+ }], prefix: [{
887
+ type: Input
888
+ }], shouldLabelFloat: [{
889
+ type: HostBinding,
890
+ args: ['class.floating']
850
891
  }] } });
851
892
 
852
- class IaSharedUIModule {
853
- }
854
- IaSharedUIModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: IaSharedUIModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
855
- IaSharedUIModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.3", ngImport: i0, type: IaSharedUIModule, declarations: [IaNotificationBarComponent,
856
- MessageDetailsComponent,
857
- IaAutocompleteInput,
858
- IaEntitySelectInput,
859
- IaMultipleEntitySelectInput], imports: [CommonModule,
860
- MatToolbarModule,
861
- MatButtonModule,
862
- MatSnackBarModule,
863
- MatDialogModule,
864
- MatAutocompleteModule,
865
- MatInputModule,
866
- MatProgressSpinnerModule,
867
- MatChipsModule,
868
- MatIconModule,
869
- ReactiveFormsModule], exports: [IaNotificationBarComponent,
870
- IaAutocompleteInput,
871
- IaEntitySelectInput,
872
- IaMultipleEntitySelectInput] });
873
- IaSharedUIModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: IaSharedUIModule, imports: [CommonModule,
874
- MatToolbarModule,
875
- MatButtonModule,
876
- MatSnackBarModule,
877
- MatDialogModule,
878
- MatAutocompleteModule,
879
- MatInputModule,
880
- MatProgressSpinnerModule,
881
- MatChipsModule,
882
- MatIconModule,
883
- ReactiveFormsModule] });
884
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: IaSharedUIModule, decorators: [{
885
- type: NgModule,
886
- args: [{
887
- declarations: [
888
- IaNotificationBarComponent,
889
- MessageDetailsComponent,
890
- IaAutocompleteInput,
891
- IaEntitySelectInput,
892
- IaMultipleEntitySelectInput
893
- ],
894
- exports: [
895
- IaNotificationBarComponent,
896
- IaAutocompleteInput,
897
- IaEntitySelectInput,
898
- IaMultipleEntitySelectInput
899
- ],
900
- entryComponents: [
901
- MessageDetailsComponent,
902
- IaAutocompleteInput,
903
- IaEntitySelectInput,
904
- IaMultipleEntitySelectInput
905
- ],
906
- imports: [
907
- CommonModule,
908
- MatToolbarModule,
909
- MatButtonModule,
910
- MatSnackBarModule,
911
- MatDialogModule,
912
- MatAutocompleteModule,
913
- MatInputModule,
914
- MatProgressSpinnerModule,
915
- MatChipsModule,
916
- MatIconModule,
917
- ReactiveFormsModule
918
- ]
919
- }]
893
+ class IaSharedUIModule {
894
+ }
895
+ IaSharedUIModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: IaSharedUIModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
896
+ IaSharedUIModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: IaSharedUIModule, declarations: [IaNotificationBarComponent,
897
+ MessageDetailsComponent,
898
+ IaAutocompleteInput,
899
+ IaEntitySelectInput,
900
+ IaMultipleEntitySelectInput], imports: [CommonModule,
901
+ MatToolbarModule,
902
+ MatButtonModule,
903
+ MatSnackBarModule,
904
+ MatDialogModule,
905
+ MatAutocompleteModule,
906
+ MatInputModule,
907
+ MatProgressSpinnerModule,
908
+ MatChipsModule,
909
+ MatIconModule,
910
+ ReactiveFormsModule], exports: [IaNotificationBarComponent,
911
+ IaAutocompleteInput,
912
+ IaEntitySelectInput,
913
+ IaMultipleEntitySelectInput] });
914
+ IaSharedUIModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: IaSharedUIModule, imports: [CommonModule,
915
+ MatToolbarModule,
916
+ MatButtonModule,
917
+ MatSnackBarModule,
918
+ MatDialogModule,
919
+ MatAutocompleteModule,
920
+ MatInputModule,
921
+ MatProgressSpinnerModule,
922
+ MatChipsModule,
923
+ MatIconModule,
924
+ ReactiveFormsModule] });
925
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: IaSharedUIModule, decorators: [{
926
+ type: NgModule,
927
+ args: [{
928
+ declarations: [
929
+ IaNotificationBarComponent,
930
+ MessageDetailsComponent,
931
+ IaAutocompleteInput,
932
+ IaEntitySelectInput,
933
+ IaMultipleEntitySelectInput
934
+ ],
935
+ exports: [
936
+ IaNotificationBarComponent,
937
+ IaAutocompleteInput,
938
+ IaEntitySelectInput,
939
+ IaMultipleEntitySelectInput
940
+ ],
941
+ entryComponents: [
942
+ MessageDetailsComponent,
943
+ IaAutocompleteInput,
944
+ IaEntitySelectInput,
945
+ IaMultipleEntitySelectInput
946
+ ],
947
+ imports: [
948
+ CommonModule,
949
+ MatToolbarModule,
950
+ MatButtonModule,
951
+ MatSnackBarModule,
952
+ MatDialogModule,
953
+ MatAutocompleteModule,
954
+ MatInputModule,
955
+ MatProgressSpinnerModule,
956
+ MatChipsModule,
957
+ MatIconModule,
958
+ ReactiveFormsModule
959
+ ]
960
+ }]
920
961
  }] });
921
962
 
922
- class ProgressWindowComponent {
923
- constructor(data) {
924
- this.data = data;
925
- this.statusText = null;
926
- data.progress.subscribe(value => {
927
- this.statusText = value.statusText;
928
- this.progressValue = value.progressValue;
929
- });
930
- }
931
- ngOnInit() {
932
- }
933
- onCancelClick() {
934
- this.data.cancelOperation();
935
- }
936
- }
937
- ProgressWindowComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: ProgressWindowComponent, deps: [{ token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component });
938
- ProgressWindowComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.3", type: ProgressWindowComponent, selector: "lib-progress-window", ngImport: i0, template: "<h1 mat-dialog-title>{{data.title}}</h1>\r\n<div mat-dialog-content>\r\n <div fxLayout=\"column\">\r\n <mat-progress-bar *ngIf=\"data.isDeterminate\" [value]=\"progressValue\" mode=\"determinate\"></mat-progress-bar>\r\n <mat-progress-bar *ngIf=\"!data.isDeterminate\" mode=\"indeterminate\"></mat-progress-bar>\r\n <p>{{statusText}}</p>\r\n </div>\r\n</div>\r\n<div fxLayoutAlign=\"end\" mat-dialog-actions>\r\n <button (click)=\"onCancelClick()\" *ngIf=\"data.isCancelOperationAvailable\" mat-button>Cancel</button>\r\n</div>\r\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-flat-button], button[mat-stroked-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"] }] });
939
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: ProgressWindowComponent, decorators: [{
940
- type: Component,
941
- args: [{ selector: 'lib-progress-window', template: "<h1 mat-dialog-title>{{data.title}}</h1>\r\n<div mat-dialog-content>\r\n <div fxLayout=\"column\">\r\n <mat-progress-bar *ngIf=\"data.isDeterminate\" [value]=\"progressValue\" mode=\"determinate\"></mat-progress-bar>\r\n <mat-progress-bar *ngIf=\"!data.isDeterminate\" mode=\"indeterminate\"></mat-progress-bar>\r\n <p>{{statusText}}</p>\r\n </div>\r\n</div>\r\n<div fxLayoutAlign=\"end\" mat-dialog-actions>\r\n <button (click)=\"onCancelClick()\" *ngIf=\"data.isCancelOperationAvailable\" mat-button>Cancel</button>\r\n</div>\r\n" }]
942
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
943
- type: Inject,
944
- args: [MAT_DIALOG_DATA]
963
+ class ProgressWindowComponent {
964
+ constructor(data) {
965
+ this.data = data;
966
+ this.statusText = null;
967
+ this.progressValue = 0;
968
+ data.progress.subscribe(value => {
969
+ this.statusText = value.statusText;
970
+ this.progressValue = value.progressValue;
971
+ });
972
+ }
973
+ ngOnInit() {
974
+ }
975
+ onCancelClick() {
976
+ this.data.cancelOperation();
977
+ }
978
+ }
979
+ ProgressWindowComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ProgressWindowComponent, deps: [{ token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component });
980
+ ProgressWindowComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.8", 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-flat-button], button[mat-stroked-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"] }] });
981
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ProgressWindowComponent, decorators: [{
982
+ type: Component,
983
+ 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" }]
984
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
985
+ type: Inject,
986
+ args: [MAT_DIALOG_DATA]
945
987
  }] }]; } });
946
988
 
947
- class ProgressNotifierService {
948
- constructor(dialog) {
949
- this.dialog = dialog;
950
- this._currentProgressValue = new BehaviorSubject(null);
951
- this.isCanceled = false;
952
- }
953
- get isCanceled() {
954
- return this._isCanceled;
955
- }
956
- set isCanceled(value) {
957
- this._isCanceled = value;
958
- }
959
- start(title, isDeterminate, isCancelOperationAvailable) {
960
- this.isCanceled = false;
961
- this.reportProgressDeterminate(0, 100, "Working...");
962
- this.currentDialogRef = this.dialog.open(ProgressWindowComponent, {
963
- width: '50vw',
964
- maxWidth: '50vw',
965
- data: {
966
- title: title,
967
- isDeterminate: isDeterminate,
968
- progress: this._currentProgressValue.asObservable(),
969
- isCancelOperationAvailable: isCancelOperationAvailable,
970
- cancelOperation: () => {
971
- this.reportProgressIndeterminate("Canceling operation...");
972
- this.isCanceled = true;
973
- }
974
- }
975
- });
976
- }
977
- reportProgressDeterminate(progressCurrent, progressMax, statusText) {
978
- const progressPercentage = (progressMax / 100) * progressCurrent;
979
- this._currentProgressValue.next({
980
- statusText: statusText,
981
- progressValue: progressPercentage
982
- });
983
- }
984
- reportProgressIndeterminate(statusText) {
985
- this._currentProgressValue.next({
986
- statusText: statusText,
987
- progressValue: 0
988
- });
989
- }
990
- complete() {
991
- this.currentDialogRef.close();
992
- }
993
- }
994
- ProgressNotifierService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: ProgressNotifierService, deps: [{ token: i1.MatDialog }], target: i0.ɵɵFactoryTarget.Injectable });
995
- ProgressNotifierService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: ProgressNotifierService });
996
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: ProgressNotifierService, decorators: [{
997
- type: Injectable
989
+ class ProgressNotifierService {
990
+ constructor(dialog) {
991
+ this.dialog = dialog;
992
+ this._currentProgressValue = new BehaviorSubject(null);
993
+ this.currentDialogRef = null;
994
+ this._isCanceled = false;
995
+ }
996
+ get isCanceled() {
997
+ return this._isCanceled;
998
+ }
999
+ set isCanceled(value) {
1000
+ this._isCanceled = value;
1001
+ }
1002
+ start(title, isDeterminate, isCancelOperationAvailable) {
1003
+ this.isCanceled = false;
1004
+ this.reportProgressDeterminate(0, 100, "Working...");
1005
+ this.currentDialogRef = this.dialog.open(ProgressWindowComponent, {
1006
+ width: '50vw',
1007
+ maxWidth: '50vw',
1008
+ data: {
1009
+ title: title,
1010
+ isDeterminate: isDeterminate,
1011
+ progress: this._currentProgressValue.asObservable(),
1012
+ isCancelOperationAvailable: isCancelOperationAvailable,
1013
+ cancelOperation: () => {
1014
+ this.reportProgressIndeterminate("Canceling operation...");
1015
+ this.isCanceled = true;
1016
+ }
1017
+ }
1018
+ });
1019
+ }
1020
+ reportProgressDeterminate(progressCurrent, progressMax, statusText) {
1021
+ const progressPercentage = (progressMax / 100) * progressCurrent;
1022
+ this._currentProgressValue.next({
1023
+ statusText: statusText,
1024
+ progressValue: progressPercentage
1025
+ });
1026
+ }
1027
+ reportProgressIndeterminate(statusText) {
1028
+ this._currentProgressValue.next({
1029
+ statusText: statusText,
1030
+ progressValue: 0
1031
+ });
1032
+ }
1033
+ complete() {
1034
+ this.currentDialogRef?.close();
1035
+ }
1036
+ }
1037
+ ProgressNotifierService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ProgressNotifierService, deps: [{ token: i1.MatDialog }], target: i0.ɵɵFactoryTarget.Injectable });
1038
+ ProgressNotifierService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ProgressNotifierService });
1039
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ProgressNotifierService, decorators: [{
1040
+ type: Injectable
998
1041
  }], ctorParameters: function () { return [{ type: i1.MatDialog }]; } });
999
1042
 
1000
- class ProgressNotifierModule {
1001
- static forRoot() {
1002
- return {
1003
- ngModule: ProgressNotifierModule,
1004
- providers: [
1005
- ProgressNotifierService
1006
- ]
1007
- };
1008
- }
1009
- }
1010
- ProgressNotifierModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: ProgressNotifierModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1011
- ProgressNotifierModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.3", ngImport: i0, type: ProgressNotifierModule, declarations: [ProgressWindowComponent], imports: [CommonModule,
1012
- MatDialogModule,
1013
- FlexLayoutModule,
1014
- MatButtonModule,
1015
- MatProgressBarModule] });
1016
- ProgressNotifierModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: ProgressNotifierModule, imports: [CommonModule,
1017
- MatDialogModule,
1018
- FlexLayoutModule,
1019
- MatButtonModule,
1020
- MatProgressBarModule] });
1021
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: ProgressNotifierModule, decorators: [{
1022
- type: NgModule,
1023
- args: [{
1024
- declarations: [ProgressWindowComponent],
1025
- imports: [
1026
- CommonModule,
1027
- MatDialogModule,
1028
- FlexLayoutModule,
1029
- MatButtonModule,
1030
- MatProgressBarModule
1031
- ]
1032
- }]
1043
+ class ProgressNotifierModule {
1044
+ static forRoot() {
1045
+ return {
1046
+ ngModule: ProgressNotifierModule,
1047
+ providers: [
1048
+ ProgressNotifierService
1049
+ ]
1050
+ };
1051
+ }
1052
+ }
1053
+ ProgressNotifierModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ProgressNotifierModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1054
+ ProgressNotifierModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: ProgressNotifierModule, declarations: [ProgressWindowComponent], imports: [CommonModule,
1055
+ MatDialogModule,
1056
+ FlexLayoutModule,
1057
+ MatButtonModule,
1058
+ MatProgressBarModule] });
1059
+ ProgressNotifierModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ProgressNotifierModule, imports: [CommonModule,
1060
+ MatDialogModule,
1061
+ FlexLayoutModule,
1062
+ MatButtonModule,
1063
+ MatProgressBarModule] });
1064
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ProgressNotifierModule, decorators: [{
1065
+ type: NgModule,
1066
+ args: [{
1067
+ declarations: [ProgressWindowComponent],
1068
+ imports: [
1069
+ CommonModule,
1070
+ MatDialogModule,
1071
+ FlexLayoutModule,
1072
+ MatButtonModule,
1073
+ MatProgressBarModule
1074
+ ]
1075
+ }]
1033
1076
  }] });
1034
1077
 
1035
- var ButtonTypes;
1036
- (function (ButtonTypes) {
1037
- ButtonTypes[ButtonTypes["Ok"] = 0] = "Ok";
1038
- ButtonTypes[ButtonTypes["Cancel"] = 1] = "Cancel";
1039
- ButtonTypes[ButtonTypes["Yes"] = 2] = "Yes";
1040
- ButtonTypes[ButtonTypes["No"] = 3] = "No";
1041
- })(ButtonTypes || (ButtonTypes = {}));
1042
- var DialogType;
1043
- (function (DialogType) {
1044
- DialogType[DialogType["YesNo"] = 0] = "YesNo";
1045
- DialogType[DialogType["YesNoCancel"] = 1] = "YesNoCancel";
1046
- DialogType[DialogType["OkCancel"] = 2] = "OkCancel";
1047
- DialogType[DialogType["Ok"] = 3] = "Ok";
1078
+ var ButtonTypes;
1079
+ (function (ButtonTypes) {
1080
+ ButtonTypes[ButtonTypes["Ok"] = 0] = "Ok";
1081
+ ButtonTypes[ButtonTypes["Cancel"] = 1] = "Cancel";
1082
+ ButtonTypes[ButtonTypes["Yes"] = 2] = "Yes";
1083
+ ButtonTypes[ButtonTypes["No"] = 3] = "No";
1084
+ })(ButtonTypes || (ButtonTypes = {}));
1085
+ var DialogType;
1086
+ (function (DialogType) {
1087
+ DialogType[DialogType["YesNo"] = 0] = "YesNo";
1088
+ DialogType[DialogType["YesNoCancel"] = 1] = "YesNoCancel";
1089
+ DialogType[DialogType["OkCancel"] = 2] = "OkCancel";
1090
+ DialogType[DialogType["Ok"] = 3] = "Ok";
1048
1091
  })(DialogType || (DialogType = {}));
1049
1092
 
1050
- class ConfirmationWindowComponent {
1051
- constructor(dialogRef, data) {
1052
- this.dialogRef = dialogRef;
1053
- this.data = data;
1054
- if (data.dialogType === DialogType.OkCancel) {
1055
- this.button1Text = "OK";
1056
- this.button1Result = ButtonTypes.Ok;
1057
- this.button2Text = "Cancel";
1058
- this.button2Result = ButtonTypes.Cancel;
1059
- }
1060
- else if (data.dialogType === DialogType.YesNoCancel) {
1061
- this.button1Text = "Yes";
1062
- this.button1Result = ButtonTypes.Yes;
1063
- this.button2Text = "No";
1064
- this.button2Result = ButtonTypes.No;
1065
- this.button3Text = "Cancel";
1066
- this.button3Result = ButtonTypes.Cancel;
1067
- }
1068
- else if (data.dialogType === DialogType.Ok) {
1069
- this.button1Text = "OK";
1070
- this.button1Result = ButtonTypes.Ok;
1071
- }
1072
- else {
1073
- this.button1Text = "Yes";
1074
- this.button1Result = ButtonTypes.Yes;
1075
- this.button2Text = "No";
1076
- this.button2Result = ButtonTypes.No;
1077
- }
1078
- }
1079
- ngOnInit() {
1080
- }
1081
- onButton1() {
1082
- this.dialogRef.close({
1083
- result: this.button1Result
1084
- });
1085
- }
1086
- onButton2() {
1087
- this.dialogRef.close({
1088
- result: this.button2Result
1089
- });
1090
- }
1091
- onButton3() {
1092
- this.dialogRef.close({
1093
- result: this.button3Result
1094
- });
1095
- }
1096
- }
1097
- ConfirmationWindowComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: ConfirmationWindowComponent, deps: [{ token: i1.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component });
1098
- ConfirmationWindowComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.3", type: ConfirmationWindowComponent, selector: "lib-shared-ui-confirmation-window", ngImport: i0, template: "<h1 mat-dialog-title>{{data.title}}</h1>\r\n<div mat-dialog-content>{{data.message}}</div>\r\n<div fxLayoutAlign=\"end\" mat-dialog-actions>\r\n <button (click)=\"onButton1()\" color=\"primary\" mat-button>{{button1Text}}</button>\r\n <button (click)=\"onButton2()\" *ngIf=\"button2Text\" mat-button>{{button2Text}}</button>\r\n <button (click)=\"onButton3()\" *ngIf=\"button3Text\" mat-button>{{button3Text}}</button>\r\n</div>\r\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-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }] });
1099
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: ConfirmationWindowComponent, decorators: [{
1100
- type: Component,
1101
- args: [{ selector: 'lib-shared-ui-confirmation-window', template: "<h1 mat-dialog-title>{{data.title}}</h1>\r\n<div mat-dialog-content>{{data.message}}</div>\r\n<div fxLayoutAlign=\"end\" mat-dialog-actions>\r\n <button (click)=\"onButton1()\" color=\"primary\" mat-button>{{button1Text}}</button>\r\n <button (click)=\"onButton2()\" *ngIf=\"button2Text\" mat-button>{{button2Text}}</button>\r\n <button (click)=\"onButton3()\" *ngIf=\"button3Text\" mat-button>{{button3Text}}</button>\r\n</div>\r\n" }]
1102
- }], ctorParameters: function () { return [{ type: i1.MatDialogRef }, { type: undefined, decorators: [{
1103
- type: Inject,
1104
- args: [MAT_DIALOG_DATA]
1093
+ class ConfirmationWindowComponent {
1094
+ constructor(dialogRef, data) {
1095
+ this.dialogRef = dialogRef;
1096
+ this.data = data;
1097
+ this.button2Text = null;
1098
+ this.button2Result = null;
1099
+ this.button3Text = null;
1100
+ this.button3Result = null;
1101
+ if (data.dialogType === DialogType.OkCancel) {
1102
+ this.button1Text = "OK";
1103
+ this.button1Result = ButtonTypes.Ok;
1104
+ this.button2Text = "Cancel";
1105
+ this.button2Result = ButtonTypes.Cancel;
1106
+ }
1107
+ else if (data.dialogType === DialogType.YesNoCancel) {
1108
+ this.button1Text = "Yes";
1109
+ this.button1Result = ButtonTypes.Yes;
1110
+ this.button2Text = "No";
1111
+ this.button2Result = ButtonTypes.No;
1112
+ this.button3Text = "Cancel";
1113
+ this.button3Result = ButtonTypes.Cancel;
1114
+ }
1115
+ else if (data.dialogType === DialogType.Ok) {
1116
+ this.button1Text = "OK";
1117
+ this.button1Result = ButtonTypes.Ok;
1118
+ }
1119
+ else {
1120
+ this.button1Text = "Yes";
1121
+ this.button1Result = ButtonTypes.Yes;
1122
+ this.button2Text = "No";
1123
+ this.button2Result = ButtonTypes.No;
1124
+ }
1125
+ }
1126
+ ngOnInit() {
1127
+ }
1128
+ onButton1() {
1129
+ this.dialogRef.close({
1130
+ result: this.button1Result
1131
+ });
1132
+ }
1133
+ onButton2() {
1134
+ this.dialogRef.close({
1135
+ result: this.button2Result
1136
+ });
1137
+ }
1138
+ onButton3() {
1139
+ this.dialogRef.close({
1140
+ result: this.button3Result
1141
+ });
1142
+ }
1143
+ }
1144
+ ConfirmationWindowComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfirmationWindowComponent, deps: [{ token: i1.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component });
1145
+ ConfirmationWindowComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.8", 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-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }] });
1146
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfirmationWindowComponent, decorators: [{
1147
+ type: Component,
1148
+ 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" }]
1149
+ }], ctorParameters: function () { return [{ type: i1.MatDialogRef }, { type: undefined, decorators: [{
1150
+ type: Inject,
1151
+ args: [MAT_DIALOG_DATA]
1105
1152
  }] }]; } });
1106
1153
 
1107
- class ConfirmationService {
1108
- constructor(dialog) {
1109
- this.dialog = dialog;
1110
- }
1111
- showYesNoConfirmationDialog(title, message) {
1112
- const dialogRef = this.dialog.open(ConfirmationWindowComponent, {
1113
- width: '50vw',
1114
- maxWidth: '50vw',
1115
- data: {
1116
- title: title,
1117
- message: message,
1118
- dialogType: DialogType.YesNo
1119
- }
1120
- });
1121
- return dialogRef.afterClosed().pipe(map(value => value.result == ButtonTypes.Yes));
1122
- }
1123
- showYesNoCancelConfirmationDialog(title, message) {
1124
- const dialogRef = this.dialog.open(ConfirmationWindowComponent, {
1125
- width: '50vw',
1126
- maxWidth: '50vw',
1127
- data: {
1128
- title: title,
1129
- message: message,
1130
- dialogType: DialogType.YesNoCancel
1131
- }
1132
- });
1133
- return dialogRef.afterClosed();
1134
- }
1135
- showOkCancelConfirmationDialog(title, message) {
1136
- const dialogRef = this.dialog.open(ConfirmationWindowComponent, {
1137
- width: '50vw',
1138
- maxWidth: '50vw',
1139
- data: {
1140
- title: title,
1141
- message: message,
1142
- dialogType: DialogType.OkCancel
1143
- }
1144
- });
1145
- return dialogRef.afterClosed().pipe(map(value => value.result == ButtonTypes.Ok));
1146
- }
1147
- showOkDialog(title, message) {
1148
- const dialogRef = this.dialog.open(ConfirmationWindowComponent, {
1149
- width: '50vw',
1150
- maxWidth: '50vw',
1151
- data: {
1152
- title: title,
1153
- message: message,
1154
- dialogType: DialogType.Ok
1155
- }
1156
- });
1157
- return dialogRef.afterClosed().pipe(map(value => value.result == ButtonTypes.Ok));
1158
- }
1159
- }
1160
- ConfirmationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: ConfirmationService, deps: [{ token: i1.MatDialog }], target: i0.ɵɵFactoryTarget.Injectable });
1161
- ConfirmationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: ConfirmationService, providedIn: 'root' });
1162
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: ConfirmationService, decorators: [{
1163
- type: Injectable,
1164
- args: [{
1165
- providedIn: 'root'
1166
- }]
1154
+ class ConfirmationService {
1155
+ constructor(dialog) {
1156
+ this.dialog = dialog;
1157
+ }
1158
+ showYesNoConfirmationDialog(title, message) {
1159
+ const dialogRef = this.dialog.open(ConfirmationWindowComponent, {
1160
+ width: '50vw',
1161
+ maxWidth: '50vw',
1162
+ data: {
1163
+ title: title,
1164
+ message: message,
1165
+ dialogType: DialogType.YesNo
1166
+ }
1167
+ });
1168
+ return dialogRef.afterClosed().pipe(map(value => value?.result == ButtonTypes.Yes));
1169
+ }
1170
+ showYesNoCancelConfirmationDialog(title, message) {
1171
+ const dialogRef = this.dialog.open(ConfirmationWindowComponent, {
1172
+ width: '50vw',
1173
+ maxWidth: '50vw',
1174
+ data: {
1175
+ title: title,
1176
+ message: message,
1177
+ dialogType: DialogType.YesNoCancel
1178
+ }
1179
+ });
1180
+ return dialogRef.afterClosed();
1181
+ }
1182
+ showOkCancelConfirmationDialog(title, message) {
1183
+ const dialogRef = this.dialog.open(ConfirmationWindowComponent, {
1184
+ width: '50vw',
1185
+ maxWidth: '50vw',
1186
+ data: {
1187
+ title: title,
1188
+ message: message,
1189
+ dialogType: DialogType.OkCancel
1190
+ }
1191
+ });
1192
+ return dialogRef.afterClosed().pipe(map(value => value?.result == ButtonTypes.Ok));
1193
+ }
1194
+ showOkDialog(title, message) {
1195
+ const dialogRef = this.dialog.open(ConfirmationWindowComponent, {
1196
+ width: '50vw',
1197
+ maxWidth: '50vw',
1198
+ data: {
1199
+ title: title,
1200
+ message: message,
1201
+ dialogType: DialogType.Ok
1202
+ }
1203
+ });
1204
+ return dialogRef.afterClosed().pipe(map(value => value?.result == ButtonTypes.Ok));
1205
+ }
1206
+ }
1207
+ ConfirmationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfirmationService, deps: [{ token: i1.MatDialog }], target: i0.ɵɵFactoryTarget.Injectable });
1208
+ ConfirmationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfirmationService, providedIn: 'root' });
1209
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfirmationService, decorators: [{
1210
+ type: Injectable,
1211
+ args: [{
1212
+ providedIn: 'root'
1213
+ }]
1167
1214
  }], ctorParameters: function () { return [{ type: i1.MatDialog }]; } });
1168
1215
 
1169
- class ConfirmationDialogModule {
1170
- static forRoot() {
1171
- return {
1172
- ngModule: ConfirmationDialogModule,
1173
- providers: [
1174
- ConfirmationService
1175
- ]
1176
- };
1177
- }
1178
- }
1179
- ConfirmationDialogModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: ConfirmationDialogModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1180
- ConfirmationDialogModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.3", ngImport: i0, type: ConfirmationDialogModule, declarations: [ConfirmationWindowComponent], imports: [CommonModule,
1181
- MatDialogModule,
1182
- FlexLayoutModule,
1183
- MatButtonModule] });
1184
- ConfirmationDialogModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: ConfirmationDialogModule, imports: [CommonModule,
1185
- MatDialogModule,
1186
- FlexLayoutModule,
1187
- MatButtonModule] });
1188
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: ConfirmationDialogModule, decorators: [{
1189
- type: NgModule,
1190
- args: [{
1191
- declarations: [ConfirmationWindowComponent],
1192
- imports: [
1193
- CommonModule,
1194
- MatDialogModule,
1195
- FlexLayoutModule,
1196
- MatButtonModule,
1197
- ]
1198
- }]
1216
+ class ConfirmationDialogModule {
1217
+ static forRoot() {
1218
+ return {
1219
+ ngModule: ConfirmationDialogModule,
1220
+ providers: [
1221
+ ConfirmationService
1222
+ ]
1223
+ };
1224
+ }
1225
+ }
1226
+ ConfirmationDialogModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfirmationDialogModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1227
+ ConfirmationDialogModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: ConfirmationDialogModule, declarations: [ConfirmationWindowComponent], imports: [CommonModule,
1228
+ MatDialogModule,
1229
+ FlexLayoutModule,
1230
+ MatButtonModule] });
1231
+ ConfirmationDialogModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfirmationDialogModule, imports: [CommonModule,
1232
+ MatDialogModule,
1233
+ FlexLayoutModule,
1234
+ MatButtonModule] });
1235
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfirmationDialogModule, decorators: [{
1236
+ type: NgModule,
1237
+ args: [{
1238
+ declarations: [ConfirmationWindowComponent],
1239
+ imports: [
1240
+ CommonModule,
1241
+ MatDialogModule,
1242
+ FlexLayoutModule,
1243
+ MatButtonModule,
1244
+ ]
1245
+ }]
1199
1246
  }] });
1200
1247
 
1201
- function isEmptyInputValue(value) {
1202
- // we don't check for string here so it also works with arrays
1203
- return value == null || value.length === 0;
1204
- }
1205
- class CommonValidators {
1206
- static phoneNumber() {
1207
- return Validators.pattern('^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\\s\\./0-9]*$');
1208
- }
1209
- static httpUri() {
1210
- 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}$");
1211
- }
1212
- static conditionalRequired(sourceControlName, sourceValueCompareExpression) {
1213
- return (control) => {
1214
- if (control.parent && sourceValueCompareExpression(control.parent.get(sourceControlName).value)) {
1215
- return isEmptyInputValue(control.value) ? { 'required': true } : null;
1216
- }
1217
- };
1218
- }
1219
- static dependentControls(controlNames) {
1220
- return (control) => {
1221
- controlNames.forEach(controlName => {
1222
- control.parent?.get(controlName).updateValueAndValidity();
1223
- });
1224
- return null;
1225
- };
1226
- }
1248
+ function isEmptyInputValue(value) {
1249
+ // we don't check for string here so it also works with arrays
1250
+ return value == null || value.length === 0;
1251
+ }
1252
+ class CommonValidators {
1253
+ static phoneNumber() {
1254
+ return Validators.pattern('^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\\s\\./0-9]*$');
1255
+ }
1256
+ static httpUri() {
1257
+ 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}$");
1258
+ }
1259
+ static conditionalRequired(sourceControlName, sourceValueCompareExpression) {
1260
+ return (control) => {
1261
+ if (control.parent && sourceValueCompareExpression(control.parent.get(sourceControlName)?.value)) {
1262
+ return isEmptyInputValue(control.value) ? { 'required': true } : null;
1263
+ }
1264
+ return null;
1265
+ };
1266
+ }
1267
+ static dependentControls(controlNames) {
1268
+ return (control) => {
1269
+ controlNames.forEach(controlName => {
1270
+ control.parent?.get(controlName)?.updateValueAndValidity();
1271
+ });
1272
+ return null;
1273
+ };
1274
+ }
1227
1275
  }
1228
1276
 
1229
- class AbstractDetailsComponent {
1230
- constructor() {
1231
- this.hasError = (controlName, errorName) => {
1232
- return this.ownerForm.controls[controlName].hasError(errorName);
1233
- };
1234
- this.hasFormError = (errorName) => {
1235
- return this.ownerForm.hasError(errorName);
1236
- };
1237
- this.loading = true;
1238
- this.entity = null;
1239
- }
1240
- get ownerForm() {
1241
- return this._ownerForm;
1242
- }
1243
- get isLoaded() {
1244
- return this.entity !== null;
1245
- }
1246
- updateDateTime(controlName) {
1247
- this.ownerForm.get(controlName).setValue(IsoDateTime.utcToLocalDateTimeIso(IsoDateTime.currentUtcDateTimeIso()));
1248
- }
1249
- copyInputMessage(inputElement) {
1250
- inputElement.select();
1251
- document.execCommand('copy');
1252
- inputElement.setSelectionRange(0, 0);
1253
- }
1254
- onProgressStarting() {
1255
- this.loading = true;
1256
- this.ownerForm.disable();
1257
- this.ownerForm.updateValueAndValidity();
1258
- }
1259
- onProgressCompleted() {
1260
- this.ownerForm.enable();
1261
- this.loading = false;
1262
- }
1277
+ class AbstractDetailsComponent {
1278
+ constructor() {
1279
+ this.hasError = (controlName, errorName) => {
1280
+ return this.ownerForm?.controls[controlName].hasError(errorName);
1281
+ };
1282
+ this.hasFormError = (errorName) => {
1283
+ return this.ownerForm?.hasError(errorName);
1284
+ };
1285
+ this.loading = true;
1286
+ this.entity = null;
1287
+ this._ownerForm = null;
1288
+ }
1289
+ get ownerForm() {
1290
+ return this._ownerForm;
1291
+ }
1292
+ get isLoaded() {
1293
+ return this.entity !== null;
1294
+ }
1295
+ updateDateTime(controlName) {
1296
+ this.ownerForm?.get(controlName)?.setValue(IsoDateTime.utcToLocalDateTimeIso(IsoDateTime.currentUtcDateTimeIso()));
1297
+ }
1298
+ copyInputMessage(inputElement) {
1299
+ inputElement.select();
1300
+ document.execCommand('copy');
1301
+ inputElement.setSelectionRange(0, 0);
1302
+ }
1303
+ onProgressStarting() {
1304
+ this.loading = true;
1305
+ this.ownerForm?.disable();
1306
+ this.ownerForm?.updateValueAndValidity();
1307
+ }
1308
+ onProgressCompleted() {
1309
+ this.ownerForm?.enable();
1310
+ this.loading = false;
1311
+ }
1263
1312
  }
1264
1313
 
1265
- /*
1266
- * Public API Surface of shared-ui
1314
+ /*
1315
+ * Public API Surface of shared-ui
1267
1316
  */
1268
1317
 
1269
- /**
1270
- * Generated bundle index. Do not edit.
1318
+ /**
1319
+ * Generated bundle index. Do not edit.
1271
1320
  */
1272
1321
 
1273
1322
  export { AbstractDetailsComponent, ButtonTypes, CommonValidators, ConfirmationDialogModule, ConfirmationService, DialogType, IaAutocompleteInput, IaEntitySelectInput, IaMultipleEntitySelectInput, IaNotificationBarComponent, IaSharedUIModule, ProgressNotifierModule, ProgressNotifierService };