@porscheinformatik/material-addons 16.0.0 → 16.0.2

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/button/button.mjs +7 -0
  2. package/esm2022/lib/button/button.module.mjs +26 -0
  3. package/esm2022/lib/button/danger-button/danger-button.component.mjs +28 -0
  4. package/esm2022/lib/button/flat-button/link-button.component.mjs +28 -0
  5. package/esm2022/lib/button/icon-button/icon-button.component.mjs +28 -0
  6. package/esm2022/lib/button/mad-basic-button.mjs +39 -0
  7. package/esm2022/lib/button/outline-button/outline-button.component.mjs +28 -0
  8. package/esm2022/lib/button/primary-button/primary-button.component.mjs +28 -0
  9. package/esm2022/lib/card/card.component.mjs +129 -0
  10. package/esm2022/lib/card/card.mjs +2 -0
  11. package/esm2022/lib/card/card.module.mjs +23 -0
  12. package/esm2022/lib/content-panel/content-header/content-header.component.mjs +11 -0
  13. package/esm2022/lib/content-panel/content-panel-container/content-panel-container.component.mjs +11 -0
  14. package/esm2022/lib/content-panel/content-panel-container-content/content-panel-container-content.component.mjs +11 -0
  15. package/esm2022/lib/content-panel/content-panel-container-footer/content-panel-container-footer.component.mjs +11 -0
  16. package/esm2022/lib/content-panel/content-panel.module.mjs +42 -0
  17. package/esm2022/lib/content-panel/main-container/main-container.component.mjs +11 -0
  18. package/esm2022/lib/data-table/data-table-action-type.mjs +6 -0
  19. package/esm2022/lib/data-table/data-table-action.mjs +2 -0
  20. package/esm2022/lib/data-table/data-table-column-definition.mjs +2 -0
  21. package/esm2022/lib/data-table/data-table-column.mjs +2 -0
  22. package/esm2022/lib/data-table/data-table-columns-modal/data-table-columns-modal.component.mjs +103 -0
  23. package/esm2022/lib/data-table/data-table-row.mjs +2 -0
  24. package/esm2022/lib/data-table/data-table.component.mjs +527 -0
  25. package/esm2022/lib/data-table/data-table.mjs +3 -0
  26. package/esm2022/lib/data-table/data-table.module.mjs +81 -0
  27. package/esm2022/lib/flowbar/flowbar.component.mjs +190 -0
  28. package/esm2022/lib/flowbar/flowbar.module.mjs +19 -0
  29. package/esm2022/lib/material-action-button/material-action-button.component.mjs +34 -0
  30. package/esm2022/lib/material-action-button/material-action-button.module.mjs +22 -0
  31. package/esm2022/lib/material-addons.module.mjs +45 -0
  32. package/esm2022/lib/numeric-field/number-format.service.mjs +139 -0
  33. package/esm2022/lib/numeric-field/numeric-field.directive.mjs +295 -0
  34. package/esm2022/lib/numeric-field/numeric-field.mjs +2 -0
  35. package/esm2022/lib/numeric-field/numeric-field.module.mjs +24 -0
  36. package/esm2022/lib/quick-list/base-quick-list.component.mjs +101 -0
  37. package/esm2022/lib/quick-list/quick-list-compact/quick-list-compact.component.mjs +20 -0
  38. package/esm2022/lib/quick-list/quick-list.component.mjs +21 -0
  39. package/esm2022/lib/quick-list/quick-list.mjs +4 -0
  40. package/esm2022/lib/quick-list/quick-list.module.mjs +23 -0
  41. package/esm2022/lib/readonly/readonly-form-field/readonly-form-field.component.mjs +155 -0
  42. package/esm2022/lib/readonly/readonly-form-field-wrapper/readonly-form-field-wrapper.component.mjs +185 -0
  43. package/esm2022/lib/readonly/readonly-form-field.module.mjs +24 -0
  44. package/esm2022/lib/stepper/mad-stepper-animation.mjs +13 -0
  45. package/esm2022/lib/stepper/step-header/step-header.component.mjs +77 -0
  46. package/esm2022/lib/stepper/stepper.component.mjs +159 -0
  47. package/esm2022/lib/stepper/stepper.module.mjs +23 -0
  48. package/esm2022/lib/table/column-header.mjs +2 -0
  49. package/esm2022/lib/table/table-action.mjs +2 -0
  50. package/esm2022/lib/table/table.component.mjs +130 -0
  51. package/esm2022/lib/table/table.mjs +2 -0
  52. package/esm2022/lib/table/table.module.mjs +56 -0
  53. package/esm2022/lib/throttle-click/throttle-click.directive.mjs +38 -0
  54. package/esm2022/lib/throttle-click/throttle-click.module.mjs +18 -0
  55. package/esm2022/lib/toolbar/toolbar-action.interface.mjs +2 -0
  56. package/esm2022/lib/toolbar/toolbar.component.mjs +78 -0
  57. package/esm2022/lib/toolbar/toolbar.module.mjs +56 -0
  58. package/esm2022/lib/toolbar/toolbar.service.mjs +124 -0
  59. package/esm2022/porscheinformatik-material-addons.mjs +5 -0
  60. package/esm2022/public_api.mjs +41 -0
  61. package/fesm2022/porscheinformatik-material-addons.mjs +2983 -0
  62. package/fesm2022/porscheinformatik-material-addons.mjs.map +1 -0
  63. package/package.json +8 -12
