@porscheinformatik/material-addons 10.3.2 → 10.4.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 (73) hide show
  1. package/bundles/porscheinformatik-material-addons.umd.js +511 -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 +1 -1
  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/column-header.js +1 -1
  39. package/esm2015/lib/table/table.component.js +7 -7
  40. package/esm2015/lib/throttle-click/throttle-click.directive.js +6 -7
  41. package/esm2015/lib/toolbar/toolbar-action.interface.js +1 -1
  42. package/esm2015/lib/toolbar/toolbar.component.js +7 -4
  43. package/esm2015/lib/toolbar/toolbar.module.js +2 -2
  44. package/esm2015/lib/toolbar/toolbar.service.js +7 -7
  45. package/esm2015/porscheinformatik-material-addons.js +15 -14
  46. package/fesm2015/porscheinformatik-material-addons.js +407 -153
  47. package/fesm2015/porscheinformatik-material-addons.js.map +1 -1
  48. package/lib/button/mad-basic-button.d.ts +4 -4
  49. package/lib/content-panel/content-header/content-header.component.d.ts +1 -4
  50. package/lib/content-panel/content-panel-container/content-panel-container.component.d.ts +1 -4
  51. package/lib/content-panel/content-panel-container-content/content-panel-container-content.component.d.ts +1 -4
  52. package/lib/content-panel/content-panel-container-footer/content-panel-container-footer.component.d.ts +1 -4
  53. package/lib/content-panel/main-container/main-container.component.d.ts +1 -4
  54. package/lib/data-table/data-table-action.d.ts +1 -1
  55. package/lib/data-table/data-table-column-definition.d.ts +26 -0
  56. package/lib/data-table/{data-table-column-header.d.ts → data-table-column.d.ts} +3 -1
  57. package/lib/data-table/data-table-columns-modal/data-table-columns-modal.component.d.ts +23 -0
  58. package/lib/data-table/data-table.component.d.ts +68 -20
  59. package/lib/data-table/data-table.d.ts +2 -1
  60. package/lib/flowbar/flowbar.component.d.ts +3 -3
  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/column-header.d.ts +1 -0
  64. package/lib/table/table.component.d.ts +4 -4
  65. package/lib/throttle-click/throttle-click.directive.d.ts +1 -2
  66. package/lib/toolbar/toolbar-action.interface.d.ts +2 -1
  67. package/lib/toolbar/toolbar.component.d.ts +1 -0
  68. package/lib/toolbar/toolbar.service.d.ts +2 -2
  69. package/package.json +1 -1
  70. package/porscheinformatik-material-addons.d.ts +15 -13
  71. package/porscheinformatik-material-addons.metadata.json +1 -1
  72. package/themes/common/styles.scss +6 -0
  73. 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 }],
