@porscheinformatik/material-addons 10.3.3 → 10.4.1

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 (72) hide show
  1. package/bundles/porscheinformatik-material-addons.umd.js +513 -200
  2. package/bundles/porscheinformatik-material-addons.umd.js.map +1 -1
  3. package/bundles/porscheinformatik-material-addons.umd.min.js +2 -2
  4. package/bundles/porscheinformatik-material-addons.umd.min.js.map +1 -1
  5. package/esm2015/lib/button/button.module.js +2 -2
  6. package/esm2015/lib/button/danger-button/danger-button.component.js +1 -1
  7. package/esm2015/lib/button/flat-button/link-button.component.js +1 -1
  8. package/esm2015/lib/button/icon-button/icon-button.component.js +1 -1
  9. package/esm2015/lib/button/mad-basic-button.js +8 -8
  10. package/esm2015/lib/button/outline-button/outline-button.component.js +1 -1
  11. package/esm2015/lib/button/primary-button/primary-button.component.js +1 -1
  12. package/esm2015/lib/card/card.component.js +13 -7
  13. package/esm2015/lib/card/card.module.js +3 -3
  14. package/esm2015/lib/content-panel/content-header/content-header.component.js +1 -5
  15. package/esm2015/lib/content-panel/content-panel-container/content-panel-container.component.js +1 -5
  16. package/esm2015/lib/content-panel/content-panel-container-content/content-panel-container-content.component.js +1 -5
  17. package/esm2015/lib/content-panel/content-panel-container-footer/content-panel-container-footer.component.js +1 -5
  18. package/esm2015/lib/content-panel/main-container/main-container.component.js +1 -5
  19. package/esm2015/lib/data-table/data-table-action-type.js +4 -4
  20. package/esm2015/lib/data-table/data-table-action.js +1 -1
  21. package/esm2015/lib/data-table/data-table-column-definition.js +1 -0
  22. package/esm2015/lib/data-table/data-table-column.js +1 -0
  23. package/esm2015/lib/data-table/data-table-columns-modal/data-table-columns-modal.component.js +93 -0
  24. package/esm2015/lib/data-table/data-table.component.js +248 -66
  25. package/esm2015/lib/data-table/data-table.js +1 -1
  26. package/esm2015/lib/data-table/data-table.module.js +25 -20
  27. package/esm2015/lib/flowbar/flowbar.component.js +14 -22
  28. package/esm2015/lib/flowbar/flowbar.module.js +1 -1
  29. package/esm2015/lib/material-addons.module.js +1 -1
  30. package/esm2015/lib/quick-list/base-quick-list.component.js +4 -2
  31. package/esm2015/lib/quick-list/quick-list-compact/quick-list-compact.component.js +2 -2
  32. package/esm2015/lib/readonly/readonly-form-field/readonly-form-field.component.js +1 -1
  33. package/esm2015/lib/readonly/readonly-form-field-wrapper/readonly-form-field-wrapper.component.js +12 -12
  34. package/esm2015/lib/readonly/readonly-form-field.module.js +1 -1
  35. package/esm2015/lib/stepper/step-header/step-header.component.js +3 -3
  36. package/esm2015/lib/stepper/stepper.component.js +2 -2
  37. package/esm2015/lib/stepper/stepper.module.js +1 -1
  38. package/esm2015/lib/table/table.component.js +6 -6
  39. package/esm2015/lib/throttle-click/throttle-click.directive.js +6 -7
  40. package/esm2015/lib/toolbar/toolbar-action.interface.js +1 -1
  41. package/esm2015/lib/toolbar/toolbar.component.js +7 -4
  42. package/esm2015/lib/toolbar/toolbar.module.js +2 -2
  43. package/esm2015/lib/toolbar/toolbar.service.js +7 -7
  44. package/esm2015/porscheinformatik-material-addons.js +15 -14
  45. package/fesm2015/porscheinformatik-material-addons.js +409 -153
  46. package/fesm2015/porscheinformatik-material-addons.js.map +1 -1
  47. package/lib/button/mad-basic-button.d.ts +4 -4
  48. package/lib/content-panel/content-header/content-header.component.d.ts +1 -4
  49. package/lib/content-panel/content-panel-container/content-panel-container.component.d.ts +1 -4
  50. package/lib/content-panel/content-panel-container-content/content-panel-container-content.component.d.ts +1 -4
  51. package/lib/content-panel/content-panel-container-footer/content-panel-container-footer.component.d.ts +1 -4
  52. package/lib/content-panel/main-container/main-container.component.d.ts +1 -4
  53. package/lib/data-table/data-table-action.d.ts +1 -1
  54. package/lib/data-table/data-table-column-definition.d.ts +26 -0
  55. package/lib/data-table/{data-table-column-header.d.ts → data-table-column.d.ts} +3 -1
  56. package/lib/data-table/data-table-columns-modal/data-table-columns-modal.component.d.ts +23 -0
  57. package/lib/data-table/data-table.component.d.ts +68 -20
  58. package/lib/data-table/data-table.d.ts +2 -1
  59. package/lib/flowbar/flowbar.component.d.ts +3 -3
  60. package/lib/quick-list/base-quick-list.component.d.ts +1 -0
  61. package/lib/readonly/readonly-form-field-wrapper/readonly-form-field-wrapper.component.d.ts +11 -11
  62. package/lib/stepper/step-header/step-header.component.d.ts +2 -2
  63. package/lib/table/table.component.d.ts +4 -4
  64. package/lib/throttle-click/throttle-click.directive.d.ts +1 -2
  65. package/lib/toolbar/toolbar-action.interface.d.ts +2 -1
  66. package/lib/toolbar/toolbar.component.d.ts +1 -0
  67. package/lib/toolbar/toolbar.service.d.ts +2 -2
  68. package/package.json +1 -1
  69. package/porscheinformatik-material-addons.d.ts +15 -13
  70. package/porscheinformatik-material-addons.metadata.json +1 -1
  71. package/themes/common/styles.scss +6 -0
  72. package/esm2015/lib/data-table/data-table-column-header.js +0 -1
@@ -22,6 +22,8 @@ import { MatSort, MatSortModule } from '@angular/material/sort';
22
22
  import { MatPaginator, MatPaginatorModule } from '@angular/material/paginator';
23
23
  import { SelectionModel } from '@angular/cdk/collections';
24
24
  import { v4 } from 'uuid';
25
+ import { MatDialogRef, MAT_DIALOG_DATA, MatDialog } from '@angular/material/dialog';
26
+ import { moveItemInArray, transferArrayItem, DragDropModule } from '@angular/cdk/drag-drop';
25
27
  import { MatCheckboxModule } from '@angular/material/checkbox';
26
28
  import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
27
29
  import { Directionality } from '@angular/cdk/bidi';