@@ -0,0 +1,2983 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Component, Input, NgModule, HostBinding, ElementRef, ViewChild, LOCALE_ID, Injectable, Inject, EventEmitter, forwardRef, Directive, Output, HostListener, TemplateRef, ContentChild, ViewChildren, ViewEncapsulation, ChangeDetectionStrategy, QueryList, Optional, ContentChildren } from '@angular/core';
3
+ import * as i1 from '@angular/common';
4
+ import { CommonModule } from '@angular/common';
5
+ import * as i1$1 from '@angular/router';
6
+ import { RouterModule, NavigationEnd } from '@angular/router';
7
+ import * as i1$2 from '@angular/material/button';
8
+ import { MatButtonModule } from '@angular/material/button';
9
+ import * as i2 from '@angular/material/icon';
10
+ import { MatIconModule } from '@angular/material/icon';
11
+ import * as i5 from '@angular/material/tooltip';
12
+ import { MatTooltipModule } from '@angular/material/tooltip';
13
+ import * as i3 from '@angular/material/form-field';
14
+ import { MatFormFieldModule } from '@angular/material/form-field';
15
+ import * as i4 from '@angular/material/input';
16
+ import { MatInputModule } from '@angular/material/input';
17
+ import * as i5$1 from '@angular/forms';
18
+ import { FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
19
+ import { of, Subject, Subscription } from 'rxjs';
20
+ import * as i1$3 from '@angular/cdk/layout';
21
+ import { Breakpoints } from '@angular/cdk/layout';
22
+ import { map, throttleTime, switchMap, tap, startWith, takeUntil, distinctUntilChanged } from 'rxjs/operators';
23
+ import * as i2$2 from '@angular/platform-browser';
24
+ import * as i2$1 from '@ngx-translate/core';
25
+ import { TranslateModule } from '@ngx-translate/core';
26
+ import * as i6 from '@angular/material/menu';
27
+ import { MatMenuModule } from '@angular/material/menu';
28
+ import * as i8 from '@angular/material/toolbar';
29
+ import { MatToolbarModule } from '@angular/material/toolbar';
30
+ import * as i14 from '@angular/material/badge';
31
+ import { MatBadgeModule } from '@angular/material/badge';
32
+ import { trigger, transition, style, animate, state } from '@angular/animations';
33
+ import * as i2$3 from '@angular/material/card';
34
+ import { MatCardModule } from '@angular/material/card';
35
+ import * as i8$1 from '@angular/material/table';
36
+ import { MatTableDataSource, MatTableModule } from '@angular/material/table';
37
+ import * as i6$1 from '@angular/material/paginator';
38
+ import { MatPaginator, MatPaginatorModule } from '@angular/material/paginator';
39
+ import * as i7 from '@angular/material/sort';
40
+ import { MatSort, MatSortModule } from '@angular/material/sort';
41
+ import * as i1$4 from '@angular/material/dialog';
42
+ import { MAT_DIALOG_DATA } from '@angular/material/dialog';
43
+ import * as i10 from '@angular/cdk/drag-drop';
44
+ import { moveItemInArray, transferArrayItem, DragDropModule } from '@angular/cdk/drag-drop';
45
+ import { SelectionModel } from '@angular/cdk/collections';
46
+ import { v4 } from 'uuid';
47
+ import * as i10$1 from '@angular/material/progress-spinner';
48
+ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
49
+ import * as i13 from '@angular/material/checkbox';
50
+ import { MatCheckboxModule } from '@angular/material/checkbox';
51
+ import { CdkStepHeader, STEP_STATE, CdkStep, CdkStepper, CdkStepperModule } from '@angular/cdk/stepper';
52
+ import * as i1$5 from '@angular/cdk/a11y';
53
+ import * as i3$1 from '@angular/cdk/bidi';
54
+ import * as i2$4 from '@angular/material/stepper';
55
+ import { MatStepperModule } from '@angular/material/stepper';
56
+
57
+ class MaterialActionButtonComponent {
58
+ constructor() {
59
+ this.icon = 'add';
60
+ // Sets the lower padding higher providing some bottom space for a fixed paginator
61
+ this.liftHigher = true;
62
+ this.liftHigher2 = false;
63
+ }
64
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: MaterialActionButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
65
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: MaterialActionButtonComponent, selector: "mad-material-action-button", inputs: { actionName: "actionName", id: "id", icon: "icon", routerLink: "routerLink", liftHigher: "liftHigher", liftHigher2: "liftHigher2" }, ngImport: i0, template: "<div class=\"material-action-button {{ liftHigher ? 'lift-higher' : '' }} {{ liftHigher2 ? 'lift-higher-2' : '' }}\">\n <a [routerLink]=\"routerLink\">\n <button [id]=\"id\" mat-fab [matTooltipPosition]=\"'left'\" [matTooltip]=\"actionName\" color=\"primary\" *ngIf=\"!liftHigher2\">\n <mat-icon>{{ icon }}</mat-icon>\n </button>\n <button [id]=\"id\" mat-mini-fab [matTooltipPosition]=\"'left'\" [matTooltip]=\"actionName\" color=\"accent\" *ngIf=\"liftHigher2\">\n <mat-icon>{{ icon }}</mat-icon>\n </button>\n </a>\n</div>\n", styles: [".material-action-button{position:fixed;bottom:20px;right:20px;z-index:100;display:flex;flex-direction:column-reverse;align-items:center}.lift-higher{bottom:61px}.lift-higher-2{right:28px;bottom:121px}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "component", type: i1$2.MatMiniFabButton, selector: "button[mat-mini-fab]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i1$2.MatFabButton, selector: "button[mat-fab]", inputs: ["disabled", "disableRipple", "color", "tabIndex", "extended"], exportAs: ["matButton"] }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i5.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }] }); }
66
+ }
67
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: MaterialActionButtonComponent, decorators: [{
68
+ type: Component,
69
+ args: [{ selector: 'mad-material-action-button', template: "<div class=\"material-action-button {{ liftHigher ? 'lift-higher' : '' }} {{ liftHigher2 ? 'lift-higher-2' : '' }}\">\n <a [routerLink]=\"routerLink\">\n <button [id]=\"id\" mat-fab [matTooltipPosition]=\"'left'\" [matTooltip]=\"actionName\" color=\"primary\" *ngIf=\"!liftHigher2\">\n <mat-icon>{{ icon }}</mat-icon>\n </button>\n <button [id]=\"id\" mat-mini-fab [matTooltipPosition]=\"'left'\" [matTooltip]=\"actionName\" color=\"accent\" *ngIf=\"liftHigher2\">\n <mat-icon>{{ icon }}</mat-icon>\n </button>\n </a>\n</div>\n", styles: [".material-action-button{position:fixed;bottom:20px;right:20px;z-index:100;display:flex;flex-direction:column-reverse;align-items:center}.lift-higher{bottom:61px}.lift-higher-2{right:28px;bottom:121px}\n"] }]
70
+ }], propDecorators: { actionName: [{
71
+ type: Input
72
+ }], id: [{
73
+ type: Input
74
+ }], icon: [{
75
+ type: Input
76
+ }], routerLink: [{
77
+ type: Input
78
+ }], liftHigher: [{
79
+ type: Input
80
+ }], liftHigher2: [{
81
+ type: Input
82
+ }] } });
83
+
84
+ class MaterialActionButtonModule {
85
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: MaterialActionButtonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
86
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.1", ngImport: i0, type: MaterialActionButtonModule, declarations: [MaterialActionButtonComponent], imports: [CommonModule, RouterModule, MatButtonModule, MatIconModule, MatTooltipModule], exports: [MaterialActionButtonComponent] }); }
87
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: MaterialActionButtonModule, imports: [CommonModule, RouterModule, MatButtonModule, MatIconModule, MatTooltipModule] }); }
88
+ }
89
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: MaterialActionButtonModule, decorators: [{
90
+ type: NgModule,
91
+ args: [{
92
+ declarations: [MaterialActionButtonComponent],
93
+ imports: [CommonModule, RouterModule, MatButtonModule, MatIconModule, MatTooltipModule],
94
+ exports: [MaterialActionButtonComponent],
95
+ }]
96
+ }] });
97
+
98
+ class MadBasicButton {
99
+ constructor() {
100
+ this.disableClick = (e) => e.stopPropagation();
101
+ }
102
+ get pointerEvent() {
103
+ return this.disabled ? 'none' : 'auto';
104
+ }
105
+ get opacity() {
106
+ return this.disabled ? '0.35' : '1';
107
+ }
108
+ ngOnChanges() {
109
+ this.disableButton();
110
+ }
111
+ disableButton() {
112
+ if (this.disabled) {
113
+ this.button.nativeElement.addEventListener('click', this.disableClick);
114
+ }
115
+ else {
116
+ this.button.nativeElement.removeEventListener('click', this.disableClick);
117
+ }
118
+ }
119
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: MadBasicButton, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
120
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: MadBasicButton, selector: "ng-component", host: { properties: { "style.pointer-events": "this.pointerEvent", "style.opacity": "this.opacity" } }, usesOnChanges: true, ngImport: i0, template: '', isInline: true }); }
121
+ }
122
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: MadBasicButton, decorators: [{
123
+ type: Component,
124
+ args: [{
125
+ template: ''
126
+ }]
127
+ }], propDecorators: { pointerEvent: [{
128
+ type: HostBinding,
129
+ args: ['style.pointer-events']
130
+ }], opacity: [{
131
+ type: HostBinding,
132
+ args: ['style.opacity']
133
+ }] } });
134
+
135
+ class DangerButtonComponent extends MadBasicButton {
136
+ constructor() {
137
+ super();
138
+ this.title = '';
139
+ super.button = this.button;
140
+ super.disabled = this.disabled;
141
+ }
142
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DangerButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
143
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: DangerButtonComponent, selector: "mad-danger-button", inputs: { type: "type", disabled: "disabled", title: "title" }, viewQueries: [{ propertyName: "button", first: true, predicate: ["btn"], descendants: true, read: ElementRef, static: true }], usesInheritance: true, ngImport: i0, template: "<button mat-raised-button color=\"warn\" [type]=\"type\" [title]=\"title\" #btn>\n <ng-content></ng-content>\n</button>\n", styles: [""], dependencies: [{ kind: "component", type: i1$2.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }] }); }
144
+ }
145
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DangerButtonComponent, decorators: [{
146
+ type: Component,
147
+ args: [{ selector: 'mad-danger-button', template: "<button mat-raised-button color=\"warn\" [type]=\"type\" [title]=\"title\" #btn>\n <ng-content></ng-content>\n</button>\n" }]
148
+ }], ctorParameters: function () { return []; }, propDecorators: { type: [{
149
+ type: Input
150
+ }], disabled: [{
151
+ type: Input
152
+ }], title: [{
153
+ type: Input
154
+ }], button: [{
155
+ type: ViewChild,
156
+ args: ['btn', { read: ElementRef, static: true }]
157
+ }] } });
158
+
159
+ class LinkButtonComponent extends MadBasicButton {
160
+ constructor() {
161
+ super();
162
+ this.title = '';
163
+ super.button = this.button;
164
+ super.disabled = this.disabled;
165
+ }
166
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: LinkButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
167
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: LinkButtonComponent, selector: "mad-link-button", inputs: { type: "type", disabled: "disabled", title: "title" }, viewQueries: [{ propertyName: "button", first: true, predicate: ["btn"], descendants: true, read: ElementRef, static: true }], usesInheritance: true, ngImport: i0, template: "<button [title]=\"title\" [type]=\"type\" color=\"primary\" #btn mat-button>\n <ng-content></ng-content>\n</button>\n", styles: [""], dependencies: [{ kind: "component", type: i1$2.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }] }); }
168
+ }
169
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: LinkButtonComponent, decorators: [{
170
+ type: Component,
171
+ args: [{ selector: 'mad-link-button', template: "<button [title]=\"title\" [type]=\"type\" color=\"primary\" #btn mat-button>\n <ng-content></ng-content>\n</button>\n" }]
172
+ }], ctorParameters: function () { return []; }, propDecorators: { type: [{
173
+ type: Input
174
+ }], disabled: [{
175
+ type: Input
176
+ }], title: [{
177
+ type: Input
178
+ }], button: [{
179
+ type: ViewChild,
180
+ args: ['btn', { read: ElementRef, static: true }]
181
+ }] } });
182
+
183
+ class IconButtonComponent extends MadBasicButton {
184
+ constructor() {
185
+ super();
186
+ this.title = '';
187
+ super.button = this.button;
188
+ super.disabled = this.disabled;
189
+ }
190
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: IconButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
191
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: IconButtonComponent, selector: "mad-icon-button", inputs: { type: "type", disabled: "disabled", title: "title" }, viewQueries: [{ propertyName: "button", first: true, predicate: ["btn"], descendants: true, read: ElementRef, static: true }], usesInheritance: true, ngImport: i0, template: "<button mat-icon-button color=\"primary\" [type]=\"type\" [title]=\"title\" #btn>\n <ng-content></ng-content>\n</button>\n", styles: [""], dependencies: [{ kind: "component", type: i1$2.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }] }); }
192
+ }
193
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: IconButtonComponent, decorators: [{
194
+ type: Component,
195
+ args: [{ selector: 'mad-icon-button', template: "<button mat-icon-button color=\"primary\" [type]=\"type\" [title]=\"title\" #btn>\n <ng-content></ng-content>\n</button>\n" }]
196
+ }], ctorParameters: function () { return []; }, propDecorators: { type: [{
197
+ type: Input
198
+ }], disabled: [{
199
+ type: Input
200
+ }], title: [{
201
+ type: Input
202
+ }], button: [{
203
+ type: ViewChild,
204
+ args: ['btn', { read: ElementRef, static: true }]
205
+ }] } });
206
+
207
+ class OutlineButtonComponent extends MadBasicButton {
208
+ constructor() {
209
+ super();
210
+ this.title = '';
211
+ super.button = this.button;
212
+ super.disabled = this.disabled;
213
+ }
214
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: OutlineButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
215
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: OutlineButtonComponent, selector: "mad-outline-button", inputs: { type: "type", disabled: "disabled", title: "title" }, viewQueries: [{ propertyName: "button", first: true, predicate: ["btn"], descendants: true, read: ElementRef, static: true }], usesInheritance: true, ngImport: i0, template: "<button mat-stroked-button color=\"primary\" [type]=\"type\" [title]=\"title\" #btn>\n <ng-content></ng-content>\n</button>\n", styles: [""], dependencies: [{ kind: "component", type: i1$2.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }] }); }
216
+ }
217
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: OutlineButtonComponent, decorators: [{
218
+ type: Component,
219
+ args: [{ selector: 'mad-outline-button', template: "<button mat-stroked-button color=\"primary\" [type]=\"type\" [title]=\"title\" #btn>\n <ng-content></ng-content>\n</button>\n" }]
220
+ }], ctorParameters: function () { return []; }, propDecorators: { type: [{
221
+ type: Input
222
+ }], disabled: [{
223
+ type: Input
224
+ }], title: [{
225
+ type: Input
226
+ }], button: [{
227
+ type: ViewChild,
228
+ args: ['btn', { read: ElementRef, static: true }]
229
+ }] } });
230
+
231
+ class PrimaryButtonComponent extends MadBasicButton {
232
+ constructor() {
233
+ super();
234
+ this.title = '';
235
+ super.button = this.button;
236
+ super.disabled = this.disabled;
237
+ }
238
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: PrimaryButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
239
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: PrimaryButtonComponent, selector: "mad-primary-button", inputs: { type: "type", disabled: "disabled", title: "title" }, viewQueries: [{ propertyName: "button", first: true, predicate: ["btn"], descendants: true, read: ElementRef, static: true }], usesInheritance: true, ngImport: i0, template: "<button mat-raised-button color=\"primary\" [type]=\"type\" [title]=\"title\" #btn>\n <ng-content></ng-content>\n</button>\n", styles: ["::ng-deep .mat-icon{vertical-align:middle}\n"], dependencies: [{ kind: "component", type: i1$2.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }] }); }
240
+ }
241
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: PrimaryButtonComponent, decorators: [{
242
+ type: Component,
243
+ args: [{ selector: 'mad-primary-button', template: "<button mat-raised-button color=\"primary\" [type]=\"type\" [title]=\"title\" #btn>\n <ng-content></ng-content>\n</button>\n", styles: ["::ng-deep .mat-icon{vertical-align:middle}\n"] }]
244
+ }], ctorParameters: function () { return []; }, propDecorators: { type: [{
245
+ type: Input
246
+ }], disabled: [{
247
+ type: Input
248
+ }], title: [{
249
+ type: Input
250
+ }], button: [{
251
+ type: ViewChild,
252
+ args: ['btn', { read: ElementRef, static: true }]
253
+ }] } });
254
+
255
+ class ButtonModule {
256
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ButtonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
257
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.1", ngImport: i0, type: ButtonModule, declarations: [PrimaryButtonComponent, OutlineButtonComponent, LinkButtonComponent, DangerButtonComponent, IconButtonComponent], imports: [CommonModule, RouterModule, MatButtonModule, MatIconModule, MatTooltipModule], exports: [PrimaryButtonComponent, OutlineButtonComponent, LinkButtonComponent, DangerButtonComponent, IconButtonComponent] }); }
258
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ButtonModule, imports: [CommonModule, RouterModule, MatButtonModule, MatIconModule, MatTooltipModule] }); }
259
+ }
260
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ButtonModule, decorators: [{
261
+ type: NgModule,
262
+ args: [{
263
+ declarations: [PrimaryButtonComponent, OutlineButtonComponent, LinkButtonComponent, DangerButtonComponent, IconButtonComponent],
264
+ imports: [CommonModule, RouterModule, MatButtonModule, MatIconModule, MatTooltipModule],
265
+ exports: [PrimaryButtonComponent, OutlineButtonComponent, LinkButtonComponent, DangerButtonComponent, IconButtonComponent],
266
+ }]
267
+ }] });
268
+
269
+ class NumberFormatService {
270
+ static { this.NEGATIVE = '-'; }
271
+ static { this.NUMBERS = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']; }
272
+ static { this.DEFAULT_FINAL_FORMATTING = true; }
273
+ static { this.DEFAULT_DECIMAL_PLACES = 2; }
274
+ static { this.DEFAULT_AUTOFILL_DECIMALS = false; }
275
+ static { this.DEFAULT_REMOVE_LEADING_ZEROS = false; }
276
+ constructor(locale) {
277
+ this.allowedKeys = [];
278
+ // try to get the current formatting
279
+ const localeDecimalSeparator = (1.1).toLocaleString(locale).charAt(1);
280
+ this.decimalSeparator = localeDecimalSeparator === ',' ? ',' : '.';
281
+ this.groupingSeparator = localeDecimalSeparator === ',' ? '.' : ',';
282
+ this.allowedKeys = [...NumberFormatService.NUMBERS, NumberFormatService.NEGATIVE, this.decimalSeparator];
283
+ }
284
+ static valueIsSet(value) {
285
+ return typeof value !== 'undefined' && value !== null && (typeof value !== 'string' || value.length !== 0);
286
+ }
287
+ format(value, options) {
288
+ return NumberFormatService.valueIsSet(value)
289
+ ? this.formatNumber(value.toString().replace(new RegExp('[.]', 'g'), this.decimalSeparator), options)
290
+ : '';
291
+ }
292
+ formatNumber(value, options) {
293
+ const autofillDecimals = this.valueOrDefault(options?.autofillDecimals, NumberFormatService.DEFAULT_AUTOFILL_DECIMALS);
294
+ const decimalPlaces = this.valueOrDefault(options?.decimalPlaces, NumberFormatService.DEFAULT_DECIMAL_PLACES);
295
+ const finalFormatting = this.valueOrDefault(options?.finalFormatting, NumberFormatService.DEFAULT_FINAL_FORMATTING);
296
+ let result = this.strip(value, { decimalPlaces, removeLeadingZeros: finalFormatting });
297
+ /* add grouping separator */
298
+ const decimalIndex = result.indexOf(this.decimalSeparator);
299
+ const isNegative = result.startsWith(NumberFormatService.NEGATIVE);
300
+ let i = decimalIndex > -1 ? decimalIndex : result.length;
301
+ while (i > (isNegative ? 4 : 3)) {
302
+ i -= 3;
303
+ result = result.substring(0, i) + this.groupingSeparator + result.substring(i, result.length);
304
+ }
305
+ if (finalFormatting) {
306
+ if (decimalPlaces > 0 && !!result) {
307
+ /* autofill decimal places */
308
+ let actualDecimalIndex = result.indexOf(this.decimalSeparator);
309
+ if (autofillDecimals) {
310
+ if (actualDecimalIndex === -1) {
311
+ actualDecimalIndex = result.length;
312
+ result += this.decimalSeparator;
313
+ }
314
+ result = this.addMissingLeadingZero(result, actualDecimalIndex);
315
+ actualDecimalIndex = result.indexOf(this.decimalSeparator);
316
+ const actualDecimalPlaces = result.length - actualDecimalIndex - 1;
317
+ for (let j = 0; j < decimalPlaces - actualDecimalPlaces; j++) {
318
+ result += '0';
319
+ }
320
+ }
321
+ else {
322
+ result = this.addMissingLeadingZero(result, actualDecimalIndex);
323
+ }
324
+ }
325
+ }
326
+ return result;
327
+ }
328
+ strip(value, options) {
329
+ const decimalPlaces = this.valueOrDefault(options?.decimalPlaces, NumberFormatService.DEFAULT_DECIMAL_PLACES);
330
+ const removeLeadingZeros = this.valueOrDefault(options?.removeLeadingZeros, NumberFormatService.DEFAULT_REMOVE_LEADING_ZEROS);
331
+ let result = '';
332
+ let indexDecimalSep = -1;
333
+ let j = -1;
334
+ let ignoredChars = 0;
335
+ for (const char of value) {
336
+ j++;
337
+ if (this.allowedKeys.includes(char)) {
338
+ if (char === this.decimalSeparator) {
339
+ if (decimalPlaces === 0) {
340
+ /* dismiss content after a decimal separator, when no places allowed */
341
+ break;
342
+ }
343
+ else if (indexDecimalSep > -1) {
344
+ /* ignore subsequent decimal separators */
345
+ continue;
346
+ }
347
+ indexDecimalSep = j;
348
+ }
349
+ if (char === '0' && removeLeadingZeros) {
350
+ /* remove leading zero only if it's not the only zero in the 'value' string */
351
+ if ((result.length === 0 && j + 1 !== value.length) || result === NumberFormatService.NEGATIVE) {
352
+ ignoredChars++;
353
+ continue;
354
+ }
355
+ }
356
+ if (char === NumberFormatService.NEGATIVE && j > 0) {
357
+ /* dismiss content after a negative sign not on first position */
358
+ break;
359
+ }
360
+ if (indexDecimalSep > -1 && result.length + ignoredChars > indexDecimalSep + decimalPlaces) {
361
+ /* dismiss content after maximum decimal places reached */
362
+ break;
363
+ }
364
+ result += char;
365
+ }
366
+ else if (char === this.groupingSeparator) {
367
+ if (indexDecimalSep === -1) {
368
+ ignoredChars++;
369
+ }
370
+ }
371
+ else {
372
+ /* dismiss content after a invalid character */
373
+ break;
374
+ }
375
+ }
376
+ return result;
377
+ }
378
+ addMissingLeadingZero(result, actualDecimalIndex) {
379
+ const isNegative = result.startsWith(NumberFormatService.NEGATIVE);
380
+ /* autoadd a zero before decimal separator, when it's missing */
381
+ if (actualDecimalIndex === 0) {
382
+ result = '0' + result;
383
+ }
384
+ /* autoadd a zero before decimal separator, when it's missing, for negative values */
385
+ if (actualDecimalIndex === 1 && isNegative) {
386
+ result = result[0] + '0' + result.substring(1, result.length);
387
+ }
388
+ return result;
389
+ }
390
+ valueOrDefault(value, defaultValue) {
391
+ return NumberFormatService.valueIsSet(value) ? value : defaultValue;
392
+ }
393
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: NumberFormatService, deps: [{ token: LOCALE_ID }], target: i0.ɵɵFactoryTarget.Injectable }); }
394
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: NumberFormatService, providedIn: 'any' }); }
395
+ }
396
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: NumberFormatService, decorators: [{
397
+ type: Injectable,
398
+ args: [{
399
+ providedIn: 'any',
400
+ }]
401
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
402
+ type: Inject,
403
+ args: [LOCALE_ID]
404
+ }] }]; } });
405
+
406
+ /**
407
+ * Read-only mat-form-field representation of provided value
408
+ *
409
+ * @author Stefan Laesser
410
+ */
411
+ class ReadOnlyFormFieldComponent {
412
+ constructor(changeDetector, renderer, numberFormatService) {
413
+ this.changeDetector = changeDetector;
414
+ this.renderer = renderer;
415
+ this.numberFormatService = numberFormatService;
416
+ this.textAlign = 'left';
417
+ this.formatNumber = false;
418
+ this.decimalPlaces = 2;
419
+ this.roundValue = false;
420
+ this.autofillDecimals = false;
421
+ this.unit = null;
422
+ this.unitPosition = 'left';
423
+ this.errorMessage = null;
424
+ this.multiline = false;
425
+ this.rows = 3;
426
+ /*
427
+ * If shrinkIfEmpty is set to "false", nothing changes
428
+ * If set to "true" and multiline is also "true", the textarea will
429
+ * shrink to one row, if value is empty/null/undefined.
430
+ * Otherwise, the defined rows-value will be used
431
+ */
432
+ this.shrinkIfEmpty = false;
433
+ this.errorMatcher = {
434
+ isErrorState: () => !!this.errorMessage,
435
+ };
436
+ }
437
+ ngOnChanges(_) {
438
+ if (!NumberFormatService.valueIsSet(this.value)) {
439
+ this.value = '-';
440
+ if (this.shrinkIfEmpty) {
441
+ this.rows = 1;
442
+ }
443
+ }
444
+ else if (this.formatNumber && typeof this.value === 'number') {
445
+ this.value = this.numberFormatService.format(this.value, {
446
+ decimalPlaces: this.decimalPlaces,
447
+ finalFormatting: true,
448
+ autofillDecimals: this.autofillDecimals,
449
+ });
450
+ }
451
+ this.changeDetector.detectChanges();
452
+ }
453
+ // TODO direct copy from NumericFieldDirective
454
+ ngAfterViewChecked() {
455
+ this.injectUnitSymbol();
456
+ }
457
+ injectUnitSymbol() {
458
+ // Need to inject the unit symbol when the input element width is set to its actual value,
459
+ // otherwise the icon wont show in the correct position
460
+ if (!!this.unit && !this.unitSpan && this.inputEl.nativeElement.offsetWidth !== 0) {
461
+ // Get the input wrapper and apply necessary styles
462
+ const inputWrapper = this.inputEl.nativeElement.parentNode.parentNode;
463
+ // Create the span with unit symbol and apply necessary styles
464
+ this.unitSpan = this.renderer.createElement('span');
465
+ if (this.unitPosition === 'left') {
466
+ this.renderer.setAttribute(this.unitSpan, 'matPrefix', '');
467
+ this.renderer.setStyle(this.unitSpan, 'padding-right', '5px');
468
+ this.renderer.insertBefore(inputWrapper, this.unitSpan, inputWrapper.children[0]);
469
+ }
470
+ else {
471
+ this.renderer.setAttribute(this.unitSpan, 'matSuffix', '');
472
+ this.renderer.setStyle(this.unitSpan, 'padding-left', '5px');
473
+ this.renderer.appendChild(inputWrapper, this.unitSpan);
474
+ }
475
+ }
476
+ // special handling to move unit symbol along with display value
477
+ if (!!this.unitSpan && this.textAlign === 'left' && this.unitPosition === 'right') {
478
+ const inputStyles = window.getComputedStyle(this.inputEl.nativeElement.parentElement, null);
479
+ this.unitSpan.style.position = 'absolute';
480
+ this.unitSpan.style.marginTop = inputStyles.getPropertyValue('border-top-width');
481
+ this.unitSpan.style.paddingTop = inputStyles.getPropertyValue('padding-top');
482
+ this.unitSpan.style.paddingBottom = inputStyles.getPropertyValue('padding-bottom');
483
+ if (!this.textSpan) {
484
+ this.textSpan = document.createElement('span');
485
+ document.body.appendChild(this.textSpan);
486
+ this.textSpan.style.font = inputStyles.getPropertyValue('font');
487
+ this.textSpan.style.fontSize = inputStyles.getPropertyValue('font-size');
488
+ this.textSpan.style.height = 'auto';
489
+ this.textSpan.style.width = 'auto';
490
+ this.textSpan.style.position = 'absolute';
491
+ this.textSpan.style.top = '0';
492
+ this.textSpan.style.whiteSpace = 'no-wrap';
493
+ this.textSpan.style.visibility = 'hidden';
494
+ }
495
+ this.textSpan.innerHTML = this.value;
496
+ const width = Math.min(this.inputEl.nativeElement.clientWidth - this.unitSpan.clientWidth, Math.ceil(this.textSpan.clientWidth));
497
+ this.unitSpan.style.left = width + 'px';
498
+ }
499
+ // always reset unit symbol
500
+ if (!!this.unitSpan) {
501
+ this.unitSpan.textContent = this.unit;
502
+ }
503
+ }
504
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ReadOnlyFormFieldComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.Renderer2 }, { token: NumberFormatService }], target: i0.ɵɵFactoryTarget.Component }); }
505
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: ReadOnlyFormFieldComponent, selector: "mad-readonly-form-field", inputs: { value: "value", label: "label", textAlign: "textAlign", formatNumber: "formatNumber", decimalPlaces: "decimalPlaces", roundValue: ["roundDisplayValue", "roundValue"], autofillDecimals: "autofillDecimals", unit: "unit", unitPosition: "unitPosition", errorMessage: "errorMessage", multiline: "multiline", rows: "rows", id: "id", shrinkIfEmpty: "shrinkIfEmpty" }, viewQueries: [{ propertyName: "inputEl", first: true, predicate: ["inputEl"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<mat-form-field class=\"form-group mad-read-only\">\n <mat-label>{{ label }}</mat-label>\n <input\n *ngIf=\"!multiline\"\n [ngModel]=\"value\"\n [ngClass]=\"'text-' + textAlign + ' content'\"\n [errorStateMatcher]=\"errorMatcher\"\n [id]=\"id\"\n readonly\n disabled\n matInput\n #inputEl\n />\n\n <textarea\n *ngIf=\"multiline\"\n [rows]=\"rows\"\n [ngModel]=\"value\"\n class=\"multiline content\"\n [errorStateMatcher]=\"errorMatcher\"\n [id]=\"id\"\n readonly\n disabled\n matInput\n ></textarea>\n <mat-error>{{ errorMessage }}</mat-error>\n</mat-form-field>\n", styles: ["mat-form-field{width:100%;width:-webkit-fill-available;width:-moz-available;width:stretch}mat-label{line-height:1.4}span[matPrefix]{padding-right:5px}span[matSuffix]{padding-left:5px}.text-left{text-align:left}.text-right{text-align:right}.multiline{resize:none}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i4.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: "directive", type: i5$1.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: i5$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i5$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
506
+ }
507
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ReadOnlyFormFieldComponent, decorators: [{
508
+ type: Component,
509
+ args: [{ selector: 'mad-readonly-form-field', template: "<mat-form-field class=\"form-group mad-read-only\">\n <mat-label>{{ label }}</mat-label>\n <input\n *ngIf=\"!multiline\"\n [ngModel]=\"value\"\n [ngClass]=\"'text-' + textAlign + ' content'\"\n [errorStateMatcher]=\"errorMatcher\"\n [id]=\"id\"\n readonly\n disabled\n matInput\n #inputEl\n />\n\n <textarea\n *ngIf=\"multiline\"\n [rows]=\"rows\"\n [ngModel]=\"value\"\n class=\"multiline content\"\n [errorStateMatcher]=\"errorMatcher\"\n [id]=\"id\"\n readonly\n disabled\n matInput\n ></textarea>\n <mat-error>{{ errorMessage }}</mat-error>\n</mat-form-field>\n", styles: ["mat-form-field{width:100%;width:-webkit-fill-available;width:-moz-available;width:stretch}mat-label{line-height:1.4}span[matPrefix]{padding-right:5px}span[matSuffix]{padding-left:5px}.text-left{text-align:left}.text-right{text-align:right}.multiline{resize:none}\n"] }]
510
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.Renderer2 }, { type: NumberFormatService }]; }, propDecorators: { value: [{
511
+ type: Input,
512
+ args: ['value']
513
+ }], label: [{
514
+ type: Input,
515
+ args: ['label']
516
+ }], textAlign: [{
517
+ type: Input,
518
+ args: ['textAlign']
519
+ }], formatNumber: [{
520
+ type: Input,
521
+ args: ['formatNumber']
522
+ }], decimalPlaces: [{
523
+ type: Input,
524
+ args: ['decimalPlaces']
525
+ }], roundValue: [{
526
+ type: Input,
527
+ args: ['roundDisplayValue']
528
+ }], autofillDecimals: [{
529
+ type: Input,
530
+ args: ['autofillDecimals']
531
+ }], unit: [{
532
+ type: Input,
533
+ args: ['unit']
534
+ }], unitPosition: [{
535
+ type: Input,
536
+ args: ['unitPosition']
537
+ }], errorMessage: [{
538
+ type: Input,
539
+ args: ['errorMessage']
540
+ }], multiline: [{
541
+ type: Input
542
+ }], rows: [{
543
+ type: Input
544
+ }], id: [{
545
+ type: Input
546
+ }], shrinkIfEmpty: [{
547
+ type: Input
548
+ }], inputEl: [{
549
+ type: ViewChild,
550
+ args: ['inputEl']
551
+ }] } });
552
+
553
+ /**
554
+ * Wraps a mat-form-field to replace it by a readOnly representation if necessary
555
+ *
556
+ * @author Stefan Laesser
557
+ */
558
+ class ReadOnlyFormFieldWrapperComponent {
559
+ constructor(changeDetector, elementRef) {
560
+ this.changeDetector = changeDetector;
561
+ this.elementRef = elementRef;
562
+ /**
563
+ * If set to "false", the contained mat-form-field is rendered in all it's glory.
564
+ * If set to "true", a readonly representation of the value is shown using the mat-form-fields label.
565
+ */
566
+ this.readonly = true;
567
+ this.textAlign = 'left';
568
+ this.formatNumber = false;
569
+ this.decimalPlaces = 2;
570
+ this.roundValue = false;
571
+ this.autofillDecimals = false;
572
+ this.unit = null;
573
+ this.unitPosition = 'left';
574
+ this.errorMessage = null;
575
+ /**
576
+ * If set to "false", a readonly input will be rendered.
577
+ * If set to "true", a readonly textarea will be rendered instead.
578
+ */
579
+ this.multiline = false;
580
+ /**
581
+ * Defines the rows for the readonly textarea.
582
+ */
583
+ this.rows = 3;
584
+ /**
585
+ * If shrinkIfEmpty is set to "false", nothing changes
586
+ * If set to "true" and multiline is also "true", the textarea will
587
+ * shrink to one row, if value is empty/null/undefined.
588
+ * Otherwise, the defined rows-value will be used
589
+ */
590
+ this.shrinkIfEmpty = false;
591
+ this.toolTipForInputEnabled = false;
592
+ }
593
+ ngOnInit() {
594
+ this.doRendering();
595
+ }
596
+ ngAfterViewInit() {
597
+ this.setReadonlyFieldStyle();
598
+ this.doRendering();
599
+ }
600
+ ngAfterViewChecked() {
601
+ this.setReadonlyFieldStyle();
602
+ this.setTooltipForOverflownField();
603
+ }
604
+ ngOnChanges(_) {
605
+ this.doRendering();
606
+ }
607
+ getLabel() {
608
+ if (!this.label) {
609
+ this.extractLabel();
610
+ }
611
+ return this.label;
612
+ }
613
+ doRendering() {
614
+ if (!this.originalContent) {
615
+ return;
616
+ }
617
+ if (!this.readonly) {
618
+ this.correctWidth();
619
+ return;
620
+ }
621
+ this.changeDetector.detectChanges();
622
+ }
623
+ extractLabel() {
624
+ if (!this.originalContent || !this.originalContent.nativeElement) {
625
+ return null;
626
+ }
627
+ const labelElement = this.originalContent.nativeElement.querySelector('mat-label');
628
+ this.label = labelElement ? labelElement.innerHTML : 'mat-label is missing!';
629
+ }
630
+ correctWidth() {
631
+ const formField = this.originalContent.nativeElement.querySelector('mat-form-field');
632
+ if (formField) {
633
+ formField.setAttribute('style', 'width:100%');
634
+ }
635
+ }
636
+ setReadonlyFieldStyle() {
637
+ const input = this.readOnlyContentWrapper?.nativeElement?.querySelector('input');
638
+ if (input) {
639
+ const textOverFlowStyleValue = this.getTextOverFlowStyleValue();
640
+ if (textOverFlowStyleValue) {
641
+ input.setAttribute('style', 'text-overflow: ' + textOverFlowStyleValue);
642
+ }
643
+ }
644
+ }
645
+ // Ellipsis is enabled by default as text-overflow behaviour
646
+ getTextOverFlowStyleValue() {
647
+ // it works only if the style is added to the component directly. Should find a way for get it from the calculated
648
+ // style. Than it would be possible to define the text-overflow in css for the whole application
649
+ const textOverflow = this.elementRef?.nativeElement?.style.textOverflow;
650
+ if (!textOverflow) {
651
+ return 'ellipsis';
652
+ }
653
+ return textOverflow;
654
+ }
655
+ setTooltipForOverflownField() {
656
+ if (this.isEllipsisForTextOverflowEnabled()) {
657
+ const input = this.readOnlyContentWrapper?.nativeElement?.querySelector('input');
658
+ if (input) {
659
+ this.toolTipForInputEnabled = this.isTextOverflown(input);
660
+ if (this.toolTipForInputEnabled) {
661
+ this.toolTipText = this.calculateToolTipText();
662
+ }
663
+ this.changeDetector.detectChanges();
664
+ }
665
+ }
666
+ }
667
+ isEllipsisForTextOverflowEnabled() {
668
+ return this.getTextOverFlowStyleValue() === 'ellipsis';
669
+ }
670
+ isTextOverflown(input) {
671
+ if (input) {
672
+ return input.offsetWidth < input.scrollWidth;
673
+ }
674
+ return false;
675
+ }
676
+ calculateToolTipText() {
677
+ if (!this.unit) {
678
+ return this.value;
679
+ }
680
+ return this.unitPosition === 'left' ? this.unit + ' ' + this.value : this.value + ' ' + this.unit;
681
+ }
682
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ReadOnlyFormFieldWrapperComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
683
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: ReadOnlyFormFieldWrapperComponent, selector: "mad-readonly-form-field-wrapper", inputs: { readonly: "readonly", value: "value", textAlign: "textAlign", formatNumber: "formatNumber", decimalPlaces: "decimalPlaces", roundValue: ["roundDisplayValue", "roundValue"], autofillDecimals: "autofillDecimals", unit: "unit", unitPosition: "unitPosition", errorMessage: "errorMessage", id: "id", multiline: "multiline", rows: "rows", shrinkIfEmpty: "shrinkIfEmpty" }, viewQueries: [{ propertyName: "originalContent", first: true, predicate: ["contentWrapper"], descendants: true }, { propertyName: "readOnlyContentWrapper", first: true, predicate: ["readOnlyContentWrapper"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div #contentWrapper [hidden]=\"readonly\">\n <ng-content></ng-content>\n</div>\n\n<div #readOnlyContentWrapper>\n <ng-container *ngIf=\"!!readonly\">\n <mad-readonly-form-field\n [label]=\"getLabel()\"\n [value]=\"value\"\n [textAlign]=\"textAlign\"\n [formatNumber]=\"formatNumber\"\n [decimalPlaces]=\"decimalPlaces\"\n [roundDisplayValue]=\"roundValue\"\n [autofillDecimals]=\"autofillDecimals\"\n [unit]=\"unit\"\n [unitPosition]=\"unitPosition\"\n [errorMessage]=\"errorMessage\"\n [multiline]=\"multiline\"\n [rows]=\"rows\"\n [shrinkIfEmpty]=\"shrinkIfEmpty\"\n [id]=\"id\"\n matTooltip=\"{{toolTipText}}\"\n matTooltipPosition=\"right\"\n matTooltipClass=\"custom-tooltip\"\n matTooltipDisabled=\"{{!toolTipForInputEnabled}}\">\n </mad-readonly-form-field>\n </ng-container>\n</div>\n", styles: ["mat-form-field{width:inherit}div{width:inherit}::ng-deep .custom-tooltip{font-size:14px!important;word-break:break-all!important;white-space:normal!important}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "component", type: ReadOnlyFormFieldComponent, selector: "mad-readonly-form-field", inputs: ["value", "label", "textAlign", "formatNumber", "decimalPlaces", "roundDisplayValue", "autofillDecimals", "unit", "unitPosition", "errorMessage", "multiline", "rows", "id", "shrinkIfEmpty"] }] }); }
684
+ }
685
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ReadOnlyFormFieldWrapperComponent, decorators: [{
686
+ type: Component,
687
+ args: [{ selector: 'mad-readonly-form-field-wrapper', template: "<div #contentWrapper [hidden]=\"readonly\">\n <ng-content></ng-content>\n</div>\n\n<div #readOnlyContentWrapper>\n <ng-container *ngIf=\"!!readonly\">\n <mad-readonly-form-field\n [label]=\"getLabel()\"\n [value]=\"value\"\n [textAlign]=\"textAlign\"\n [formatNumber]=\"formatNumber\"\n [decimalPlaces]=\"decimalPlaces\"\n [roundDisplayValue]=\"roundValue\"\n [autofillDecimals]=\"autofillDecimals\"\n [unit]=\"unit\"\n [unitPosition]=\"unitPosition\"\n [errorMessage]=\"errorMessage\"\n [multiline]=\"multiline\"\n [rows]=\"rows\"\n [shrinkIfEmpty]=\"shrinkIfEmpty\"\n [id]=\"id\"\n matTooltip=\"{{toolTipText}}\"\n matTooltipPosition=\"right\"\n matTooltipClass=\"custom-tooltip\"\n matTooltipDisabled=\"{{!toolTipForInputEnabled}}\">\n </mad-readonly-form-field>\n </ng-container>\n</div>\n", styles: ["mat-form-field{width:inherit}div{width:inherit}::ng-deep .custom-tooltip{font-size:14px!important;word-break:break-all!important;white-space:normal!important}\n"] }]
688
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }]; }, propDecorators: { originalContent: [{
689
+ type: ViewChild,
690
+ args: ['contentWrapper', { static: false }]
691
+ }], readOnlyContentWrapper: [{
692
+ type: ViewChild,
693
+ args: ['readOnlyContentWrapper', { static: false }]
694
+ }], readonly: [{
695
+ type: Input
696
+ }], value: [{
697
+ type: Input,
698
+ args: ['value']
699
+ }], textAlign: [{
700
+ type: Input,
701
+ args: ['textAlign']
702
+ }], formatNumber: [{
703
+ type: Input,
704
+ args: ['formatNumber']
705
+ }], decimalPlaces: [{
706
+ type: Input,
707
+ args: ['decimalPlaces']
708
+ }], roundValue: [{
709
+ type: Input,
710
+ args: ['roundDisplayValue']
711
+ }], autofillDecimals: [{
712
+ type: Input,
713
+ args: ['autofillDecimals']
714
+ }], unit: [{
715
+ type: Input,
716
+ args: ['unit']
717
+ }], unitPosition: [{
718
+ type: Input,
719
+ args: ['unitPosition']
720
+ }], errorMessage: [{
721
+ type: Input,
722
+ args: ['errorMessage']
723
+ }], id: [{
724
+ type: Input
725
+ }], multiline: [{
726
+ type: Input
727
+ }], rows: [{
728
+ type: Input
729
+ }], shrinkIfEmpty: [{
730
+ type: Input
731
+ }] } });
732
+
733
+ class ReadOnlyFormFieldModule {
734
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ReadOnlyFormFieldModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
735
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.1", ngImport: i0, type: ReadOnlyFormFieldModule, declarations: [ReadOnlyFormFieldComponent, ReadOnlyFormFieldWrapperComponent], imports: [CommonModule, RouterModule, MatFormFieldModule, MatInputModule, FormsModule, MatTooltipModule], exports: [ReadOnlyFormFieldComponent, ReadOnlyFormFieldWrapperComponent] }); }
736
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ReadOnlyFormFieldModule, imports: [CommonModule, RouterModule, MatFormFieldModule, MatInputModule, FormsModule, MatTooltipModule] }); }
737
+ }
738
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ReadOnlyFormFieldModule, decorators: [{
739
+ type: NgModule,
740
+ args: [{
741
+ declarations: [ReadOnlyFormFieldComponent, ReadOnlyFormFieldWrapperComponent],
742
+ imports: [CommonModule, RouterModule, MatFormFieldModule, MatInputModule, FormsModule, MatTooltipModule],
743
+ exports: [ReadOnlyFormFieldComponent, ReadOnlyFormFieldWrapperComponent],
744
+ }]
745
+ }] });
746
+
747
+ class ToolbarService {
748
+ constructor(router, translate) {
749
+ this.router = router;
750
+ this.translate = translate;
751
+ this.mainActions = []; // shown on the left, next to title, as big buttons
752
+ this.toolbarActions = []; // shown on the right as icons
753
+ this.toolbarActionsAlwaysAsMenu = false; // show the mobile view (burger menu) for toolbar actions
754
+ this.toolbarActionsMenuTitle = 'More'; // title of the burger menu
755
+ this.routerSubscription = this.router.events.subscribe(routingEvent => {
756
+ if (routingEvent instanceof NavigationEnd) {
757
+ if (this.currentUrl !== routingEvent.urlAfterRedirects) {
758
+ this.clearToolbarActions();
759
+ this.clearMainActions();
760
+ delete this.backAction;
761
+ delete this.dataTitle;
762
+ }
763
+ this.currentUrl = router.url;
764
+ }
765
+ });
766
+ }
767
+ get toolbarTitle() {
768
+ return this.title;
769
+ }
770
+ set toolbarTitle(toolbarTitle) {
771
+ this.title = toolbarTitle;
772
+ }
773
+ ngOnDestroy() {
774
+ if (this.routerSubscription) {
775
+ this.routerSubscription.unsubscribe();
776
+ }
777
+ }
778
+ getToolbarActions() {
779
+ return this.toolbarActions;
780
+ }
781
+ addToolbarAction(action) {
782
+ this.translate
783
+ .get(action.i18nActionKey)
784
+ .toPromise()
785
+ .then(translated => {
786
+ action.actionName = translated;
787
+ this.toolbarActions.push(action);
788
+ });
789
+ }
790
+ setDataTitle(dataTitle) {
791
+ this.dataTitle = dataTitle;
792
+ }
793
+ setToolbarActionsAlwaysAsMenu(toolbarActionsAlwaysAsMenu) {
794
+ this.toolbarActionsAlwaysAsMenu = toolbarActionsAlwaysAsMenu;
795
+ }
796
+ getToolbarActionsAlwaysAsMenu() {
797
+ return this.toolbarActionsAlwaysAsMenu;
798
+ }
799
+ getDataTitle() {
800
+ return this.dataTitle;
801
+ }
802
+ clearToolbarActions() {
803
+ this.toolbarActions = [];
804
+ }
805
+ getMainActions() {
806
+ return this.mainActions;
807
+ }
808
+ getBackAction() {
809
+ return this.backAction;
810
+ }
811
+ setToolbarActionsMenuTitle(toolbarActionsMenuTitle) {
812
+ this.toolbarActionsMenuTitle = toolbarActionsMenuTitle;
813
+ }
814
+ getToolbarActionsMenuTitle() {
815
+ return this.toolbarActionsMenuTitle;
816
+ }
817
+ addMainAction(mainAction) {
818
+ this.translate
819
+ .get(mainAction.i18nActionKey)
820
+ .toPromise()
821
+ .then(translated => {
822
+ mainAction.actionName = translated;
823
+ this.mainActions.push(mainAction);
824
+ });
825
+ }
826
+ /**
827
+ * Per default the goBackRoute is a routerLink. But if a href should be used (for absolute browser routing) then isAbsoluteUrl can be set to true.
828
+ */
829
+ addBackAction(goBackRoute, isAbsoluteUrl = false) {
830
+ this.backAction = {
831
+ matIcon: 'keyboard_backspace',
832
+ i18nActionKey: '',
833
+ };
834
+ if (!isAbsoluteUrl) {
835
+ this.backAction.routerLink = goBackRoute;
836
+ }
837
+ else {
838
+ this.backAction.href = goBackRoute;
839
+ }
840
+ }
841
+ addSimpleBackButton(overrideIfPresent = false) {
842
+ if (this.getBackAction() && !overrideIfPresent) {
843
+ return;
844
+ }
845
+ this.backAction = {
846
+ matIcon: 'keyboard_backspace',
847
+ i18nActionKey: '',
848
+ action() {
849
+ window.history.back();
850
+ },
851
+ };
852
+ }
853
+ clearMainActions() {
854
+ this.mainActions = [];
855
+ }
856
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ToolbarService, deps: [{ token: i1$1.Router }, { token: i2$1.TranslateService }], target: i0.ɵɵFactoryTarget.Injectable }); }
857
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ToolbarService, providedIn: 'root' }); }
858
+ }
859
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ToolbarService, decorators: [{
860
+ type: Injectable,
861
+ args: [{
862
+ providedIn: 'root',
863
+ }]
864
+ }], ctorParameters: function () { return [{ type: i1$1.Router }, { type: i2$1.TranslateService }]; } });
865
+
866
+ class ToolbarComponent {
867
+ constructor(breakpointObserver, titleService, toolbarService) {
868
+ this.breakpointObserver = breakpointObserver;
869
+ this.titleService = titleService;
870
+ this.toolbarService = toolbarService;
871
+ this.isHandset$ = this.breakpointObserver.observe([Breakpoints.Handset]).pipe(map(result => result.matches));
872
+ }
873
+ getTitle() {
874
+ const dataTitle = this.toolbarService.getDataTitle();
875
+ const toolbarTitle = this.toolbarService.toolbarTitle;
876
+ const title = !toolbarTitle || toolbarTitle.length <= 0 ? this.titleService.getTitle() : toolbarTitle;
877
+ return !dataTitle || dataTitle.length <= 0 ? title : title + ': ' + dataTitle;
878
+ }
879
+ getToolbarActions() {
880
+ return this.toolbarService.getToolbarActions();
881
+ }
882
+ getMainActions() {
883
+ return this.toolbarService.getMainActions();
884
+ }
885
+ hasPermission(action) {
886
+ if (!action || !action.showIf) {
887
+ return of(true);
888
+ }
889
+ return action.showIf;
890
+ }
891
+ isRouterLink() {
892
+ return this.toolbarService.getBackAction() && !!this.toolbarService.getBackAction().routerLink;
893
+ }
894
+ isAbsoluteLink() {
895
+ return this.toolbarService.getBackAction() && !!this.toolbarService.getBackAction().href;
896
+ }
897
+ isAction() {
898
+ return this.toolbarService.getBackAction() && !!this.toolbarService.getBackAction().action;
899
+ }
900
+ getBackAction() {
901
+ return this.toolbarService.getBackAction();
902
+ }
903
+ getToolbarActionsAlwaysAsMenu() {
904
+ return this.toolbarService.getToolbarActionsAlwaysAsMenu();
905
+ }
906
+ getToolbarActionsMenuTitle() {
907
+ return this.toolbarService.getToolbarActionsMenuTitle();
908
+ }
909
+ showBadgeForMenu() {
910
+ return (this.getToolbarActions()
911
+ .slice(1) // the first icon is not shown in menu
912
+ .filter(value => value.badge && value.badge.value).length > 0);
913
+ }
914
+ hasImportantToolbarActions() {
915
+ return this.getToolbarActions().filter(value => !!value.importantAction).length > 0;
916
+ }
917
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ToolbarComponent, deps: [{ token: i1$3.BreakpointObserver }, { token: i2$2.Title }, { token: ToolbarService }], target: i0.ɵɵFactoryTarget.Component }); }
918
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: ToolbarComponent, selector: "mad-toolbar", ngImport: i0, template: "<mat-toolbar class=\"content-toolbar\">\n <a [routerLink]=\"getBackAction().routerLink\" *ngIf=\"isRouterLink()\">\n <button [id]=\"'go-back'\" color=\"primary\" mat-icon-button class=\"go-back-button\">\n <mat-icon>{{ getBackAction().matIcon }}</mat-icon>\n </button>\n </a>\n <a [href]=\"getBackAction().href\" *ngIf=\"isAbsoluteLink()\">\n <button [id]=\"'go-back'\" class=\"go-back-button\" color=\"primary\" mat-icon-button>\n <mat-icon>{{ getBackAction().matIcon }}</mat-icon>\n </button>\n </a>\n <a (click)=\"getBackAction().action()\" *ngIf=\"isAction()\">\n <button [id]=\"'go-back'\" color=\"primary\" mat-icon-button class=\"go-back-button\">\n <mat-icon>{{ getBackAction().matIcon }}</mat-icon>\n </button>\n </a>\n\n <span class=\"toolbar-title\">{{ getTitle() }}</span>\n\n <ng-container *ngFor=\"let mainAction of getMainActions(); let i = index\">\n <ng-container *ngIf=\"hasPermission(mainAction) | async\">\n <div *ngIf=\"!(isHandset$ | async)\">\n <a [routerLink]=\"mainAction.routerLink\">\n <mad-primary-button [id]=\"mainAction.matIcon\" style=\"margin-left: 56px\">\n <mat-icon>{{ mainAction.matIcon }}</mat-icon>\n {{ mainAction.actionName }}\n </mad-primary-button>\n </a>\n </div>\n <div *ngIf=\"isHandset$ | async\">\n <mad-material-action-button\n [actionName]=\"mainAction.actionName\"\n [icon]=\"mainAction.matIcon\"\n [liftHigher]=\"mainAction.liftHigherOnMobile\"\n [liftHigher2]=\"i > 0\"\n [routerLink]=\"mainAction.routerLink\"\n [id]=\"mainAction.matIcon\"\n >\n </mad-material-action-button>\n </div>\n </ng-container>\n </ng-container>\n\n <div class=\"right-aligned no-print\">\n <ng-container *ngFor=\"let action of getToolbarActions(); let i = index\">\n <ng-container *ngIf=\"hasPermission(action) | async\">\n <mad-icon-button\n (click)=\"action.action()\"\n *ngIf=\"(!(isHandset$ | async) && !getToolbarActionsAlwaysAsMenu()) || i < (getToolbarActions().length > 2 ? (hasImportantToolbarActions() ? 0:1) : 2) || !!action.importantAction\"\n [id]=\"action.matIcon\"\n [matTooltip]=\"action.actionName\"\n type=\"button\">\n <mat-icon\n [matBadgeColor]=\"action.badge ? action.badge.color : 'primary'\"\n matBadgePosition=\"below after\"\n [matBadge]=\"action.badge ? action.badge.value : null\"\n >{{ action.matIcon }}</mat-icon>\n </mad-icon-button>\n </ng-container>\n </ng-container>\n\n <ng-container *ngIf=\"(isHandset$ | async) || getToolbarActionsAlwaysAsMenu()\">\n <ng-container *ngIf=\"getToolbarActions().length > 2\">\n <mad-icon-button type=\"button\" [matMenuTriggerFor]=\"burgerMenu\" [matTooltip]=\"getToolbarActionsMenuTitle()\">\n <mat-icon\n matBadgeColor=\"warn\"\n [matBadge]=\"showBadgeForMenu() ? '&#8288;' : null\"\n matBadgeSize=\"small\"\n matBadgePosition=\"above after\"\n >more_vert\n </mat-icon>\n </mad-icon-button>\n <mat-menu #burgerMenu=\"matMenu\" class=\"no-print toolbar-menu\">\n <ng-container *ngFor=\"let action of getToolbarActions(); let i = index\">\n <ng-container *ngIf=\"!action.importantAction\">\n <ng-container *ngIf=\"hasPermission(action) | async\">\n <button\n *ngIf=\"i >= (hasImportantToolbarActions() ? 0:1)\" mat-menu-item (click)=\"action.action()\"\n [title]=\"action.actionName\">\n <mat-icon\n color=\"primary\"\n [matBadgeColor]=\"action.badge ? action.badge.color : 'primary'\"\n [matBadge]=\"action.badge ? action.badge.value : null\"\n matBadgePosition=\"below after\"\n >{{ action.matIcon }}</mat-icon\n >\n {{ action.actionName }}\n </button>\n </ng-container>\n </ng-container>\n </ng-container>\n </mat-menu>\n </ng-container>\n </ng-container>\n </div>\n</mat-toolbar>\n", styles: ["mat-toolbar{background:white}.content-toolbar{height:57px;border-bottom:1px solid #dcdcdc}.right-aligned{overflow:hidden;margin-left:auto;margin-right:0}.go-back-button{padding-left:0;padding-right:0}.toolbar-title{margin-right:72px}::ng-deep .mat-badge-content{bottom:-7px!important;right:-7px!important}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "component", type: i6.MatMenu, selector: "mat-menu", exportAs: ["matMenu"] }, { kind: "component", type: i6.MatMenuItem, selector: "[mat-menu-item]", inputs: ["disabled", "disableRipple", "role"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i6.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", exportAs: ["matMenuTrigger"] }, { kind: "component", type: i1$2.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i8.MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: MaterialActionButtonComponent, selector: "mad-material-action-button", inputs: ["actionName", "id", "icon", "routerLink", "liftHigher", "liftHigher2"] }, { kind: "directive", type: i5.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "component", type: PrimaryButtonComponent, selector: "mad-primary-button", inputs: ["type", "disabled", "title"] }, { kind: "component", type: IconButtonComponent, selector: "mad-icon-button", inputs: ["type", "disabled", "title"] }, { kind: "directive", type: i14.MatBadge, selector: "[matBadge]", inputs: ["matBadgeDisabled", "matBadgeColor", "matBadgeOverlap", "matBadgePosition", "matBadge", "matBadgeDescription", "matBadgeSize", "matBadgeHidden"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }] }); }
919
+ }
920
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ToolbarComponent, decorators: [{
921
+ type: Component,
922
+ args: [{ selector: 'mad-toolbar', template: "<mat-toolbar class=\"content-toolbar\">\n <a [routerLink]=\"getBackAction().routerLink\" *ngIf=\"isRouterLink()\">\n <button [id]=\"'go-back'\" color=\"primary\" mat-icon-button class=\"go-back-button\">\n <mat-icon>{{ getBackAction().matIcon }}</mat-icon>\n </button>\n </a>\n <a [href]=\"getBackAction().href\" *ngIf=\"isAbsoluteLink()\">\n <button [id]=\"'go-back'\" class=\"go-back-button\" color=\"primary\" mat-icon-button>\n <mat-icon>{{ getBackAction().matIcon }}</mat-icon>\n </button>\n </a>\n <a (click)=\"getBackAction().action()\" *ngIf=\"isAction()\">\n <button [id]=\"'go-back'\" color=\"primary\" mat-icon-button class=\"go-back-button\">\n <mat-icon>{{ getBackAction().matIcon }}</mat-icon>\n </button>\n </a>\n\n <span class=\"toolbar-title\">{{ getTitle() }}</span>\n\n <ng-container *ngFor=\"let mainAction of getMainActions(); let i = index\">\n <ng-container *ngIf=\"hasPermission(mainAction) | async\">\n <div *ngIf=\"!(isHandset$ | async)\">\n <a [routerLink]=\"mainAction.routerLink\">\n <mad-primary-button [id]=\"mainAction.matIcon\" style=\"margin-left: 56px\">\n <mat-icon>{{ mainAction.matIcon }}</mat-icon>\n {{ mainAction.actionName }}\n </mad-primary-button>\n </a>\n </div>\n <div *ngIf=\"isHandset$ | async\">\n <mad-material-action-button\n [actionName]=\"mainAction.actionName\"\n [icon]=\"mainAction.matIcon\"\n [liftHigher]=\"mainAction.liftHigherOnMobile\"\n [liftHigher2]=\"i > 0\"\n [routerLink]=\"mainAction.routerLink\"\n [id]=\"mainAction.matIcon\"\n >\n </mad-material-action-button>\n </div>\n </ng-container>\n </ng-container>\n\n <div class=\"right-aligned no-print\">\n <ng-container *ngFor=\"let action of getToolbarActions(); let i = index\">\n <ng-container *ngIf=\"hasPermission(action) | async\">\n <mad-icon-button\n (click)=\"action.action()\"\n *ngIf=\"(!(isHandset$ | async) && !getToolbarActionsAlwaysAsMenu()) || i < (getToolbarActions().length > 2 ? (hasImportantToolbarActions() ? 0:1) : 2) || !!action.importantAction\"\n [id]=\"action.matIcon\"\n [matTooltip]=\"action.actionName\"\n type=\"button\">\n <mat-icon\n [matBadgeColor]=\"action.badge ? action.badge.color : 'primary'\"\n matBadgePosition=\"below after\"\n [matBadge]=\"action.badge ? action.badge.value : null\"\n >{{ action.matIcon }}</mat-icon>\n </mad-icon-button>\n </ng-container>\n </ng-container>\n\n <ng-container *ngIf=\"(isHandset$ | async) || getToolbarActionsAlwaysAsMenu()\">\n <ng-container *ngIf=\"getToolbarActions().length > 2\">\n <mad-icon-button type=\"button\" [matMenuTriggerFor]=\"burgerMenu\" [matTooltip]=\"getToolbarActionsMenuTitle()\">\n <mat-icon\n matBadgeColor=\"warn\"\n [matBadge]=\"showBadgeForMenu() ? '&#8288;' : null\"\n matBadgeSize=\"small\"\n matBadgePosition=\"above after\"\n >more_vert\n </mat-icon>\n </mad-icon-button>\n <mat-menu #burgerMenu=\"matMenu\" class=\"no-print toolbar-menu\">\n <ng-container *ngFor=\"let action of getToolbarActions(); let i = index\">\n <ng-container *ngIf=\"!action.importantAction\">\n <ng-container *ngIf=\"hasPermission(action) | async\">\n <button\n *ngIf=\"i >= (hasImportantToolbarActions() ? 0:1)\" mat-menu-item (click)=\"action.action()\"\n [title]=\"action.actionName\">\n <mat-icon\n color=\"primary\"\n [matBadgeColor]=\"action.badge ? action.badge.color : 'primary'\"\n [matBadge]=\"action.badge ? action.badge.value : null\"\n matBadgePosition=\"below after\"\n >{{ action.matIcon }}</mat-icon\n >\n {{ action.actionName }}\n </button>\n </ng-container>\n </ng-container>\n </ng-container>\n </mat-menu>\n </ng-container>\n </ng-container>\n </div>\n</mat-toolbar>\n", styles: ["mat-toolbar{background:white}.content-toolbar{height:57px;border-bottom:1px solid #dcdcdc}.right-aligned{overflow:hidden;margin-left:auto;margin-right:0}.go-back-button{padding-left:0;padding-right:0}.toolbar-title{margin-right:72px}::ng-deep .mat-badge-content{bottom:-7px!important;right:-7px!important}\n"] }]
923
+ }], ctorParameters: function () { return [{ type: i1$3.BreakpointObserver }, { type: i2$2.Title }, { type: ToolbarService }]; } });
924
+
925
+ class ToolbarModule {
926
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ToolbarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
927
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.1", ngImport: i0, type: ToolbarModule, declarations: [ToolbarComponent], imports: [CommonModule,
928
+ RouterModule,
929
+ MatMenuModule,
930
+ MatButtonModule,
931
+ MatToolbarModule,
932
+ MatIconModule,
933
+ MaterialActionButtonModule,
934
+ MatTooltipModule,
935
+ ButtonModule,
936
+ MatBadgeModule], exports: [ToolbarComponent] }); }
937
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ToolbarModule, imports: [CommonModule,
938
+ RouterModule,
939
+ MatMenuModule,
940
+ MatButtonModule,
941
+ MatToolbarModule,
942
+ MatIconModule,
943
+ MaterialActionButtonModule,
944
+ MatTooltipModule,
945
+ ButtonModule,
946
+ MatBadgeModule] }); }
947
+ }
948
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ToolbarModule, decorators: [{
949
+ type: NgModule,
950
+ args: [{
951
+ declarations: [ToolbarComponent],
952
+ imports: [
953
+ CommonModule,
954
+ RouterModule,
955
+ MatMenuModule,
956
+ MatButtonModule,
957
+ MatToolbarModule,
958
+ MatIconModule,
959
+ MaterialActionButtonModule,
960
+ MatTooltipModule,
961
+ ButtonModule,
962
+ MatBadgeModule,
963
+ ],
964
+ exports: [ToolbarComponent],
965
+ }]
966
+ }] });
967
+
968
+ /*
969
+ * Copyright (c) 2018-2020 Porsche Informatik. All Rights Reserved.
970
+ * This software is released under MIT license.
971
+ * The full license information can be found in LICENSE in the root directory of this project.
972
+ */
973
+ const BACK_KEYCODE = 8;
974
+ const SPACE_KEYCODE = 32;
975
+ const DEL_KEYCODE = 46;
976
+ const CONTROL_KEYCODES_UPPER_BORDER = 46;
977
+ const OTHER_CONTROL_KEYS = new Set([224, 91, 93]);
978
+ class NumericFieldDirective {
979
+ set numericValue(value) {
980
+ if (this._numericValue !== value && !(isNaN(this._numericValue) && (isNaN(value) || value === null))) {
981
+ this.originalValue = value;
982
+ // Don't roundOrTruncate if value was set to empty otherwise input value will be set to 0 instead of empty
983
+ // which happens when an input is being reset
984
+ this._numericValue = value === null || value === undefined ? value : this.roundOrTruncate(value); // eslint-disable-line
985
+ this.handleInputChanged();
986
+ }
987
+ }
988
+ constructor(renderer, inputEl, numberFormatService) {
989
+ this.renderer = renderer;
990
+ this.inputEl = inputEl;
991
+ this.numberFormatService = numberFormatService;
992
+ this.textAlign = 'right';
993
+ this.decimalPlaces = 2;
994
+ this.roundValue = false;
995
+ this.autofillDecimals = false;
996
+ this.unit = null;
997
+ this.unitPosition = 'right';
998
+ this.numericValueChanged = new EventEmitter();
999
+ this.displayValue = '';
1000
+ this.originalValue = NaN;
1001
+ /* Control Values Accessor Stuff below */
1002
+ // eslint-disable-next-line
1003
+ this.onChange = () => { };
1004
+ // eslint-disable-next-line
1005
+ this.onTouched = () => { };
1006
+ }
1007
+ registerOnChange(fn) {
1008
+ this.onChange = fn;
1009
+ }
1010
+ registerOnTouched(fn) {
1011
+ this.onTouched = fn;
1012
+ }
1013
+ setDisabledState() {
1014
+ // Dont need to implement since its just a directive
1015
+ }
1016
+ writeValue(value) {
1017
+ this.numericValue = value;
1018
+ }
1019
+ ngOnInit() {
1020
+ /* needs to be parsed as number explicitly as it comes as string from user input */
1021
+ this.decimalPlaces = parseInt(this.decimalPlaces.toString(), 10);
1022
+ this.inputChangeListener = this.renderer.listen(this.inputEl.nativeElement, 'blur', event => {
1023
+ this.formatInput(event.target, true);
1024
+ });
1025
+ this.keyupListener = this.renderer.listen(this.inputEl.nativeElement, 'keyup', event => {
1026
+ if (event.keyCode === BACK_KEYCODE || (event.keyCode >= CONTROL_KEYCODES_UPPER_BORDER && !OTHER_CONTROL_KEYS.has(event.keyCode))) {
1027
+ this.formatInput(event.target, false);
1028
+ }
1029
+ });
1030
+ this.keydownListener = this.renderer.listen(this.inputEl.nativeElement, 'keydown', event => {
1031
+ const value = event.target.value;
1032
+ if (this.numberFormatService.allowedKeys.includes(event.key) ||
1033
+ (event.keyCode <= CONTROL_KEYCODES_UPPER_BORDER && event.keyCode > 0 && event.keyCode !== SPACE_KEYCODE) ||
1034
+ event.metaKey ||
1035
+ event.ctrlKey ||
1036
+ event.altKey) {
1037
+ /* allow negative sign only as first character and none exists outside of text selection */
1038
+ const indexNegativeSign = value.indexOf(NumberFormatService.NEGATIVE);
1039
+ if (event.key === NumberFormatService.NEGATIVE &&
1040
+ (event.target.selectionStart > 0 || indexNegativeSign > -1) &&
1041
+ (event.target.selectionStart === event.target.selectionEnd ||
1042
+ !(indexNegativeSign >= event.target.selectionStart && indexNegativeSign <= event.target.selectionEnd))) {
1043
+ return false;
1044
+ }
1045
+ /* no duplicate decimal separators */
1046
+ const indexDecimalSep = value.indexOf(this.numberFormatService.decimalSeparator);
1047
+ if (event.key === this.numberFormatService.decimalSeparator &&
1048
+ (indexDecimalSep > -1 || this.decimalPlaces === 0) &&
1049
+ (event.target.selectionStart === event.target.selectionEnd ||
1050
+ !(indexDecimalSep >= event.target.selectionStart && indexDecimalSep <= event.target.selectionEnd))) {
1051
+ return false;
1052
+ }
1053
+ /* prevent too many decimal places */
1054
+ if (NumberFormatService.NUMBERS.includes(event.key) &&
1055
+ indexDecimalSep > -1 &&
1056
+ indexDecimalSep < event.target.selectionStart &&
1057
+ event.target.selectionStart === event.target.selectionEnd &&
1058
+ value.length > indexDecimalSep + this.decimalPlaces) {
1059
+ return false;
1060
+ }
1061
+ /* when deleting thousand separator, remove the digit before or after it */
1062
+ const cursorStart = event.target.selectionStart;
1063
+ if (cursorStart === event.target.selectionEnd) {
1064
+ if (event.keyCode === BACK_KEYCODE && value.substr(cursorStart - 1, 1) === this.numberFormatService.groupingSeparator) {
1065
+ event.target.value = value.substring(0, cursorStart - 2) + value.substring(cursorStart - 1, value.length);
1066
+ event.target.selectionStart = event.target.selectionEnd = cursorStart - 1;
1067
+ return false;
1068
+ }
1069
+ else if (event.keyCode === DEL_KEYCODE && value.substr(cursorStart, 1) === this.numberFormatService.groupingSeparator) {
1070
+ event.target.value = value.substring(0, cursorStart + 1) + value.substring(cursorStart + 2, value.length);
1071
+ event.target.selectionStart = event.target.selectionEnd = cursorStart + 1;
1072
+ return false;
1073
+ }
1074
+ }
1075
+ this.originalValue = NaN;
1076
+ }
1077
+ else {
1078
+ return false;
1079
+ }
1080
+ return true;
1081
+ });
1082
+ }
1083
+ ngOnDestroy() {
1084
+ this.detachListener();
1085
+ }
1086
+ ngAfterViewChecked() {
1087
+ this.injectUnitSymbol();
1088
+ }
1089
+ handleInputChanged() {
1090
+ // Call in set timeout to avoid Expression has changed after it has been checked error.
1091
+ // Sometimes the value changes because we cut off decimal places
1092
+ setTimeout(() => {
1093
+ this.updateInput(this.numberFormatService.format(this._numericValue, {
1094
+ decimalPlaces: this.decimalPlaces,
1095
+ finalFormatting: false,
1096
+ autofillDecimals: this.autofillDecimals,
1097
+ }));
1098
+ }, 1);
1099
+ }
1100
+ formatInput(element, finalFormatting) {
1101
+ const cursorPos = element.selectionStart;
1102
+ const length = element.value.length;
1103
+ const setCursor = this.displayValue !== element.value;
1104
+ const textFormatted = this.numberFormatService.formatNumber(element.value, {
1105
+ decimalPlaces: this.decimalPlaces,
1106
+ finalFormatting,
1107
+ autofillDecimals: this.autofillDecimals,
1108
+ });
1109
+ // special handling to move unit symbol along with display value
1110
+ if (this.textAlign === 'left' && this.unitPosition === 'right') {
1111
+ const inputStyles = window.getComputedStyle(this.inputEl.nativeElement.parentElement, null);
1112
+ this.unitSpan.style.position = 'absolute';
1113
+ this.unitSpan.style.marginTop = inputStyles.getPropertyValue('border-top-width');
1114
+ this.unitSpan.style.paddingTop = inputStyles.getPropertyValue('padding-top');
1115
+ this.unitSpan.style.paddingBottom = inputStyles.getPropertyValue('padding-bottom');
1116
+ if (!this.textSpan) {
1117
+ this.textSpan = document.createElement('span');
1118
+ document.body.appendChild(this.textSpan);
1119
+ this.textSpan.style.font = inputStyles.getPropertyValue('font');
1120
+ this.textSpan.style.fontSize = inputStyles.getPropertyValue('font-size');
1121
+ this.textSpan.style.height = 'auto';
1122
+ this.textSpan.style.width = 'auto';
1123
+ this.textSpan.style.position = 'absolute';
1124
+ this.textSpan.style.top = '0';
1125
+ this.textSpan.style.whiteSpace = 'no-wrap';
1126
+ this.textSpan.style.visibility = 'hidden';
1127
+ }
1128
+ this.textSpan.innerHTML = textFormatted;
1129
+ const width = Math.min(this.inputEl.nativeElement.clientWidth - this.unitSpan.clientWidth, Math.ceil(this.textSpan.clientWidth));
1130
+ this.unitSpan.style.left = width + 'px';
1131
+ }
1132
+ this.updateInput(textFormatted);
1133
+ if (setCursor) {
1134
+ element.selectionStart = element.selectionEnd = Math.max(cursorPos + element.value.length - length, 0);
1135
+ }
1136
+ }
1137
+ updateInput(value) {
1138
+ this.displayValue = value;
1139
+ this.inputEl.nativeElement.value = value;
1140
+ this._numericValue = parseFloat(this.numberFormatService.strip(value, { decimalPlaces: this.decimalPlaces }).replace(this.numberFormatService.decimalSeparator, '.'));
1141
+ if (this._numericValue !== this.roundOrTruncate(this.originalValue)) {
1142
+ this.originalValue = this._numericValue;
1143
+ this.numericValueChanged.emit(this._numericValue);
1144
+ }
1145
+ }
1146
+ getValueForFormControl() {
1147
+ this.formatInput(this.inputEl.nativeElement, false);
1148
+ if (isNaN(this._numericValue)) {
1149
+ // Return undefined instead of NaN to support the default required validator.
1150
+ return undefined; // eslint-disable-line
1151
+ }
1152
+ return this._numericValue;
1153
+ }
1154
+ injectUnitSymbol() {
1155
+ // Need to inject the unit symbol when the input element width is set to its actual value,
1156
+ // otherwise the icon wont show in the correct position
1157
+ if (!!this.unit && !this.unitSpan && this.inputEl.nativeElement.offsetWidth !== 0) {
1158
+ // Get the input wrapper and apply necessary styles
1159
+ const inputWrapper = this.inputEl.nativeElement.parentNode.parentNode;
1160
+ // Create the span with unit symbol and apply necessary styles
1161
+ this.unitSpan = this.renderer.createElement('span');
1162
+ if (this.unitPosition === 'left') {
1163
+ this.renderer.setAttribute(this.unitSpan, 'matPrefix', '');
1164
+ this.renderer.setStyle(this.unitSpan, 'padding-right', '5px');
1165
+ this.renderer.insertBefore(inputWrapper, this.unitSpan, inputWrapper.children[0]);
1166
+ }
1167
+ else {
1168
+ this.renderer.setAttribute(this.unitSpan, 'matSuffix', '');
1169
+ this.renderer.setStyle(this.unitSpan, 'padding-left', '5px');
1170
+ this.renderer.appendChild(inputWrapper, this.unitSpan);
1171
+ }
1172
+ }
1173
+ // do not display unit symbol if the unit should move along display value
1174
+ if (!!this.unitSpan && this.textAlign === 'left' && this.unitPosition === 'right') {
1175
+ if (NumberFormatService.valueIsSet(this.displayValue)) {
1176
+ this.unitSpan.style.display = 'unset';
1177
+ }
1178
+ else {
1179
+ this.unitSpan.style.display = 'none';
1180
+ }
1181
+ }
1182
+ // always reset unit symbol
1183
+ if (!!this.unitSpan) {
1184
+ this.unitSpan.textContent = this.unit;
1185
+ }
1186
+ }
1187
+ detachListener() {
1188
+ if (this.inputChangeListener) {
1189
+ this.inputChangeListener();
1190
+ delete this.inputChangeListener;
1191
+ }
1192
+ if (this.keydownListener) {
1193
+ this.keydownListener();
1194
+ delete this.keydownListener;
1195
+ }
1196
+ if (this.keyupListener) {
1197
+ this.keyupListener();
1198
+ delete this.keyupListener;
1199
+ }
1200
+ }
1201
+ roundOrTruncate(value) {
1202
+ const method = this.roundValue ? 'round' : value < 0 ? 'ceil' : 'floor';
1203
+ return Math[method](value * Math.pow(10, this.decimalPlaces)) / Math.pow(10, this.decimalPlaces);
1204
+ }
1205
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: NumericFieldDirective, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }, { token: NumberFormatService }], target: i0.ɵɵFactoryTarget.Directive }); }
1206
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.1", type: NumericFieldDirective, selector: "[madNumericField]", inputs: { textAlign: "textAlign", decimalPlaces: "decimalPlaces", roundValue: ["roundDisplayValue", "roundValue"], autofillDecimals: "autofillDecimals", unit: "unit", unitPosition: "unitPosition", numericValue: "numericValue" }, outputs: { numericValueChanged: "numericValueChange" }, host: { listeners: { "change": "onChange(getValueForFormControl())", "input": "onChange(getValueForFormControl())", "blur": "onTouched()" }, properties: { "class.text-right": "textAlign === \"right\"" } }, providers: [
1207
+ {
1208
+ provide: NG_VALUE_ACCESSOR,
1209
+ useExisting: forwardRef(() => NumericFieldDirective),
1210
+ multi: true,
1211
+ },
1212
+ ], ngImport: i0 }); }
1213
+ }
1214
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: NumericFieldDirective, decorators: [{
1215
+ type: Directive,
1216
+ args: [{
1217
+ selector: '[madNumericField]',
1218
+ host: {
1219
+ '[class.text-right]': 'textAlign === "right"',
1220
+ '(change)': 'onChange(getValueForFormControl())',
1221
+ '(input)': 'onChange(getValueForFormControl())',
1222
+ '(blur)': 'onTouched()',
1223
+ },
1224
+ providers: [
1225
+ {
1226
+ provide: NG_VALUE_ACCESSOR,
1227
+ useExisting: forwardRef(() => NumericFieldDirective),
1228
+ multi: true,
1229
+ },
1230
+ ],
1231
+ }]
1232
+ }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type: NumberFormatService }]; }, propDecorators: { textAlign: [{
1233
+ type: Input,
1234
+ args: ['textAlign']
1235
+ }], decimalPlaces: [{
1236
+ type: Input,
1237
+ args: ['decimalPlaces']
1238
+ }], roundValue: [{
1239
+ type: Input,
1240
+ args: ['roundDisplayValue']
1241
+ }], autofillDecimals: [{
1242
+ type: Input,
1243
+ args: ['autofillDecimals']
1244
+ }], unit: [{
1245
+ type: Input,
1246
+ args: ['unit']
1247
+ }], unitPosition: [{
1248
+ type: Input,
1249
+ args: ['unitPosition']
1250
+ }], numericValueChanged: [{
1251
+ type: Output,
1252
+ args: ['numericValueChange']
1253
+ }], numericValue: [{
1254
+ type: Input,
1255
+ args: ['numericValue']
1256
+ }] } });
1257
+
1258
+ class NumericFieldModule {
1259
+ static forRoot() {
1260
+ return {
1261
+ ngModule: NumericFieldModule,
1262
+ providers: [NumberFormatService],
1263
+ };
1264
+ }
1265
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: NumericFieldModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1266
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.1", ngImport: i0, type: NumericFieldModule, declarations: [NumericFieldDirective], exports: [NumericFieldDirective] }); }
1267
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: NumericFieldModule, providers: [NumberFormatService] }); }
1268
+ }
1269
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: NumericFieldModule, decorators: [{
1270
+ type: NgModule,
1271
+ args: [{
1272
+ providers: [NumberFormatService],
1273
+ declarations: [NumericFieldDirective],
1274
+ exports: [NumericFieldDirective],
1275
+ }]
1276
+ }] });
1277
+
1278
+ class ThrottleClickDirective {
1279
+ constructor() {
1280
+ this.throttleTime = 300;
1281
+ this.throttleClick = new EventEmitter();
1282
+ this.clicks = new Subject();
1283
+ }
1284
+ clickEvent(event) {
1285
+ event.preventDefault();
1286
+ event.stopPropagation();
1287
+ this.clicks.next(event);
1288
+ }
1289
+ ngOnInit() {
1290
+ this.subscription = this.clicks.pipe(throttleTime(this.throttleTime)).subscribe(e => this.throttleClick.emit(e));
1291
+ }
1292
+ ngOnDestroy() {
1293
+ this.subscription.unsubscribe();
1294
+ }
1295
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ThrottleClickDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1296
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.1", type: ThrottleClickDirective, selector: "[madThrottleClick]", inputs: { throttleTime: "throttleTime" }, outputs: { throttleClick: "throttleClick" }, host: { listeners: { "click": "clickEvent($event)" } }, ngImport: i0 }); }
1297
+ }
1298
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ThrottleClickDirective, decorators: [{
1299
+ type: Directive,
1300
+ args: [{
1301
+ selector: '[madThrottleClick]',
1302
+ }]
1303
+ }], propDecorators: { throttleTime: [{
1304
+ type: Input
1305
+ }], throttleClick: [{
1306
+ type: Output
1307
+ }], clickEvent: [{
1308
+ type: HostListener,
1309
+ args: ['click', ['$event']]
1310
+ }] } });
1311
+
1312
+ class CardComponent {
1313
+ constructor() {
1314
+ this.cancelDisabled = false;
1315
+ this.cancelText = 'NOT SET';
1316
+ this.readonly = true;
1317
+ this.editText = 'NOT SET';
1318
+ this.expandable = true;
1319
+ this.expanded = true;
1320
+ this.saveDisabled = false;
1321
+ this.saveText = 'NOT SET';
1322
+ this.editMode = false;
1323
+ this.additionalActionText = '';
1324
+ this.edit = new EventEmitter();
1325
+ this.cancel = new EventEmitter();
1326
+ this.save = new EventEmitter();
1327
+ this.additionalAction = new EventEmitter();
1328
+ }
1329
+ onCancel() {
1330
+ this.cancel.emit(undefined);
1331
+ }
1332
+ onEdit() {
1333
+ this.edit.emit(undefined);
1334
+ this.expanded = true;
1335
+ }
1336
+ onSave() {
1337
+ this.save.emit(undefined);
1338
+ }
1339
+ toggleCollapse() {
1340
+ this.expanded = !this.expanded;
1341
+ }
1342
+ additionalActionClicked() {
1343
+ this.additionalAction.emit(undefined);
1344
+ }
1345
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: CardComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1346
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: CardComponent, selector: "mad-card", inputs: { cancelDisabled: "cancelDisabled", cancelText: "cancelText", readonly: "readonly", editText: "editText", expandable: "expandable", expanded: "expanded", saveDisabled: "saveDisabled", saveText: "saveText", title: "title", editMode: "editMode", additionalActionIcon: "additionalActionIcon", additionalActionText: "additionalActionText" }, outputs: { edit: "edit", cancel: "cancel", save: "save", additionalAction: "additionalAction" }, ngImport: i0, template: "<mat-card>\n <mat-card-header class=\"header\">\n <mat-card-title-group class=\"center\">\n <mat-card-title class=\"small-title-container\">{{ title }}</mat-card-title>\n <div class=\"top-right-icons\">\n <mad-icon-button (click)=\"toggleCollapse()\" *ngIf=\"expandable && !editMode\">\n <mat-icon [@rotateIcon]=\"!expanded\">keyboard_arrow_down</mat-icon>\n </mad-icon-button>\n <mad-icon-button (click)=\"additionalActionClicked()\" *ngIf=\"additionalActionIcon\" [title]=\"additionalActionText\" type=\"button\">\n <mat-icon>{{additionalActionIcon}}</mat-icon>\n </mad-icon-button>\n <mad-icon-button [title]=\"editText\" (click)=\"onEdit()\" *ngIf=\"!readonly && !editMode\">\n <mat-icon>create</mat-icon>\n </mad-icon-button>\n </div>\n </mat-card-title-group>\n </mat-card-header>\n <mat-card-content [@collapseExpandAnimation] *ngIf=\"expanded\">\n <ng-content></ng-content>\n </mat-card-content>\n <mat-card-actions *ngIf=\"!readonly && editMode\">\n <mad-primary-button [title]=\"saveText\" [disabled]=\"saveDisabled\" (throttleClick)=\"onSave()\" madThrottleClick>\n {{ saveText }}\n </mad-primary-button>\n <mad-outline-button [title]=\"cancelText\" [disabled]=\"cancelDisabled\" (click)=\"onCancel()\">\n {{ cancelText }}\n </mad-outline-button>\n </mat-card-actions>\n</mat-card>\n", styles: [".top-right-icons{text-align:end;width:-moz-fit-content;width:fit-content}.center{display:flex;align-items:center}.header{height:48px}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2$3.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: i2$3.MatCardActions, selector: "mat-card-actions", inputs: ["align"], exportAs: ["matCardActions"] }, { kind: "directive", type: i2$3.MatCardContent, selector: "mat-card-content" }, { kind: "component", type: i2$3.MatCardHeader, selector: "mat-card-header" }, { kind: "directive", type: i2$3.MatCardTitle, selector: "mat-card-title, [mat-card-title], [matCardTitle]" }, { kind: "component", type: i2$3.MatCardTitleGroup, selector: "mat-card-title-group" }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: PrimaryButtonComponent, selector: "mad-primary-button", inputs: ["type", "disabled", "title"] }, { kind: "component", type: OutlineButtonComponent, selector: "mad-outline-button", inputs: ["type", "disabled", "title"] }, { kind: "component", type: IconButtonComponent, selector: "mad-icon-button", inputs: ["type", "disabled", "title"] }, { kind: "directive", type: ThrottleClickDirective, selector: "[madThrottleClick]", inputs: ["throttleTime"], outputs: ["throttleClick"] }], animations: [
1347
+ trigger('collapseExpandAnimation', [
1348
+ transition(':enter', [
1349
+ style({ opacity: 0, height: 0, overflow: 'hidden' }),
1350
+ animate('100ms', style({
1351
+ opacity: 1,
1352
+ height: '*',
1353
+ })),
1354
+ ]),
1355
+ transition(':leave', [
1356
+ style({ opacity: 1, height: '*', overflow: 'hidden' }),
1357
+ animate('100ms', style({
1358
+ opacity: 0,
1359
+ height: 0,
1360
+ })),
1361
+ ]),
1362
+ ]),
1363
+ trigger('rotateIcon', [
1364
+ state('true', style({ transform: 'rotate(0)' })),
1365
+ state('false', style({ transform: 'rotate(180deg)' })),
1366
+ transition('true => false', animate('100ms ease-out')),
1367
+ transition('false => true', animate('100ms ease-in')),
1368
+ ]),
1369
+ ] }); }
1370
+ }
1371
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: CardComponent, decorators: [{
1372
+ type: Component,
1373
+ args: [{ selector: 'mad-card', animations: [
1374
+ trigger('collapseExpandAnimation', [
1375
+ transition(':enter', [
1376
+ style({ opacity: 0, height: 0, overflow: 'hidden' }),
1377
+ animate('100ms', style({
1378
+ opacity: 1,
1379
+ height: '*',
1380
+ })),
1381
+ ]),
1382
+ transition(':leave', [
1383
+ style({ opacity: 1, height: '*', overflow: 'hidden' }),
1384
+ animate('100ms', style({
1385
+ opacity: 0,
1386
+ height: 0,
1387
+ })),
1388
+ ]),
1389
+ ]),
1390
+ trigger('rotateIcon', [
1391
+ state('true', style({ transform: 'rotate(0)' })),
1392
+ state('false', style({ transform: 'rotate(180deg)' })),
1393
+ transition('true => false', animate('100ms ease-out')),
1394
+ transition('false => true', animate('100ms ease-in')),
1395
+ ]),
1396
+ ], template: "<mat-card>\n <mat-card-header class=\"header\">\n <mat-card-title-group class=\"center\">\n <mat-card-title class=\"small-title-container\">{{ title }}</mat-card-title>\n <div class=\"top-right-icons\">\n <mad-icon-button (click)=\"toggleCollapse()\" *ngIf=\"expandable && !editMode\">\n <mat-icon [@rotateIcon]=\"!expanded\">keyboard_arrow_down</mat-icon>\n </mad-icon-button>\n <mad-icon-button (click)=\"additionalActionClicked()\" *ngIf=\"additionalActionIcon\" [title]=\"additionalActionText\" type=\"button\">\n <mat-icon>{{additionalActionIcon}}</mat-icon>\n </mad-icon-button>\n <mad-icon-button [title]=\"editText\" (click)=\"onEdit()\" *ngIf=\"!readonly && !editMode\">\n <mat-icon>create</mat-icon>\n </mad-icon-button>\n </div>\n </mat-card-title-group>\n </mat-card-header>\n <mat-card-content [@collapseExpandAnimation] *ngIf=\"expanded\">\n <ng-content></ng-content>\n </mat-card-content>\n <mat-card-actions *ngIf=\"!readonly && editMode\">\n <mad-primary-button [title]=\"saveText\" [disabled]=\"saveDisabled\" (throttleClick)=\"onSave()\" madThrottleClick>\n {{ saveText }}\n </mad-primary-button>\n <mad-outline-button [title]=\"cancelText\" [disabled]=\"cancelDisabled\" (click)=\"onCancel()\">\n {{ cancelText }}\n </mad-outline-button>\n </mat-card-actions>\n</mat-card>\n", styles: [".top-right-icons{text-align:end;width:-moz-fit-content;width:fit-content}.center{display:flex;align-items:center}.header{height:48px}\n"] }]
1397
+ }], propDecorators: { cancelDisabled: [{
1398
+ type: Input
1399
+ }], cancelText: [{
1400
+ type: Input
1401
+ }], readonly: [{
1402
+ type: Input
1403
+ }], editText: [{
1404
+ type: Input
1405
+ }], expandable: [{
1406
+ type: Input
1407
+ }], expanded: [{
1408
+ type: Input
1409
+ }], saveDisabled: [{
1410
+ type: Input
1411
+ }], saveText: [{
1412
+ type: Input
1413
+ }], title: [{
1414
+ type: Input
1415
+ }], editMode: [{
1416
+ type: Input
1417
+ }], additionalActionIcon: [{
1418
+ type: Input
1419
+ }], additionalActionText: [{
1420
+ type: Input
1421
+ }], edit: [{
1422
+ type: Output
1423
+ }], cancel: [{
1424
+ type: Output
1425
+ }], save: [{
1426
+ type: Output
1427
+ }], additionalAction: [{
1428
+ type: Output
1429
+ }] } });
1430
+
1431
+ class ThrottleClickModule {
1432
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ThrottleClickModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1433
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.1", ngImport: i0, type: ThrottleClickModule, declarations: [ThrottleClickDirective], imports: [CommonModule], exports: [ThrottleClickDirective] }); }
1434
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ThrottleClickModule, imports: [CommonModule] }); }
1435
+ }
1436
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ThrottleClickModule, decorators: [{
1437
+ type: NgModule,
1438
+ args: [{
1439
+ declarations: [ThrottleClickDirective],
1440
+ imports: [CommonModule],
1441
+ exports: [ThrottleClickDirective],
1442
+ }]
1443
+ }] });
1444
+
1445
+ class CardModule {
1446
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: CardModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1447
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.1", ngImport: i0, type: CardModule, declarations: [CardComponent], imports: [CommonModule, MatCardModule, MatIconModule, ButtonModule, MatButtonModule, ThrottleClickModule], exports: [CardComponent] }); }
1448
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: CardModule, imports: [CommonModule, MatCardModule, MatIconModule, ButtonModule, MatButtonModule, ThrottleClickModule] }); }
1449
+ }
1450
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: CardModule, decorators: [{
1451
+ type: NgModule,
1452
+ args: [{
1453
+ declarations: [CardComponent],
1454
+ imports: [CommonModule, MatCardModule, MatIconModule, ButtonModule, MatButtonModule, ThrottleClickModule],
1455
+ exports: [CardComponent],
1456
+ }]
1457
+ }] });
1458
+
1459
+ class BaseQuickListComponent {
1460
+ constructor(changeDetectorRef) {
1461
+ this.changeDetectorRef = changeDetectorRef;
1462
+ this.allItems = [];
1463
+ this.addLabel = 'NOT SET';
1464
+ this.addPossible = true;
1465
+ this.removePossible = true;
1466
+ this.blankItem = {};
1467
+ this.added = new EventEmitter();
1468
+ this.removed = new EventEmitter();
1469
+ }
1470
+ ngOnInit() {
1471
+ this.addEventFunction = this.addItem.bind(this);
1472
+ if (this.minItems) {
1473
+ for (let n = this.allItems.length; n < this.minItems; n++) {
1474
+ this.interalAddItem();
1475
+ }
1476
+ }
1477
+ }
1478
+ ngAfterViewInit() {
1479
+ setTimeout(() => this.setFocusOnAdd(), 1);
1480
+ }
1481
+ addItem() {
1482
+ const newItem = this.interalAddItem();
1483
+ if (!!newItem) {
1484
+ this.added.emit(newItem);
1485
+ }
1486
+ }
1487
+ removeItem(item) {
1488
+ if (this.isDeleteAllowed()) {
1489
+ this.allItems.splice(this.allItems.indexOf(item), 1);
1490
+ this.removed.emit(item);
1491
+ }
1492
+ }
1493
+ setFocusOnAdd() {
1494
+ this.rowCountFocus = this.itemRows.length;
1495
+ this.itemRows.changes.subscribe((els) => {
1496
+ if (els.length > this.rowCountFocus && !!els.last) {
1497
+ const firstFocusable = els.last.nativeElement.querySelector("button, a, input, select, textarea, [tabindex]:not([tabindex='-1'])");
1498
+ if (firstFocusable) {
1499
+ firstFocusable.focus();
1500
+ }
1501
+ }
1502
+ this.rowCountFocus = els.length;
1503
+ });
1504
+ }
1505
+ isAddAllowed() {
1506
+ return this.addPossible && (!this.maxItems || this.allItems.length < this.maxItems);
1507
+ }
1508
+ isDeleteAllowed() {
1509
+ return this.removePossible && (!this.minItems || this.allItems.length > this.minItems);
1510
+ }
1511
+ interalAddItem() {
1512
+ if (this.isAddAllowed()) {
1513
+ const newItem = { ...this.blankItem };
1514
+ // creates ids in the form of "n5kdz1pljl8"
1515
+ newItem.id = Math.random()
1516
+ .toString(36)
1517
+ .substring(2);
1518
+ this.allItems.push(newItem);
1519
+ this.changeDetectorRef.detectChanges();
1520
+ return newItem;
1521
+ }
1522
+ return null;
1523
+ }
1524
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: BaseQuickListComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
1525
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: BaseQuickListComponent, selector: "mad-base-quick-list", inputs: { allItems: "allItems", addLabel: "addLabel", addPossible: "addPossible", removePossible: "removePossible", blankItem: "blankItem", readonly: "readonly", maxItems: "maxItems", minItems: "minItems" }, outputs: { added: "added", removed: "removed" }, queries: [{ propertyName: "itemTemplate", first: true, predicate: TemplateRef, descendants: true }], viewQueries: [{ propertyName: "itemRows", predicate: ["row"], descendants: true }], ngImport: i0, template: '', isInline: true }); }
1526
+ }
1527
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: BaseQuickListComponent, decorators: [{
1528
+ type: Component,
1529
+ args: [{ selector: 'mad-base-quick-list', template: '' }]
1530
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { allItems: [{
1531
+ type: Input
1532
+ }], addLabel: [{
1533
+ type: Input
1534
+ }], addPossible: [{
1535
+ type: Input
1536
+ }], removePossible: [{
1537
+ type: Input
1538
+ }], blankItem: [{
1539
+ type: Input
1540
+ }], readonly: [{
1541
+ type: Input
1542
+ }], maxItems: [{
1543
+ type: Input
1544
+ }], minItems: [{
1545
+ type: Input
1546
+ }], added: [{
1547
+ type: Output
1548
+ }], removed: [{
1549
+ type: Output
1550
+ }], itemTemplate: [{
1551
+ type: ContentChild,
1552
+ args: [TemplateRef]
1553
+ }], itemRows: [{
1554
+ type: ViewChildren,
1555
+ args: ['row']
1556
+ }] } });
1557
+
1558
+ class QuickListCompactComponent extends BaseQuickListComponent {
1559
+ constructor(changeDetectorRef) {
1560
+ super(changeDetectorRef);
1561
+ this.changeDetectorRef = changeDetectorRef;
1562
+ }
1563
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: QuickListCompactComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
1564
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: QuickListCompactComponent, selector: "mad-quick-list-compact", usesInheritance: true, ngImport: i0, template: "<h3>\n <ng-content select=\"label\"></ng-content>\n</h3>\n<ng-container *ngFor=\"let item of allItems; let isLast = last;\">\n <div class=\"flex-container\" *ngIf=\"itemTemplate\" #row style=\"display: flex; flex-direction: row;\">\n <ng-container *ngTemplateOutlet=\"itemTemplate; context: { $implicit: item }\"></ng-container>\n <mad-icon-button *ngIf=\"!readonly && isDeleteAllowed()\" (click)=\"removeItem(item)\">\n <mat-icon>delete</mat-icon>\n </mad-icon-button>\n <mad-icon-button *ngIf=\"!readonly && isLast\" [disabled]=\"!isAddAllowed()\" (click)=\"addItem()\">\n <mat-icon>add_circle_outline</mat-icon>\n </mad-icon-button>\n </div>\n</ng-container>\n<mad-link-button *ngIf=\"!readonly && !this.allItems.length\"\n (click)=\"addItem()\"\n [disabled]=\"!isAddAllowed()\">\n {{ addLabel }}\n</mad-link-button>\n", dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: LinkButtonComponent, selector: "mad-link-button", inputs: ["type", "disabled", "title"] }, { kind: "component", type: IconButtonComponent, selector: "mad-icon-button", inputs: ["type", "disabled", "title"] }] }); }
1565
+ }
1566
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: QuickListCompactComponent, decorators: [{
1567
+ type: Component,
1568
+ args: [{ selector: 'mad-quick-list-compact', template: "<h3>\n <ng-content select=\"label\"></ng-content>\n</h3>\n<ng-container *ngFor=\"let item of allItems; let isLast = last;\">\n <div class=\"flex-container\" *ngIf=\"itemTemplate\" #row style=\"display: flex; flex-direction: row;\">\n <ng-container *ngTemplateOutlet=\"itemTemplate; context: { $implicit: item }\"></ng-container>\n <mad-icon-button *ngIf=\"!readonly && isDeleteAllowed()\" (click)=\"removeItem(item)\">\n <mat-icon>delete</mat-icon>\n </mad-icon-button>\n <mad-icon-button *ngIf=\"!readonly && isLast\" [disabled]=\"!isAddAllowed()\" (click)=\"addItem()\">\n <mat-icon>add_circle_outline</mat-icon>\n </mad-icon-button>\n </div>\n</ng-container>\n<mad-link-button *ngIf=\"!readonly && !this.allItems.length\"\n (click)=\"addItem()\"\n [disabled]=\"!isAddAllowed()\">\n {{ addLabel }}\n</mad-link-button>\n" }]
1569
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; } });
1570
+
1571
+ // Based on https://github.com/porscheinformatik/clarity-addons/blob/master/src/clr-addons/generic-quick-list/generic-quick-list.ts
1572
+ class QuickListComponent extends BaseQuickListComponent {
1573
+ constructor(changeDetectorRef) {
1574
+ super(changeDetectorRef);
1575
+ this.changeDetectorRef = changeDetectorRef;
1576
+ }
1577
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: QuickListComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
1578
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: QuickListComponent, selector: "mad-quick-list", usesInheritance: true, ngImport: i0, template: "<h3>\n <ng-content select=\"label\"></ng-content>\n</h3>\n<ng-container *ngFor=\"let item of allItems\">\n <div *ngIf=\"itemTemplate\" #row style=\"display: flex; flex-direction: row;\">\n <ng-container *ngTemplateOutlet=\"itemTemplate; context: { $implicit: item }\"></ng-container>\n <mad-icon-button *ngIf=\"!readonly && isDeleteAllowed()\" (click)=\"removeItem(item)\">\n <mat-icon>delete</mat-icon>\n </mad-icon-button>\n </div>\n</ng-container>\n<mad-outline-button *ngIf=\"!readonly\" (click)=\"addItem()\"\n [disabled]=\"!addPossible || !isAddAllowed()\">\n {{ addLabel }}\n</mad-outline-button>\n", dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: OutlineButtonComponent, selector: "mad-outline-button", inputs: ["type", "disabled", "title"] }, { kind: "component", type: IconButtonComponent, selector: "mad-icon-button", inputs: ["type", "disabled", "title"] }] }); }
1579
+ }
1580
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: QuickListComponent, decorators: [{
1581
+ type: Component,
1582
+ args: [{ selector: 'mad-quick-list', template: "<h3>\n <ng-content select=\"label\"></ng-content>\n</h3>\n<ng-container *ngFor=\"let item of allItems\">\n <div *ngIf=\"itemTemplate\" #row style=\"display: flex; flex-direction: row;\">\n <ng-container *ngTemplateOutlet=\"itemTemplate; context: { $implicit: item }\"></ng-container>\n <mad-icon-button *ngIf=\"!readonly && isDeleteAllowed()\" (click)=\"removeItem(item)\">\n <mat-icon>delete</mat-icon>\n </mad-icon-button>\n </div>\n</ng-container>\n<mad-outline-button *ngIf=\"!readonly\" (click)=\"addItem()\"\n [disabled]=\"!addPossible || !isAddAllowed()\">\n {{ addLabel }}\n</mad-outline-button>\n" }]
1583
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; } });
1584
+
1585
+ class QuickListModule {
1586
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: QuickListModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1587
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.1", ngImport: i0, type: QuickListModule, declarations: [QuickListComponent, BaseQuickListComponent, QuickListCompactComponent], imports: [CommonModule, MatButtonModule, MatIconModule, ButtonModule], exports: [QuickListComponent, QuickListCompactComponent, BaseQuickListComponent] }); }
1588
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: QuickListModule, imports: [CommonModule, MatButtonModule, MatIconModule, ButtonModule] }); }
1589
+ }
1590
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: QuickListModule, decorators: [{
1591
+ type: NgModule,
1592
+ args: [{
1593
+ declarations: [QuickListComponent, BaseQuickListComponent, QuickListCompactComponent],
1594
+ imports: [CommonModule, MatButtonModule, MatIconModule, ButtonModule],
1595
+ exports: [QuickListComponent, QuickListCompactComponent, BaseQuickListComponent],
1596
+ }]
1597
+ }] });
1598
+
1599
+ class TableComponent {
1600
+ constructor() {
1601
+ this.columns = [];
1602
+ this.filterLabel = 'NOT SET';
1603
+ this.filterPlaceholder = 'NOT SET';
1604
+ this.pageSizeOptions = [5, 10, 15];
1605
+ this.defaultPageSize = this.pageSizeOptions?.[0] || 10;
1606
+ this.rowActions = [];
1607
+ this.tableActions = [];
1608
+ this.tableAction = new EventEmitter();
1609
+ this.rowAction = new EventEmitter();
1610
+ this.sortEvent = new EventEmitter();
1611
+ this.ACTION_COLUMN_NAME = '__action__';
1612
+ this.isFilterEnabled = false;
1613
+ this.isPaginationEnabled = false;
1614
+ }
1615
+ set displayedData(data) {
1616
+ if (!this.dataSource) {
1617
+ this.dataSource = new MatTableDataSource(data);
1618
+ }
1619
+ else {
1620
+ this.dataSource.data = data;
1621
+ }
1622
+ }
1623
+ set paginationEnabled(isPaginationEnabled) {
1624
+ this.isPaginationEnabled = isPaginationEnabled;
1625
+ // eslint-disable-next-line
1626
+ const pageSize = this.isPaginationEnabled ? this.defaultPageSize : Number.MAX_VALUE;
1627
+ if (this.dataSource.paginator) {
1628
+ this.dataSource.paginator.pageSize = pageSize;
1629
+ }
1630
+ }
1631
+ set filterEnabled(isFilterEnabled) {
1632
+ this.isFilterEnabled = isFilterEnabled;
1633
+ this.setFilterValue(undefined);
1634
+ }
1635
+ ngOnInit() {
1636
+ this.columnNames = this.columns.map(column => column.label);
1637
+ this.isRowClickable = this.rowActions.length > 0;
1638
+ if (this.isRowClickable) {
1639
+ this.columnNames.unshift(this.ACTION_COLUMN_NAME);
1640
+ this.defaultAction = this.rowActions[0];
1641
+ }
1642
+ }
1643
+ ngAfterViewInit() {
1644
+ this.dataSource.paginator = this.paginator;
1645
+ this.dataSource.sort = this.sort;
1646
+ // set custom filter predicate to enable search for multiple search strings:
1647
+ // e.g. "one two three"
1648
+ this.dataSource.filterPredicate = (data, filter) => !filter || filter.split(/\s+/).every(term => !!Object.keys(data).find(key => data[key].includes(term)));
1649
+ }
1650
+ onFilter(value) {
1651
+ this.setFilterValue(value);
1652
+ }
1653
+ onRowEvent(event, row, action = this.defaultAction) {
1654
+ if (!!action && !this.isClickOnRowMenuIcon(event)) {
1655
+ this.rowAction.emit({ ...action, outputRow: row });
1656
+ }
1657
+ }
1658
+ onSortingEvent(sortingParams) {
1659
+ this.sortEvent.emit(sortingParams);
1660
+ }
1661
+ onTableAction(tableAction) {
1662
+ if (!!tableAction) {
1663
+ this.tableAction.emit(tableAction);
1664
+ }
1665
+ }
1666
+ setFilterValue(value) {
1667
+ this.dataSource.filter = value?.trim().toLowerCase();
1668
+ }
1669
+ isClickOnRowMenuIcon(event) {
1670
+ return event?.target?.classList.contains('mat-icon');
1671
+ }
1672
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: TableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1673
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: TableComponent, selector: "mad-table", inputs: { columns: "columns", filterLabel: "filterLabel", filterPlaceholder: "filterPlaceholder", noDataText: "noDataText", pageSizeOptions: "pageSizeOptions", defaultPageSize: "defaultPageSize", rowActions: "rowActions", tableActions: "tableActions", displayedData: "displayedData", paginationEnabled: "paginationEnabled", filterEnabled: "filterEnabled" }, outputs: { tableAction: "tableAction", rowAction: "rowAction", sortEvent: "sortEvent" }, viewQueries: [{ propertyName: "paginator", first: true, predicate: MatPaginator, descendants: true }, { propertyName: "sort", first: true, predicate: MatSort, descendants: true, static: true }], ngImport: i0, template: "<!-- Table actions -->\n<div *ngIf=\"tableActions?.length\">\n <mad-primary-button class=\"table-action\" *ngFor=\"let tableAction of tableActions\" (click)=\"onTableAction(tableAction)\">\n {{ tableAction.label }}\n </mad-primary-button>\n</div>\n\n<!-- Row action buttons -->\n<mat-menu #menu=\"matMenu\">\n <ng-template matMenuContent let-element=\"element\">\n <button *ngFor=\"let rowAction of rowActions\" mat-menu-item class=\"row-action\" (click)=\"onRowEvent($event, element, rowAction)\">\n {{ rowAction.label }}\n </button>\n </ng-template>\n</mat-menu>\n\n<!-- Table filter -->\n<mat-form-field *ngIf=\"isFilterEnabled\">\n <mat-label>{{ filterLabel }}</mat-label>\n <input matInput (keyup)=\"onFilter($event?.target?.value)\" placeholder=\"{{ filterPlaceholder }}\" />\n</mat-form-field>\n\n<!-- Table -->\n<div *ngIf=\"dataSource?.data?.length > 0; else noData\" class=\"mad-table\">\n <table mat-table [dataSource]=\"dataSource\" matSort (matSortChange)=\"onSortingEvent($event)\">\n <!-- Row actions column -->\n <ng-container [matColumnDef]=\"ACTION_COLUMN_NAME\" *ngIf=\"rowActions?.length\" sticky>\n <th mat-header-cell *matHeaderCellDef class=\"row-action-button\"></th>\n <td mat-cell *matCellDef=\"let element\" class=\"row-action-button\">\n <mad-icon-button [matMenuTriggerData]=\"{ element: element }\" [matMenuTriggerFor]=\"menu\">\n <mat-icon>more_vert</mat-icon>\n </mad-icon-button>\n </td>\n </ng-container>\n <!-- Columns with data -->\n <ng-container *ngFor=\"let column of columns\" [matColumnDef]=\"column.label\" [sticky]=\"column.isSticky\">\n <ng-container *ngIf=\"column.isSortable; else noSort\">\n <th\n mat-header-cell\n *matHeaderCellDef\n mat-sort-header=\"{{ column.label }}\"\n [arrowPosition]=\"column.isRightAligned ? 'before' : 'after'\"\n [class.text-right]=\"column.isRightAligned\"\n >\n {{ column.label }}\n </th>\n </ng-container>\n <ng-template #noSort>\n <th mat-header-cell *matHeaderCellDef [class.text-right]=\"column.isRightAligned\">\n {{ column.label }}\n </th>\n </ng-template>\n <td mat-cell *matCellDef=\"let element\" [class.text-right]=\"column.isRightAligned\">\n {{ element[column.dataPropertyName] }}\n </td>\n </ng-container>\n <tr mat-header-row *matHeaderRowDef=\"columnNames\"></tr>\n <tr\n mat-row\n [class.clickable-table-row]=\"isRowClickable\"\n (click)=\"onRowEvent($event, row)\"\n *matRowDef=\"let row; columns: columnNames\"\n ></tr>\n </table>\n</div>\n<!-- Pagination -->\n<mat-paginator\n [style.display]=\"isPaginationEnabled ? 'block' : 'none'\"\n [pageSize]=\"defaultPageSize\"\n [pageSizeOptions]=\"pageSizeOptions\"\n showFirstLastButtons\n>\n</mat-paginator>\n\n<!-- No data alert -->\n<ng-template #noData>\n <div class=\"noDataText\">\n {{ noDataText }}\n </div>\n</ng-template>\n", styles: [".text-right{text-align:right!important}.table-action{margin-right:.5em;margin-bottom:.5em}.row-action-button{width:10px}.noDataText{width:100%;text-align:center}.mad-table{width:100%;overflow-x:auto}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatLabel, selector: "mat-label" }, { kind: "directive", type: i4.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.MatMenu, selector: "mat-menu", exportAs: ["matMenu"] }, { kind: "component", type: i6.MatMenuItem, selector: "[mat-menu-item]", inputs: ["disabled", "disableRipple", "role"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i6.MatMenuContent, selector: "ng-template[matMenuContent]" }, { kind: "directive", type: i6.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", exportAs: ["matMenuTrigger"] }, { kind: "component", type: i6$1.MatPaginator, selector: "mat-paginator", inputs: ["disabled"], exportAs: ["matPaginator"] }, { kind: "directive", type: i7.MatSort, selector: "[matSort]", inputs: ["matSortDisabled", "matSortActive", "matSortStart", "matSortDirection", "matSortDisableClear"], outputs: ["matSortChange"], exportAs: ["matSort"] }, { kind: "component", type: i7.MatSortHeader, selector: "[mat-sort-header]", inputs: ["disabled", "mat-sort-header", "arrowPosition", "start", "sortActionDescription", "disableClear"], exportAs: ["matSortHeader"] }, { kind: "component", type: i8$1.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i8$1.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i8$1.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i8$1.MatColumnDef, selector: "[matColumnDef]", inputs: ["sticky", "matColumnDef"] }, { kind: "directive", type: i8$1.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i8$1.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i8$1.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i8$1.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i8$1.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i8$1.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "component", type: PrimaryButtonComponent, selector: "mad-primary-button", inputs: ["type", "disabled", "title"] }, { kind: "component", type: IconButtonComponent, selector: "mad-icon-button", inputs: ["type", "disabled", "title"] }] }); }
1674
+ }
1675
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: TableComponent, decorators: [{
1676
+ type: Component,
1677
+ args: [{ selector: 'mad-table', template: "<!-- Table actions -->\n<div *ngIf=\"tableActions?.length\">\n <mad-primary-button class=\"table-action\" *ngFor=\"let tableAction of tableActions\" (click)=\"onTableAction(tableAction)\">\n {{ tableAction.label }}\n </mad-primary-button>\n</div>\n\n<!-- Row action buttons -->\n<mat-menu #menu=\"matMenu\">\n <ng-template matMenuContent let-element=\"element\">\n <button *ngFor=\"let rowAction of rowActions\" mat-menu-item class=\"row-action\" (click)=\"onRowEvent($event, element, rowAction)\">\n {{ rowAction.label }}\n </button>\n </ng-template>\n</mat-menu>\n\n<!-- Table filter -->\n<mat-form-field *ngIf=\"isFilterEnabled\">\n <mat-label>{{ filterLabel }}</mat-label>\n <input matInput (keyup)=\"onFilter($event?.target?.value)\" placeholder=\"{{ filterPlaceholder }}\" />\n</mat-form-field>\n\n<!-- Table -->\n<div *ngIf=\"dataSource?.data?.length > 0; else noData\" class=\"mad-table\">\n <table mat-table [dataSource]=\"dataSource\" matSort (matSortChange)=\"onSortingEvent($event)\">\n <!-- Row actions column -->\n <ng-container [matColumnDef]=\"ACTION_COLUMN_NAME\" *ngIf=\"rowActions?.length\" sticky>\n <th mat-header-cell *matHeaderCellDef class=\"row-action-button\"></th>\n <td mat-cell *matCellDef=\"let element\" class=\"row-action-button\">\n <mad-icon-button [matMenuTriggerData]=\"{ element: element }\" [matMenuTriggerFor]=\"menu\">\n <mat-icon>more_vert</mat-icon>\n </mad-icon-button>\n </td>\n </ng-container>\n <!-- Columns with data -->\n <ng-container *ngFor=\"let column of columns\" [matColumnDef]=\"column.label\" [sticky]=\"column.isSticky\">\n <ng-container *ngIf=\"column.isSortable; else noSort\">\n <th\n mat-header-cell\n *matHeaderCellDef\n mat-sort-header=\"{{ column.label }}\"\n [arrowPosition]=\"column.isRightAligned ? 'before' : 'after'\"\n [class.text-right]=\"column.isRightAligned\"\n >\n {{ column.label }}\n </th>\n </ng-container>\n <ng-template #noSort>\n <th mat-header-cell *matHeaderCellDef [class.text-right]=\"column.isRightAligned\">\n {{ column.label }}\n </th>\n </ng-template>\n <td mat-cell *matCellDef=\"let element\" [class.text-right]=\"column.isRightAligned\">\n {{ element[column.dataPropertyName] }}\n </td>\n </ng-container>\n <tr mat-header-row *matHeaderRowDef=\"columnNames\"></tr>\n <tr\n mat-row\n [class.clickable-table-row]=\"isRowClickable\"\n (click)=\"onRowEvent($event, row)\"\n *matRowDef=\"let row; columns: columnNames\"\n ></tr>\n </table>\n</div>\n<!-- Pagination -->\n<mat-paginator\n [style.display]=\"isPaginationEnabled ? 'block' : 'none'\"\n [pageSize]=\"defaultPageSize\"\n [pageSizeOptions]=\"pageSizeOptions\"\n showFirstLastButtons\n>\n</mat-paginator>\n\n<!-- No data alert -->\n<ng-template #noData>\n <div class=\"noDataText\">\n {{ noDataText }}\n </div>\n</ng-template>\n", styles: [".text-right{text-align:right!important}.table-action{margin-right:.5em;margin-bottom:.5em}.row-action-button{width:10px}.noDataText{width:100%;text-align:center}.mad-table{width:100%;overflow-x:auto}\n"] }]
1678
+ }], propDecorators: { columns: [{
1679
+ type: Input
1680
+ }], filterLabel: [{
1681
+ type: Input
1682
+ }], filterPlaceholder: [{
1683
+ type: Input
1684
+ }], noDataText: [{
1685
+ type: Input
1686
+ }], pageSizeOptions: [{
1687
+ type: Input
1688
+ }], defaultPageSize: [{
1689
+ type: Input
1690
+ }], rowActions: [{
1691
+ type: Input
1692
+ }], tableActions: [{
1693
+ type: Input
1694
+ }], tableAction: [{
1695
+ type: Output
1696
+ }], rowAction: [{
1697
+ type: Output
1698
+ }], sortEvent: [{
1699
+ type: Output
1700
+ }], paginator: [{
1701
+ type: ViewChild,
1702
+ args: [MatPaginator, { static: false }]
1703
+ }], sort: [{
1704
+ type: ViewChild,
1705
+ args: [MatSort, { static: true }]
1706
+ }], displayedData: [{
1707
+ type: Input
1708
+ }], paginationEnabled: [{
1709
+ type: Input
1710
+ }], filterEnabled: [{
1711
+ type: Input
1712
+ }] } });
1713
+
1714
+ class TableModule {
1715
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: TableModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1716
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.1", ngImport: i0, type: TableModule, declarations: [TableComponent], imports: [CommonModule,
1717
+ MatButtonModule,
1718
+ MatIconModule,
1719
+ MatFormFieldModule,
1720
+ MatInputModule,
1721
+ MatMenuModule,
1722
+ MatPaginatorModule,
1723
+ MatSortModule,
1724
+ MatTableModule,
1725
+ ButtonModule], exports: [TableComponent] }); }
1726
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: TableModule, imports: [CommonModule,
1727
+ MatButtonModule,
1728
+ MatIconModule,
1729
+ MatFormFieldModule,
1730
+ MatInputModule,
1731
+ MatMenuModule,
1732
+ MatPaginatorModule,
1733
+ MatSortModule,
1734
+ MatTableModule,
1735
+ ButtonModule] }); }
1736
+ }
1737
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: TableModule, decorators: [{
1738
+ type: NgModule,
1739
+ args: [{
1740
+ declarations: [TableComponent],
1741
+ imports: [
1742
+ CommonModule,
1743
+ MatButtonModule,
1744
+ MatIconModule,
1745
+ MatFormFieldModule,
1746
+ MatInputModule,
1747
+ MatMenuModule,
1748
+ MatPaginatorModule,
1749
+ MatSortModule,
1750
+ MatTableModule,
1751
+ ButtonModule,
1752
+ ],
1753
+ exports: [TableComponent],
1754
+ }]
1755
+ }] });
1756
+
1757
+ class DataTableColumnsModalComponent {
1758
+ constructor(dialogRef, data) {
1759
+ this.dialogRef = dialogRef;
1760
+ this.data = data;
1761
+ this.selectedColumns = [];
1762
+ this.availableColumns = [];
1763
+ this.filteredAvailableColumns = [];
1764
+ }
1765
+ ngOnInit() {
1766
+ this.definition = this.data.definition;
1767
+ for (const column of this.data.allColumns) {
1768
+ const columnId = column.id;
1769
+ const selectedColumnIds = this.definition.displayedColumns.map(col => col.id);
1770
+ if (selectedColumnIds.includes(columnId)) {
1771
+ this.selectedColumns.push(column);
1772
+ }
1773
+ else {
1774
+ this.availableColumns.push(column);
1775
+ }
1776
+ }
1777
+ this.clearFilterValue();
1778
+ }
1779
+ onDrop(event) {
1780
+ if (event.previousContainer === event.container) {
1781
+ moveItemInArray(event.container.data, event.previousIndex, event.currentIndex);
1782
+ }
1783
+ else {
1784
+ const itemIndex = this.findMatchingItemIndex(event.previousContainer, event.item);
1785
+ transferArrayItem(event.previousContainer.data, event.container.data, itemIndex, event.currentIndex);
1786
+ this.clearFilterValue();
1787
+ this.availableColumns.sort((a, b) => a.label.localeCompare(b.label));
1788
+ }
1789
+ }
1790
+ onSave() {
1791
+ this.definition.displayedColumns = this.selectedColumns;
1792
+ const saveChange = {
1793
+ action: 'SAVE',
1794
+ definition: this.definition,
1795
+ };
1796
+ this.dialogRef.close(saveChange);
1797
+ }
1798
+ onDelete() {
1799
+ const deleteChange = {
1800
+ action: 'DELETE',
1801
+ definition: this.definition,
1802
+ };
1803
+ this.dialogRef.close(deleteChange);
1804
+ }
1805
+ onCancel() {
1806
+ this.dialogRef.close();
1807
+ }
1808
+ updateFilterValue() {
1809
+ if (this.searchFilter?.length > 0) {
1810
+ this.filteredAvailableColumns = this.availableColumns.filter(c => c.label.toLowerCase().includes(this.searchFilter.toLowerCase()));
1811
+ }
1812
+ else {
1813
+ this.filteredAvailableColumns = [...this.availableColumns];
1814
+ }
1815
+ }
1816
+ findMatchingItemIndex(previousContainer, item) {
1817
+ const itemId = item.element.nativeElement.id;
1818
+ const previousContainerItems = [...previousContainer.data];
1819
+ if (previousContainerItems?.length < 1) {
1820
+ return 0;
1821
+ }
1822
+ for (let itemIndex = 0; itemIndex < previousContainerItems.length; itemIndex++) {
1823
+ if (previousContainerItems[itemIndex].id === itemId) {
1824
+ return itemIndex;
1825
+ }
1826
+ }
1827
+ return 0;
1828
+ }
1829
+ clearFilterValue() {
1830
+ this.searchFilter = '';
1831
+ this.filteredAvailableColumns = [...this.availableColumns];
1832
+ }
1833
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DataTableColumnsModalComponent, deps: [{ token: i1$4.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component }); }
1834
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: DataTableColumnsModalComponent, selector: "mad-data-table-columns-modal.component", ngImport: i0, template: "<h1 mat-dialog-title>{{ data?.titleLabel | translate }}</h1>\n<div mat-dialog-content>\n <div class=\"column-drag-main-content\">\n <div class=\"column-drag-container\">\n <div class=\"column-drag-info-area\">{{ data?.infoTextLabel | translate }}</div>\n <div class=\"column-drag-container-header\">{{ data?.selectedLabel | translate }}</div>\n <div\n cdkDropList\n #selectedList=\"cdkDropList\"\n [cdkDropListData]=\"selectedColumns\"\n [cdkDropListConnectedTo]=\"[availableList]\"\n class=\"column-drag-list selected-drag-list\"\n (cdkDropListDropped)=\"onDrop($event)\">\n <div class=\"column-drag-box\"\n *ngFor=\"let selectedColumn of selectedColumns; let i = index\"\n cdkDrag\n [id]=\"selectedColumn.id\"\n >\n {{i + 1}}. {{selectedColumn.label | translate }}\n </div>\n </div>\n </div>\n\n <div class=\"column-drag-container\">\n <div class=\"column-drag-info-area\">\n <!-- Table filter -->\n <mat-form-field>\n <mat-label>{{ data?.filterColumnsLabel | translate }}</mat-label>\n <input matInput autocomplete=\"off\" (keyup)=\"updateFilterValue()\"\n placeholder=\"{{ data?.filterColumnsPlaceHolder | translate }}\" [(ngModel)]=\"searchFilter\"/>\n <button *ngIf=\"searchFilter\" matSuffix mat-icon-button aria-label=\"Clear\" (click)=\"clearFilterValue()\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n </div>\n <div class=\"column-drag-container-header\">{{ data?.availableLabel | translate }}</div>\n <div\n cdkDropList\n cdkDropListSortingDisabled\n #availableList=\"cdkDropList\"\n [cdkDropListData]=\"availableColumns\"\n [cdkDropListConnectedTo]=\"[selectedList]\"\n class=\"column-drag-list\"\n (cdkDropListDropped)=\"onDrop($event)\">\n <div *ngFor=\"let availableColumn of filteredAvailableColumns\" class=\"column-drag-box\" cdkDrag [id]=\"availableColumn.id\">\n {{availableColumn.label}}\n </div>\n </div>\n </div>\n </div>\n\n</div>\n<div mat-dialog-actions [align]=\"'end'\">\n <mad-outline-button (click)=\"onCancel()\">\n {{ data?.cancelLabel | translate }}\n </mad-outline-button>\n <mad-danger-button *ngIf=\"data?.deleteDefinitionAllowed\" (click)=\"onDelete()\">\n {{ data?.deleteLabel | translate }}\n </mad-danger-button>\n <mad-primary-button (click)=\"onSave()\" [disabled]=\"!(this.selectedColumns?.length > 0)\">\n {{ data?.saveLabel | translate }}\n </mad-primary-button>\n</div>\n", styles: [".column-drag-main-content{display:flex;flex-direction:row;width:544px;justify-content:space-between;padding:8px 8px 16px;margin-bottom:16px;border-bottom:1px solid whitesmoke}.column-drag-container{width:256px;max-width:100%;display:inline-block;vertical-align:top;font-size:small}.info-box{width:100%;font-size:small;margin-bottom:16px;color:#000000a8}.column-drag-info-area{width:100%;height:36px;margin-bottom:32px;color:#000000a8;font-size:small;display:flex;justify-content:right;align-items:stretch;flex-direction:column}.column-drag-list{border:solid 1px #ccc;height:200px;box-sizing:border-box;background:white;border-radius:4px;overflow:auto;display:block}.column-drag-container-header{font-weight:700;margin-bottom:4px}.column-drag-box{padding:12px 10px;border-bottom:solid 1px #ccc;color:#000000de;display:flex;flex-direction:row;align-items:center;justify-content:space-between;box-sizing:border-box;height:40px;cursor:move;background:white;font-size:14px}.cdk-drag-preview{box-sizing:border-box;border-radius:4px;box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.cdk-drag-placeholder{opacity:0}.cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}.column-drag-box:last-child{border:none}.column-drag-list.cdk-drop-list-dragging .column-drag-box:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i1$2.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "directive", type: i4.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: PrimaryButtonComponent, selector: "mad-primary-button", inputs: ["type", "disabled", "title"] }, { kind: "component", type: OutlineButtonComponent, selector: "mad-outline-button", inputs: ["type", "disabled", "title"] }, { kind: "component", type: DangerButtonComponent, selector: "mad-danger-button", inputs: ["type", "disabled", "title"] }, { kind: "directive", type: i10.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i10.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: i5$1.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: i5$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i5$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "pipe", type: i2$1.TranslatePipe, name: "translate" }] }); }
1835
+ }
1836
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DataTableColumnsModalComponent, decorators: [{
1837
+ type: Component,
1838
+ args: [{ selector: 'mad-data-table-columns-modal.component', template: "<h1 mat-dialog-title>{{ data?.titleLabel | translate }}</h1>\n<div mat-dialog-content>\n <div class=\"column-drag-main-content\">\n <div class=\"column-drag-container\">\n <div class=\"column-drag-info-area\">{{ data?.infoTextLabel | translate }}</div>\n <div class=\"column-drag-container-header\">{{ data?.selectedLabel | translate }}</div>\n <div\n cdkDropList\n #selectedList=\"cdkDropList\"\n [cdkDropListData]=\"selectedColumns\"\n [cdkDropListConnectedTo]=\"[availableList]\"\n class=\"column-drag-list selected-drag-list\"\n (cdkDropListDropped)=\"onDrop($event)\">\n <div class=\"column-drag-box\"\n *ngFor=\"let selectedColumn of selectedColumns; let i = index\"\n cdkDrag\n [id]=\"selectedColumn.id\"\n >\n {{i + 1}}. {{selectedColumn.label | translate }}\n </div>\n </div>\n </div>\n\n <div class=\"column-drag-container\">\n <div class=\"column-drag-info-area\">\n <!-- Table filter -->\n <mat-form-field>\n <mat-label>{{ data?.filterColumnsLabel | translate }}</mat-label>\n <input matInput autocomplete=\"off\" (keyup)=\"updateFilterValue()\"\n placeholder=\"{{ data?.filterColumnsPlaceHolder | translate }}\" [(ngModel)]=\"searchFilter\"/>\n <button *ngIf=\"searchFilter\" matSuffix mat-icon-button aria-label=\"Clear\" (click)=\"clearFilterValue()\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n </div>\n <div class=\"column-drag-container-header\">{{ data?.availableLabel | translate }}</div>\n <div\n cdkDropList\n cdkDropListSortingDisabled\n #availableList=\"cdkDropList\"\n [cdkDropListData]=\"availableColumns\"\n [cdkDropListConnectedTo]=\"[selectedList]\"\n class=\"column-drag-list\"\n (cdkDropListDropped)=\"onDrop($event)\">\n <div *ngFor=\"let availableColumn of filteredAvailableColumns\" class=\"column-drag-box\" cdkDrag [id]=\"availableColumn.id\">\n {{availableColumn.label}}\n </div>\n </div>\n </div>\n </div>\n\n</div>\n<div mat-dialog-actions [align]=\"'end'\">\n <mad-outline-button (click)=\"onCancel()\">\n {{ data?.cancelLabel | translate }}\n </mad-outline-button>\n <mad-danger-button *ngIf=\"data?.deleteDefinitionAllowed\" (click)=\"onDelete()\">\n {{ data?.deleteLabel | translate }}\n </mad-danger-button>\n <mad-primary-button (click)=\"onSave()\" [disabled]=\"!(this.selectedColumns?.length > 0)\">\n {{ data?.saveLabel | translate }}\n </mad-primary-button>\n</div>\n", styles: [".column-drag-main-content{display:flex;flex-direction:row;width:544px;justify-content:space-between;padding:8px 8px 16px;margin-bottom:16px;border-bottom:1px solid whitesmoke}.column-drag-container{width:256px;max-width:100%;display:inline-block;vertical-align:top;font-size:small}.info-box{width:100%;font-size:small;margin-bottom:16px;color:#000000a8}.column-drag-info-area{width:100%;height:36px;margin-bottom:32px;color:#000000a8;font-size:small;display:flex;justify-content:right;align-items:stretch;flex-direction:column}.column-drag-list{border:solid 1px #ccc;height:200px;box-sizing:border-box;background:white;border-radius:4px;overflow:auto;display:block}.column-drag-container-header{font-weight:700;margin-bottom:4px}.column-drag-box{padding:12px 10px;border-bottom:solid 1px #ccc;color:#000000de;display:flex;flex-direction:row;align-items:center;justify-content:space-between;box-sizing:border-box;height:40px;cursor:move;background:white;font-size:14px}.cdk-drag-preview{box-sizing:border-box;border-radius:4px;box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.cdk-drag-placeholder{opacity:0}.cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}.column-drag-box:last-child{border:none}.column-drag-list.cdk-drop-list-dragging .column-drag-box:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}\n"] }]
1839
+ }], ctorParameters: function () { return [{ type: i1$4.MatDialogRef }, { type: undefined, decorators: [{
1840
+ type: Inject,
1841
+ args: [MAT_DIALOG_DATA]
1842
+ }] }]; } });
1843
+
1844
+ class DataTableActionType {
1845
+ static { this.SINGLE = 'SINGLE'; }
1846
+ static { this.BATCH = 'BATCH'; }
1847
+ static { this.NONE = 'NONE'; }
1848
+ }
1849
+
1850
+ class DataTableComponent {
1851
+ set filterValue(filterValue) {
1852
+ const filterString = '' + filterValue;
1853
+ if (this.dataSource) {
1854
+ this.setFilterValue(filterString);
1855
+ }
1856
+ }
1857
+ set displayedColumns(cols) {
1858
+ if (!this.displayedColumnDefinition) {
1859
+ this.columns = cols ? [...cols] : [];
1860
+ this.columnIds = this.columns.map((column) => column.id);
1861
+ this.columnIds.unshift(this.ACTION_COLUMN_NAME);
1862
+ }
1863
+ }
1864
+ set displayedColumnDefinition(def) {
1865
+ this.selectedColumnDefinion = def;
1866
+ this.columns = def.displayedColumns;
1867
+ this.columnIds = this.columns.map((column) => column.id);
1868
+ this.columnIds.unshift(this.ACTION_COLUMN_NAME);
1869
+ }
1870
+ set tableData(data) {
1871
+ const dataArray = data ? data : [];
1872
+ if (!this.dataSource) {
1873
+ this.dataSource = new MatTableDataSource(dataArray);
1874
+ }
1875
+ this.createDataMapsAndSetDisplayedDataSourceData(dataArray);
1876
+ }
1877
+ set page(page) {
1878
+ this.paginatorPageIndex = page.pageIndex;
1879
+ this.paginatorPageSize = page.pageSize;
1880
+ this.paginatorLength = page.length;
1881
+ }
1882
+ set columnDefinitions(definitions) {
1883
+ this.editableColumnDefinitions = [];
1884
+ this.viewableColumnDefinitions = [];
1885
+ this.allColumnDefinitions = [...definitions];
1886
+ for (const definition of definitions) {
1887
+ if (definition.editable) {
1888
+ this.editableColumnDefinitions.push(definition);
1889
+ }
1890
+ if (definition.displayedColumns?.length > 0) {
1891
+ this.viewableColumnDefinitions.push(definition);
1892
+ }
1893
+ }
1894
+ }
1895
+ set loading(isLoading) {
1896
+ this.isLoading = isLoading;
1897
+ }
1898
+ set defaultPageSize(defaultSize) {
1899
+ this.paginatorPageSize = defaultSize;
1900
+ }
1901
+ set externalPaginator(paginator) {
1902
+ this.extPaginator = paginator;
1903
+ }
1904
+ set paginationEnabled(isPaginationEnabled) {
1905
+ this.isPaginationEnabled = isPaginationEnabled;
1906
+ this.unsetPageSizeIfNecessary();
1907
+ }
1908
+ set allColumns(allColumns) {
1909
+ this.allAvailableColumns = allColumns;
1910
+ if (allColumns && this.showColumnModal) {
1911
+ this.openColumnModal();
1912
+ }
1913
+ }
1914
+ set filterEnabled(isFilterEnabled) {
1915
+ this.isFilterEnabled = !this.useAsync ? isFilterEnabled : false;
1916
+ this.setFilterValue(undefined);
1917
+ }
1918
+ set forceMode(mode) {
1919
+ if (mode === this.SINGLE || mode === this.BATCH || mode === this.NONE) {
1920
+ this._forceMode = mode;
1921
+ this.mode = mode;
1922
+ this.selectionModel.clear();
1923
+ this.setActions();
1924
+ }
1925
+ }
1926
+ constructor(matDialog) {
1927
+ this.matDialog = matDialog;
1928
+ // Translations
1929
+ this.filterLabel = 'Filter';
1930
+ this.filterPlaceholder = '';
1931
+ this.filterColumnsLabel = 'Filter';
1932
+ this.filterColumnsPlaceHolder = 'Filter available columns';
1933
+ this.noDataText = 'No matching data found';
1934
+ this.columnSettingsModalTitleLabel = 'Column settings';
1935
+ this.selectedLabel = 'Selected columns';
1936
+ this.availableLabel = 'Available columns';
1937
+ this.saveLabel = 'Save';
1938
+ this.deleteLabel = 'Delete';
1939
+ this.cancelLabel = 'Cancel';
1940
+ this.infoTextLabel = 'Drag and drop a column to select or reorder it.';
1941
+ this.pageSizeOptions = [5, 10, 15];
1942
+ this.actions = [];
1943
+ this.deleteDefinitionAllowed = false;
1944
+ this.useAsync = false;
1945
+ this.translateLabels = true;
1946
+ this.sortEvent = new EventEmitter();
1947
+ this.actionEvent = new EventEmitter();
1948
+ this.pageEvent = new EventEmitter();
1949
+ this.allColumnsEvent = new EventEmitter();
1950
+ this.columnDefinitionChangeEvent = new EventEmitter();
1951
+ this.viewDefinitionChangeEvent = new EventEmitter();
1952
+ this.ACTION_COLUMN_NAME = '__action__';
1953
+ this.SINGLE = DataTableActionType.SINGLE;
1954
+ this.BATCH = DataTableActionType.BATCH;
1955
+ this.NONE = DataTableActionType.NONE;
1956
+ this.tableActions = [];
1957
+ this.rowActions = [];
1958
+ this.columns = [];
1959
+ this.allSelected = false;
1960
+ this.rowMap = new Map();
1961
+ this.selectionModel = new SelectionModel(true);
1962
+ this.allColumnDefinitions = [];
1963
+ this.isFilterEnabled = false;
1964
+ this.isPaginationEnabled = false;
1965
+ this.mode = this.NONE;
1966
+ this.isRowClickable = false;
1967
+ this.showColumnModal = false;
1968
+ this.isLoading = false;
1969
+ this.paginatorLength = 0;
1970
+ this.paginatorPageIndex = 0;
1971
+ this.paginatorPageSize = 50;
1972
+ }
1973
+ static compare(a, b, sort) {
1974
+ const x = a[sort.active];
1975
+ const y = b[sort.active];
1976
+ const ascending = sort.direction === 'asc';
1977
+ switch (typeof x) {
1978
+ case 'number':
1979
+ return DataTableComponent.compareNumber(x, y, ascending);
1980
+ case 'string':
1981
+ return DataTableComponent.compareString(x, y, ascending);
1982
+ case 'boolean':
1983
+ return DataTableComponent.compareBoolean(x, y, ascending);
1984
+ default:
1985
+ // cannot compare -> return equal
1986
+ return 0;
1987
+ }
1988
+ }
1989
+ static compareNumber(x, y, ascending) {
1990
+ return ascending ? x - y : y - x;
1991
+ }
1992
+ static compareString(x, y, ascending) {
1993
+ return ascending ? x.localeCompare(y) : y.localeCompare(x);
1994
+ }
1995
+ static compareBoolean(x, y, ascending) {
1996
+ if (x === y) {
1997
+ return 0;
1998
+ }
1999
+ if (ascending) {
2000
+ // true first
2001
+ return x ? -1 : 1;
2002
+ }
2003
+ else {
2004
+ // false first
2005
+ return x ? 1 : -1;
2006
+ }
2007
+ }
2008
+ static transformData(value, transformer, transformerParams) {
2009
+ if (!transformer || !(transformer instanceof Function)) {
2010
+ return value;
2011
+ }
2012
+ return transformer(value, transformerParams);
2013
+ }
2014
+ static generateRowId() {
2015
+ return v4();
2016
+ }
2017
+ static isClickOnRowMenuIcon(event) {
2018
+ return event?.target?.classList.contains('mat-icon');
2019
+ }
2020
+ ngOnInit() {
2021
+ this.mode = this.getTableMode();
2022
+ this.setActions();
2023
+ if (this.mode !== this.NONE) {
2024
+ this.isRowClickable = true;
2025
+ this.defaultAction = this.rowActions[0];
2026
+ }
2027
+ }
2028
+ ngAfterViewInit() {
2029
+ if (!this.useAsync) {
2030
+ this.dataSource.paginator = this.paginator;
2031
+ this.dataSource.sort = this.sort;
2032
+ }
2033
+ }
2034
+ onColumnSettings(definition) {
2035
+ this.showColumnModal = true;
2036
+ this.selectedDefinition = definition ? definition : this.allColumnDefinitions[0];
2037
+ if (this.allAvailableColumns) {
2038
+ this.openColumnModal();
2039
+ }
2040
+ else {
2041
+ // if no complete definitions have been loaded yet send an event so the app can load it
2042
+ this.allColumnsEvent.emit();
2043
+ }
2044
+ }
2045
+ onViewDefinition(definition) {
2046
+ this.selectedDefinition = definition;
2047
+ this.viewDefinitionChangeEvent.emit(definition);
2048
+ }
2049
+ isCurrentDefinition(definition) {
2050
+ return this.selectedDefinition && this.selectedDefinition.id === definition.id;
2051
+ }
2052
+ get selectedCount() {
2053
+ return this.selectionModel?.selected ? this.selectionModel.selected.length : 0;
2054
+ }
2055
+ get rowCount() {
2056
+ return this.getAllDataSourceRowsOfCurrentPage() ? this.getAllDataSourceRowsOfCurrentPage().length : 0;
2057
+ }
2058
+ getAllDataSourceRowsOfCurrentPage() {
2059
+ return this.dataSource?._pageData(this.dataSource.data);
2060
+ }
2061
+ getSelectedCount(actionType) {
2062
+ const count = this.selectedCount;
2063
+ if (actionType !== this.BATCH || count < 2) {
2064
+ return '';
2065
+ }
2066
+ return ' (' + count + ')';
2067
+ }
2068
+ isDisabled(actionType) {
2069
+ switch (actionType) {
2070
+ case this.SINGLE:
2071
+ return this.selectedCount !== 1;
2072
+ case this.BATCH:
2073
+ return this.selectedCount < 1;
2074
+ default:
2075
+ return false;
2076
+ }
2077
+ }
2078
+ onToggleSelectAll() {
2079
+ // clear all selection first
2080
+ this.selectionModel.clear();
2081
+ // toggle all checkbox
2082
+ this.allSelected = !this.allSelected;
2083
+ if (this.allSelected) {
2084
+ // select all rows of the current page
2085
+ this.getAllDataSourceRowsOfCurrentPage().forEach((row) => {
2086
+ if (!row.parentId) {
2087
+ this.selectionModel.select('' + row.rowId);
2088
+ }
2089
+ });
2090
+ }
2091
+ }
2092
+ isSelected(rowId) {
2093
+ return this.selectionModel.isSelected(rowId);
2094
+ }
2095
+ setFilterValue(value) {
2096
+ this.dataSource.filter = value?.trim().toLowerCase();
2097
+ }
2098
+ onRowEvent(event, row, action = this.defaultAction) {
2099
+ if (row?.parentId) {
2100
+ return;
2101
+ }
2102
+ switch (this.mode) {
2103
+ case this.BATCH:
2104
+ this.selectionModel.toggle(row.rowId);
2105
+ break;
2106
+ case this.SINGLE:
2107
+ // emit the default action if the row (not the icon!) was clicked
2108
+ if (!!action && !DataTableComponent.isClickOnRowMenuIcon(event)) {
2109
+ const selected = [];
2110
+ // if ID-generator is provided, return the ID, else return the ACTUAL data
2111
+ selected.push(this.idGenerator ? row.rowId : this.rowMap.get(row.rowId)?.actualData);
2112
+ this.emitTableAction(action, selected);
2113
+ }
2114
+ break;
2115
+ default:
2116
+ // do nothing if mode is NONE (or null)
2117
+ return;
2118
+ }
2119
+ }
2120
+ onSortingEvent(sort) {
2121
+ if (this.useAsync) {
2122
+ this.sortEvent.emit(sort);
2123
+ }
2124
+ else {
2125
+ this.internalSort(sort);
2126
+ }
2127
+ }
2128
+ onPageEvent(event) {
2129
+ if (this.useAsync) {
2130
+ this.pageEvent.emit(event);
2131
+ }
2132
+ }
2133
+ onTableAction(tableAction) {
2134
+ if (!!tableAction) {
2135
+ const selection = [];
2136
+ for (const selected of this.selectionModel.selected) {
2137
+ selection.push(this.idGenerator ? selected : this.rowMap.get(selected)?.actualData);
2138
+ }
2139
+ tableAction.selected = selection;
2140
+ this.actionEvent.emit(tableAction);
2141
+ }
2142
+ }
2143
+ emitTableAction(action, selected) {
2144
+ const emitAction = { ...action };
2145
+ if (action.type !== this.NONE) {
2146
+ emitAction.selected = [...selected];
2147
+ }
2148
+ this.actionEvent.emit(emitAction);
2149
+ }
2150
+ generateDisplayedDataElement(rowId, parentId, actualDataElement) {
2151
+ const displayedDataElement = {};
2152
+ displayedDataElement.rowId = rowId;
2153
+ displayedDataElement.parentId = parentId;
2154
+ for (const column of this.columns) {
2155
+ const actualValue = actualDataElement[column.dataPropertyName];
2156
+ displayedDataElement[column.dataPropertyName] = DataTableComponent.transformData(actualValue, column.transformer, column.transformerParams);
2157
+ }
2158
+ return displayedDataElement;
2159
+ }
2160
+ internalSort(sort) {
2161
+ const sortedData = [...this.dataSource.data].sort((a, b) => DataTableComponent.compare(a, b, sort));
2162
+ this.dataSource.data = [...sortedData];
2163
+ }
2164
+ setActions() {
2165
+ this.rowActions = [];
2166
+ this.tableActions = [];
2167
+ for (const action of this.actions) {
2168
+ if (this.mode !== action.hiddenInMode) {
2169
+ switch (action.type) {
2170
+ case this.SINGLE:
2171
+ if (this.mode === this.SINGLE) {
2172
+ this.rowActions.push(action);
2173
+ }
2174
+ else {
2175
+ this.tableActions.push(action);
2176
+ }
2177
+ break;
2178
+ case this.BATCH:
2179
+ if (this.mode !== this.SINGLE) {
2180
+ this.tableActions.push(action);
2181
+ }
2182
+ break;
2183
+ default:
2184
+ this.tableActions.push(action);
2185
+ }
2186
+ }
2187
+ }
2188
+ }
2189
+ createDataMapsAndSetDisplayedDataSourceData(data) {
2190
+ const displayedDataList = [];
2191
+ this.rowMap.clear();
2192
+ if (data?.length > 0) {
2193
+ for (const dataEntry of data) {
2194
+ const rowId = this.idGenerator ? this.idGenerator(dataEntry) : DataTableComponent.generateRowId();
2195
+ const parentId = this.parentIdGenerator ? this.parentIdGenerator(dataEntry) : undefined;
2196
+ const displayedDataElement = this.generateDisplayedDataElement(rowId, parentId, dataEntry);
2197
+ const dataRow = {
2198
+ id: rowId,
2199
+ parentId: parentId,
2200
+ actualData: dataEntry,
2201
+ displayedData: displayedDataElement,
2202
+ };
2203
+ this.rowMap.set(rowId, dataRow);
2204
+ displayedDataList.push(displayedDataElement);
2205
+ }
2206
+ }
2207
+ this.dataSource.data = displayedDataList;
2208
+ this.unsetPageSizeIfNecessary();
2209
+ }
2210
+ openColumnModal() {
2211
+ const dialogData = {
2212
+ allColumns: this.allAvailableColumns,
2213
+ definition: this.selectedDefinition,
2214
+ deleteDefinitionAllowed: this.deleteDefinitionAllowed,
2215
+ filterColumnsLabel: this.filterColumnsLabel,
2216
+ filterColumnsPlaceHolder: this.filterColumnsPlaceHolder,
2217
+ noDataText: this.noDataText,
2218
+ titleLabel: this.columnSettingsModalTitleLabel,
2219
+ selectedLabel: this.selectedLabel,
2220
+ availableLabel: this.availableLabel,
2221
+ saveLabel: this.saveLabel,
2222
+ deleteLabel: this.deleteLabel,
2223
+ cancelLabel: this.cancelLabel,
2224
+ infoTextLabel: this.infoTextLabel,
2225
+ };
2226
+ const dialog = this.matDialog.open(DataTableColumnsModalComponent, { data: dialogData });
2227
+ dialog.afterClosed().subscribe((result) => {
2228
+ // no event on CANCEL
2229
+ if (result) {
2230
+ this.columnDefinitionChangeEvent.emit(result);
2231
+ }
2232
+ });
2233
+ }
2234
+ getTableMode() {
2235
+ if (this._forceMode) {
2236
+ return this._forceMode;
2237
+ }
2238
+ if (!this.actions) {
2239
+ return this.NONE;
2240
+ }
2241
+ const distinctActionTypes = new Set();
2242
+ for (const rowAction of this.actions) {
2243
+ distinctActionTypes.add(rowAction.type);
2244
+ }
2245
+ if (distinctActionTypes.has(this.BATCH)) {
2246
+ return this.BATCH;
2247
+ }
2248
+ if (distinctActionTypes.has(this.SINGLE)) {
2249
+ return this.SINGLE;
2250
+ }
2251
+ return this.NONE;
2252
+ }
2253
+ unsetPageSizeIfNecessary() {
2254
+ if (!this.useAsync && !this.isPaginationEnabled) {
2255
+ const dataCount = this.dataSource.data ? this.dataSource.data.length : 0;
2256
+ this.paginatorPageSize = dataCount;
2257
+ this.paginatorLength = dataCount;
2258
+ }
2259
+ }
2260
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DataTableComponent, deps: [{ token: i1$4.MatDialog }], target: i0.ɵɵFactoryTarget.Component }); }
2261
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: DataTableComponent, selector: "mad-data-table", inputs: { filterLabel: "filterLabel", filterPlaceholder: "filterPlaceholder", filterColumnsLabel: "filterColumnsLabel", filterColumnsPlaceHolder: "filterColumnsPlaceHolder", noDataText: "noDataText", columnSettingsModalTitleLabel: "columnSettingsModalTitleLabel", selectedLabel: "selectedLabel", availableLabel: "availableLabel", saveLabel: "saveLabel", deleteLabel: "deleteLabel", cancelLabel: "cancelLabel", infoTextLabel: "infoTextLabel", tableClass: "tableClass", pageSizeOptions: "pageSizeOptions", externalFilter: "externalFilter", actions: "actions", idGenerator: "idGenerator", parentIdGenerator: "parentIdGenerator", deleteDefinitionAllowed: "deleteDefinitionAllowed", useAsync: "useAsync", translateLabels: "translateLabels", filterValue: "filterValue", displayedColumns: "displayedColumns", displayedColumnDefinition: "displayedColumnDefinition", tableData: "tableData", page: "page", columnDefinitions: "columnDefinitions", loading: "loading", defaultPageSize: "defaultPageSize", externalPaginator: "externalPaginator", paginationEnabled: "paginationEnabled", allColumns: "allColumns", filterEnabled: "filterEnabled", forceMode: "forceMode" }, outputs: { sortEvent: "sortEvent", actionEvent: "actionEvent", pageEvent: "pageEvent", allColumnsEvent: "allColumnsEvent", columnDefinitionChangeEvent: "columnDefinitionChangeEvent", viewDefinitionChangeEvent: "viewDefinitionChangeEvent" }, viewQueries: [{ propertyName: "paginator", first: true, predicate: MatPaginator, descendants: true }, { propertyName: "sort", first: true, predicate: MatSort, descendants: true, static: true }], ngImport: i0, template: "<div class=\"mad-datatable-action-bar\">\n <!-- Table actions: displayed before the table -->\n <div *ngIf=\"tableActions?.length\">\n <mad-outline-button\n [disabled]=\"isDisabled(tableAction.type)\"\n class=\"table-action\"\n *ngFor=\"let tableAction of tableActions\"\n (click)=\"onTableAction(tableAction)\">\n {{ translateLabels ? (tableAction.label | translate) : tableAction.label }} {{ getSelectedCount(tableAction.type) }}\n </mad-outline-button>\n </div>\n <!-- Table filter -->\n <mat-form-field *ngIf=\"isFilterEnabled\">\n <mat-label>{{ translateLabels ? (filterLabel | translate) : filterLabel }}</mat-label>\n <input matInput autocomplete=\"off\" (keyup)=\"setFilterValue($event?.target?.value)\"\n placeholder=\"{{ filterPlaceholder }}\" />\n </mat-form-field>\n</div>\n\n\n<!-- Row action menu -->\n<mat-menu #rowActionMenu=\"matMenu\">\n <ng-template matMenuContent let-element=\"element\">\n <button *ngFor=\"let rowAction of rowActions\" mat-menu-item class=\"row-action\"\n (click)=\"onRowEvent($event, element, rowAction)\">\n {{ translateLabels ? (rowAction.label | translate) : rowAction.label }}\n </button>\n </ng-template>\n</mat-menu>\n\n<!-- editable definition menu -->\n<mat-menu #editableDefinitionMenu=\"matMenu\">\n <ng-template matMenuContent>\n <button *ngFor=\"let definition of editableColumnDefinitions\"\n mat-menu-item\n class=\"row-action\"\n (click)=\"onColumnSettings(definition)\"\n [ngClass]=\"{'active-column-definition': isCurrentDefinition(definition)}\"\n >\n {{ translateLabels ? (definition.label | translate) : definition.label }}\n </button>\n </ng-template>\n</mat-menu>\n\n<!-- viewable definition menu -->\n<mat-menu #viewableDefinitionMenu=\"matMenu\">\n <ng-template matMenuContent>\n <button *ngFor=\"let definition of viewableColumnDefinitions\"\n mat-menu-item\n class=\"row-action\"\n (click)=\"onViewDefinition(definition)\"\n [ngClass]=\"{'active-column-definition': isCurrentDefinition(definition)}\"\n >\n {{ translateLabels ? (definition.label | translate) : definition.label }}\n </button>\n </ng-template>\n</mat-menu>\n\n<!-- Table -->\n<div *ngIf=\"rowCount > 0; else noData\" class=\"datatable\" [class]=\"tableClass\">\n <div class=\"mad-datatable-spinner-wrapper\" *ngIf=\"isLoading\">\n <mat-spinner [diameter]=\"50\" [strokeWidth]=\"3\"></mat-spinner>\n </div>\n\n <table mat-table [dataSource]=\"dataSource\" matSort (matSortChange)=\"onSortingEvent($event)\">\n <!-- Row actions column-->\n <ng-container [matColumnDef]=\"ACTION_COLUMN_NAME\">\n <th scope=\"col\" mat-header-cell *matHeaderCellDef [ngClass]=\"mode === NONE ? 'no-action-cell' : 'row-action-cell'\">\n <!-- BATCH: master checkbox -->\n <div *ngIf=\"mode === BATCH\" class=\"mad-datatable-checkbox-container\">\n <mat-checkbox\n (change)=\"onToggleSelectAll()\"\n [checked]=\"allSelected\"\n >\n </mat-checkbox>\n </div>\n <!-- SINGLE / NONE: nothing in header row -->\n </th>\n <td mat-cell *matCellDef=\"let element\" [ngClass]=\"mode === NONE ? 'no-action-cell' : 'row-action-cell'\">\n <!-- BATCH: row checkbox -->\n <div *ngIf=\"!element.parentId && (mode === BATCH)\" class=\"mad-datatable-checkbox-container\">\n <mat-checkbox\n class=\"no-pointer-events\"\n [checked]=\"isSelected(element.rowId)\"\n >\n </mat-checkbox>\n </div>\n <!-- SINGLE: row action menu icon -->\n <mad-icon-button\n *ngIf=\"!element.parentId && (mode === SINGLE)\"\n [matMenuTriggerData]=\"{ element: element }\" [matMenuTriggerFor]=\"rowActionMenu\"\n >\n <mat-icon>more_vert</mat-icon>\n </mad-icon-button>\n <!-- NONE: nothing -->\n </td>\n </ng-container>\n <!-- Cell definitions and rows with injected cells -->\n <ng-container *ngFor=\"let column of columns\" [matColumnDef]=\"column.id\">\n <!-- header cell to be injected -->\n <ng-container *ngIf=\"column.isSortable; else noSort\">\n <th\n scope=\"col\"\n mat-header-cell\n *matHeaderCellDef\n mat-sort-header=\"{{ column.orderByName? column.orderByName : column.dataPropertyName }}\"\n [arrowPosition]=\"column.isRightAligned ? 'before' : 'after'\"\n [class.text-right]=\"column.isRightAligned\"\n >\n {{ translateLabels ? (column.label | translate) : column.label }}\n </th>\n </ng-container>\n <ng-template #noSort>\n <th scope=\"col\" mat-header-cell *matHeaderCellDef [class.text-right]=\"column.isRightAligned\">\n {{ translateLabels ? (column.label | translate) : column.label }}\n </th>\n </ng-template>\n <!-- data cell to be injected -->\n <td mat-cell *matCellDef=\"let element\" [class.text-right]=\"column.isRightAligned\" [class.mad-dt-child-cell]=\"element.parentId\" [ngSwitch]=\"column.transformer\">\n <span>\n {{ element[column.dataPropertyName] }}\n </span>\n </td>\n </ng-container>\n <!-- header row where cells will be injected -->\n <tr mat-header-row *matHeaderRowDef=\"columnIds\"></tr>\n <!-- data row where cells will be injected -->\n <tr\n mat-row\n [class.clickable-table-row]=\"!row.parentId && isRowClickable\"\n (click)=\"onRowEvent($event, row)\"\n *matRowDef=\"let row; columns: columnIds\"\n ></tr>\n </table>\n</div>\n<div class=\"mad-data-table-bottom-area\">\n <div class=\"mad-data-table-bottom-info-area\">\n <!-- column settings: 1 definition -->\n <mad-icon-button\n *ngIf=\"this.editableColumnDefinitions?.length == 1\"\n (click)=\"onColumnSettings()\"\n >\n <mat-icon class=\"material-icons-outlined\">view_column</mat-icon>\n </mad-icon-button>\n <!-- column settings: multiple definitions -->\n <mad-icon-button\n *ngIf=\"this.editableColumnDefinitions?.length > 0\" [matMenuTriggerFor]=\"editableDefinitionMenu\"\n >\n <mat-icon>view_column</mat-icon>\n </mad-icon-button>\n <!-- column view: multiple definitions -->\n <mad-icon-button\n *ngIf=\"this.viewableColumnDefinitions?.length > 0\" [matMenuTriggerFor]=\"viewableDefinitionMenu\"\n >\n <mat-icon>preview</mat-icon>\n </mad-icon-button>\n </div>\n\n <!-- Pagination -->\n <mat-paginator\n [style.display]=\"isPaginationEnabled ? 'block' : 'none'\"\n [length]=\"paginatorLength\"\n [pageIndex]=\"paginatorPageIndex\"\n [pageSize]=\"paginatorPageSize\"\n [pageSizeOptions]=\"pageSizeOptions\"\n (page)=\"onPageEvent($event)\"\n showFirstLastButtons\n >\n </mat-paginator>\n</div>\n\n<!-- No data alert -->\n<ng-template #noData>\n <div class=\"noDataText\">\n <div class=\"mad-datatable-spinner-wrapper\" *ngIf=\"isLoading\">\n <mat-spinner [diameter]=\"50\" [strokeWidth]=\"3\"></mat-spinner>\n </div>\n {{ noDataText }}\n </div>\n</ng-template>\n", styles: [":host{display:flex;flex-direction:column;min-height:112px;flex:1 1 auto;background-color:#fff}.datatable-vertical-stretch-to-parent{flex:1;max-height:100%;width:100%;display:flex;flex-direction:column}.datatable-max-height-500{max-height:500px}.datatable-max-height-300{max-height:300px}.datatable-max-height,.datatable-max-height-500,.datatable-max-height-300{flex:1;width:100%;display:flex;flex-direction:column}.datatable{overflow:auto;flex:1 1 auto;height:100%;position:relative;width:100%}.datatable table{max-height:100%;width:100%}.datatable th,.datatable td{overflow:hidden;width:auto;text-overflow:ellipsis;white-space:nowrap}.text-right{text-align:right!important;padding-right:24px!important}.table-action{margin-right:.5em;margin-bottom:.5em}.row-action-cell{width:48px!important;padding-left:8px!important}.no-action-cell{width:8px!important;padding:0}.noDataText{width:100%;text-align:center;position:relative}.mad-datatable-action-bar{display:flex;justify-content:space-between;align-items:baseline}.mad-datatable-checkbox-container{margin-right:8px;margin-left:8px}.mad-datatable-spinner-wrapper{background-color:#fff;opacity:.8;position:absolute;top:0;left:0;width:100%;height:100%;display:flex;justify-content:center;align-items:center;z-index:99999;pointer-events:unset}.mad-data-table-bottom-area{display:flex;flex-direction:row}.mad-data-table-bottom-area .mad-data-table-bottom-info-area{display:flex;flex:1}.mat-mdc-header-row th{position:sticky;top:0;background-color:#fff;z-index:1}.no-pointer-events{pointer-events:none}.active-column-definition{color:#000;background-color:#f5f5f5}.mad-dt-child-cell{color:#0009}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatLabel, selector: "mat-label" }, { kind: "directive", type: i4.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.MatMenu, selector: "mat-menu", exportAs: ["matMenu"] }, { kind: "component", type: i6.MatMenuItem, selector: "[mat-menu-item]", inputs: ["disabled", "disableRipple", "role"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i6.MatMenuContent, selector: "ng-template[matMenuContent]" }, { kind: "directive", type: i6.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", exportAs: ["matMenuTrigger"] }, { kind: "component", type: i6$1.MatPaginator, selector: "mat-paginator", inputs: ["disabled"], exportAs: ["matPaginator"] }, { kind: "directive", type: i7.MatSort, selector: "[matSort]", inputs: ["matSortDisabled", "matSortActive", "matSortStart", "matSortDirection", "matSortDisableClear"], outputs: ["matSortChange"], exportAs: ["matSort"] }, { kind: "component", type: i7.MatSortHeader, selector: "[mat-sort-header]", inputs: ["disabled", "mat-sort-header", "arrowPosition", "start", "sortActionDescription", "disableClear"], exportAs: ["matSortHeader"] }, { kind: "component", type: i8$1.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i8$1.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i8$1.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i8$1.MatColumnDef, selector: "[matColumnDef]", inputs: ["sticky", "matColumnDef"] }, { kind: "directive", type: i8$1.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i8$1.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i8$1.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i8$1.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i8$1.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i8$1.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "component", type: i10$1.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "component", type: OutlineButtonComponent, selector: "mad-outline-button", inputs: ["type", "disabled", "title"] }, { kind: "component", type: IconButtonComponent, selector: "mad-icon-button", inputs: ["type", "disabled", "title"] }, { kind: "component", type: i13.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex"], exportAs: ["matCheckbox"] }, { kind: "pipe", type: i2$1.TranslatePipe, name: "translate" }] }); }
2262
+ }
2263
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DataTableComponent, decorators: [{
2264
+ type: Component,
2265
+ args: [{ selector: 'mad-data-table', template: "<div class=\"mad-datatable-action-bar\">\n <!-- Table actions: displayed before the table -->\n <div *ngIf=\"tableActions?.length\">\n <mad-outline-button\n [disabled]=\"isDisabled(tableAction.type)\"\n class=\"table-action\"\n *ngFor=\"let tableAction of tableActions\"\n (click)=\"onTableAction(tableAction)\">\n {{ translateLabels ? (tableAction.label | translate) : tableAction.label }} {{ getSelectedCount(tableAction.type) }}\n </mad-outline-button>\n </div>\n <!-- Table filter -->\n <mat-form-field *ngIf=\"isFilterEnabled\">\n <mat-label>{{ translateLabels ? (filterLabel | translate) : filterLabel }}</mat-label>\n <input matInput autocomplete=\"off\" (keyup)=\"setFilterValue($event?.target?.value)\"\n placeholder=\"{{ filterPlaceholder }}\" />\n </mat-form-field>\n</div>\n\n\n<!-- Row action menu -->\n<mat-menu #rowActionMenu=\"matMenu\">\n <ng-template matMenuContent let-element=\"element\">\n <button *ngFor=\"let rowAction of rowActions\" mat-menu-item class=\"row-action\"\n (click)=\"onRowEvent($event, element, rowAction)\">\n {{ translateLabels ? (rowAction.label | translate) : rowAction.label }}\n </button>\n </ng-template>\n</mat-menu>\n\n<!-- editable definition menu -->\n<mat-menu #editableDefinitionMenu=\"matMenu\">\n <ng-template matMenuContent>\n <button *ngFor=\"let definition of editableColumnDefinitions\"\n mat-menu-item\n class=\"row-action\"\n (click)=\"onColumnSettings(definition)\"\n [ngClass]=\"{'active-column-definition': isCurrentDefinition(definition)}\"\n >\n {{ translateLabels ? (definition.label | translate) : definition.label }}\n </button>\n </ng-template>\n</mat-menu>\n\n<!-- viewable definition menu -->\n<mat-menu #viewableDefinitionMenu=\"matMenu\">\n <ng-template matMenuContent>\n <button *ngFor=\"let definition of viewableColumnDefinitions\"\n mat-menu-item\n class=\"row-action\"\n (click)=\"onViewDefinition(definition)\"\n [ngClass]=\"{'active-column-definition': isCurrentDefinition(definition)}\"\n >\n {{ translateLabels ? (definition.label | translate) : definition.label }}\n </button>\n </ng-template>\n</mat-menu>\n\n<!-- Table -->\n<div *ngIf=\"rowCount > 0; else noData\" class=\"datatable\" [class]=\"tableClass\">\n <div class=\"mad-datatable-spinner-wrapper\" *ngIf=\"isLoading\">\n <mat-spinner [diameter]=\"50\" [strokeWidth]=\"3\"></mat-spinner>\n </div>\n\n <table mat-table [dataSource]=\"dataSource\" matSort (matSortChange)=\"onSortingEvent($event)\">\n <!-- Row actions column-->\n <ng-container [matColumnDef]=\"ACTION_COLUMN_NAME\">\n <th scope=\"col\" mat-header-cell *matHeaderCellDef [ngClass]=\"mode === NONE ? 'no-action-cell' : 'row-action-cell'\">\n <!-- BATCH: master checkbox -->\n <div *ngIf=\"mode === BATCH\" class=\"mad-datatable-checkbox-container\">\n <mat-checkbox\n (change)=\"onToggleSelectAll()\"\n [checked]=\"allSelected\"\n >\n </mat-checkbox>\n </div>\n <!-- SINGLE / NONE: nothing in header row -->\n </th>\n <td mat-cell *matCellDef=\"let element\" [ngClass]=\"mode === NONE ? 'no-action-cell' : 'row-action-cell'\">\n <!-- BATCH: row checkbox -->\n <div *ngIf=\"!element.parentId && (mode === BATCH)\" class=\"mad-datatable-checkbox-container\">\n <mat-checkbox\n class=\"no-pointer-events\"\n [checked]=\"isSelected(element.rowId)\"\n >\n </mat-checkbox>\n </div>\n <!-- SINGLE: row action menu icon -->\n <mad-icon-button\n *ngIf=\"!element.parentId && (mode === SINGLE)\"\n [matMenuTriggerData]=\"{ element: element }\" [matMenuTriggerFor]=\"rowActionMenu\"\n >\n <mat-icon>more_vert</mat-icon>\n </mad-icon-button>\n <!-- NONE: nothing -->\n </td>\n </ng-container>\n <!-- Cell definitions and rows with injected cells -->\n <ng-container *ngFor=\"let column of columns\" [matColumnDef]=\"column.id\">\n <!-- header cell to be injected -->\n <ng-container *ngIf=\"column.isSortable; else noSort\">\n <th\n scope=\"col\"\n mat-header-cell\n *matHeaderCellDef\n mat-sort-header=\"{{ column.orderByName? column.orderByName : column.dataPropertyName }}\"\n [arrowPosition]=\"column.isRightAligned ? 'before' : 'after'\"\n [class.text-right]=\"column.isRightAligned\"\n >\n {{ translateLabels ? (column.label | translate) : column.label }}\n </th>\n </ng-container>\n <ng-template #noSort>\n <th scope=\"col\" mat-header-cell *matHeaderCellDef [class.text-right]=\"column.isRightAligned\">\n {{ translateLabels ? (column.label | translate) : column.label }}\n </th>\n </ng-template>\n <!-- data cell to be injected -->\n <td mat-cell *matCellDef=\"let element\" [class.text-right]=\"column.isRightAligned\" [class.mad-dt-child-cell]=\"element.parentId\" [ngSwitch]=\"column.transformer\">\n <span>\n {{ element[column.dataPropertyName] }}\n </span>\n </td>\n </ng-container>\n <!-- header row where cells will be injected -->\n <tr mat-header-row *matHeaderRowDef=\"columnIds\"></tr>\n <!-- data row where cells will be injected -->\n <tr\n mat-row\n [class.clickable-table-row]=\"!row.parentId && isRowClickable\"\n (click)=\"onRowEvent($event, row)\"\n *matRowDef=\"let row; columns: columnIds\"\n ></tr>\n </table>\n</div>\n<div class=\"mad-data-table-bottom-area\">\n <div class=\"mad-data-table-bottom-info-area\">\n <!-- column settings: 1 definition -->\n <mad-icon-button\n *ngIf=\"this.editableColumnDefinitions?.length == 1\"\n (click)=\"onColumnSettings()\"\n >\n <mat-icon class=\"material-icons-outlined\">view_column</mat-icon>\n </mad-icon-button>\n <!-- column settings: multiple definitions -->\n <mad-icon-button\n *ngIf=\"this.editableColumnDefinitions?.length > 0\" [matMenuTriggerFor]=\"editableDefinitionMenu\"\n >\n <mat-icon>view_column</mat-icon>\n </mad-icon-button>\n <!-- column view: multiple definitions -->\n <mad-icon-button\n *ngIf=\"this.viewableColumnDefinitions?.length > 0\" [matMenuTriggerFor]=\"viewableDefinitionMenu\"\n >\n <mat-icon>preview</mat-icon>\n </mad-icon-button>\n </div>\n\n <!-- Pagination -->\n <mat-paginator\n [style.display]=\"isPaginationEnabled ? 'block' : 'none'\"\n [length]=\"paginatorLength\"\n [pageIndex]=\"paginatorPageIndex\"\n [pageSize]=\"paginatorPageSize\"\n [pageSizeOptions]=\"pageSizeOptions\"\n (page)=\"onPageEvent($event)\"\n showFirstLastButtons\n >\n </mat-paginator>\n</div>\n\n<!-- No data alert -->\n<ng-template #noData>\n <div class=\"noDataText\">\n <div class=\"mad-datatable-spinner-wrapper\" *ngIf=\"isLoading\">\n <mat-spinner [diameter]=\"50\" [strokeWidth]=\"3\"></mat-spinner>\n </div>\n {{ noDataText }}\n </div>\n</ng-template>\n", styles: [":host{display:flex;flex-direction:column;min-height:112px;flex:1 1 auto;background-color:#fff}.datatable-vertical-stretch-to-parent{flex:1;max-height:100%;width:100%;display:flex;flex-direction:column}.datatable-max-height-500{max-height:500px}.datatable-max-height-300{max-height:300px}.datatable-max-height,.datatable-max-height-500,.datatable-max-height-300{flex:1;width:100%;display:flex;flex-direction:column}.datatable{overflow:auto;flex:1 1 auto;height:100%;position:relative;width:100%}.datatable table{max-height:100%;width:100%}.datatable th,.datatable td{overflow:hidden;width:auto;text-overflow:ellipsis;white-space:nowrap}.text-right{text-align:right!important;padding-right:24px!important}.table-action{margin-right:.5em;margin-bottom:.5em}.row-action-cell{width:48px!important;padding-left:8px!important}.no-action-cell{width:8px!important;padding:0}.noDataText{width:100%;text-align:center;position:relative}.mad-datatable-action-bar{display:flex;justify-content:space-between;align-items:baseline}.mad-datatable-checkbox-container{margin-right:8px;margin-left:8px}.mad-datatable-spinner-wrapper{background-color:#fff;opacity:.8;position:absolute;top:0;left:0;width:100%;height:100%;display:flex;justify-content:center;align-items:center;z-index:99999;pointer-events:unset}.mad-data-table-bottom-area{display:flex;flex-direction:row}.mad-data-table-bottom-area .mad-data-table-bottom-info-area{display:flex;flex:1}.mat-mdc-header-row th{position:sticky;top:0;background-color:#fff;z-index:1}.no-pointer-events{pointer-events:none}.active-column-definition{color:#000;background-color:#f5f5f5}.mad-dt-child-cell{color:#0009}\n"] }]
2266
+ }], ctorParameters: function () { return [{ type: i1$4.MatDialog }]; }, propDecorators: { filterLabel: [{
2267
+ type: Input
2268
+ }], filterPlaceholder: [{
2269
+ type: Input
2270
+ }], filterColumnsLabel: [{
2271
+ type: Input
2272
+ }], filterColumnsPlaceHolder: [{
2273
+ type: Input
2274
+ }], noDataText: [{
2275
+ type: Input
2276
+ }], columnSettingsModalTitleLabel: [{
2277
+ type: Input
2278
+ }], selectedLabel: [{
2279
+ type: Input
2280
+ }], availableLabel: [{
2281
+ type: Input
2282
+ }], saveLabel: [{
2283
+ type: Input
2284
+ }], deleteLabel: [{
2285
+ type: Input
2286
+ }], cancelLabel: [{
2287
+ type: Input
2288
+ }], infoTextLabel: [{
2289
+ type: Input
2290
+ }], tableClass: [{
2291
+ type: Input
2292
+ }], pageSizeOptions: [{
2293
+ type: Input
2294
+ }], externalFilter: [{
2295
+ type: Input
2296
+ }], actions: [{
2297
+ type: Input
2298
+ }], idGenerator: [{
2299
+ type: Input
2300
+ }], parentIdGenerator: [{
2301
+ type: Input
2302
+ }], deleteDefinitionAllowed: [{
2303
+ type: Input
2304
+ }], useAsync: [{
2305
+ type: Input
2306
+ }], translateLabels: [{
2307
+ type: Input
2308
+ }], filterValue: [{
2309
+ type: Input
2310
+ }], displayedColumns: [{
2311
+ type: Input
2312
+ }], displayedColumnDefinition: [{
2313
+ type: Input
2314
+ }], tableData: [{
2315
+ type: Input
2316
+ }], page: [{
2317
+ type: Input
2318
+ }], columnDefinitions: [{
2319
+ type: Input
2320
+ }], loading: [{
2321
+ type: Input
2322
+ }], defaultPageSize: [{
2323
+ type: Input
2324
+ }], externalPaginator: [{
2325
+ type: Input
2326
+ }], paginationEnabled: [{
2327
+ type: Input
2328
+ }], allColumns: [{
2329
+ type: Input
2330
+ }], filterEnabled: [{
2331
+ type: Input
2332
+ }], forceMode: [{
2333
+ type: Input
2334
+ }], sortEvent: [{
2335
+ type: Output
2336
+ }], actionEvent: [{
2337
+ type: Output
2338
+ }], pageEvent: [{
2339
+ type: Output
2340
+ }], allColumnsEvent: [{
2341
+ type: Output
2342
+ }], columnDefinitionChangeEvent: [{
2343
+ type: Output
2344
+ }], viewDefinitionChangeEvent: [{
2345
+ type: Output
2346
+ }], paginator: [{
2347
+ type: ViewChild,
2348
+ args: [MatPaginator, { static: false }]
2349
+ }], sort: [{
2350
+ type: ViewChild,
2351
+ args: [MatSort, { static: true }]
2352
+ }] } });
2353
+
2354
+ class DataTableModule {
2355
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DataTableModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
2356
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.1", ngImport: i0, type: DataTableModule, declarations: [DataTableComponent, DataTableColumnsModalComponent], imports: [CommonModule,
2357
+ MatButtonModule,
2358
+ MatIconModule,
2359
+ MatFormFieldModule,
2360
+ MatInputModule,
2361
+ MatMenuModule,
2362
+ MatPaginatorModule,
2363
+ MatSortModule,
2364
+ MatTableModule,
2365
+ MatProgressSpinnerModule,
2366
+ ButtonModule,
2367
+ TranslateModule,
2368
+ MatCheckboxModule,
2369
+ MatBadgeModule,
2370
+ DragDropModule,
2371
+ FormsModule], exports: [DataTableComponent, DataTableColumnsModalComponent] }); }
2372
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DataTableModule, imports: [CommonModule,
2373
+ MatButtonModule,
2374
+ MatIconModule,
2375
+ MatFormFieldModule,
2376
+ MatInputModule,
2377
+ MatMenuModule,
2378
+ MatPaginatorModule,
2379
+ MatSortModule,
2380
+ MatTableModule,
2381
+ MatProgressSpinnerModule,
2382
+ ButtonModule,
2383
+ TranslateModule,
2384
+ MatCheckboxModule,
2385
+ MatBadgeModule,
2386
+ DragDropModule,
2387
+ FormsModule] }); }
2388
+ }
2389
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DataTableModule, decorators: [{
2390
+ type: NgModule,
2391
+ args: [{
2392
+ declarations: [DataTableComponent, DataTableColumnsModalComponent],
2393
+ imports: [
2394
+ CommonModule,
2395
+ MatButtonModule,
2396
+ MatIconModule,
2397
+ MatFormFieldModule,
2398
+ MatInputModule,
2399
+ MatMenuModule,
2400
+ MatPaginatorModule,
2401
+ MatSortModule,
2402
+ MatTableModule,
2403
+ MatProgressSpinnerModule,
2404
+ ButtonModule,
2405
+ TranslateModule,
2406
+ MatCheckboxModule,
2407
+ MatBadgeModule,
2408
+ DragDropModule,
2409
+ FormsModule,
2410
+ ],
2411
+ exports: [DataTableComponent, DataTableColumnsModalComponent],
2412
+ }]
2413
+ }] });
2414
+
2415
+ class StepHeaderComponent extends CdkStepHeader {
2416
+ constructor(_focusMonitor, _elementRef) {
2417
+ super(_elementRef);
2418
+ this._focusMonitor = _focusMonitor;
2419
+ }
2420
+ ngAfterViewInit() {
2421
+ this._focusMonitor.monitor(this._elementRef, true);
2422
+ }
2423
+ ngOnDestroy() {
2424
+ this._focusMonitor.stopMonitoring(this._elementRef);
2425
+ }
2426
+ /** Focuses the step header. */
2427
+ focus(origin, options) {
2428
+ if (origin) {
2429
+ this._focusMonitor.focusVia(this._elementRef, origin, options);
2430
+ }
2431
+ else {
2432
+ this._elementRef.nativeElement.focus(options);
2433
+ }
2434
+ }
2435
+ getCssForState() {
2436
+ if (this.state === STEP_STATE.NUMBER && !this.completed && !this.hasError) {
2437
+ return 'step-state-neutral'; //initiale state is 'number'
2438
+ }
2439
+ else if (this.completed) {
2440
+ return 'step-state-complete';
2441
+ }
2442
+ else if (this.hasError) {
2443
+ return 'step-state-error';
2444
+ }
2445
+ }
2446
+ getIcon() {
2447
+ if (this.completed) {
2448
+ return 'check_circle_outline';
2449
+ }
2450
+ else if (this.hasError) {
2451
+ return 'error_outline';
2452
+ }
2453
+ return '';
2454
+ }
2455
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: StepHeaderComponent, deps: [{ token: i1$5.FocusMonitor }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
2456
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: StepHeaderComponent, selector: "mad-step-header", inputs: { color: "color", index: "index", label: "label", state: "state", errorMessage: "errorMessage", selected: "selected", active: "active", optional: "optional", hasError: "hasError", completed: "completed", closed: "closed" }, host: { attributes: { "role": "tab" }, classAttribute: "mad-step-header" }, usesInheritance: true, ngImport: i0, template: "<div\n class=\"header\"\n [style.background]=\"this.selected && !this.closed ? '#d8e2e9' : '#ffffff'\"\n [ngClass]=\"this.hasError ? 'error-border' : 'check-border'\"\n>\n <div [ngClass]=\"this.getCssForState()\"></div>\n <div class=\"header-label\">\n <mat-icon class=\"material-icons-outlined\">\n {{ this.selected && !this.closed ? 'keyboard_arrow_down' : 'keyboard_arrow_right' }}\n </mat-icon>\n </div>\n <div *ngIf=\"this.completed || this.hasError\" class=\"header-label\">\n <mat-icon [ngClass]=\"this.completed ? 'green-check' : 'red-error'\">\n {{ getIcon() }}\n </mat-icon>\n </div>\n <span *ngIf=\"!this.hasError && !this.completed\" class=\"header-label\">{{ this.index + 1 + '.' }}</span>\n <div class=\"header-label\">{{ this.label }}</div>\n</div>\n", styles: [".header{overflow:hidden;outline:var(--warn-color);cursor:pointer;box-sizing:content-box;-webkit-tap-highlight-color:transparent;border:1px solid lightgrey;width:100%;height:62px;display:flex;flex-direction:row;gap:1em}.header-label{align-items:center;display:flex}.step-state-complete{width:5px;background:green}.step-state-error{width:5px;background:var(--warn-color)}.step-state-neutral{width:5px;background:lightgrey}.green-check{color:green}.red-error{color:var(--warn-color)}.check-border{border-color:#d3d3d3}.error-border{border-color:var(--warn-color)}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
2457
+ }
2458
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: StepHeaderComponent, decorators: [{
2459
+ type: Component,
2460
+ args: [{ selector: 'mad-step-header', inputs: ['color'], host: {
2461
+ class: 'mad-step-header',
2462
+ role: 'tab',
2463
+ }, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n class=\"header\"\n [style.background]=\"this.selected && !this.closed ? '#d8e2e9' : '#ffffff'\"\n [ngClass]=\"this.hasError ? 'error-border' : 'check-border'\"\n>\n <div [ngClass]=\"this.getCssForState()\"></div>\n <div class=\"header-label\">\n <mat-icon class=\"material-icons-outlined\">\n {{ this.selected && !this.closed ? 'keyboard_arrow_down' : 'keyboard_arrow_right' }}\n </mat-icon>\n </div>\n <div *ngIf=\"this.completed || this.hasError\" class=\"header-label\">\n <mat-icon [ngClass]=\"this.completed ? 'green-check' : 'red-error'\">\n {{ getIcon() }}\n </mat-icon>\n </div>\n <span *ngIf=\"!this.hasError && !this.completed\" class=\"header-label\">{{ this.index + 1 + '.' }}</span>\n <div class=\"header-label\">{{ this.label }}</div>\n</div>\n", styles: [".header{overflow:hidden;outline:var(--warn-color);cursor:pointer;box-sizing:content-box;-webkit-tap-highlight-color:transparent;border:1px solid lightgrey;width:100%;height:62px;display:flex;flex-direction:row;gap:1em}.header-label{align-items:center;display:flex}.step-state-complete{width:5px;background:green}.step-state-error{width:5px;background:var(--warn-color)}.step-state-neutral{width:5px;background:lightgrey}.green-check{color:green}.red-error{color:var(--warn-color)}.check-border{border-color:#d3d3d3}.error-border{border-color:var(--warn-color)}\n"] }]
2464
+ }], ctorParameters: function () { return [{ type: i1$5.FocusMonitor }, { type: i0.ElementRef }]; }, propDecorators: { index: [{
2465
+ type: Input
2466
+ }], label: [{
2467
+ type: Input
2468
+ }], state: [{
2469
+ type: Input
2470
+ }], errorMessage: [{
2471
+ type: Input
2472
+ }], selected: [{
2473
+ type: Input
2474
+ }], active: [{
2475
+ type: Input
2476
+ }], optional: [{
2477
+ type: Input
2478
+ }], hasError: [{
2479
+ type: Input
2480
+ }], completed: [{
2481
+ type: Input
2482
+ }], closed: [{
2483
+ type: Input
2484
+ }] } });
2485
+
2486
+ /**
2487
+ * Animations used by the MAD stepper.
2488
+ */
2489
+ const madStepperAnimations = {
2490
+ verticalStepTransition: trigger('stepTransition', [
2491
+ state('previous', style({ height: '0px', visibility: 'hidden' })),
2492
+ state('next', style({ height: '0px', visibility: 'hidden' })),
2493
+ state('current', style({ height: '*', visibility: 'visible' })),
2494
+ transition('* <=> current', animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)')),
2495
+ ]),
2496
+ };
2497
+
2498
+ class StepComponent extends CdkStep {
2499
+ constructor(stepper, _viewContainerRef) {
2500
+ super(stepper);
2501
+ this.stepper = stepper;
2502
+ this._viewContainerRef = _viewContainerRef;
2503
+ /** Action event for the next button. If not set the StepComponent will handle the step navigation */
2504
+ this.onNext = new EventEmitter();
2505
+ /** Action event for the done button. If not set the StepComponent will handle the step navigation */
2506
+ this.onDone = new EventEmitter();
2507
+ /*** Action event when the header is clicked. If not set the StepComponent will handle the step navigation*/
2508
+ this.onHeaderClick = new EventEmitter();
2509
+ this.stepClosed = false;
2510
+ this._isSelected = Subscription.EMPTY;
2511
+ }
2512
+ ngAfterContentInit() {
2513
+ this._isSelected = this._stepper.steps.changes
2514
+ .pipe(switchMap(() => this._stepper.selectionChange.pipe(map(event => event.selectedStep === this), tap(() => (this.stepClosed = false)), startWith(this._stepper.selected === this))))
2515
+ .subscribe();
2516
+ }
2517
+ ngOnDestroy() {
2518
+ this._isSelected.unsubscribe();
2519
+ }
2520
+ next(markFormAsTouched = true) {
2521
+ this.stepValidation(markFormAsTouched);
2522
+ if (this.onNext.observers.length <= 0) {
2523
+ this.stepper.next();
2524
+ }
2525
+ this.onNext.emit();
2526
+ }
2527
+ selectAndMarkAsTouched(index) {
2528
+ //Mark current selected step as touched before selecting to display errors in the from
2529
+ this._stepper.selected?.stepControl?.markAllAsTouched();
2530
+ this.stepClosed = false;
2531
+ if (this.onHeaderClick.observers.length <= 0) {
2532
+ this.select();
2533
+ }
2534
+ this.onHeaderClick.emit(index);
2535
+ }
2536
+ completeLast() {
2537
+ this.stepValidation(true);
2538
+ this.stepClosed = true;
2539
+ if (this.onDone.observers.length <= 0) {
2540
+ this.stepper.next();
2541
+ }
2542
+ this.onDone.emit();
2543
+ }
2544
+ resetValidations() {
2545
+ this.hasError = false;
2546
+ this.completed = true;
2547
+ this.state = STEP_STATE.DONE;
2548
+ }
2549
+ stepValidation(markFormAsTouched) {
2550
+ if (markFormAsTouched) {
2551
+ this.stepControl?.markAllAsTouched();
2552
+ }
2553
+ if (this.stepControl?.valid) {
2554
+ this.hasError = false;
2555
+ this.completed = true;
2556
+ this.state = STEP_STATE.DONE;
2557
+ }
2558
+ else {
2559
+ this.completed = false;
2560
+ this.hasError = true;
2561
+ this.state = STEP_STATE.ERROR;
2562
+ }
2563
+ }
2564
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: StepComponent, deps: [{ token: forwardRef(() => StepperComponent) }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Component }); }
2565
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: StepComponent, selector: "mad-step", outputs: { onNext: "onNext", onDone: "onDone", onHeaderClick: "onHeaderClick" }, providers: [{ provide: CdkStep, useExisting: StepComponent }], usesInheritance: true, ngImport: i0, template: "<ng-template let-last=\"last\" let-nextBtnLbl=\"nextBtnLbl\" let-doneBtnLbl=\"doneBtnLbl\">\n <div class=\"step-container\">\n <div class=\"step-content\">\n <ng-content></ng-content>\n </div>\n <div class=\"step-buttons\">\n <div *ngIf=\"!last\">\n <mad-primary-button (click)=\"next()\">{{nextBtnLbl}}</mad-primary-button>\n </div>\n <div *ngIf=\"last\">\n <mad-primary-button (click)=\"completeLast()\">{{doneBtnLbl}}</mad-primary-button>\n </div>\n </div>\n </div>\n</ng-template>\n", styles: [".stepper-vertical{display:block}.mat-vertical-stepper-header{display:flex;align-items:center;border:none!important;height:10px}.mat-vertical-stepper-header .mat-step-icon{margin-right:12px}.vertical-content-container{border:none}[dir=rtl] .vertical-content-container{margin-left:0;margin-right:36px}.vertical-stepper-content{overflow:hidden;outline:0}.vertical-content{padding:0 24px}.step-container{border-left:1px solid lightgrey;border-right:1px solid lightgrey;border-bottom:1px solid lightgrey;display:flex;flex-direction:column}.step-content,.step-buttons{padding:2em}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: PrimaryButtonComponent, selector: "mad-primary-button", inputs: ["type", "disabled", "title"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
2566
+ }
2567
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: StepComponent, decorators: [{
2568
+ type: Component,
2569
+ args: [{ selector: 'mad-step', providers: [{ provide: CdkStep, useExisting: StepComponent }], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-template let-last=\"last\" let-nextBtnLbl=\"nextBtnLbl\" let-doneBtnLbl=\"doneBtnLbl\">\n <div class=\"step-container\">\n <div class=\"step-content\">\n <ng-content></ng-content>\n </div>\n <div class=\"step-buttons\">\n <div *ngIf=\"!last\">\n <mad-primary-button (click)=\"next()\">{{nextBtnLbl}}</mad-primary-button>\n </div>\n <div *ngIf=\"last\">\n <mad-primary-button (click)=\"completeLast()\">{{doneBtnLbl}}</mad-primary-button>\n </div>\n </div>\n </div>\n</ng-template>\n", styles: [".stepper-vertical{display:block}.mat-vertical-stepper-header{display:flex;align-items:center;border:none!important;height:10px}.mat-vertical-stepper-header .mat-step-icon{margin-right:12px}.vertical-content-container{border:none}[dir=rtl] .vertical-content-container{margin-left:0;margin-right:36px}.vertical-stepper-content{overflow:hidden;outline:0}.vertical-content{padding:0 24px}.step-container{border-left:1px solid lightgrey;border-right:1px solid lightgrey;border-bottom:1px solid lightgrey;display:flex;flex-direction:column}.step-content,.step-buttons{padding:2em}\n"] }]
2570
+ }], ctorParameters: function () { return [{ type: StepperComponent, decorators: [{
2571
+ type: Inject,
2572
+ args: [forwardRef(() => StepperComponent)]
2573
+ }] }, { type: i0.ViewContainerRef }]; }, propDecorators: { onNext: [{
2574
+ type: Output
2575
+ }], onDone: [{
2576
+ type: Output
2577
+ }], onHeaderClick: [{
2578
+ type: Output
2579
+ }] } });
2580
+ class StepperComponent extends CdkStepper {
2581
+ constructor(dir, changeDetectorRef, elementRef) {
2582
+ super(dir, changeDetectorRef, elementRef);
2583
+ /** Event emitted when the current step is done transitioning in. */
2584
+ this.animationDone = new EventEmitter();
2585
+ /** Steps that belong to the current stepper, excluding ones from nested steppers. */
2586
+ this.steps = new QueryList();
2587
+ this._animationDone = new Subject();
2588
+ this.orientation = 'vertical';
2589
+ }
2590
+ ngOnInit() {
2591
+ // Only linear stepper implementation is supported
2592
+ super.linear = true;
2593
+ }
2594
+ ngAfterContentInit() {
2595
+ super.ngAfterContentInit();
2596
+ this.steps.changes.pipe(takeUntil(this._destroyed)).subscribe(() => {
2597
+ this._stateChanged();
2598
+ });
2599
+ this._animationDone
2600
+ .pipe(distinctUntilChanged((x, y) => x.fromState === y.fromState && x.toState === y.toState), takeUntil(this._destroyed))
2601
+ .subscribe(event => {
2602
+ if (event.toState === 'current') {
2603
+ this.animationDone.emit();
2604
+ }
2605
+ });
2606
+ }
2607
+ /**
2608
+ * Method patched to enable the closing of the last step.
2609
+ */
2610
+ _getAnimationDirection(index) {
2611
+ const closeLastStep = this.selectedIndex === this.steps.length - 1 && this._steps.last?.completed && this._steps.last?.stepClosed;
2612
+ if (closeLastStep) {
2613
+ return 'next';
2614
+ }
2615
+ return super._getAnimationDirection(index);
2616
+ }
2617
+ _stepIsNavigable(index, step) {
2618
+ return step.completed || this.selectedIndex === index || !this.linear;
2619
+ }
2620
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: StepperComponent, deps: [{ token: i3$1.Directionality, optional: true }, { token: i0.ChangeDetectorRef }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
2621
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: StepperComponent, selector: "mad-stepper", inputs: { nextButtonLabel: "nextButtonLabel", doneButtonLabel: "doneButtonLabel" }, outputs: { animationDone: "animationDone" }, host: { attributes: { "role": "tablist" }, properties: { "class.stepper-vertical": "true", "attr.aria-orientation": "\"vertical\"" } }, providers: [{ provide: CdkStepper, useExisting: StepperComponent }], queries: [{ propertyName: "_steps", predicate: StepComponent, descendants: true }], viewQueries: [{ propertyName: "_stepHeader", predicate: StepHeaderComponent, descendants: true }], usesInheritance: true, ngImport: i0, template: "<!-- Vertical stepper -->\n<ng-container>\n <div *ngFor=\"let step of steps; let i = index; let isLast = last; let isFirst = first\">\n <ng-container\n [ngTemplateOutlet]=\"stepTemplate\"\n [ngTemplateOutletContext]=\"{step: step, i: i}\"></ng-container>\n <div class=\"vertical-content-container\" [class.mat-stepper-vertical-line]=\"!isLast\">\n <div class=\"vertical-stepper-content\" role=\"tabpanel\"\n [@stepTransition]=\"_getAnimationDirection(i)\"\n (@stepTransition.done)=\"_animationDone.next($event)\"\n [id]=\"_getStepContentId(i)\"\n [attr.aria-labelledby]=\"_getStepLabelId(i)\"\n [attr.aria-expanded]=\"selectedIndex === i\">\n <div class=\"vertical-content\">\n <ng-container [ngTemplateOutlet]=\"step.content\"\n [ngTemplateOutletContext]=\"{step: step, i: i, last: isLast, first: isFirst, nextBtnLbl: this.nextButtonLabel, doneBtnLbl: this.doneButtonLabel}\"></ng-container>\n </div>\n </div>\n </div>\n </div>\n</ng-container>\n\n<ng-template let-step=\"step\" let-i=\"i\" #stepTemplate>\n <mad-step-header\n class=\"mat-vertical-stepper-header\"\n (click)=\"step.selectAndMarkAsTouched(i)\"\n (keydown)=\"_onKeydown($event)\"\n [tabIndex]=\"_getFocusIndex() === i ? 0 : -1\"\n [id]=\"_getStepLabelId(i)\"\n [attr.aria-posinset]=\"i + 1\"\n [attr.aria-setsize]=\"steps.length\"\n [attr.aria-controls]=\"_getStepContentId(i)\"\n [attr.aria-selected]=\"selectedIndex == i\"\n [attr.aria-label]=\"step.ariaLabel || null\"\n [attr.aria-labelledby]=\"(!step.ariaLabel && step.ariaLabelledby) ? step.ariaLabelledby : null\"\n [attr.aria-disabled]=\"_stepIsNavigable(i, step) ? null : true\"\n [index]=\"i\"\n [completed]=\"step.completed\"\n [hasError]=\"step.hasError\"\n [state]=\"_getIndicatorType(i, step.state)\"\n [label]=\"step.stepLabel || step.label\"\n [selected]=\"selectedIndex === i\"\n [active]=\"_stepIsNavigable(i, step)\"\n [optional]=\"step.optional\"\n [closed]=\"step.stepClosed\"\n [errorMessage]=\"step.errorMessage\"></mad-step-header>\n</ng-template>\n", styles: [".stepper-vertical{display:block}.mat-vertical-stepper-header{display:flex;align-items:center;border:none!important;height:10px}.mat-vertical-stepper-header .mat-step-icon{margin-right:12px}.vertical-content-container{border:none}[dir=rtl] .vertical-content-container{margin-left:0;margin-right:36px}.vertical-stepper-content{overflow:hidden;outline:0}.vertical-content{padding:0 24px}.step-container{border-left:1px solid lightgrey;border-right:1px solid lightgrey;border-bottom:1px solid lightgrey;display:flex;flex-direction:column}.step-content,.step-buttons{padding:2em}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: StepHeaderComponent, selector: "mad-step-header", inputs: ["color", "index", "label", "state", "errorMessage", "selected", "active", "optional", "hasError", "completed", "closed"] }], animations: [madStepperAnimations.verticalStepTransition], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
2622
+ }
2623
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: StepperComponent, decorators: [{
2624
+ type: Component,
2625
+ args: [{ selector: 'mad-stepper', host: {
2626
+ '[class.stepper-vertical]': 'true',
2627
+ '[attr.aria-orientation]': '"vertical"',
2628
+ role: 'tablist',
2629
+ }, animations: [madStepperAnimations.verticalStepTransition], providers: [{ provide: CdkStepper, useExisting: StepperComponent }], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<!-- Vertical stepper -->\n<ng-container>\n <div *ngFor=\"let step of steps; let i = index; let isLast = last; let isFirst = first\">\n <ng-container\n [ngTemplateOutlet]=\"stepTemplate\"\n [ngTemplateOutletContext]=\"{step: step, i: i}\"></ng-container>\n <div class=\"vertical-content-container\" [class.mat-stepper-vertical-line]=\"!isLast\">\n <div class=\"vertical-stepper-content\" role=\"tabpanel\"\n [@stepTransition]=\"_getAnimationDirection(i)\"\n (@stepTransition.done)=\"_animationDone.next($event)\"\n [id]=\"_getStepContentId(i)\"\n [attr.aria-labelledby]=\"_getStepLabelId(i)\"\n [attr.aria-expanded]=\"selectedIndex === i\">\n <div class=\"vertical-content\">\n <ng-container [ngTemplateOutlet]=\"step.content\"\n [ngTemplateOutletContext]=\"{step: step, i: i, last: isLast, first: isFirst, nextBtnLbl: this.nextButtonLabel, doneBtnLbl: this.doneButtonLabel}\"></ng-container>\n </div>\n </div>\n </div>\n </div>\n</ng-container>\n\n<ng-template let-step=\"step\" let-i=\"i\" #stepTemplate>\n <mad-step-header\n class=\"mat-vertical-stepper-header\"\n (click)=\"step.selectAndMarkAsTouched(i)\"\n (keydown)=\"_onKeydown($event)\"\n [tabIndex]=\"_getFocusIndex() === i ? 0 : -1\"\n [id]=\"_getStepLabelId(i)\"\n [attr.aria-posinset]=\"i + 1\"\n [attr.aria-setsize]=\"steps.length\"\n [attr.aria-controls]=\"_getStepContentId(i)\"\n [attr.aria-selected]=\"selectedIndex == i\"\n [attr.aria-label]=\"step.ariaLabel || null\"\n [attr.aria-labelledby]=\"(!step.ariaLabel && step.ariaLabelledby) ? step.ariaLabelledby : null\"\n [attr.aria-disabled]=\"_stepIsNavigable(i, step) ? null : true\"\n [index]=\"i\"\n [completed]=\"step.completed\"\n [hasError]=\"step.hasError\"\n [state]=\"_getIndicatorType(i, step.state)\"\n [label]=\"step.stepLabel || step.label\"\n [selected]=\"selectedIndex === i\"\n [active]=\"_stepIsNavigable(i, step)\"\n [optional]=\"step.optional\"\n [closed]=\"step.stepClosed\"\n [errorMessage]=\"step.errorMessage\"></mad-step-header>\n</ng-template>\n", styles: [".stepper-vertical{display:block}.mat-vertical-stepper-header{display:flex;align-items:center;border:none!important;height:10px}.mat-vertical-stepper-header .mat-step-icon{margin-right:12px}.vertical-content-container{border:none}[dir=rtl] .vertical-content-container{margin-left:0;margin-right:36px}.vertical-stepper-content{overflow:hidden;outline:0}.vertical-content{padding:0 24px}.step-container{border-left:1px solid lightgrey;border-right:1px solid lightgrey;border-bottom:1px solid lightgrey;display:flex;flex-direction:column}.step-content,.step-buttons{padding:2em}\n"] }]
2630
+ }], ctorParameters: function () { return [{ type: i3$1.Directionality, decorators: [{
2631
+ type: Optional
2632
+ }] }, { type: i0.ChangeDetectorRef }, { type: i0.ElementRef }]; }, propDecorators: { animationDone: [{
2633
+ type: Output
2634
+ }], nextButtonLabel: [{
2635
+ type: Input
2636
+ }], doneButtonLabel: [{
2637
+ type: Input
2638
+ }], _stepHeader: [{
2639
+ type: ViewChildren,
2640
+ args: [StepHeaderComponent]
2641
+ }], _steps: [{
2642
+ type: ContentChildren,
2643
+ args: [StepComponent, { descendants: true }]
2644
+ }] } });
2645
+
2646
+ class StepperModule {
2647
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: StepperModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
2648
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.1", ngImport: i0, type: StepperModule, declarations: [StepperComponent, StepHeaderComponent, StepComponent], imports: [CommonModule, MatButtonModule, MatIconModule, CdkStepperModule, ButtonModule], exports: [StepperComponent, StepHeaderComponent, StepComponent] }); }
2649
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: StepperModule, imports: [CommonModule, MatButtonModule, MatIconModule, CdkStepperModule, ButtonModule] }); }
2650
+ }
2651
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: StepperModule, decorators: [{
2652
+ type: NgModule,
2653
+ args: [{
2654
+ declarations: [StepperComponent, StepHeaderComponent, StepComponent],
2655
+ imports: [CommonModule, MatButtonModule, MatIconModule, CdkStepperModule, ButtonModule],
2656
+ exports: [StepperComponent, StepHeaderComponent, StepComponent],
2657
+ }]
2658
+ }] });
2659
+
2660
+ class ContentHeaderComponent {
2661
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ContentHeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2662
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: ContentHeaderComponent, selector: "mad-content-header", ngImport: i0, template: "<div class=\"content-header\">\n <ng-content></ng-content>\n</div>\n", styles: [".content-header{padding-right:.5rem}\n"] }); }
2663
+ }
2664
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ContentHeaderComponent, decorators: [{
2665
+ type: Component,
2666
+ args: [{ selector: 'mad-content-header', template: "<div class=\"content-header\">\n <ng-content></ng-content>\n</div>\n", styles: [".content-header{padding-right:.5rem}\n"] }]
2667
+ }] });
2668
+
2669
+ class ContentPanelContainerComponent {
2670
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ContentPanelContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2671
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: ContentPanelContainerComponent, selector: "mad-content-panel-container", ngImport: i0, template: "<div class=\"content-panel-outer-wrapper\">\n <ng-content select=\"mad-content-panel-container-content\"></ng-content>\n <ng-content select=\"mad-content-panel-container-footer\"></ng-content>\n</div>\n", styles: [":host{position:relative;overflow:hidden;display:flex;flex:1 1 auto;min-height:.05rem}.content-panel-outer-wrapper{display:flex;flex:1 1 auto;flex-direction:column}\n"] }); }
2672
+ }
2673
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ContentPanelContainerComponent, decorators: [{
2674
+ type: Component,
2675
+ args: [{ selector: 'mad-content-panel-container', template: "<div class=\"content-panel-outer-wrapper\">\n <ng-content select=\"mad-content-panel-container-content\"></ng-content>\n <ng-content select=\"mad-content-panel-container-footer\"></ng-content>\n</div>\n", styles: [":host{position:relative;overflow:hidden;display:flex;flex:1 1 auto;min-height:.05rem}.content-panel-outer-wrapper{display:flex;flex:1 1 auto;flex-direction:column}\n"] }]
2676
+ }] });
2677
+
2678
+ class ContentPanelContainerContentComponent {
2679
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ContentPanelContainerContentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2680
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: ContentPanelContainerContentComponent, selector: "mad-content-panel-container-content", ngImport: i0, template: "<ng-content></ng-content>", styles: [":host{flex:1 1 auto;overflow-y:auto;border-top:.05rem solid #cccccc;padding:1rem;height:1rem}\n"] }); }
2681
+ }
2682
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ContentPanelContainerContentComponent, decorators: [{
2683
+ type: Component,
2684
+ args: [{ selector: 'mad-content-panel-container-content', template: "<ng-content></ng-content>", styles: [":host{flex:1 1 auto;overflow-y:auto;border-top:.05rem solid #cccccc;padding:1rem;height:1rem}\n"] }]
2685
+ }] });
2686
+
2687
+ class ContentPanelContainerFooterComponent {
2688
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ContentPanelContainerFooterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2689
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: ContentPanelContainerFooterComponent, selector: "mad-content-panel-container-footer", ngImport: i0, template: "<ng-content></ng-content>", styles: [":host{border-top:.05rem solid #cccccc;padding:.25rem 1rem;display:flex;flex:0 0 auto;align-items:center;min-height:2rem}\n"] }); }
2690
+ }
2691
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ContentPanelContainerFooterComponent, decorators: [{
2692
+ type: Component,
2693
+ args: [{ selector: 'mad-content-panel-container-footer', template: "<ng-content></ng-content>", styles: [":host{border-top:.05rem solid #cccccc;padding:.25rem 1rem;display:flex;flex:0 0 auto;align-items:center;min-height:2rem}\n"] }]
2694
+ }] });
2695
+
2696
+ class MainContainerComponent {
2697
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: MainContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2698
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: MainContainerComponent, selector: "mad-main-container", ngImport: i0, template: "<div class=\"main-container\">\n <ng-content select=\"mad-content-header\"></ng-content>\n <ng-content select=\"mad-flowbar\"></ng-content>\n <ng-content select=\"mad-content-panel-container\"></ng-content>\n</div>\n", styles: [".main-container{height:100%;display:flex;flex-direction:column}\n"] }); }
2699
+ }
2700
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: MainContainerComponent, decorators: [{
2701
+ type: Component,
2702
+ args: [{ selector: 'mad-main-container', template: "<div class=\"main-container\">\n <ng-content select=\"mad-content-header\"></ng-content>\n <ng-content select=\"mad-flowbar\"></ng-content>\n <ng-content select=\"mad-content-panel-container\"></ng-content>\n</div>\n", styles: [".main-container{height:100%;display:flex;flex-direction:column}\n"] }]
2703
+ }] });
2704
+
2705
+ class ContentPanelModule {
2706
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ContentPanelModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
2707
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.1", ngImport: i0, type: ContentPanelModule, declarations: [ContentHeaderComponent,
2708
+ ContentPanelContainerComponent,
2709
+ ContentPanelContainerContentComponent,
2710
+ ContentPanelContainerFooterComponent,
2711
+ MainContainerComponent], imports: [CommonModule], exports: [ContentHeaderComponent,
2712
+ ContentPanelContainerComponent,
2713
+ ContentPanelContainerContentComponent,
2714
+ ContentPanelContainerFooterComponent,
2715
+ MainContainerComponent] }); }
2716
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ContentPanelModule, imports: [CommonModule] }); }
2717
+ }
2718
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ContentPanelModule, decorators: [{
2719
+ type: NgModule,
2720
+ args: [{
2721
+ declarations: [
2722
+ ContentHeaderComponent,
2723
+ ContentPanelContainerComponent,
2724
+ ContentPanelContainerContentComponent,
2725
+ ContentPanelContainerFooterComponent,
2726
+ MainContainerComponent,
2727
+ ],
2728
+ imports: [CommonModule],
2729
+ exports: [
2730
+ ContentHeaderComponent,
2731
+ ContentPanelContainerComponent,
2732
+ ContentPanelContainerContentComponent,
2733
+ ContentPanelContainerFooterComponent,
2734
+ MainContainerComponent,
2735
+ ],
2736
+ }]
2737
+ }] });
2738
+
2739
+ class FlowbarComponent {
2740
+ constructor() {
2741
+ this._steps = [];
2742
+ this._activeStepChange = new EventEmitter(true);
2743
+ /**
2744
+ * Event emitted when a step header is clicked.
2745
+ * When defined header navigation has to be implemented programmatically.
2746
+ * e.g. {@see changeActiveStepOnHeader}
2747
+ */
2748
+ this._headerClick = new EventEmitter(true);
2749
+ }
2750
+ get currentStepLabel() {
2751
+ return this._activeStep.label;
2752
+ }
2753
+ get currentSubStepLabel() {
2754
+ return this._activeStep.activeSubStep?.label;
2755
+ }
2756
+ ngOnInit() {
2757
+ // If no active step is set as input or the active step is not enabled, select the first enabled step
2758
+ if (!this._activeStep || !this._activeStep.enabled) {
2759
+ this._activeStep = this._steps.find(step => step.enabled);
2760
+ if (this._activeStep) {
2761
+ // If sub steps exist then set the first non disabled sub step per default
2762
+ if (this.activeTabHasSubSteps()) {
2763
+ this._activeStep.activeSubStep = this._activeStep.subSteps.find(step => step.enabled);
2764
+ }
2765
+ this._activeStepChange.emit(this._activeStep);
2766
+ }
2767
+ }
2768
+ }
2769
+ ngAfterViewInit() {
2770
+ this.stepper._getIndicatorType = () => 'number';
2771
+ }
2772
+ getIndexForActiveStep() {
2773
+ const selectedIndex = this._steps.indexOf(this._activeStep);
2774
+ return selectedIndex === -1 ? 0 : selectedIndex;
2775
+ }
2776
+ changeActiveStep(step) {
2777
+ const previousIndex = this._steps.indexOf(this._activeStep);
2778
+ this._activeStep = step;
2779
+ if (this.activeTabHasSubSteps()) {
2780
+ if (previousIndex < this._steps.indexOf(this._activeStep)) {
2781
+ this._activeStep.activeSubStep = this._activeStep.subSteps[0];
2782
+ }
2783
+ else {
2784
+ this._activeStep.activeSubStep = this._activeStep.subSteps[this._activeStep.subSteps.length - 1];
2785
+ }
2786
+ }
2787
+ this._activeStepChange.emit(this._activeStep);
2788
+ }
2789
+ changeActiveStepOnHeader(step) {
2790
+ const stepIndex = this._steps.indexOf(step);
2791
+ this._activeStep = step;
2792
+ this.stepper.selected = this.stepper._steps.find((_, i) => i === stepIndex);
2793
+ }
2794
+ changeActiveSubStep(subStep) {
2795
+ this._activeStep.activeSubStep = subStep;
2796
+ }
2797
+ previous() {
2798
+ if (this.isPreviousAvailable()) {
2799
+ // If active step has no sub steps or first sub step is selected -> go to previous main step
2800
+ if (!this.activeTabHasSubSteps() || this.isFirstSubStep()) {
2801
+ const previousEnabledStep = this.findPreviousEnabledStep();
2802
+ this.changeActiveStep(previousEnabledStep);
2803
+ this.stepper.selectedIndex = this._steps.indexOf(previousEnabledStep);
2804
+ }
2805
+ else {
2806
+ const subStepIndex = this._activeStep.subSteps.indexOf(this._activeStep.activeSubStep);
2807
+ this._activeStep.activeSubStep = this._activeStep.subSteps[subStepIndex - 1];
2808
+ }
2809
+ }
2810
+ }
2811
+ next() {
2812
+ if (this.isNextAvailable()) {
2813
+ // If active step has no sub steps or last sub step is selected -> go to next main step
2814
+ if (!this.activeTabHasSubSteps() || this.isLastSubStep()) {
2815
+ const nextEnabledStep = this.findNextEnabledStep();
2816
+ this.changeActiveStep(nextEnabledStep);
2817
+ this.stepper.selectedIndex = this._steps.indexOf(nextEnabledStep);
2818
+ }
2819
+ else {
2820
+ const subStepIndex = this._activeStep.subSteps.indexOf(this._activeStep.activeSubStep);
2821
+ this._activeStep.activeSubStep = this._activeStep.subSteps[subStepIndex + 1];
2822
+ }
2823
+ }
2824
+ }
2825
+ isPreviousAvailable() {
2826
+ if (this._activeStep) {
2827
+ if (!this.activeTabHasSubSteps() || this.isFirstSubStep()) {
2828
+ const index = this.getCurrentIndex();
2829
+ return index > 0 && this.isAnyPreviousStepEnabled(index);
2830
+ }
2831
+ else {
2832
+ return true;
2833
+ }
2834
+ }
2835
+ return false;
2836
+ }
2837
+ isNextAvailable() {
2838
+ if (this._activeStep) {
2839
+ if (!this.activeTabHasSubSteps() || this.isLastSubStep()) {
2840
+ const index = this.getCurrentIndex();
2841
+ return index < this._steps.length - 1 && this.isAnyFollowingStepEnabled(index);
2842
+ }
2843
+ else {
2844
+ return true;
2845
+ }
2846
+ }
2847
+ return false;
2848
+ }
2849
+ isLastStep() {
2850
+ if (this.getCurrentIndex() === this._steps.length - 1) {
2851
+ if (this.activeTabHasSubSteps()) {
2852
+ return this.isLastSubStep();
2853
+ }
2854
+ else {
2855
+ return true;
2856
+ }
2857
+ }
2858
+ return false;
2859
+ }
2860
+ getCurrentIndex() {
2861
+ return this._steps.findIndex(value => value === this._activeStep);
2862
+ }
2863
+ getCurrentSubStepIndex() {
2864
+ return this._activeStep.subSteps.findIndex(value => value === this._activeStep.activeSubStep);
2865
+ }
2866
+ triggerClick() {
2867
+ const selectedStep = this._steps[this.stepper.selectedIndex];
2868
+ this.changeActiveStep(selectedStep);
2869
+ }
2870
+ headerClick(event, step) {
2871
+ event.stopPropagation(); //stop processing current header click event
2872
+ this._headerClick.emit(step);
2873
+ }
2874
+ activeTabHasSubSteps() {
2875
+ return this._activeStep.subSteps && this._activeStep.subSteps.length > 0;
2876
+ }
2877
+ isFirstSubStep() {
2878
+ return this._activeStep.activeSubStep === this._activeStep.subSteps[0];
2879
+ }
2880
+ isLastSubStep() {
2881
+ return this._activeStep.activeSubStep === this._activeStep.subSteps[this._activeStep.subSteps.length - 1];
2882
+ }
2883
+ isAnyPreviousStepEnabled(index) {
2884
+ // eslint-disable-next-line id-blacklist
2885
+ return this._steps.slice(0, index).find(step => step.enabled) !== undefined;
2886
+ }
2887
+ isAnyFollowingStepEnabled(index) {
2888
+ // eslint-disable-next-line id-blacklist
2889
+ return this._steps.slice(index + 1, this._steps.length).find(step => step.enabled) !== undefined;
2890
+ }
2891
+ findPreviousEnabledStep() {
2892
+ const index = this.getCurrentIndex();
2893
+ return this._steps
2894
+ .slice(0, index)
2895
+ .reverse()
2896
+ .find(step => step.enabled);
2897
+ }
2898
+ findNextEnabledStep() {
2899
+ const index = this.getCurrentIndex();
2900
+ return this._steps.slice(index + 1, this._steps.length).find(step => step.enabled);
2901
+ }
2902
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: FlowbarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2903
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: FlowbarComponent, selector: "mad-flowbar", inputs: { _steps: ["steps", "_steps"], _activeStep: ["activeStep", "_activeStep"] }, outputs: { _activeStepChange: "activeStepChange", _headerClick: "headerClick" }, viewQueries: [{ propertyName: "stepper", first: true, predicate: ["stepper"], descendants: true }], ngImport: i0, template: "<div class=\"stepper-container\">\n <mat-horizontal-stepper #stepper [selectedIndex]=\"this.getIndexForActiveStep()\" (click)=\"triggerClick()\">\n <mat-step *ngFor=\"let step of _steps\" [aria-labelledby]=\"!step.enabled ? 'disabled' : null\">\n <ng-template matStepLabel>\n <div class=\"step-header-overlay\" *ngIf=\"this._headerClick.observers.length > 0\" (click)=\"headerClick($event, step)\"></div>\n <span>{{step.label}}</span>\n </ng-template>\n </mat-step>\n </mat-horizontal-stepper>\n</div>\n", styles: [".stepper-container{display:flex;padding:0 1rem}::ng-deep .mat-stepper-horizontal .mat-horizontal-stepper-header{padding:0;height:auto}::ng-deep .mat-step-header[aria-labelledby=disabled]{pointer-events:none!important;cursor:not-allowed}::ng-deep .mat-stepper-horizontal .mat-horizontal-content-container{padding:0 0 10px}::ng-deep .mat-stepper-horizontal .mat-stepper-horizontal-line{margin:0 5px;border-top-width:4px}.step-header-overlay{position:absolute;width:100%;height:100%;right:0;top:0}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2$4.MatStep, selector: "mat-step", inputs: ["color"], exportAs: ["matStep"] }, { kind: "directive", type: i2$4.MatStepLabel, selector: "[matStepLabel]" }, { kind: "component", type: i2$4.MatStepper, selector: "mat-stepper, mat-vertical-stepper, mat-horizontal-stepper, [matStepper]", inputs: ["selectedIndex", "disableRipple", "color", "labelPosition", "headerPosition", "animationDuration"], outputs: ["animationDone"], exportAs: ["matStepper", "matVerticalStepper", "matHorizontalStepper"] }] }); }
2904
+ }
2905
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: FlowbarComponent, decorators: [{
2906
+ type: Component,
2907
+ args: [{ selector: 'mad-flowbar', template: "<div class=\"stepper-container\">\n <mat-horizontal-stepper #stepper [selectedIndex]=\"this.getIndexForActiveStep()\" (click)=\"triggerClick()\">\n <mat-step *ngFor=\"let step of _steps\" [aria-labelledby]=\"!step.enabled ? 'disabled' : null\">\n <ng-template matStepLabel>\n <div class=\"step-header-overlay\" *ngIf=\"this._headerClick.observers.length > 0\" (click)=\"headerClick($event, step)\"></div>\n <span>{{step.label}}</span>\n </ng-template>\n </mat-step>\n </mat-horizontal-stepper>\n</div>\n", styles: [".stepper-container{display:flex;padding:0 1rem}::ng-deep .mat-stepper-horizontal .mat-horizontal-stepper-header{padding:0;height:auto}::ng-deep .mat-step-header[aria-labelledby=disabled]{pointer-events:none!important;cursor:not-allowed}::ng-deep .mat-stepper-horizontal .mat-horizontal-content-container{padding:0 0 10px}::ng-deep .mat-stepper-horizontal .mat-stepper-horizontal-line{margin:0 5px;border-top-width:4px}.step-header-overlay{position:absolute;width:100%;height:100%;right:0;top:0}\n"] }]
2908
+ }], propDecorators: { _steps: [{
2909
+ type: Input,
2910
+ args: ['steps']
2911
+ }], _activeStep: [{
2912
+ type: Input,
2913
+ args: ['activeStep']
2914
+ }], _activeStepChange: [{
2915
+ type: Output,
2916
+ args: ['activeStepChange']
2917
+ }], _headerClick: [{
2918
+ type: Output,
2919
+ args: ['headerClick']
2920
+ }], stepper: [{
2921
+ type: ViewChild,
2922
+ args: ['stepper']
2923
+ }] } });
2924
+
2925
+ class FlowbarModule {
2926
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: FlowbarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
2927
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.1", ngImport: i0, type: FlowbarModule, declarations: [FlowbarComponent], imports: [CommonModule, MatStepperModule], exports: [FlowbarComponent] }); }
2928
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: FlowbarModule, imports: [CommonModule, MatStepperModule] }); }
2929
+ }
2930
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: FlowbarModule, decorators: [{
2931
+ type: NgModule,
2932
+ args: [{
2933
+ declarations: [FlowbarComponent],
2934
+ imports: [CommonModule, MatStepperModule],
2935
+ exports: [FlowbarComponent],
2936
+ }]
2937
+ }] });
2938
+
2939
+ class MaterialAddonsModule {
2940
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: MaterialAddonsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
2941
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.1", ngImport: i0, type: MaterialAddonsModule, exports: [ReadOnlyFormFieldModule,
2942
+ ButtonModule,
2943
+ ToolbarModule,
2944
+ MaterialActionButtonModule,
2945
+ NumericFieldModule,
2946
+ CardModule,
2947
+ QuickListModule,
2948
+ ThrottleClickModule] }); }
2949
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: MaterialAddonsModule, imports: [ReadOnlyFormFieldModule,
2950
+ ButtonModule,
2951
+ ToolbarModule,
2952
+ MaterialActionButtonModule,
2953
+ NumericFieldModule,
2954
+ CardModule,
2955
+ QuickListModule,
2956
+ ThrottleClickModule] }); }
2957
+ }
2958
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: MaterialAddonsModule, decorators: [{
2959
+ type: NgModule,
2960
+ args: [{
2961
+ exports: [
2962
+ ReadOnlyFormFieldModule,
2963
+ ButtonModule,
2964
+ ToolbarModule,
2965
+ MaterialActionButtonModule,
2966
+ NumericFieldModule,
2967
+ CardModule,
2968
+ QuickListModule,
2969
+ ThrottleClickModule,
2970
+ ],
2971
+ }]
2972
+ }] });
2973
+
2974
+ /*
2975
+ * Public API Surface of material-addons
2976
+ */
2977
+
2978
+ /**
2979
+ * Generated bundle index. Do not edit.
2980
+ */
2981
+
2982
+ export { BaseQuickListComponent, ButtonModule, CardComponent, CardModule, ContentHeaderComponent, ContentPanelContainerComponent, ContentPanelContainerContentComponent, ContentPanelContainerFooterComponent, ContentPanelModule, DangerButtonComponent, DataTableColumnsModalComponent, DataTableComponent, DataTableModule, FlowbarComponent, FlowbarModule, IconButtonComponent, LinkButtonComponent, MadBasicButton, MainContainerComponent, MaterialActionButtonComponent, MaterialActionButtonModule, MaterialAddonsModule, NumberFormatService, NumericFieldDirective, NumericFieldModule, OutlineButtonComponent, PrimaryButtonComponent, QuickListCompactComponent, QuickListComponent, QuickListModule, ReadOnlyFormFieldComponent, ReadOnlyFormFieldModule, ReadOnlyFormFieldWrapperComponent, StepComponent, StepHeaderComponent, StepperComponent, StepperModule, TableComponent, TableModule, ThrottleClickDirective, ThrottleClickModule, ToolbarComponent, ToolbarModule, ToolbarService, madStepperAnimations };
2983
+ //# sourceMappingURL=porscheinformatik-material-addons.mjs.map