@@ -1407,7 +1417,6 @@ QuickListModule.decorators = [
1407
1417
  class TableComponent {
1408
1418
  constructor() {
1409
1419
  var _a;
1410
- this.ACTION_COLUMN_NAME = '__action__';
1411
1420
  this.columns = [];
1412
1421
  this.filterLabel = 'NOT SET';
1413
1422
  this.filterPlaceholder = 'NOT SET';
@@ -1418,6 +1427,7 @@ class TableComponent {
1418
1427
  this.tableAction = new EventEmitter();
1419
1428
  this.rowAction = new EventEmitter();
1420
1429
  this.sortEvent = new EventEmitter();
1430
+ this.ACTION_COLUMN_NAME = '__action__';
1421
1431
  this.isFilterEnabled = false;
1422
1432
  this.isPaginationEnabled = false;
1423
1433
  }
@@ -1483,7 +1493,7 @@ class TableComponent {
1483
1493
  TableComponent.decorators = [
1484
1494
  { type: Component, args: [{
1485
1495
  selector: 'mad-table',
1486
- 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\">\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\">\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\n <!-- Pagination -->\n <mat-paginator\n [style.display]=\"isPaginationEnabled ? 'block' : 'none'\"\n [pageSize]=\"defaultPageSize\"\n [pageSizeOptions]=\"pageSizeOptions\"\n showFirstLastButtons\n >\n </mat-paginator>\n</div>\n\n<!-- No data alert -->\n<ng-template #noData>\n <div class=\"noDataText\">\n {{ noDataText }}\n </div>\n</ng-template>\n",
1496
+ 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",
1487
1497
  styles: [".text-right{text-align:right!important}.table-action{margin-bottom:.5em;margin-right:.5em}.row-action-button{width:10px}.noDataText{text-align:center;width:100%}.mad-table{overflow-x:auto;width:100%}"]
1488
1498
  },] }
1489
1499
  ];
@@ -1496,14 +1506,14 @@ TableComponent.propDecorators = {
1496
1506
  defaultPageSize: [{ type: Input }],
1497
1507
  rowActions: [{ type: Input }],
1498
1508
  tableActions: [{ type: Input }],
1499
- displayedData: [{ type: Input }],
1500
- paginationEnabled: [{ type: Input }],
1501
- filterEnabled: [{ type: Input }],
1502
1509
  tableAction: [{ type: Output }],
1503
1510
  rowAction: [{ type: Output }],
1504
1511
  sortEvent: [{ type: Output }],
1505
1512
  paginator: [{ type: ViewChild, args: [MatPaginator, { static: false },] }],
1506
- sort: [{ type: ViewChild, args: [MatSort, { static: true },] }]
1513
+ sort: [{ type: ViewChild, args: [MatSort, { static: true },] }],
1514
+ displayedData: [{ type: Input }],
1515
+ paginationEnabled: [{ type: Input }],
1516
+ filterEnabled: [{ type: Input }]
1507
1517
  };
1508
1518
 
1509
1519
  class TableModule {
@@ -1529,38 +1539,160 @@ TableModule.decorators = [
1529
1539
 
1530
1540
  class DataTableActionType {
1531
1541
  }
1532
- DataTableActionType.SINGLE = "SINGLE";
1533
- DataTableActionType.BATCH = "BATCH";
1534
- DataTableActionType.NONE = "NONE";
1542
+ DataTableActionType.SINGLE = 'SINGLE';
1543
+ DataTableActionType.BATCH = 'BATCH';
1544
+ DataTableActionType.NONE = 'NONE';
1535
1545
 
1536
- class DataTableComponent {
1537
- constructor() {
1546
+ class DataTableColumnsModalComponent {
1547
+ constructor(dialogRef, data) {
1548
+ this.dialogRef = dialogRef;
1549
+ this.data = data;
1550
+ this.selectedColumns = [];
1551
+ this.availableColumns = [];
1552
+ this.filteredAvailableColumns = [];
1553
+ }
1554
+ ngOnInit() {
1555
+ this.definition = this.data.definition;
1556
+ for (const column of this.data.allColumns) {
1557
+ const columnId = column.id;
1558
+ const selectedColumnIds = this.definition.displayedColumns.map(col => col.id);
1559
+ if (selectedColumnIds.includes(columnId)) {
1560
+ this.selectedColumns.push(column);
1561
+ }
1562
+ else {
1563
+ this.availableColumns.push(column);
1564
+ }
1565
+ }
1566
+ this.clearFilterValue();
1567
+ }
1568
+ onDrop(event) {
1569
+ if (event.previousContainer === event.container) {
1570
+ moveItemInArray(event.container.data, event.previousIndex, event.currentIndex);
1571
+ }
1572
+ else {
1573
+ const itemIndex = this.findMatchingItemIndex(event.previousContainer, event.item);
1574
+ transferArrayItem(event.previousContainer.data, event.container.data, itemIndex, event.currentIndex);
1575
+ this.clearFilterValue();
1576
+ this.availableColumns.sort((a, b) => a.label.localeCompare(b.label));
1577
+ }
1578
+ }
1579
+ onSave() {
1580
+ this.definition.displayedColumns = this.selectedColumns;
1581
+ const saveChange = {
1582
+ action: 'SAVE',
1583
+ definition: this.definition,
1584
+ };
1585
+ this.dialogRef.close(saveChange);
1586
+ }
1587
+ onDelete() {
1588
+ const deleteChange = {
1589
+ action: 'DELETE',
1590
+ definition: this.definition,
1591
+ };
1592
+ this.dialogRef.close(deleteChange);
1593
+ }
1594
+ onCancel() {
1595
+ this.dialogRef.close();
1596
+ }
1597
+ updateFilterValue() {
1538
1598
  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";
1599
+ if (((_a = this.searchFilter) === null || _a === void 0 ? void 0 : _a.length) > 0) {
1600
+ this.filteredAvailableColumns = this.availableColumns.filter(c => c.label.toLowerCase().includes(this.searchFilter.toLowerCase()));
1601
+ }
1602
+ else {
1603
+ this.filteredAvailableColumns = [...this.availableColumns];
1604
+ }
1605
+ }
1606
+ findMatchingItemIndex(previousContainer, item) {
1607
+ const itemId = item.element.nativeElement.id;
1608
+ const previousContainerItems = [...previousContainer.data];
1609
+ if ((previousContainerItems === null || previousContainerItems === void 0 ? void 0 : previousContainerItems.length) < 1) {
1610
+ return 0;
1611
+ }
1612
+ for (let itemIndex = 0; itemIndex < previousContainerItems.length; itemIndex++) {
1613
+ if (previousContainerItems[itemIndex].id === itemId) {
1614
+ return itemIndex;
1615
+ }
1616
+ }
1617
+ return 0;
1618
+ }
1619
+ clearFilterValue() {
1620
+ this.searchFilter = '';
1621
+ this.filteredAvailableColumns = [...this.availableColumns];
1622
+ }
1623
+ }
1624
+ DataTableColumnsModalComponent.decorators = [
1625
+ { type: Component, args: [{
1626
+ selector: 'mad-data-table-columns-modal.component',
1627
+ 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",
1628
+ 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)}"]
1629
+ },] }
1630
+ ];
1631
+ DataTableColumnsModalComponent.ctorParameters = () => [
1632
+ { type: MatDialogRef },
1633
+ { type: undefined, decorators: [{ type: Inject, args: [MAT_DIALOG_DATA,] }] }
1634
+ ];
1635
+
1636
+ class DataTableComponent {
1637
+ constructor(matDialog) {
1638
+ this.matDialog = matDialog;
1639
+ // Translations
1640
+ this.filterLabel = 'Filter';
1641
+ this.filterPlaceholder = '';
1642
+ this.filterColumnsLabel = 'Filter';
1643
+ this.filterColumnsPlaceHolder = 'Filter available columns';
1644
+ this.noDataText = 'No matching data found';
1645
+ this.columnSettingsModalTitleLabel = 'Column settings';
1646
+ this.selectedLabel = 'Selected columns';
1647
+ this.availableLabel = 'Available columns';
1648
+ this.saveLabel = 'Save';
1649
+ this.deleteLabel = 'Delete';
1650
+ this.cancelLabel = 'Cancel';
1651
+ this.infoTextLabel = 'Drag and drop a column to select or reorder it.';
1547
1652
  this.pageSizeOptions = [5, 10, 15];
1548
- this.defaultPageSize = ((_a = this.pageSizeOptions) === null || _a === void 0 ? void 0 : _a[0]) || 10;
1549
1653
  this.actions = [];
1654
+ this.deleteDefinitionAllowed = false;
1655
+ this.useAsync = false;
1550
1656
  this.sortEvent = new EventEmitter();
1551
1657
  this.actionEvent = new EventEmitter();
1552
- this.pagingEvent = new EventEmitter();
1658
+ this.pageEvent = new EventEmitter();
1659
+ this.allColumnsEvent = new EventEmitter();
1660
+ this.columnDefinitionChangeEvent = new EventEmitter();
1661
+ this.viewDefinitionChangeEvent = new EventEmitter();
1662
+ this.ACTION_COLUMN_NAME = '__action__';
1663
+ this.SINGLE = DataTableActionType.SINGLE;
1664
+ this.BATCH = DataTableActionType.BATCH;
1665
+ this.NONE = DataTableActionType.NONE;
1553
1666
  this.tableActions = [];
1554
1667
  this.rowActions = [];
1668
+ this.columns = [];
1555
1669
  this.allSelected = false;
1556
1670
  this.displayedDataMap = new Map();
1557
1671
  this.actualDataMap = new Map();
1558
1672
  this.selectionModel = new SelectionModel(true);
1673
+ this.allColumnDefinitions = [];
1559
1674
  this.isFilterEnabled = false;
1560
1675
  this.isPaginationEnabled = false;
1561
1676
  this.mode = this.NONE;
1562
1677
  this.isRowClickable = false;
1678
+ this.showColumnModal = false;
1563
1679
  this.isLoading = false;
1680
+ this.paginatorLength = 0;
1681
+ this.paginatorPageIndex = 0;
1682
+ this.paginatorPageSize = 50;
1683
+ }
1684
+ set displayedColumns(cols) {
1685
+ if (!this.displayedColumnDefinition) {
1686
+ this.columns = cols ? [...cols] : [];
1687
+ this.columnIds = this.columns.map(column => column.id);
1688
+ this.columnIds.unshift(this.ACTION_COLUMN_NAME);
1689
+ }
1690
+ }
1691
+ set displayedColumnDefinition(def) {
1692
+ this.selectedColumnDefinion = def;
1693
+ this.columns = def.displayedColumns;
1694
+ this.columnIds = this.columns.map(column => column.id);
1695
+ this.columnIds.unshift(this.ACTION_COLUMN_NAME);
1564
1696
  }
1565
1697
  set tableData(data) {
1566
1698
  if (!this.dataSource) {
@@ -1568,19 +1700,46 @@ class DataTableComponent {
1568
1700
  }
1569
1701
  this.createDataMapsAndSetDisplayedDataSourceData(data);
1570
1702
  }
1703
+ set page(page) {
1704
+ this.paginatorPageIndex = page.pageIndex;
1705
+ this.paginatorPageSize = page.pageSize;
1706
+ this.paginatorLength = page.length;
1707
+ }
1708
+ set columnDefinitions(definitions) {
1709
+ var _a;
1710
+ this.editableColumnDefinitions = [];
1711
+ this.viewableColumnDefinitions = [];
1712
+ this.allColumnDefinitions = [...definitions];
1713
+ for (const definition of definitions) {
1714
+ if (definition.editable) {
1715
+ this.editableColumnDefinitions.push(definition);
1716
+ }
1717
+ if (((_a = definition.displayedColumns) === null || _a === void 0 ? void 0 : _a.length) > 0) {
1718
+ this.viewableColumnDefinitions.push(definition);
1719
+ }
1720
+ }
1721
+ }
1571
1722
  set loading(isLoading) {
1572
1723
  this.isLoading = isLoading;
1573
1724
  }
1725
+ set defaultPageSize(defaultSize) {
1726
+ this.paginatorPageSize = defaultSize;
1727
+ }
1728
+ set externalPaginator(paginator) {
1729
+ this.extPaginator = paginator;
1730
+ }
1574
1731
  set paginationEnabled(isPaginationEnabled) {
1575
1732
  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);
1733
+ this.unsetPageSizeIfNecessary();
1734
+ }
1735
+ set allColumns(allColumns) {
1736
+ this.allAvailableColumns = allColumns;
1737
+ if (allColumns && this.showColumnModal) {
1738
+ this.openColumnModal();
1580
1739
  }
1581
1740
  }
1582
1741
  set filterEnabled(isFilterEnabled) {
1583
- this.isFilterEnabled = isFilterEnabled;
1742
+ this.isFilterEnabled = !this.useAsync ? isFilterEnabled : false;
1584
1743
  this.setFilterValue(undefined);
1585
1744
  }
1586
1745
  set forceMode(mode) {
@@ -1590,39 +1749,106 @@ class DataTableComponent {
1590
1749
  this.setActions();
1591
1750
  }
1592
1751
  }
1752
+ static compare(a, b, sort) {
1753
+ const x = a[sort.active];
1754
+ const y = b[sort.active];
1755
+ const ascending = sort.direction === 'asc';
1756
+ switch (typeof x) {
1757
+ case 'number':
1758
+ return DataTableComponent.compareNumber(x, y, ascending);
1759
+ case 'string':
1760
+ return DataTableComponent.compareString(x, y, ascending);
1761
+ case 'boolean':
1762
+ return DataTableComponent.compareBoolean(x, y, ascending);
1763
+ default:
1764
+ // cannot compare -> return equal
1765
+ return 0;
1766
+ }
1767
+ }
1768
+ static compareNumber(x, y, ascending) {
1769
+ return ascending ? x - y : y - x;
1770
+ }
1771
+ static compareString(x, y, ascending) {
1772
+ return ascending ? x.localeCompare(y) : y.localeCompare(x);
1773
+ }
1774
+ static compareBoolean(x, y, ascending) {
1775
+ if (x === y) {
1776
+ return 0;
1777
+ }
1778
+ if (ascending) {
1779
+ // true first
1780
+ return x ? -1 : 1;
1781
+ }
1782
+ else {
1783
+ // false first
1784
+ return x ? 1 : -1;
1785
+ }
1786
+ }
1787
+ static transformData(value, transformer, transformerParams) {
1788
+ if (!transformer || !(transformer instanceof Function)) {
1789
+ return value;
1790
+ }
1791
+ return transformer(value, transformerParams);
1792
+ }
1793
+ static generateRowId() {
1794
+ return v4();
1795
+ }
1796
+ static isClickOnRowMenuIcon(event) {
1797
+ var _a;
1798
+ return (_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.classList.contains('mat-icon');
1799
+ }
1593
1800
  ngOnInit() {
1594
- this.columnNames = this.columns.map(column => column.label);
1595
1801
  this.mode = this.getTableMode();
1596
1802
  this.setActions();
1597
1803
  if (this.mode !== this.NONE) {
1598
1804
  this.isRowClickable = true;
1599
1805
  this.defaultAction = this.rowActions[0];
1600
1806
  }
1601
- this.columnNames.unshift(this.ACTION_COLUMN_NAME);
1602
1807
  }
1603
1808
  ngAfterViewInit() {
1604
1809
  this.dataSource.paginator = this.paginator;
1605
1810
  this.dataSource.sort = this.sort;
1606
1811
  }
1812
+ onColumnSettings(definition) {
1813
+ this.showColumnModal = true;
1814
+ this.selectedDefinition = definition ? definition : this.allColumnDefinitions[0];
1815
+ if (this.allAvailableColumns) {
1816
+ this.openColumnModal();
1817
+ }
1818
+ else {
1819
+ // if no complete definitions have been loaded yet send an event so the app can load it
1820
+ this.allColumnsEvent.emit();
1821
+ }
1822
+ }
1823
+ onViewDefinition(definition) {
1824
+ this.selectedDefinition = definition;
1825
+ this.viewDefinitionChangeEvent.emit(definition);
1826
+ }
1827
+ isCurrentDefinition(definition) {
1828
+ return this.selectedDefinition && this.selectedDefinition.id === definition.id;
1829
+ }
1607
1830
  get selectedCount() {
1608
1831
  var _a;
1609
1832
  return ((_a = this.selectionModel) === null || _a === void 0 ? void 0 : _a.selected) ? this.selectionModel.selected.length : 0;
1610
1833
  }
1611
1834
  get rowCount() {
1835
+ return this.getAllDataSourceRowsOfCurrentPage() ? this.getAllDataSourceRowsOfCurrentPage().length : 0;
1836
+ }
1837
+ getAllDataSourceRowsOfCurrentPage() {
1612
1838
  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;
1839
+ return (_a = this.dataSource) === null || _a === void 0 ? void 0 : _a._pageData(this.dataSource.data);
1614
1840
  }
1615
1841
  getSelectedCount(actionType) {
1616
1842
  const count = this.selectedCount;
1617
- if (actionType != this.BATCH || count < 2) {
1618
- return "";
1843
+ if (actionType !== this.BATCH || count < 2) {
1844
+ return '';
1619
1845
  }
1620
- return " (" + count + ")";
1846
+ return ' (' + count + ')';
1621
1847
  }
1622
1848
  isDisabled(actionType) {
1623
1849
  switch (actionType) {
1624
1850
  case this.SINGLE:
1625
- return this.selectedCount != 1;
1851
+ return this.selectedCount !== 1;
1626
1852
  case this.BATCH:
1627
1853
  return this.selectedCount < 1;
1628
1854
  default:
@@ -1636,10 +1862,8 @@ class DataTableComponent {
1636
1862
  this.allSelected = !this.allSelected;
1637
1863
  if (this.allSelected) {
1638
1864
  // 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);
1865
+ this.getAllDataSourceRowsOfCurrentPage().forEach(row => {
1866
+ this.selectionModel.select('' + row.rowId);
1643
1867
  });
1644
1868
  }
1645
1869
  }
@@ -1672,11 +1896,18 @@ class DataTableComponent {
1672
1896
  return;
1673
1897
  }
1674
1898
  }
1675
- onSortingEvent(sortingParams) {
1676
- this.sortEvent.emit(sortingParams);
1899
+ onSortingEvent(sort) {
1900
+ if (this.useAsync) {
1901
+ this.sortEvent.emit(sort);
1902
+ }
1903
+ else {
1904
+ this.internalSort(sort);
1905
+ }
1677
1906
  }
1678
- onPaginationEvent(event) {
1679
- this.pagingEvent.emit(event);
1907
+ onPageEvent(event) {
1908
+ if (this.useAsync) {
1909
+ this.pageEvent.emit(event);
1910
+ }
1680
1911
  }
1681
1912
  onTableAction(tableAction) {
1682
1913
  if (!!tableAction) {
@@ -1688,19 +1919,6 @@ class DataTableComponent {
1688
1919
  this.actionEvent.emit(tableAction);
1689
1920
  }
1690
1921
  }
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
1922
  emitTableAction(action, selected) {
1705
1923
  const emitAction = Object.assign({}, action);
1706
1924
  if (action.type !== this.NONE) {
@@ -1710,13 +1928,17 @@ class DataTableComponent {
1710
1928
  }
1711
1929
  generateDisplayedDataElement(rowId, actualDataElement) {
1712
1930
  const displayedDataElement = {};
1713
- displayedDataElement["rowId"] = rowId;
1931
+ displayedDataElement.rowId = rowId;
1714
1932
  for (const column of this.columns) {
1715
1933
  const actualValue = actualDataElement[column.dataPropertyName];
1716
1934
  displayedDataElement[column.dataPropertyName] = DataTableComponent.transformData(actualValue, column.transformer, column.transformerParams);
1717
1935
  }
1718
1936
  return displayedDataElement;
1719
1937
  }
1938
+ internalSort(sort) {
1939
+ const sortedData = [...this.dataSource.data].sort((a, b) => DataTableComponent.compare(a, b, sort));
1940
+ this.dataSource.data = [...sortedData];
1941
+ }
1720
1942
  setActions() {
1721
1943
  this.rowActions = [];
1722
1944
  this.tableActions = [];
@@ -1746,14 +1968,41 @@ class DataTableComponent {
1746
1968
  const displayedDataList = [];
1747
1969
  this.actualDataMap.clear();
1748
1970
  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);
1971
+ if ((data === null || data === void 0 ? void 0 : data.length) > 0) {
1972
+ for (const dataEntry of data) {
1973
+ const rowId = this.idGenerator ? this.idGenerator(dataEntry) : DataTableComponent.generateRowId();
1974
+ this.actualDataMap.set(rowId, dataEntry);
1975
+ const displayedDataElement = this.generateDisplayedDataElement(rowId, dataEntry);
1976
+ this.displayedDataMap.set(rowId, displayedDataElement);
1977
+ displayedDataList.push(displayedDataElement);
1978
+ }
1755
1979
  }
1756
1980
  this.dataSource.data = displayedDataList;
1981
+ this.unsetPageSizeIfNecessary();
1982
+ }
1983
+ openColumnModal() {
1984
+ const dialogData = {
1985
+ allColumns: this.allAvailableColumns,
1986
+ definition: this.selectedDefinition,
1987
+ deleteDefinitionAllowed: this.deleteDefinitionAllowed,
1988
+ filterColumnsLabel: this.filterColumnsLabel,
1989
+ filterColumnsPlaceHolder: this.filterColumnsPlaceHolder,
1990
+ noDataText: this.noDataText,
1991
+ titleLabel: this.columnSettingsModalTitleLabel,
1992
+ selectedLabel: this.selectedLabel,
1993
+ availableLabel: this.availableLabel,
1994
+ saveLabel: this.saveLabel,
1995
+ deleteLabel: this.deleteLabel,
1996
+ cancelLabel: this.cancelLabel,
1997
+ infoTextLabel: this.infoTextLabel,
1998
+ };
1999
+ const dialog = this.matDialog.open(DataTableColumnsModalComponent, { data: dialogData });
2000
+ dialog.afterClosed().subscribe(result => {
2001
+ // no event on CANCEL
2002
+ if (result) {
2003
+ this.columnDefinitionChangeEvent.emit(result);
2004
+ }
2005
+ });
1757
2006
  }
1758
2007
  getTableMode() {
1759
2008
  if (this._forceMode) {
@@ -1774,31 +2023,62 @@ class DataTableComponent {
1774
2023
  }
1775
2024
  return this.NONE;
1776
2025
  }
2026
+ unsetPageSizeIfNecessary() {
2027
+ if (!this.useAsync && !this.isPaginationEnabled) {
2028
+ const dataCount = this.dataSource.data ? this.dataSource.data.length : 0;
2029
+ this.paginatorPageSize = dataCount;
2030
+ this.paginatorLength = dataCount;
2031
+ }
2032
+ }
1777
2033
  }
1778
2034
  DataTableComponent.decorators = [
1779
2035
  { 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}"]
2036
+ selector: 'mad-data-table',
2037
+ 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",
2038
+ 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
2039
  },] }
1784
2040
  ];
2041
+ DataTableComponent.ctorParameters = () => [
2042
+ { type: MatDialog }
2043
+ ];
1785
2044
  DataTableComponent.propDecorators = {
1786
- columns: [{ type: Input }],
1787
2045
  filterLabel: [{ type: Input }],
1788
2046
  filterPlaceholder: [{ type: Input }],
2047
+ filterColumnsLabel: [{ type: Input }],
2048
+ filterColumnsPlaceHolder: [{ type: Input }],
1789
2049
  noDataText: [{ type: Input }],
2050
+ columnSettingsModalTitleLabel: [{ type: Input }],
2051
+ selectedLabel: [{ type: Input }],
2052
+ availableLabel: [{ type: Input }],
2053
+ saveLabel: [{ type: Input }],
2054
+ deleteLabel: [{ type: Input }],
2055
+ cancelLabel: [{ type: Input }],
2056
+ infoTextLabel: [{ type: Input }],
2057
+ tableClass: [{ type: Input }],
1790
2058
  pageSizeOptions: [{ type: Input }],
1791
- defaultPageSize: [{ type: Input }],
2059
+ externalFilter: [{ type: Input }],
1792
2060
  actions: [{ type: Input }],
1793
2061
  idGenerator: [{ type: Input }],
2062
+ deleteDefinitionAllowed: [{ type: Input }],
2063
+ useAsync: [{ type: Input }],
2064
+ displayedColumns: [{ type: Input }],
2065
+ displayedColumnDefinition: [{ type: Input }],
1794
2066
  tableData: [{ type: Input }],
2067
+ page: [{ type: Input }],
2068
+ columnDefinitions: [{ type: Input }],
1795
2069
  loading: [{ type: Input }],
2070
+ defaultPageSize: [{ type: Input }],
2071
+ externalPaginator: [{ type: Input }],
1796
2072
  paginationEnabled: [{ type: Input }],
2073
+ allColumns: [{ type: Input }],
1797
2074
  filterEnabled: [{ type: Input }],
1798
2075
  forceMode: [{ type: Input }],
1799
2076
  sortEvent: [{ type: Output }],
1800
2077
  actionEvent: [{ type: Output }],
1801
- pagingEvent: [{ type: Output }],
2078
+ pageEvent: [{ type: Output }],
2079
+ allColumnsEvent: [{ type: Output }],
2080
+ columnDefinitionChangeEvent: [{ type: Output }],
2081
+ viewDefinitionChangeEvent: [{ type: Output }],
1802
2082
  paginator: [{ type: ViewChild, args: [MatPaginator, { static: false },] }],
1803
2083
  sort: [{ type: ViewChild, args: [MatSort, { static: true },] }]
1804
2084
  };
@@ -1807,7 +2087,7 @@ class DataTableModule {
1807
2087
  }
1808
2088
  DataTableModule.decorators = [
1809
2089
  { type: NgModule, args: [{
1810
- declarations: [DataTableComponent],
2090
+ declarations: [DataTableComponent, DataTableColumnsModalComponent],
1811
2091
  imports: [
1812
2092
  CommonModule,
1813
2093
  MatButtonModule,
@@ -1822,9 +2102,11 @@ DataTableModule.decorators = [
1822
2102
  ButtonModule,
1823
2103
  TranslateModule,
1824
2104
  MatCheckboxModule,
1825
- MatBadgeModule
2105
+ MatBadgeModule,
2106
+ DragDropModule,
2107
+ FormsModule,
1826
2108
  ],
1827
- exports: [DataTableComponent]
2109
+ exports: [DataTableComponent, DataTableColumnsModalComponent],
1828
2110
  },] }
1829
2111
  ];
1830
2112
 
@@ -1875,8 +2157,8 @@ StepHeaderComponent.decorators = [
1875
2157
  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
2158
  inputs: ['color'],
1877
2159
  host: {
1878
- 'class': 'mad-step-header',
1879
- 'role': 'tab',
2160
+ class: 'mad-step-header',
2161
+ role: 'tab',
1880
2162
  },
1881
2163
  encapsulation: ViewEncapsulation.None,
1882
2164
  changeDetection: ChangeDetectionStrategy.OnPush,
@@ -2049,7 +2331,7 @@ StepperComponent.decorators = [
2049
2331
  host: {
2050
2332
  '[class.stepper-vertical]': 'true',
2051
2333
  '[attr.aria-orientation]': '"vertical"',
2052
- 'role': 'tablist',
2334
+ role: 'tablist',
2053
2335
  },
2054
2336
  animations: [madStepperAnimations.verticalStepTransition],
2055
2337
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
@@ -2084,9 +2366,6 @@ StepperModule.decorators = [
2084
2366
  ];
2085
2367
 
2086
2368
  class ContentHeaderComponent {
2087
- constructor() { }
2088
- ngOnInit() {
2089
- }
2090
2369
  }
2091
2370
  ContentHeaderComponent.decorators = [
2092
2371
  { type: Component, args: [{
@@ -2095,12 +2374,8 @@ ContentHeaderComponent.decorators = [
2095
2374
  styles: [".content-header{padding-right:.5rem}"]
2096
2375
  },] }
2097
2376
  ];
2098
- ContentHeaderComponent.ctorParameters = () => [];
2099
2377
 
2100
2378
  class ContentPanelContainerComponent {
2101
- constructor() { }
2102
- ngOnInit() {
2103
- }
2104
2379
  }
2105
2380
  ContentPanelContainerComponent.decorators = [
2106
2381
  { type: Component, args: [{
@@ -2109,12 +2384,8 @@ ContentPanelContainerComponent.decorators = [
2109
2384
  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
2385
  },] }
2111
2386
  ];
2112
- ContentPanelContainerComponent.ctorParameters = () => [];
2113
2387
 
2114
2388
  class ContentPanelContainerContentComponent {
2115
- constructor() { }
2116
- ngOnInit() {
2117
- }
2118
2389
  }
2119
2390
  ContentPanelContainerContentComponent.decorators = [
2120
2391
  { type: Component, args: [{
@@ -2123,12 +2394,8 @@ ContentPanelContainerContentComponent.decorators = [
2123
2394
  styles: [":host{border-top:.05rem solid #ccc;flex:1 1 auto;height:1rem;overflow-y:auto;padding:1rem}"]
2124
2395
  },] }
2125
2396
  ];
2126
- ContentPanelContainerContentComponent.ctorParameters = () => [];
2127
2397
 
2128
2398
  class ContentPanelContainerFooterComponent {
2129
- constructor() { }
2130
- ngOnInit() {
2131
- }
2132
2399
  }
2133
2400
  ContentPanelContainerFooterComponent.decorators = [
2134
2401
  { type: Component, args: [{
@@ -2137,12 +2404,8 @@ ContentPanelContainerFooterComponent.decorators = [
2137
2404
  styles: [":host{align-items:center;border-top:.05rem solid #ccc;display:flex;flex:0 0 auto;min-height:2rem;padding:.25rem 1rem}"]
2138
2405
  },] }
2139
2406
  ];
2140
- ContentPanelContainerFooterComponent.ctorParameters = () => [];
2141
2407
 
2142
2408
  class MainContainerComponent {
2143
- constructor() { }
2144
- ngOnInit() {
2145
- }
2146
2409
  }
2147
2410
  MainContainerComponent.decorators = [
2148
2411
  { type: Component, args: [{
@@ -2151,7 +2414,6 @@ MainContainerComponent.decorators = [
2151
2414
  styles: [".main-container{display:flex;flex-direction:column;height:100%}"]
2152
2415
  },] }
2153
2416
  ];
2154
- MainContainerComponent.ctorParameters = () => [];
2155
2417
 
2156
2418
  class ContentPanelModule {
2157
2419
  }
@@ -2186,18 +2448,21 @@ class FlowbarComponent {
2186
2448
  */
2187
2449
  this._headerClick = new EventEmitter(true);
2188
2450
  }
2451
+ get currentStepLabel() {
2452
+ return this._activeStep.label;
2453
+ }
2454
+ get currentSubStepLabel() {
2455
+ var _a;
2456
+ return (_a = this._activeStep.activeSubStep) === null || _a === void 0 ? void 0 : _a.label;
2457
+ }
2189
2458
  ngOnInit() {
2190
2459
  // If no active step is set as input or the active step is not enabled, select the first enabled step
2191
2460
  if (!this._activeStep || !this._activeStep.enabled) {
2192
- this._activeStep = this._steps.find(step => {
2193
- return step.enabled;
2194
- });
2461
+ this._activeStep = this._steps.find(step => step.enabled);
2195
2462
  if (this._activeStep) {
2196
2463
  // If sub steps exist then set the first non disabled sub step per default
2197
2464
  if (this.activeTabHasSubSteps()) {
2198
- this._activeStep.activeSubStep = this._activeStep.subSteps.find(step => {
2199
- return step.enabled;
2200
- });
2465
+ this._activeStep.activeSubStep = this._activeStep.subSteps.find(step => step.enabled);
2201
2466
  }
2202
2467
  this._activeStepChange.emit(this._activeStep);
2203
2468
  }
@@ -2295,14 +2560,10 @@ class FlowbarComponent {
2295
2560
  return false;
2296
2561
  }
2297
2562
  getCurrentIndex() {
2298
- return this._steps.findIndex(value => {
2299
- return value === this._activeStep;
2300
- });
2563
+ return this._steps.findIndex(value => value === this._activeStep);
2301
2564
  }
2302
2565
  getCurrentSubStepIndex() {
2303
- return this._activeStep.subSteps.findIndex(value => {
2304
- return value === this._activeStep.activeSubStep;
2305
- });
2566
+ return this._activeStep.subSteps.findIndex(value => value === this._activeStep.activeSubStep);
2306
2567
  }
2307
2568
  triggerClick() {
2308
2569
  const selectedStep = this._steps[this.stepper.selectedIndex];
@@ -2312,13 +2573,6 @@ class FlowbarComponent {
2312
2573
  event.stopPropagation(); //stop processing current header click event
2313
2574
  this._headerClick.emit(step);
2314
2575
  }
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
2576
  activeTabHasSubSteps() {
2323
2577
  return this._activeStep.subSteps && this._activeStep.subSteps.length > 0;
2324
2578
  }
@@ -2356,11 +2610,11 @@ FlowbarComponent.decorators = [
2356
2610
  },] }
2357
2611
  ];
2358
2612
  FlowbarComponent.propDecorators = {
2359
- stepper: [{ type: ViewChild, args: ['stepper',] }],
2360
2613
  _steps: [{ type: Input, args: ['steps',] }],
2361
2614
  _activeStep: [{ type: Input, args: ['activeStep',] }],
2362
2615
  _activeStepChange: [{ type: Output, args: ['activeStepChange',] }],
2363
- _headerClick: [{ type: Output, args: ['headerClick',] }]
2616
+ _headerClick: [{ type: Output, args: ['headerClick',] }],
2617
+ stepper: [{ type: ViewChild, args: ['stepper',] }]
2364
2618
  };
2365
2619
 
2366
2620
  class FlowbarModule {
@@ -2398,5 +2652,5 @@ MaterialAddonsModule.decorators = [
2398
2652
  * Generated bundle index. Do not edit.
2399
2653
  */
2400
2654
 
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 };
2655
+ 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
2656
  //# sourceMappingURL=porscheinformatik-material-addons.js.map