@meshmakers/shared-ui 2.1.17-0 → 3.1.25-0

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