@porscheinformatik/material-addons 15.0.3 → 16.0.0

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