@messaia/cdk 20.0.6 → 20.0.8

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.
@@ -914,6 +914,11 @@ class TaskDialogData {
914
914
  * @type {Function}
915
915
  */
916
916
  successButtonClick;
917
+ /**
918
+ * Optional dynamic button configurations for the dialog
919
+ * @type {DialogButtonConfig<TResult>[]}
920
+ */
921
+ buttons;
917
922
  /**
918
923
  * Initializes a new instance of the TaskDialogData class.
919
924
  * @param {Partial<TaskDialogData>} init - Optional initialization values for setting properties.
@@ -1039,6 +1044,38 @@ class VdTaskDialogComponent {
1039
1044
  this.dialogRef.close(this.result);
1040
1045
  }
1041
1046
  }
1047
+ /**
1048
+ * Determines whether a button should be visible based on its showWhen rule.
1049
+ * @param showWhen The condition that specifies when the button is displayed.
1050
+ */
1051
+ shouldShow(showWhen) {
1052
+ switch (showWhen) {
1053
+ case 'inProgress':
1054
+ return this.inProgress;
1055
+ case 'succeeded':
1056
+ return this.succeeded && !this.inProgress;
1057
+ case 'failed':
1058
+ return !this.succeeded && !this.inProgress;
1059
+ case 'always':
1060
+ default:
1061
+ return true;
1062
+ }
1063
+ }
1064
+ /**
1065
+ * Handles the click event of a dynamic button.
1066
+ * Executes its callback if provided and closes the dialog if required.
1067
+ * @param btn The button configuration object.
1068
+ */
1069
+ onButtonClick(btn) {
1070
+ /* Execute callback if defined */
1071
+ if (btn.callback) {
1072
+ btn.callback(this.result, this.dialogRef);
1073
+ }
1074
+ /* Close dialog if requested by button config */
1075
+ if (btn.closeOnClick) {
1076
+ this.dialogRef.close(this.result);
1077
+ }
1078
+ }
1042
1079
  /**
1043
1080
  * Lifecycle hook for component cleanup on destruction.
1044
1081
  * Ensures that any ongoing task is cancelled.
@@ -1048,7 +1085,7 @@ class VdTaskDialogComponent {
1048
1085
  this.unsubscribe.complete();
1049
1086
  }
1050
1087
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: VdTaskDialogComponent, deps: [{ token: i1.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component });
1051
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.3", type: VdTaskDialogComponent, isStandalone: true, selector: "vd-task-dialog", ngImport: i0, template: "<div mat-dialog-title class=\"mat-headline-6\" cdkDragRootElement=\".cdk-overlay-pane\" cdkDrag cdkDragHandle>{{this.data.title}}</div>\r\n<mat-progress-bar *ngIf=\"inProgress\" mode=\"indeterminate\"></mat-progress-bar>\r\n<mat-progress-bar *ngIf=\"!inProgress\" mode=\"determinate\" value=\"100\"></mat-progress-bar>\r\n<div mat-dialog-content>{{content}}</div>\r\n<div mat-dialog-actions class=\"pad-top\">\r\n <button type=\"button\" mat-flat-button *ngIf=\"succeeded\" (click)=\"success()\" color=\"primary\" (click)=\"null\">{{this.data.successButtonText}}</button>\r\n <button type=\"button\" mat-button *ngIf=\"inProgress\" (click)=\"cancel()\" autofocus>{{this.data.cancelButtonText}}</button>\r\n <button type=\"button\" mat-button *ngIf=\"!inProgress\" (click)=\"close()\" autofocus>{{this.data.closeButtonText}}</button>\r\n</div>", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatDialogModule }, { kind: "directive", type: i1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "ngmodule", type: MatProgressBarModule }, { kind: "component", type: i4.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }] });
1088
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.3", type: VdTaskDialogComponent, isStandalone: true, selector: "vd-task-dialog", ngImport: i0, template: "<div mat-dialog-title class=\"mat-headline-6\" cdkDragRootElement=\".cdk-overlay-pane\" cdkDrag cdkDragHandle>{{this.data.title}}</div>\r\n<mat-progress-bar *ngIf=\"inProgress\" mode=\"indeterminate\"></mat-progress-bar>\r\n<mat-progress-bar *ngIf=\"!inProgress\" mode=\"determinate\" value=\"100\"></mat-progress-bar>\r\n<div mat-dialog-content>{{content}}</div>\r\n<div mat-dialog-actions class=\"pad-top\">\r\n <ng-container *ngFor=\"let btn of data.buttons\">\r\n <button type=\"button\" mat-flat-button [color]=\"btn.color\" *ngIf=\"btn.type === 'flat' && shouldShow(btn.showWhen)\" (click)=\"onButtonClick(btn)\">{{ btn.text }}</button>\r\n <button type=\"button\" mat-button [color]=\"btn.color\" *ngIf=\"btn.type !== 'flat' && shouldShow(btn.showWhen)\" (click)=\"onButtonClick(btn)\">{{ btn.text }}</button>\r\n </ng-container>\r\n <button type=\"button\" mat-flat-button *ngIf=\"this.data.successButtonClick && succeeded\" (click)=\"success()\" color=\"primary\" (click)=\"null\">{{this.data.successButtonText}}</button>\r\n <button type=\"button\" mat-button *ngIf=\"inProgress\" (click)=\"cancel()\" autofocus>{{this.data.cancelButtonText}}</button>\r\n <button type=\"button\" mat-button *ngIf=\"!inProgress\" (click)=\"close()\" autofocus>{{this.data.closeButtonText}}</button>\r\n</div>", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatDialogModule }, { kind: "directive", type: i1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "ngmodule", type: MatProgressBarModule }, { kind: "component", type: i4.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }] });
1052
1089
  }
1053
1090
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: VdTaskDialogComponent, decorators: [{
1054
1091
  type: Component,
@@ -1057,7 +1094,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImpor
1057
1094
  MatButtonModule,
1058
1095
  MatDialogModule,
1059
1096
  MatProgressBarModule,
1060
- ], template: "<div mat-dialog-title class=\"mat-headline-6\" cdkDragRootElement=\".cdk-overlay-pane\" cdkDrag cdkDragHandle>{{this.data.title}}</div>\r\n<mat-progress-bar *ngIf=\"inProgress\" mode=\"indeterminate\"></mat-progress-bar>\r\n<mat-progress-bar *ngIf=\"!inProgress\" mode=\"determinate\" value=\"100\"></mat-progress-bar>\r\n<div mat-dialog-content>{{content}}</div>\r\n<div mat-dialog-actions class=\"pad-top\">\r\n <button type=\"button\" mat-flat-button *ngIf=\"succeeded\" (click)=\"success()\" color=\"primary\" (click)=\"null\">{{this.data.successButtonText}}</button>\r\n <button type=\"button\" mat-button *ngIf=\"inProgress\" (click)=\"cancel()\" autofocus>{{this.data.cancelButtonText}}</button>\r\n <button type=\"button\" mat-button *ngIf=\"!inProgress\" (click)=\"close()\" autofocus>{{this.data.closeButtonText}}</button>\r\n</div>" }]
1097
+ ], template: "<div mat-dialog-title class=\"mat-headline-6\" cdkDragRootElement=\".cdk-overlay-pane\" cdkDrag cdkDragHandle>{{this.data.title}}</div>\r\n<mat-progress-bar *ngIf=\"inProgress\" mode=\"indeterminate\"></mat-progress-bar>\r\n<mat-progress-bar *ngIf=\"!inProgress\" mode=\"determinate\" value=\"100\"></mat-progress-bar>\r\n<div mat-dialog-content>{{content}}</div>\r\n<div mat-dialog-actions class=\"pad-top\">\r\n <ng-container *ngFor=\"let btn of data.buttons\">\r\n <button type=\"button\" mat-flat-button [color]=\"btn.color\" *ngIf=\"btn.type === 'flat' && shouldShow(btn.showWhen)\" (click)=\"onButtonClick(btn)\">{{ btn.text }}</button>\r\n <button type=\"button\" mat-button [color]=\"btn.color\" *ngIf=\"btn.type !== 'flat' && shouldShow(btn.showWhen)\" (click)=\"onButtonClick(btn)\">{{ btn.text }}</button>\r\n </ng-container>\r\n <button type=\"button\" mat-flat-button *ngIf=\"this.data.successButtonClick && succeeded\" (click)=\"success()\" color=\"primary\" (click)=\"null\">{{this.data.successButtonText}}</button>\r\n <button type=\"button\" mat-button *ngIf=\"inProgress\" (click)=\"cancel()\" autofocus>{{this.data.cancelButtonText}}</button>\r\n <button type=\"button\" mat-button *ngIf=\"!inProgress\" (click)=\"close()\" autofocus>{{this.data.closeButtonText}}</button>\r\n</div>" }]
1061
1098
  }], ctorParameters: () => [{ type: i1.MatDialogRef }, { type: TaskDialogData, decorators: [{
1062
1099
  type: Inject,
1063
1100
  args: [MAT_DIALOG_DATA]
@@ -21615,7 +21652,7 @@ class VdChipsComponent extends AbstractMatFormField {
21615
21652
  this.dataSource.pageIndex = 0;
21616
21653
  }
21617
21654
  /* Reset filters */
21618
- delete this._params['filters'];
21655
+ delete this._params?.['filters'];
21619
21656
  }
21620
21657
  /**
21621
21658
  * Filters the options based on the provided text input.