@@ -68,7 +70,13 @@ class MadBasicButton {
68
70
  constructor() {
69
71
  this.disableClick = (e) => e.stopPropagation();
70
72
  }
71
- ngOnChanges(changes) {
73
+ get pointerEvent() {
74
+ return this.disabled ? 'none' : 'auto';
75
+ }
76
+ get opacity() {
77
+ return this.disabled ? '0.35' : '1';
78
+ }
79
+ ngOnChanges() {
72
80
  this.disableButton();
73
81
  }
74
82
  disableButton() {
@@ -79,12 +87,6 @@ class MadBasicButton {
79
87
  this.button.nativeElement.removeEventListener('click', this.disableClick);
80
88
  }
81
89
  }
82
- get pointerEvent() {
83
- return this.disabled ? 'none' : 'auto';
84
- }
85
- get opacity() {
86
- return this.disabled ? '0.35' : '1';
87
- }
88
90
  }
89
91
  MadBasicButton.propDecorators = {
90
92
  pointerEvent: [{ type: HostBinding, args: ['style.pointer-events',] }],
@@ -248,11 +250,11 @@ class ReadOnlyFormFieldWrapperComponent {
248
250
  */
249
251
  this.rows = 3;
250
252
  /**
251
- * If shrinkIfEmpty is set to "false", nothing changes
252
- * If set to "true" and multiline is also "true", the textarea will
253
- * shrink to one row, if value is empty/null/undefined.
254
- * Otherwise, the defined rows-value will be used
255
- */
253
+ * If shrinkIfEmpty is set to "false", nothing changes
254
+ * If set to "true" and multiline is also "true", the textarea will
255
+ * shrink to one row, if value is empty/null/undefined.
256
+ * Otherwise, the defined rows-value will be used
257
+ */
256
258
  this.shrinkIfEmpty = false;
257
259
  this.toolTipForInputEnabled = false;
258
260
  }
@@ -303,7 +305,7 @@ class ReadOnlyFormFieldWrapperComponent {
303
305
  var _a, _b;
304
306
  const input = (_b = (_a = this.readOnlyContentWrapper) === null || _a === void 0 ? void 0 : _a.nativeElement) === null || _b === void 0 ? void 0 : _b.querySelector('input');
305
307
  if (input) {
306
- let textOverFlowStyleValue = this.getTextOverFlowStyleValue();
308
+ const textOverFlowStyleValue = this.getTextOverFlowStyleValue();
307
309
  if (textOverFlowStyleValue) {
308
310
  input.setAttribute('style', 'text-overflow: ' + textOverFlowStyleValue);
309
311
  }
@@ -314,7 +316,7 @@ class ReadOnlyFormFieldWrapperComponent {
314
316
  var _a, _b;
315
317
  // it works only if the style is added to the component directly. Should find a way for get it from the calculated
316
318
  // style. Than it would be possible to define the text-overflow in css for the whole application
317
- let textOverflow = (_b = (_a = this.elementRef) === null || _a === void 0 ? void 0 : _a.nativeElement) === null || _b === void 0 ? void 0 : _b.style.textOverflow;
319
+ const textOverflow = (_b = (_a = this.elementRef) === null || _a === void 0 ? void 0 : _a.nativeElement) === null || _b === void 0 ? void 0 : _b.style.textOverflow;
318
320
  if (!textOverflow) {
319
321
  return 'ellipsis';
320
322
  }
@@ -338,7 +340,7 @@ class ReadOnlyFormFieldWrapperComponent {
338
340
  }
339
341
  isTextOverflown(input) {
340
342
  if (input) {
341
- return (input.offsetWidth < input.scrollWidth);
343
+ return input.offsetWidth < input.scrollWidth;
342
344
  }
343
345
  return false;
344
346
  }
@@ -361,10 +363,10 @@ ReadOnlyFormFieldWrapperComponent.ctorParameters = () => [
361
363
  { type: ElementRef }
362
364
  ];
363
365
  ReadOnlyFormFieldWrapperComponent.propDecorators = {
364
- readonly: [{ type: Input }],
365
- value: [{ type: Input, args: ['value',] }],
366
366
  originalContent: [{ type: ViewChild, args: ['contentWrapper', { static: false },] }],
367
367
  readOnlyContentWrapper: [{ type: ViewChild, args: ['readOnlyContentWrapper', { static: false },] }],
368
+ readonly: [{ type: Input }],
369
+ value: [{ type: Input, args: ['value',] }],
368
370
  textAlign: [{ type: Input, args: ['textAlign',] }],
369
371
  formatNumber: [{ type: Input, args: ['formatNumber',] }],
370
372
  decimalPlaces: [{ type: Input, args: ['decimalPlaces',] }],
@@ -673,6 +675,12 @@ class ToolbarService {
673
675
  }
674
676
  });
675
677
  }
678
+ get toolbarTitle() {
679
+ return this.title;
680
+ }
681
+ set toolbarTitle(toolbarTitle) {
682
+ this.title = toolbarTitle;
683
+ }
676
684
  ngOnDestroy() {
677
685
  if (this.routerSubscription) {
678
686
  this.routerSubscription.unsubscribe();
@@ -690,12 +698,6 @@ class ToolbarService {
690
698
  this.toolbarActions.push(action);
691
699
  });
692
700
  }
693
- set toolbarTitle(toolbarTitle) {
694
- this.title = toolbarTitle;
695
- }
696
- get toolbarTitle() {
697
- return this.title;
698
- }
699
701
  setDataTitle(dataTitle) {
700
702
  this.dataTitle = dataTitle;
701
703
  }
@@ -818,15 +820,18 @@ class ToolbarComponent {
818
820
  return this.toolbarService.getToolbarActionsMenuTitle();
819
821
  }
820
822
  showBadgeForMenu() {
821
- return this.getToolbarActions()
823
+ return (this.getToolbarActions()
822
824
  .slice(1) // the first icon is not shown in menu
823
- .filter(value => value.badge && value.badge.value).length > 0;
825
+ .filter(value => value.badge && value.badge.value).length > 0);
826
+ }
827
+ hasImportantToolbarActions() {
828
+ return this.getToolbarActions().filter(value => !!value.importantAction).length > 0;
824
829
  }
825
830
  }
826
831
  ToolbarComponent.decorators = [
827
832
  { type: Component, args: [{
828
833
  selector: 'mad-toolbar',
829
- 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 ? 1 : 2)\"\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\">\n <ng-container *ngFor=\"let action of getToolbarActions(); let i = index\">\n <ng-container *ngIf=\"hasPermission(action) | async\">\n <button *ngIf=\"i >= 1\" mat-menu-item (click)=\"action.action()\">\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 </mat-menu>\n </ng-container>\n </ng-container>\n </div>\n</mat-toolbar>\n",
834
+ 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\">\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 *ngIf=\"i >= (hasImportantToolbarActions() ? 0:1)\" mat-menu-item (click)=\"action.action()\">\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",
830
835
  styles: ["mat-toolbar{background:#fff}.content-toolbar{border-bottom:1px solid #dcdcdc;height:57px}.right-aligned{margin-left:auto;margin-right:0;overflow:hidden}.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}"]
831
836
  },] }
832
837
  ];
@@ -1185,14 +1190,20 @@ CardComponent.decorators = [
1185
1190
  template: "<mat-card>\n <mat-card-header>\n <mat-card-title>\n {{ title }}\n <mad-icon-button (click)=\"toggleCollapse()\" *ngIf=\"expandable && !editMode\">\n <mat-icon [@rotateIcon]=\"!expanded\">keyboard_arrow_down</mat-icon>\n </mad-icon-button>\n </mat-card-title>\n <span>\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 </span>\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",
1186
1191
  animations: [
1187
1192
  trigger('collapseExpandAnimation', [
1188
- transition(':enter', [style({ opacity: 0, height: 0, overflow: 'hidden' }), animate('100ms', style({
1193
+ transition(':enter', [
1194
+ style({ opacity: 0, height: 0, overflow: 'hidden' }),
1195
+ animate('100ms', style({
1189
1196
  opacity: 1,
1190
- height: '*'
1191
- }))]),
1192
- transition(':leave', [style({ opacity: 1, height: '*', overflow: 'hidden' }), animate('100ms', style({
1197
+ height: '*',
1198
+ })),
1199
+ ]),
1200
+ transition(':leave', [
1201
+ style({ opacity: 1, height: '*', overflow: 'hidden' }),
1202
+ animate('100ms', style({
1193
1203
  opacity: 0,
1194
- height: 0
1195
- }))]),
1204
+ height: 0,
1205
+ })),
1206
+ ]),
1196
1207
  ]),
1197
1208
  trigger('rotateIcon', [
1198
1209
  state('true', style({ transform: 'rotate(0)' })),
@@ -1229,24 +1240,23 @@ class ThrottleClickDirective {
1229
1240
  this.throttleClick = new EventEmitter();
1230
1241
  this.clicks = new Subject();
1231
1242
  }
1243
+ clickEvent(event) {
1244
+ event.preventDefault();
1245
+ event.stopPropagation();
1246
+ this.clicks.next(event);
1247
+ }
1232
1248
  ngOnInit() {
1233
1249
  this.subscription = this.clicks.pipe(throttleTime(this.throttleTime)).subscribe(e => this.throttleClick.emit(e));
1234
1250
  }
1235
1251
  ngOnDestroy() {
1236
1252
  this.subscription.unsubscribe();
1237
1253
  }
1238
- clickEvent(event) {
1239
- event.preventDefault();
1240
- event.stopPropagation();
1241
- this.clicks.next(event);
1242
- }
1243
1254
  }
1244
1255
  ThrottleClickDirective.decorators = [
1245
1256
  { type: Directive, args: [{
1246
1257
  selector: '[madThrottleClick]',
1247
1258
  },] }
1248
1259
  ];
1249
- ThrottleClickDirective.ctorParameters = () => [];
1250
1260
  ThrottleClickDirective.propDecorators = {
1251
1261
  throttleTime: [{ type: Input }],
1252
1262
  throttleClick: [{ type: Output }],
@@ -1279,6 +1289,7 @@ class BaseQuickListComponent {
1279
1289
  this.allItems = [];
1280
1290
  this.addLabel = 'NOT SET';
1281
1291
  this.addPossible = true;
1292
+ this.removePossible = true;
1282
1293
  this.blankItem = {};
1283
1294
  this.added = new EventEmitter();
1284
1295
  this.removed = new EventEmitter();
@@ -1322,7 +1333,7 @@ class BaseQuickListComponent {
1322
1333
  return this.addPossible && (!this.maxItems || this.allItems.length < this.maxItems);
1323
1334
  }
1324
1335
  isDeleteAllowed() {
1325
- return !this.minItems || this.allItems.length > this.minItems;
1336
+ return this.removePossible && (!this.minItems || this.allItems.length > this.minItems);
1326
1337
  }
1327
1338
  interalAddItem() {
1328
1339
  if (this.isAddAllowed()) {
@@ -1351,6 +1362,7 @@ BaseQuickListComponent.propDecorators = {
1351
1362
  allItems: [{ type: Input }],
1352
1363
  addLabel: [{ type: Input }],
1353
1364
  addPossible: [{ type: Input }],
1365
+ removePossible: [{ type: Input }],
1354
1366
  blankItem: [{ type: Input }],
1355
1367
  readonly: [{ type: Input }],
1356
1368
  maxItems: [{ type: Input }],
@@ -1407,7 +1419,6 @@ QuickListModule.decorators = [
1407
1419
  class TableComponent {
1408
1420
  constructor() {
1409
1421
  var _a;
1410
- this.ACTION_COLUMN_NAME = '__action__';
1411
1422
  this.columns = [];
1412
1423
  this.filterLabel = 'NOT SET';
1413
1424
  this.filterPlaceholder = 'NOT SET';
@@ -1418,6 +1429,7 @@ class TableComponent {
1418
1429
  this.tableAction = new EventEmitter();
1419
1430
  this.rowAction = new EventEmitter();
1420
1431
  this.sortEvent = new EventEmitter();
1432
+ this.ACTION_COLUMN_NAME = '__action__';
1421
1433
  this.isFilterEnabled = false;
1422
1434
  this.isPaginationEnabled = false;
1423
1435
  }
@@ -1496,14 +1508,14 @@ TableComponent.propDecorators = {
1496
1508
  defaultPageSize: [{ type: Input }],
1497
1509
  rowActions: [{ type: Input }],
1498
1510
  tableActions: [{ type: Input }],
1499
- displayedData: [{ type: Input }],
1500
- paginationEnabled: [{ type: Input }],
1501
- filterEnabled: [{ type: Input }],
1502
1511
  tableAction: [{ type: Output }],
1503
1512
  rowAction: [{ type: Output }],
1504
1513
  sortEvent: [{ type: Output }],
1505
1514
  paginator: [{ type: ViewChild, args: [MatPaginator, { static: false },] }],
1506
- sort: [{ type: ViewChild, args: [MatSort, { static: true },] }]
1515
+ sort: [{ type: ViewChild, args: [MatSort, { static: true },] }],
1516
+ displayedData: [{ type: Input }],
1517
+ paginationEnabled: [{ type: Input }],
1518
+ filterEnabled: [{ type: Input }]
1507
1519
  };
1508
1520
 
1509
1521
  class TableModule {
@@ -1529,38 +1541,160 @@ TableModule.decorators = [
1529
1541
 
1530
1542
  class DataTableActionType {
1531
1543
  }
1532
- DataTableActionType.SINGLE = "SINGLE";
1533
- DataTableActionType.BATCH = "BATCH";
1534
- DataTableActionType.NONE = "NONE";
1544
+ DataTableActionType.SINGLE = 'SINGLE';
1545
+ DataTableActionType.BATCH = 'BATCH';
1546
+ DataTableActionType.NONE = 'NONE';
1535
1547
 
1536
- class DataTableComponent {
1537
- constructor() {
1548
+ class DataTableColumnsModalComponent {
1549
+ constructor(dialogRef, data) {
1550
+ this.dialogRef = dialogRef;
1551
+ this.data = data;
1552
+ this.selectedColumns = [];
1553
+ this.availableColumns = [];
1554
+ this.filteredAvailableColumns = [];
1555
+ }
1556
+ ngOnInit() {
1557
+ this.definition = this.data.definition;
1558
+ for (const column of this.data.allColumns) {
1559
+ const columnId = column.id;
1560
+ const selectedColumnIds = this.definition.displayedColumns.map(col => col.id);
1561
+ if (selectedColumnIds.includes(columnId)) {
1562
+ this.selectedColumns.push(column);
1563
+ }
1564
+ else {
1565
+ this.availableColumns.push(column);
1566
+ }
1567
+ }
1568
+ this.clearFilterValue();
1569
+ }
1570
+ onDrop(event) {
1571
+ if (event.previousContainer === event.container) {
1572
+ moveItemInArray(event.container.data, event.previousIndex, event.currentIndex);
1573
+ }
1574
+ else {
1575
+ const itemIndex = this.findMatchingItemIndex(event.previousContainer, event.item);
1576
+ transferArrayItem(event.previousContainer.data, event.container.data, itemIndex, event.currentIndex);
1577
+ this.clearFilterValue();
1578
+ this.availableColumns.sort((a, b) => a.label.localeCompare(b.label));
1579
+ }
1580
+ }
1581
+ onSave() {
1582
+ this.definition.displayedColumns = this.selectedColumns;
1583
+ const saveChange = {
1584
+ action: 'SAVE',
1585
+ definition: this.definition,
1586
+ };
1587
+ this.dialogRef.close(saveChange);
1588
+ }
1589
+ onDelete() {
1590
+ const deleteChange = {
1591
+ action: 'DELETE',
1592
+ definition: this.definition,
1593
+ };
1594
+ this.dialogRef.close(deleteChange);
1595
+ }
1596
+ onCancel() {
1597
+ this.dialogRef.close();
1598
+ }
1599
+ updateFilterValue() {
1538
1600
  var _a;
1539
- this.ACTION_COLUMN_NAME = "__action__";
1540
- this.SINGLE = DataTableActionType.SINGLE;
1541
- this.BATCH = DataTableActionType.BATCH;
1542
- this.NONE = DataTableActionType.NONE;
1543
- this.columns = [];
1544
- this.filterLabel = "Filter";
1545
- this.filterPlaceholder = "";
1546
- this.noDataText = "No matching data found";
1601
+ if (((_a = this.searchFilter) === null || _a === void 0 ? void 0 : _a.length) > 0) {
1602
+ this.filteredAvailableColumns = this.availableColumns.filter(c => c.label.toLowerCase().includes(this.searchFilter.toLowerCase()));
1603
+ }
1604
+ else {
1605
+ this.filteredAvailableColumns = [...this.availableColumns];
1606
+ }
1607
+ }
1608
+ findMatchingItemIndex(previousContainer, item) {
1609
+ const itemId = item.element.nativeElement.id;
1610
+ const previousContainerItems = [...previousContainer.data];
1611
+ if ((previousContainerItems === null || previousContainerItems === void 0 ? void 0 : previousContainerItems.length) < 1) {
1612
+ return 0;
1613
+ }
1614
+ for (let itemIndex = 0; itemIndex < previousContainerItems.length; itemIndex++) {
1615
+ if (previousContainerItems[itemIndex].id === itemId) {
1616
+ return itemIndex;
1617
+ }
1618
+ }
1619
+ return 0;
1620
+ }
1621
+ clearFilterValue() {
1622
+ this.searchFilter = '';
1623
+ this.filteredAvailableColumns = [...this.availableColumns];
1624
+ }
1625
+ }
1626
+ DataTableColumnsModalComponent.decorators = [
1627
+ { type: Component, args: [{
1628
+ selector: 'mad-data-table-columns-modal.component',
1629
+ 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",
1630
+ styles: [".column-drag-main-content{border-bottom:1px solid #f5f5f5;display:flex;flex-direction:row;justify-content:space-between;margin-bottom:16px;padding:8px 8px 16px;width:544px}.column-drag-container{display:inline-block;font-size:small;max-width:100%;vertical-align:top;width:256px}.info-box{margin-bottom:16px}.column-drag-info-area,.info-box{color:rgba(0,0,0,.66);font-size:small;width:100%}.column-drag-info-area{align-items:stretch;display:flex;flex-direction:column;height:36px;justify-content:right;margin-bottom:32px}.column-drag-list{background:#fff;border:1px solid #ccc;border-radius:4px;box-sizing:border-box;display:block;height:200px;overflow:auto}.column-drag-container-header{font-weight:700;margin-bottom:4px}.column-drag-box{align-items:center;background:#fff;border-bottom:1px solid #ccc;box-sizing:border-box;color:rgba(0,0,0,.87);cursor:move;display:flex;flex-direction:row;font-size:14px;height:40px;justify-content:space-between;padding:12px 10px}.cdk-drag-preview{border-radius:4px;box-shadow:0 5px 5px -3px rgba(0,0,0,.2),0 8px 10px 1px rgba(0,0,0,.14),0 3px 14px 2px rgba(0,0,0,.12);box-sizing:border-box}.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)}"]
1631
+ },] }
1632
+ ];
1633
+ DataTableColumnsModalComponent.ctorParameters = () => [
1634
+ { type: MatDialogRef },
1635
+ { type: undefined, decorators: [{ type: Inject, args: [MAT_DIALOG_DATA,] }] }
1636
+ ];
1637
+
1638
+ class DataTableComponent {
1639
+ constructor(matDialog) {
1640
+ this.matDialog = matDialog;
1641
+ // Translations
1642
+ this.filterLabel = 'Filter';
1643
+ this.filterPlaceholder = '';
1644
+ this.filterColumnsLabel = 'Filter';
1645
+ this.filterColumnsPlaceHolder = 'Filter available columns';
1646
+ this.noDataText = 'No matching data found';
1647
+ this.columnSettingsModalTitleLabel = 'Column settings';
1648
+ this.selectedLabel = 'Selected columns';
1649
+ this.availableLabel = 'Available columns';
1650
+ this.saveLabel = 'Save';
1651
+ this.deleteLabel = 'Delete';
1652
+ this.cancelLabel = 'Cancel';
1653
+ this.infoTextLabel = 'Drag and drop a column to select or reorder it.';
1547
1654
  this.pageSizeOptions = [5, 10, 15];
1548
- this.defaultPageSize = ((_a = this.pageSizeOptions) === null || _a === void 0 ? void 0 : _a[0]) || 10;
1549
1655
  this.actions = [];
1656
+ this.deleteDefinitionAllowed = false;
1657
+ this.useAsync = false;
1550
1658
  this.sortEvent = new EventEmitter();
1551
1659
  this.actionEvent = new EventEmitter();
1552
- this.pagingEvent = new EventEmitter();
1660
+ this.pageEvent = new EventEmitter();
1661
+ this.allColumnsEvent = new EventEmitter();
1662
+ this.columnDefinitionChangeEvent = new EventEmitter();
1663
+ this.viewDefinitionChangeEvent = new EventEmitter();
1664
+ this.ACTION_COLUMN_NAME = '__action__';
1665
+ this.SINGLE = DataTableActionType.SINGLE;
1666
+ this.BATCH = DataTableActionType.BATCH;
1667
+ this.NONE = DataTableActionType.NONE;
1553
1668
  this.tableActions = [];
1554
1669
  this.rowActions = [];
1670
+ this.columns = [];
1555
1671
  this.allSelected = false;
1556
1672
  this.displayedDataMap = new Map();
1557
1673
  this.actualDataMap = new Map();
1558
1674
  this.selectionModel = new SelectionModel(true);
1675
+ this.allColumnDefinitions = [];
1559
1676
  this.isFilterEnabled = false;
1560
1677
  this.isPaginationEnabled = false;
1561
1678
  this.mode = this.NONE;
1562
1679
  this.isRowClickable = false;
1680
+ this.showColumnModal = false;
1563
1681
  this.isLoading = false;
1682
+ this.paginatorLength = 0;
1683
+ this.paginatorPageIndex = 0;
1684
+ this.paginatorPageSize = 50;
1685
+ }
1686
+ set displayedColumns(cols) {
1687
+ if (!this.displayedColumnDefinition) {
1688
+ this.columns = cols ? [...cols] : [];
1689
+ this.columnIds = this.columns.map(column => column.id);
1690
+ this.columnIds.unshift(this.ACTION_COLUMN_NAME);
1691
+ }
1692
+ }
1693
+ set displayedColumnDefinition(def) {
1694
+ this.selectedColumnDefinion = def;
1695
+ this.columns = def.displayedColumns;
1696
+ this.columnIds = this.columns.map(column => column.id);
1697
+ this.columnIds.unshift(this.ACTION_COLUMN_NAME);
1564
1698
  }
1565
1699
  set tableData(data) {
1566
1700
  if (!this.dataSource) {
@@ -1568,19 +1702,46 @@ class DataTableComponent {
1568
1702
  }
1569
1703
  this.createDataMapsAndSetDisplayedDataSourceData(data);
1570
1704
  }
1705
+ set page(page) {
1706
+ this.paginatorPageIndex = page.pageIndex;
1707
+ this.paginatorPageSize = page.pageSize;
1708
+ this.paginatorLength = page.length;
1709
+ }
1710
+ set columnDefinitions(definitions) {
1711
+ var _a;
1712
+ this.editableColumnDefinitions = [];
1713
+ this.viewableColumnDefinitions = [];
1714
+ this.allColumnDefinitions = [...definitions];
1715
+ for (const definition of definitions) {
1716
+ if (definition.editable) {
1717
+ this.editableColumnDefinitions.push(definition);
1718
+ }
1719
+ if (((_a = definition.displayedColumns) === null || _a === void 0 ? void 0 : _a.length) > 0) {
1720
+ this.viewableColumnDefinitions.push(definition);
1721
+ }
1722
+ }
1723
+ }
1571
1724
  set loading(isLoading) {
1572
1725
  this.isLoading = isLoading;
1573
1726
  }
1727
+ set defaultPageSize(defaultSize) {
1728
+ this.paginatorPageSize = defaultSize;
1729
+ }
1730
+ set externalPaginator(paginator) {
1731
+ this.extPaginator = paginator;
1732
+ }
1574
1733
  set paginationEnabled(isPaginationEnabled) {
1575
1734
  this.isPaginationEnabled = isPaginationEnabled;
1576
- // eslint-disable-next-line
1577
- const pageSize = this.isPaginationEnabled ? this.defaultPageSize : Number.MAX_VALUE;
1578
- if (this.dataSource.paginator) {
1579
- this.dataSource.paginator._changePageSize(pageSize);
1735
+ this.unsetPageSizeIfNecessary();
1736
+ }
1737
+ set allColumns(allColumns) {
1738
+ this.allAvailableColumns = allColumns;
1739
+ if (allColumns && this.showColumnModal) {
1740
+ this.openColumnModal();
1580
1741
  }
1581
1742
  }
1582
1743
  set filterEnabled(isFilterEnabled) {
1583
- this.isFilterEnabled = isFilterEnabled;
1744
+ this.isFilterEnabled = !this.useAsync ? isFilterEnabled : false;
1584
1745
  this.setFilterValue(undefined);
1585
1746
  }
1586
1747
  set forceMode(mode) {
@@ -1590,39 +1751,106 @@ class DataTableComponent {
1590
1751
  this.setActions();
1591
1752
  }
1592
1753
  }
1754
+ static compare(a, b, sort) {
1755
+ const x = a[sort.active];
1756
+ const y = b[sort.active];
1757
+ const ascending = sort.direction === 'asc';
1758
+ switch (typeof x) {
1759
+ case 'number':
1760
+ return DataTableComponent.compareNumber(x, y, ascending);
1761
+ case 'string':
1762
+ return DataTableComponent.compareString(x, y, ascending);
1763
+ case 'boolean':
1764
+ return DataTableComponent.compareBoolean(x, y, ascending);
1765
+ default:
1766
+ // cannot compare -> return equal
1767
+ return 0;
1768
+ }
1769
+ }
1770
+ static compareNumber(x, y, ascending) {
1771
+ return ascending ? x - y : y - x;
1772
+ }
1773
+ static compareString(x, y, ascending) {
1774
+ return ascending ? x.localeCompare(y) : y.localeCompare(x);
1775
+ }
1776
+ static compareBoolean(x, y, ascending) {
1777
+ if (x === y) {
1778
+ return 0;
1779
+ }
1780
+ if (ascending) {
1781
+ // true first
1782
+ return x ? -1 : 1;
1783
+ }
1784
+ else {
1785
+ // false first
1786
+ return x ? 1 : -1;
1787
+ }
1788
+ }
1789
+ static transformData(value, transformer, transformerParams) {
1790
+ if (!transformer || !(transformer instanceof Function)) {
1791
+ return value;
1792
+ }
1793
+ return transformer(value, transformerParams);
1794
+ }
1795
+ static generateRowId() {
1796
+ return v4();
1797
+ }
1798
+ static isClickOnRowMenuIcon(event) {
1799
+ var _a;
1800
+ return (_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.classList.contains('mat-icon');
1801
+ }
1593
1802
  ngOnInit() {
1594
- this.columnNames = this.columns.map(column => column.label);
1595
1803
  this.mode = this.getTableMode();
1596
1804
  this.setActions();
1597
1805
  if (this.mode !== this.NONE) {
1598
1806
  this.isRowClickable = true;
1599
1807
  this.defaultAction = this.rowActions[0];
1600
1808
  }
1601
- this.columnNames.unshift(this.ACTION_COLUMN_NAME);
1602
1809
  }
1603
1810
  ngAfterViewInit() {
1604
1811
  this.dataSource.paginator = this.paginator;
1605
1812
  this.dataSource.sort = this.sort;
1606
1813
  }
1814
+ onColumnSettings(definition) {
1815
+ this.showColumnModal = true;
1816
+ this.selectedDefinition = definition ? definition : this.allColumnDefinitions[0];
1817
+ if (this.allAvailableColumns) {
1818
+ this.openColumnModal();
1819
+ }
1820
+ else {
1821
+ // if no complete definitions have been loaded yet send an event so the app can load it
1822
+ this.allColumnsEvent.emit();
1823
+ }
1824
+ }
1825
+ onViewDefinition(definition) {
1826
+ this.selectedDefinition = definition;
1827
+ this.viewDefinitionChangeEvent.emit(definition);
1828
+ }
1829
+ isCurrentDefinition(definition) {
1830
+ return this.selectedDefinition && this.selectedDefinition.id === definition.id;
1831
+ }
1607
1832
  get selectedCount() {
1608
1833
  var _a;
1609
1834
  return ((_a = this.selectionModel) === null || _a === void 0 ? void 0 : _a.selected) ? this.selectionModel.selected.length : 0;
1610
1835
  }
1611
1836
  get rowCount() {
1837
+ return this.getAllDataSourceRowsOfCurrentPage() ? this.getAllDataSourceRowsOfCurrentPage().length : 0;
1838
+ }
1839
+ getAllDataSourceRowsOfCurrentPage() {
1612
1840
  var _a;
1613
- return ((_a = this.dataSource) === null || _a === void 0 ? void 0 : _a._pageData(this.dataSource.data)) ? this.dataSource._pageData(this.dataSource.data).length : 0;
1841
+ return (_a = this.dataSource) === null || _a === void 0 ? void 0 : _a._pageData(this.dataSource.data);
1614
1842
  }
1615
1843
  getSelectedCount(actionType) {
1616
1844
  const count = this.selectedCount;
1617
- if (actionType != this.BATCH || count < 2) {
1618
- return "";
1845
+ if (actionType !== this.BATCH || count < 2) {
1846
+ return '';
1619
1847
  }
1620
- return " (" + count + ")";
1848
+ return ' (' + count + ')';
1621
1849
  }
1622
1850
  isDisabled(actionType) {
1623
1851
  switch (actionType) {
1624
1852
  case this.SINGLE:
1625
- return this.selectedCount != 1;
1853
+ return this.selectedCount !== 1;
1626
1854
  case this.BATCH:
1627
1855
  return this.selectedCount < 1;
1628
1856
  default:
@@ -1636,10 +1864,8 @@ class DataTableComponent {
1636
1864
  this.allSelected = !this.allSelected;
1637
1865
  if (this.allSelected) {
1638
1866
  // select all rows of the current page
1639
- this.dataSource._pageData(this.dataSource.data).forEach((row) => {
1640
- const dataRow = row;
1641
- const rowId = "" + dataRow.rowId;
1642
- this.selectionModel.select(rowId);
1867
+ this.getAllDataSourceRowsOfCurrentPage().forEach(row => {
1868
+ this.selectionModel.select('' + row.rowId);
1643
1869
  });
1644
1870
  }
1645
1871
  }
@@ -1672,11 +1898,18 @@ class DataTableComponent {
1672
1898
  return;
1673
1899
  }
1674
1900
  }
1675
- onSortingEvent(sortingParams) {
1676
- this.sortEvent.emit(sortingParams);
1901
+ onSortingEvent(sort) {
1902
+ if (this.useAsync) {
1903
+ this.sortEvent.emit(sort);
1904
+ }
1905
+ else {
1906
+ this.internalSort(sort);
1907
+ }
1677
1908
  }
1678
- onPaginationEvent(event) {
1679
- this.pagingEvent.emit(event);
1909
+ onPageEvent(event) {
1910
+ if (this.useAsync) {
1911
+ this.pageEvent.emit(event);
1912
+ }
1680
1913
  }
1681
1914
  onTableAction(tableAction) {
1682
1915
  if (!!tableAction) {
@@ -1688,19 +1921,6 @@ class DataTableComponent {
1688
1921
  this.actionEvent.emit(tableAction);
1689
1922
  }
1690
1923
  }
1691
- static transformData(value, transformer, transformerParams) {
1692
- if (!transformer || !(transformer instanceof Function)) {
1693
- return value;
1694
- }
1695
- return transformer(value, transformerParams);
1696
- }
1697
- static generateRowId() {
1698
- return v4();
1699
- }
1700
- static isClickOnRowMenuIcon(event) {
1701
- var _a;
1702
- return (_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.classList.contains("mat-icon");
1703
- }
1704
1924
  emitTableAction(action, selected) {
1705
1925
  const emitAction = Object.assign({}, action);
1706
1926
  if (action.type !== this.NONE) {
@@ -1710,13 +1930,17 @@ class DataTableComponent {
1710
1930
  }
1711
1931
  generateDisplayedDataElement(rowId, actualDataElement) {
1712
1932
  const displayedDataElement = {};
1713
- displayedDataElement["rowId"] = rowId;
1933
+ displayedDataElement.rowId = rowId;
1714
1934
  for (const column of this.columns) {
1715
1935
  const actualValue = actualDataElement[column.dataPropertyName];
1716
1936
  displayedDataElement[column.dataPropertyName] = DataTableComponent.transformData(actualValue, column.transformer, column.transformerParams);
1717
1937
  }
1718
1938
  return displayedDataElement;
1719
1939
  }
1940
+ internalSort(sort) {
1941
+ const sortedData = [...this.dataSource.data].sort((a, b) => DataTableComponent.compare(a, b, sort));
1942
+ this.dataSource.data = [...sortedData];
1943
+ }
1720
1944
  setActions() {
1721
1945
  this.rowActions = [];
1722
1946
  this.tableActions = [];
@@ -1746,14 +1970,41 @@ class DataTableComponent {
1746
1970
  const displayedDataList = [];
1747
1971
  this.actualDataMap.clear();
1748
1972
  this.displayedDataMap.clear();
1749
- for (const dataEntry of data) {
1750
- const rowId = (this.idGenerator) ? this.idGenerator(dataEntry) : DataTableComponent.generateRowId();
1751
- this.actualDataMap.set(rowId, dataEntry);
1752
- const displayedDataElement = this.generateDisplayedDataElement(rowId, dataEntry);
1753
- this.displayedDataMap.set(rowId, displayedDataElement);
1754
- displayedDataList.push(displayedDataElement);
1973
+ if ((data === null || data === void 0 ? void 0 : data.length) > 0) {
1974
+ for (const dataEntry of data) {
1975
+ const rowId = this.idGenerator ? this.idGenerator(dataEntry) : DataTableComponent.generateRowId();
1976
+ this.actualDataMap.set(rowId, dataEntry);
1977
+ const displayedDataElement = this.generateDisplayedDataElement(rowId, dataEntry);
1978
+ this.displayedDataMap.set(rowId, displayedDataElement);
1979
+ displayedDataList.push(displayedDataElement);
1980
+ }
1755
1981
  }
1756
1982
  this.dataSource.data = displayedDataList;
1983
+ this.unsetPageSizeIfNecessary();
1984
+ }
1985
+ openColumnModal() {
1986
+ const dialogData = {
1987
+ allColumns: this.allAvailableColumns,
1988
+ definition: this.selectedDefinition,
1989
+ deleteDefinitionAllowed: this.deleteDefinitionAllowed,
1990
+ filterColumnsLabel: this.filterColumnsLabel,
1991
+ filterColumnsPlaceHolder: this.filterColumnsPlaceHolder,
1992
+ noDataText: this.noDataText,
1993
+ titleLabel: this.columnSettingsModalTitleLabel,
1994
+ selectedLabel: this.selectedLabel,
1995
+ availableLabel: this.availableLabel,
1996
+ saveLabel: this.saveLabel,
1997
+ deleteLabel: this.deleteLabel,
1998
+ cancelLabel: this.cancelLabel,
1999
+ infoTextLabel: this.infoTextLabel,
2000
+ };
2001
+ const dialog = this.matDialog.open(DataTableColumnsModalComponent, { data: dialogData });
2002
+ dialog.afterClosed().subscribe(result => {
2003
+ // no event on CANCEL
2004
+ if (result) {
2005
+ this.columnDefinitionChangeEvent.emit(result);
2006
+ }
2007
+ });
1757
2008
  }
1758
2009
  getTableMode() {
1759
2010
  if (this._forceMode) {
@@ -1774,31 +2025,62 @@ class DataTableComponent {
1774
2025
  }
1775
2026
  return this.NONE;
1776
2027
  }
2028
+ unsetPageSizeIfNecessary() {
2029
+ if (!this.useAsync && !this.isPaginationEnabled) {
2030
+ const dataCount = this.dataSource.data ? this.dataSource.data.length : 0;
2031
+ this.paginatorPageSize = dataCount;
2032
+ this.paginatorLength = dataCount;
2033
+ }
2034
+ }
1777
2035
  }
1778
2036
  DataTableComponent.decorators = [
1779
2037
  { type: Component, args: [{
1780
- selector: "mad-data-table",
1781
- 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 {{ tableAction.label | translate }} {{ getSelectedCount(tableAction.type) }}\n </mad-outline-button>\n </div>\n <!-- Table filter -->\n <mat-form-field *ngIf=\"isFilterEnabled\">\n <mat-label>{{ filterLabel | translate }}</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 {{ rowAction.label | translate }}\n </button>\n </ng-template>\n</mat-menu>\n\n<!-- Table -->\n<div *ngIf=\"rowCount > 0; else noData\" class=\"mad-table\">\n <div class=\"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 class=\"row-action-button\">\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\" class=\"row-action-button\">\n <!-- BATCH: row checkbox -->\n <div *ngIf=\"mode === BATCH\" class=\"mad-datatable-checkbox-container\">\n <mat-checkbox\n (click)=\"onRowCheckbox($event, element.rowId)\"\n [checked]=\"isSelected(element.rowId)\"\n >\n </mat-checkbox>\n </div>\n <!-- SINGLE: row action menu icon -->\n <mad-icon-button\n *ngIf=\"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 <!-- Columns with data -->\n <ng-container *ngFor=\"let column of columns\" [matColumnDef]=\"column.label\">\n <ng-container *ngIf=\"column.isSortable; else noSort\">\n <th\n scope=\"col\"\n mat-header-cell\n *matHeaderCellDef\n mat-sort-header=\"{{ column.label | translate}}\"\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 scope=\"col\" 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\" [ngSwitch]=\"column.transformer\">\n <span>\n {{ element[column.dataPropertyName] }}\n </span>\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\n <!-- Pagination -->\n <mat-paginator\n [style.display]=\"isPaginationEnabled ? 'block' : 'none'\"\n [pageSize]=\"defaultPageSize\"\n [pageSizeOptions]=\"pageSizeOptions\"\n (page)=\"onPaginationEvent($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=\"datatable-spinner-wrapper\" *ngIf=\"isLoading\">\n <mat-spinner [diameter]=\"50\" [strokeWidth]=\"3\"></mat-spinner>\n </div>\n {{ noDataText }}\n </div>\n</ng-template>\n",
1782
- styles: [".text-right{padding-right:24px!important;text-align:right!important}.table-action{margin-bottom:.5em;margin-right:.5em}.row-action-button{width:10px}.noDataText{text-align:center}.mad-table,.noDataText{position:relative;width:100%}.mad-table{overflow-x:auto}.mad-datatable-action-bar{align-items:baseline;display:flex;justify-content:space-between}.mad-datatable-checkbox-container{margin-right:16px}.datatable-spinner-wrapper{align-items:center;background-color:#fff;display:flex;height:100%;justify-content:center;left:0;opacity:.8;pointer-events:unset;position:absolute;top:0;width:100%;z-index:99999}"]
2038
+ selector: 'mad-data-table',
2039
+ 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 {{ tableAction.label | translate }} {{ getSelectedCount(tableAction.type) }}\n </mad-outline-button>\n </div>\n <!-- Table filter -->\n <mat-form-field *ngIf=\"isFilterEnabled\">\n <mat-label>{{ filterLabel | translate }}</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 {{ rowAction.label | translate }}\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 {{ definition.label | translate }}\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 {{ definition.label | translate }}\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 class=\"row-action-button\">\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\" class=\"row-action-button\">\n <!-- BATCH: row checkbox -->\n <div *ngIf=\"mode === BATCH\" class=\"mad-datatable-checkbox-container\">\n <mat-checkbox\n (click)=\"onRowCheckbox($event, element.rowId)\"\n [checked]=\"isSelected(element.rowId)\"\n >\n </mat-checkbox>\n </div>\n <!-- SINGLE: row action menu icon -->\n <mad-icon-button\n *ngIf=\"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 <!-- Columns with data -->\n <ng-container *ngFor=\"let column of columns\" [matColumnDef]=\"column.id\">\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 {{ column.label | translate }}\n </th>\n </ng-container>\n <ng-template #noSort>\n <th scope=\"col\" mat-header-cell *matHeaderCellDef [class.text-right]=\"column.isRightAligned\">\n {{ column.label | translate }}\n </th>\n </ng-template>\n <td mat-cell *matCellDef=\"let element\" [class.text-right]=\"column.isRightAligned\" [ngSwitch]=\"column.transformer\">\n <span>\n {{ element[column.dataPropertyName] }}\n </span>\n </td>\n </ng-container>\n <tr mat-header-row *matHeaderRowDef=\"columnIds\"></tr>\n <tr\n mat-row\n [class.clickable-table-row]=\"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",
2040
+ styles: [":host{background-color:#fff;display:flex;flex:1 1 auto;flex-direction:column;min-height:112px}.datatable-vertical-stretch-to-parent{display:flex;flex:1;flex-direction:column;max-height:100%;width:100%}.datatable-max-height-500{max-height:500px}.datatable-max-height-300{max-height:300px}.datatable-max-height,.datatable-max-height-300,.datatable-max-height-500{display:flex;flex:1;flex-direction:column;width:100%}.datatable{flex:1 1 auto;height:100%;overflow:auto;position:relative;width:100%}.datatable table{max-height:100%;width:100%}.datatable td,.datatable th{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:auto}.text-right{padding-right:24px!important;text-align:right!important}.table-action{margin-bottom:.5em;margin-right:.5em}.row-action-button{width:10px}.noDataText{position:relative;text-align:center;width:100%}.mad-datatable-action-bar{align-items:baseline;display:flex;justify-content:space-between}.mad-datatable-checkbox-container{margin-right:16px}.mad-datatable-spinner-wrapper{align-items:center;background-color:#fff;display:flex;height:100%;justify-content:center;left:0;opacity:.8;pointer-events:unset;position:absolute;top:0;width:100%;z-index:99999}.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-header-row th{background-color:#fff;position:-webkit-sticky;position:sticky;top:0;z-index:1}.active-column-definition{background-color:#f5f5f5;color:#000}"]
1783
2041
  },] }
1784
2042
  ];
2043
+ DataTableComponent.ctorParameters = () => [
2044
+ { type: MatDialog }
2045
+ ];
1785
2046
  DataTableComponent.propDecorators = {
1786
- columns: [{ type: Input }],
1787
2047
  filterLabel: [{ type: Input }],
1788
2048
  filterPlaceholder: [{ type: Input }],
2049
+ filterColumnsLabel: [{ type: Input }],
2050
+ filterColumnsPlaceHolder: [{ type: Input }],
1789
2051
  noDataText: [{ type: Input }],
2052
+ columnSettingsModalTitleLabel: [{ type: Input }],
2053
+ selectedLabel: [{ type: Input }],
2054
+ availableLabel: [{ type: Input }],
2055
+ saveLabel: [{ type: Input }],
2056
+ deleteLabel: [{ type: Input }],
2057
+ cancelLabel: [{ type: Input }],
2058
+ infoTextLabel: [{ type: Input }],
2059
+ tableClass: [{ type: Input }],
1790
2060
  pageSizeOptions: [{ type: Input }],
1791
- defaultPageSize: [{ type: Input }],
2061
+ externalFilter: [{ type: Input }],
1792
2062
  actions: [{ type: Input }],
1793
2063
  idGenerator: [{ type: Input }],
2064
+ deleteDefinitionAllowed: [{ type: Input }],
2065
+ useAsync: [{ type: Input }],
2066
+ displayedColumns: [{ type: Input }],
2067
+ displayedColumnDefinition: [{ type: Input }],
1794
2068
  tableData: [{ type: Input }],
2069
+ page: [{ type: Input }],
2070
+ columnDefinitions: [{ type: Input }],
1795
2071
  loading: [{ type: Input }],
2072
+ defaultPageSize: [{ type: Input }],
2073
+ externalPaginator: [{ type: Input }],
1796
2074
  paginationEnabled: [{ type: Input }],
2075
+ allColumns: [{ type: Input }],
1797
2076
  filterEnabled: [{ type: Input }],
1798
2077
  forceMode: [{ type: Input }],
1799
2078
  sortEvent: [{ type: Output }],
1800
2079
  actionEvent: [{ type: Output }],
1801
- pagingEvent: [{ type: Output }],
2080
+ pageEvent: [{ type: Output }],
2081
+ allColumnsEvent: [{ type: Output }],
2082
+ columnDefinitionChangeEvent: [{ type: Output }],
2083
+ viewDefinitionChangeEvent: [{ type: Output }],
1802
2084
  paginator: [{ type: ViewChild, args: [MatPaginator, { static: false },] }],
1803
2085
  sort: [{ type: ViewChild, args: [MatSort, { static: true },] }]
1804
2086
  };
@@ -1807,7 +2089,7 @@ class DataTableModule {
1807
2089
  }
1808
2090
  DataTableModule.decorators = [
1809
2091
  { type: NgModule, args: [{
1810
- declarations: [DataTableComponent],
2092
+ declarations: [DataTableComponent, DataTableColumnsModalComponent],
1811
2093
  imports: [
1812
2094
  CommonModule,
1813
2095
  MatButtonModule,
@@ -1822,9 +2104,11 @@ DataTableModule.decorators = [
1822
2104
  ButtonModule,
1823
2105
  TranslateModule,
1824
2106
  MatCheckboxModule,
1825
- MatBadgeModule
2107
+ MatBadgeModule,
2108
+ DragDropModule,
2109
+ FormsModule,
1826
2110
  ],
1827
- exports: [DataTableComponent]
2111
+ exports: [DataTableComponent, DataTableColumnsModalComponent],
1828
2112
  },] }
1829
2113
  ];
1830
2114
 
@@ -1875,8 +2159,8 @@ StepHeaderComponent.decorators = [
1875
2159
  template: "<div\n class=\"header\"\n fxLayout=\"row\"\n fxLayoutGap=\"1em\"\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",
1876
2160
  inputs: ['color'],
1877
2161
  host: {
1878
- 'class': 'mad-step-header',
1879
- 'role': 'tab',
2162
+ class: 'mad-step-header',
2163
+ role: 'tab',
1880
2164
  },
1881
2165
  encapsulation: ViewEncapsulation.None,
1882
2166
  changeDetection: ChangeDetectionStrategy.OnPush,
@@ -2049,7 +2333,7 @@ StepperComponent.decorators = [
2049
2333
  host: {
2050
2334
  '[class.stepper-vertical]': 'true',
2051
2335
  '[attr.aria-orientation]': '"vertical"',
2052
- 'role': 'tablist',
2336
+ role: 'tablist',
2053
2337
  },
2054
2338
  animations: [madStepperAnimations.verticalStepTransition],
2055
2339
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
@@ -2084,9 +2368,6 @@ StepperModule.decorators = [
2084
2368
  ];
2085
2369
 
2086
2370
  class ContentHeaderComponent {
2087
- constructor() { }
2088
- ngOnInit() {
2089
- }
2090
2371
  }
2091
2372
  ContentHeaderComponent.decorators = [
2092
2373
  { type: Component, args: [{
@@ -2095,12 +2376,8 @@ ContentHeaderComponent.decorators = [
2095
2376
  styles: [".content-header{padding-right:.5rem}"]
2096
2377
  },] }
2097
2378
  ];
2098
- ContentHeaderComponent.ctorParameters = () => [];
2099
2379
 
2100
2380
  class ContentPanelContainerComponent {
2101
- constructor() { }
2102
- ngOnInit() {
2103
- }
2104
2381
  }
2105
2382
  ContentPanelContainerComponent.decorators = [
2106
2383
  { type: Component, args: [{
@@ -2109,12 +2386,8 @@ ContentPanelContainerComponent.decorators = [
2109
2386
  styles: [":host{display:flex;flex:1 1 auto;min-height:.05rem;overflow:hidden;position:relative}.content-panel-outer-wrapper{display:flex;flex:1 1 auto;flex-direction:column}"]
2110
2387
  },] }
2111
2388
  ];
2112
- ContentPanelContainerComponent.ctorParameters = () => [];
2113
2389
 
2114
2390
  class ContentPanelContainerContentComponent {
2115
- constructor() { }
2116
- ngOnInit() {
2117
- }
2118
2391
  }
2119
2392
  ContentPanelContainerContentComponent.decorators = [
2120
2393
  { type: Component, args: [{
@@ -2123,12 +2396,8 @@ ContentPanelContainerContentComponent.decorators = [
2123
2396
  styles: [":host{border-top:.05rem solid #ccc;flex:1 1 auto;height:1rem;overflow-y:auto;padding:1rem}"]
2124
2397
  },] }
2125
2398
  ];
2126
- ContentPanelContainerContentComponent.ctorParameters = () => [];
2127
2399
 
2128
2400
  class ContentPanelContainerFooterComponent {
2129
- constructor() { }
2130
- ngOnInit() {
2131
- }
2132
2401
  }
2133
2402
  ContentPanelContainerFooterComponent.decorators = [
2134
2403
  { type: Component, args: [{
@@ -2137,12 +2406,8 @@ ContentPanelContainerFooterComponent.decorators = [
2137
2406
  styles: [":host{align-items:center;border-top:.05rem solid #ccc;display:flex;flex:0 0 auto;min-height:2rem;padding:.25rem 1rem}"]
2138
2407
  },] }
2139
2408
  ];
2140
- ContentPanelContainerFooterComponent.ctorParameters = () => [];
2141
2409
 
2142
2410
  class MainContainerComponent {
2143
- constructor() { }
2144
- ngOnInit() {
2145
- }
2146
2411
  }
2147
2412
  MainContainerComponent.decorators = [
2148
2413
  { type: Component, args: [{
@@ -2151,7 +2416,6 @@ MainContainerComponent.decorators = [
2151
2416
  styles: [".main-container{display:flex;flex-direction:column;height:100%}"]
2152
2417
  },] }
2153
2418
  ];
2154
- MainContainerComponent.ctorParameters = () => [];
2155
2419
 
2156
2420
  class ContentPanelModule {
2157
2421
  }
@@ -2186,18 +2450,21 @@ class FlowbarComponent {
2186
2450
  */
2187
2451
  this._headerClick = new EventEmitter(true);
2188
2452
  }
2453
+ get currentStepLabel() {
2454
+ return this._activeStep.label;
2455
+ }
2456
+ get currentSubStepLabel() {
2457
+ var _a;
2458
+ return (_a = this._activeStep.activeSubStep) === null || _a === void 0 ? void 0 : _a.label;
2459
+ }
2189
2460
  ngOnInit() {
2190
2461
  // If no active step is set as input or the active step is not enabled, select the first enabled step
2191
2462
  if (!this._activeStep || !this._activeStep.enabled) {
2192
- this._activeStep = this._steps.find(step => {
2193
- return step.enabled;
2194
- });
2463
+ this._activeStep = this._steps.find(step => step.enabled);
2195
2464
  if (this._activeStep) {
2196
2465
  // If sub steps exist then set the first non disabled sub step per default
2197
2466
  if (this.activeTabHasSubSteps()) {
2198
- this._activeStep.activeSubStep = this._activeStep.subSteps.find(step => {
2199
- return step.enabled;
2200
- });
2467
+ this._activeStep.activeSubStep = this._activeStep.subSteps.find(step => step.enabled);
2201
2468
  }
2202
2469
  this._activeStepChange.emit(this._activeStep);
2203
2470
  }
@@ -2295,14 +2562,10 @@ class FlowbarComponent {
2295
2562
  return false;
2296
2563
  }
2297
2564
  getCurrentIndex() {
2298
- return this._steps.findIndex(value => {
2299
- return value === this._activeStep;
2300
- });
2565
+ return this._steps.findIndex(value => value === this._activeStep);
2301
2566
  }
2302
2567
  getCurrentSubStepIndex() {
2303
- return this._activeStep.subSteps.findIndex(value => {
2304
- return value === this._activeStep.activeSubStep;
2305
- });
2568
+ return this._activeStep.subSteps.findIndex(value => value === this._activeStep.activeSubStep);
2306
2569
  }
2307
2570
  triggerClick() {
2308
2571
  const selectedStep = this._steps[this.stepper.selectedIndex];
@@ -2312,13 +2575,6 @@ class FlowbarComponent {
2312
2575
  event.stopPropagation(); //stop processing current header click event
2313
2576
  this._headerClick.emit(step);
2314
2577
  }
2315
- get currentStepLabel() {
2316
- return this._activeStep.label;
2317
- }
2318
- get currentSubStepLabel() {
2319
- var _a;
2320
- return (_a = this._activeStep.activeSubStep) === null || _a === void 0 ? void 0 : _a.label;
2321
- }
2322
2578
  activeTabHasSubSteps() {
2323
2579
  return this._activeStep.subSteps && this._activeStep.subSteps.length > 0;
2324
2580
  }
@@ -2356,11 +2612,11 @@ FlowbarComponent.decorators = [
2356
2612
  },] }
2357
2613
  ];
2358
2614
  FlowbarComponent.propDecorators = {
2359
- stepper: [{ type: ViewChild, args: ['stepper',] }],
2360
2615
  _steps: [{ type: Input, args: ['steps',] }],
2361
2616
  _activeStep: [{ type: Input, args: ['activeStep',] }],
2362
2617
  _activeStepChange: [{ type: Output, args: ['activeStepChange',] }],
2363
- _headerClick: [{ type: Output, args: ['headerClick',] }]
2618
+ _headerClick: [{ type: Output, args: ['headerClick',] }],
2619
+ stepper: [{ type: ViewChild, args: ['stepper',] }]
2364
2620
  };
2365
2621
 
2366
2622
  class FlowbarModule {
@@ -2398,5 +2654,5 @@ MaterialAddonsModule.decorators = [
2398
2654
  * Generated bundle index. Do not edit.
2399
2655
  */
2400
2656
 
2401
- export { ButtonModule, CardModule, ContentHeaderComponent, ContentPanelContainerComponent, ContentPanelContainerContentComponent, ContentPanelContainerFooterComponent, ContentPanelModule, DataTableModule, FlowbarComponent, FlowbarModule, MainContainerComponent, MaterialActionButtonComponent, MaterialActionButtonModule, MaterialAddonsModule, NumberFormatService, NumericFieldModule, QuickListModule, ReadOnlyFormFieldComponent, ReadOnlyFormFieldModule, ReadOnlyFormFieldWrapperComponent, StepComponent, StepHeaderComponent, StepperComponent, StepperModule, TableModule, ThrottleClickDirective, ThrottleClickModule, ToolbarComponent, ToolbarModule, ToolbarService, madStepperAnimations, PrimaryButtonComponent as ɵa, MadBasicButton as ɵb, OutlineButtonComponent as ɵc, LinkButtonComponent as ɵd, DangerButtonComponent as ɵe, IconButtonComponent as ɵf, NumericFieldDirective as ɵg, CardComponent as ɵh, QuickListComponent as ɵi, BaseQuickListComponent as ɵj, QuickListCompactComponent as ɵk, TableComponent as ɵl, DataTableComponent as ɵm };
2657
+ export { ButtonModule, CardModule, ContentHeaderComponent, ContentPanelContainerComponent, ContentPanelContainerContentComponent, ContentPanelContainerFooterComponent, ContentPanelModule, DataTableModule, FlowbarComponent, FlowbarModule, MainContainerComponent, MaterialActionButtonComponent, MaterialActionButtonModule, MaterialAddonsModule, NumberFormatService, NumericFieldModule, QuickListModule, ReadOnlyFormFieldComponent, ReadOnlyFormFieldModule, ReadOnlyFormFieldWrapperComponent, StepComponent, StepHeaderComponent, StepperComponent, StepperModule, TableModule, ThrottleClickDirective, ThrottleClickModule, ToolbarComponent, ToolbarModule, ToolbarService, madStepperAnimations, PrimaryButtonComponent as ɵb, MadBasicButton as ɵc, OutlineButtonComponent as ɵd, LinkButtonComponent as ɵe, DangerButtonComponent as ɵf, IconButtonComponent as ɵg, NumericFieldDirective as ɵh, CardComponent as ɵi, QuickListComponent as ɵj, BaseQuickListComponent as ɵk, QuickListCompactComponent as ɵl, TableComponent as ɵm, DataTableComponent as ɵn, DataTableColumnsModalComponent as ɵo };
2402
2658
  //# sourceMappingURL=porscheinformatik-material-addons.js.map