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