@quadrel-enterprise-ui/framework 19.2.0 → 19.3.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.
@@ -0,0 +1,14 @@
1
+ import { OnInit } from '@angular/core';
2
+ import { DialogRef } from '@angular/cdk/dialog';
3
+ import * as i0 from "@angular/core";
4
+ export declare class QdCancelDialogComponent implements OnInit {
5
+ private dialogRef;
6
+ i18n: string;
7
+ handler: () => void;
8
+ constructor(dialogRef: DialogRef<any>);
9
+ ngOnInit(): void;
10
+ close(): void;
11
+ confirm(): void;
12
+ static ɵfac: i0.ɵɵFactoryDeclaration<QdCancelDialogComponent, never>;
13
+ static ɵcmp: i0.ɵɵComponentDeclaration<QdCancelDialogComponent, "qd-cancel-dialog", never, {}, {}, never, never, false, never>;
14
+ }
@@ -1,11 +1,12 @@
1
- import { AfterContentChecked, AfterViewInit, ChangeDetectorRef, ElementRef, OnInit } from '@angular/core';
1
+ import { AfterContentChecked, AfterViewInit, ChangeDetectorRef, ElementRef, OnDestroy, OnInit } from '@angular/core';
2
2
  import { DialogRef } from '@angular/cdk/dialog';
3
3
  import { QdDialogConfig } from './models/dialog-config.model';
4
+ import { QdDialogChangeGuardService } from './services/dialog-change-guard.service';
5
+ import { QdConfirmationDialogOpenerService } from './services/confirmation-dialog.service';
4
6
  import * as i0 from "@angular/core";
5
7
  /**
6
8
  * **QdDialog** creating resonsive dialogs. Three different sizes are available.
7
9
  *
8
- * Detailed migration guideline from QdModal to QdDialog: https://confluence.bit.admin.ch/display/DAZUIC/Migration+Dialoge
9
10
  *
10
11
  * * @see child component: **QdDialogAction**.
11
12
  *
@@ -39,21 +40,36 @@ import * as i0 from "@angular/core";
39
40
  * <button qdButton (click)="close('Yes')">Submit</button>
40
41
  * </qd-dialog-action>
41
42
  * </qd-dialog>
42
- */
43
- export declare class QdDialogComponent implements OnInit, AfterContentChecked, AfterViewInit {
43
+ *
44
+ * **Example of MyModalComponent (Including Form Change Guard):**
45
+ *
46
+ * @example
47
+ * <qd-dialog>
48
+ * <form [formGroup]="myForm" qdPendingChangesGuard>
49
+ * <input type="text" formControlName="name">
50
+ * You have unsaved changes!
51
+ * </form>
52
+ * </qd-dialog>
53
+ * */
54
+ export declare class QdDialogComponent implements OnInit, AfterContentChecked, AfterViewInit, OnDestroy {
44
55
  dialogRef: DialogRef<string>;
56
+ private dialog;
45
57
  private changeDetectorRef;
58
+ private dialogChangeGuard;
46
59
  body: ElementRef;
47
60
  infoBanners: ElementRef;
48
61
  get hasSectionsClass(): boolean;
49
62
  config: QdDialogConfig;
50
63
  hasSections: boolean;
51
64
  hasInfoBanner: boolean;
52
- constructor(dialogRef: DialogRef<string>, changeDetectorRef: ChangeDetectorRef);
65
+ private _destroyed$;
66
+ constructor(dialogRef: DialogRef<string>, dialog: QdConfirmationDialogOpenerService, changeDetectorRef: ChangeDetectorRef, dialogChangeGuard: QdDialogChangeGuardService);
53
67
  ngOnInit(): void;
54
68
  ngAfterContentChecked(): void;
55
69
  ngAfterViewInit(): void;
56
70
  close(): void;
71
+ primaryActionClicked(): void;
72
+ ngOnDestroy(): void;
57
73
  get isFullWidth(): boolean;
58
74
  static ɵfac: i0.ɵɵFactoryDeclaration<QdDialogComponent, never>;
59
75
  static ɵcmp: i0.ɵɵComponentDeclaration<QdDialogComponent, "qd-dialog", never, {}, {}, never, ["qd-page-info-banner", "*", "qd-dialog-action"], false, never>;
@@ -9,6 +9,7 @@ import { QdDialogAuthSessionEndComponent } from './auth-session-end/dialog-auth-
9
9
  import { QD_DIALOG_CONFIRMATION_RESOLVER_TOKEN, QdDialogConfirmationConfig, QdDialogConfirmationResolver } from './models/confirmation.model';
10
10
  import { QdDialogData } from './models/record-stepper.model';
11
11
  import { QdDialogAuthSessionEndResult } from './models/session-end-result.model';
12
+ import { PendingChangesGuardDirective } from './directives/pending-changes-guard.directive';
12
13
  import * as i0 from "@angular/core";
13
14
  import * as i1 from "./action/dialog-action.component";
14
15
  import * as i2 from "./auth-session-end/dialog-auth-session-end.component";
@@ -16,21 +17,23 @@ import * as i3 from "./dialog.component";
16
17
  import * as i4 from "./confirmation/dialog-confirmation.component";
17
18
  import * as i5 from "./record-stepper/dialog-record-stepper.component";
18
19
  import * as i6 from "./page-dialog-with-breadcrumbs/page-dialog-with-breadcrumbs.component";
19
- import * as i7 from "@angular/common";
20
- import * as i8 from "@ngx-translate/core";
21
- import * as i9 from "@angular/router";
22
- import * as i10 from "@angular/cdk/dialog";
23
- import * as i11 from "../button/button.module";
24
- import * as i12 from "../forms/qd-form.module";
25
- import * as i13 from "../icon/icon.module";
26
- import * as i14 from "../notifications/notifications.module";
27
- import * as i15 from "../spinner/spinner.module";
28
- import * as i16 from "../text-section/text-section.module";
29
- import * as i17 from "../core/core.module";
30
- import * as i18 from "../core/breadcrumbs/breadcrumbs.module";
31
- export { QdDialogComponent, QdDialogActionComponent, QdDialogRecordStepperComponent, QdDialogAuthSessionEndComponent, QdDialogConfirmationComponent, QdDialogConfirmationErrorDirective, QdDialogConfirmationInfoDirective, QdDialogConfirmationSuccessDirective, QdDialogService, QdDialogAuthSessionEndService, QdDialogConfig, QdDialogTitle, QdDialogSize, QdDialogData, QdDialogAuthSessionEndResult, QdDialogConfirmationConfig, QdDialogConfirmationResolver, QD_DIALOG_CONFIRMATION_RESOLVER_TOKEN };
20
+ import * as i7 from "./directives/pending-changes-guard.directive";
21
+ import * as i8 from "./cancel-confirmation-dialog/cancel-dialog.component";
22
+ import * as i9 from "@angular/common";
23
+ import * as i10 from "@ngx-translate/core";
24
+ import * as i11 from "@angular/router";
25
+ import * as i12 from "@angular/cdk/dialog";
26
+ import * as i13 from "../button/button.module";
27
+ import * as i14 from "../forms/qd-form.module";
28
+ import * as i15 from "../icon/icon.module";
29
+ import * as i16 from "../notifications/notifications.module";
30
+ import * as i17 from "../spinner/spinner.module";
31
+ import * as i18 from "../text-section/text-section.module";
32
+ import * as i19 from "../core/core.module";
33
+ import * as i20 from "../core/breadcrumbs/breadcrumbs.module";
34
+ export { QdDialogComponent, QdDialogActionComponent, QdDialogRecordStepperComponent, QdDialogAuthSessionEndComponent, QdDialogConfirmationComponent, QdDialogConfirmationErrorDirective, QdDialogConfirmationInfoDirective, QdDialogConfirmationSuccessDirective, QdDialogService, QdDialogAuthSessionEndService, QdDialogConfig, QdDialogTitle, QdDialogSize, QdDialogData, QdDialogAuthSessionEndResult, QdDialogConfirmationConfig, QdDialogConfirmationResolver, PendingChangesGuardDirective, QD_DIALOG_CONFIRMATION_RESOLVER_TOKEN };
32
35
  export declare class QdDialogModule {
33
36
  static ɵfac: i0.ɵɵFactoryDeclaration<QdDialogModule, never>;
34
- static ɵmod: i0.ɵɵNgModuleDeclaration<QdDialogModule, [typeof i1.QdDialogActionComponent, typeof i2.QdDialogAuthSessionEndComponent, typeof i3.QdDialogComponent, typeof i4.QdDialogConfirmationComponent, typeof i4.QdDialogConfirmationErrorDirective, typeof i4.QdDialogConfirmationInfoDirective, typeof i4.QdDialogConfirmationSuccessDirective, typeof i5.QdDialogRecordStepperComponent, typeof i6.QdPageDialogWithBreadcrumbsComponent], [typeof i7.CommonModule, typeof i8.TranslateModule, typeof i9.RouterModule, typeof i10.DialogModule, typeof i11.QdButtonModule, typeof i12.QdFormModule, typeof i13.QdIconModule, typeof i14.QdNotificationsModule, typeof i15.QdSpinnerModule, typeof i16.QdTextSectionModule, typeof i17.QdCoreModule, typeof i18.QdBreadcrumbsModule], [typeof i1.QdDialogActionComponent, typeof i2.QdDialogAuthSessionEndComponent, typeof i3.QdDialogComponent, typeof i4.QdDialogConfirmationComponent, typeof i4.QdDialogConfirmationErrorDirective, typeof i4.QdDialogConfirmationSuccessDirective, typeof i5.QdDialogRecordStepperComponent]>;
37
+ static ɵmod: i0.ɵɵNgModuleDeclaration<QdDialogModule, [typeof i1.QdDialogActionComponent, typeof i2.QdDialogAuthSessionEndComponent, typeof i3.QdDialogComponent, typeof i4.QdDialogConfirmationComponent, typeof i4.QdDialogConfirmationErrorDirective, typeof i4.QdDialogConfirmationInfoDirective, typeof i4.QdDialogConfirmationSuccessDirective, typeof i5.QdDialogRecordStepperComponent, typeof i6.QdPageDialogWithBreadcrumbsComponent, typeof i7.PendingChangesGuardDirective, typeof i8.QdCancelDialogComponent], [typeof i9.CommonModule, typeof i10.TranslateModule, typeof i11.RouterModule, typeof i12.DialogModule, typeof i13.QdButtonModule, typeof i14.QdFormModule, typeof i15.QdIconModule, typeof i16.QdNotificationsModule, typeof i17.QdSpinnerModule, typeof i18.QdTextSectionModule, typeof i19.QdCoreModule, typeof i20.QdBreadcrumbsModule], [typeof i1.QdDialogActionComponent, typeof i2.QdDialogAuthSessionEndComponent, typeof i3.QdDialogComponent, typeof i4.QdDialogConfirmationComponent, typeof i4.QdDialogConfirmationErrorDirective, typeof i4.QdDialogConfirmationSuccessDirective, typeof i5.QdDialogRecordStepperComponent, typeof i7.PendingChangesGuardDirective]>;
35
38
  static ɵinj: i0.ɵɵInjectorDeclaration<QdDialogModule>;
36
39
  }
@@ -0,0 +1,35 @@
1
+ import { NgForm, FormGroupDirective } from '@angular/forms';
2
+ import { OnDestroy, OnInit } from '@angular/core';
3
+ import { QdDialogChangeGuardService } from '../services/dialog-change-guard.service';
4
+ import * as i0 from "@angular/core";
5
+ /**
6
+ * @name PendingChangesGuardDirective
7
+ * @description
8
+ * Automatically monitors the status of form changes in QdDialogComponent (Reactive or Template-Driven Forms)
9
+ * by comparing the current form value with its initial value.
10
+ * * The directive automatically marks the form as `pristine` when all values
11
+ * match the initial state, even if the form has been modified in between.
12
+ * * @example
13
+ * // Usage in the Dialog Content Component (Reactive Form):
14
+ * // import { QdPendingChangesGuardDirective } from '...';
15
+ * // template:
16
+ * // <qd-dialog>
17
+ * // <form [formGroup]="myForm" qdPendingChangesGuard>
18
+ * // <input type="text" formControlName="name">
19
+ * // </form>
20
+ * // </qd-dialog>
21
+ */
22
+ export declare class PendingChangesGuardDirective implements OnInit, OnDestroy {
23
+ private ngForm;
24
+ private formGroupDirective;
25
+ private changeGuard;
26
+ private statusSubscription;
27
+ private initialValue;
28
+ private formGroup;
29
+ constructor(ngForm: NgForm, formGroupDirective: FormGroupDirective, changeGuard: QdDialogChangeGuardService);
30
+ ngOnInit(): void;
31
+ private updateStatus;
32
+ ngOnDestroy(): void;
33
+ static ɵfac: i0.ɵɵFactoryDeclaration<PendingChangesGuardDirective, [{ optional: true; }, { optional: true; }, null]>;
34
+ static ɵdir: i0.ɵɵDirectiveDeclaration<PendingChangesGuardDirective, "[qdPendingChangesGuard]", never, {}, {}, never, never, false, never>;
35
+ }
@@ -24,6 +24,14 @@ export interface QdDialogConfig extends DialogConfig {
24
24
  data?: {
25
25
  [key: string]: any;
26
26
  };
27
+ /**
28
+ * @description Configuration for the primary action.
29
+ */
30
+ primary?: QdDialogPrimaryAction;
31
+ /**
32
+ * @description Configuration for the cancel button.
33
+ */
34
+ cancel?: QdDialogCancelAction;
27
35
  }
28
36
  /**
29
37
  * Configuration object for page dialog.
@@ -48,3 +56,48 @@ export declare enum QdDialogSize {
48
56
  Default = "900px",
49
57
  FullWidth = "100%"
50
58
  }
59
+ /**
60
+ * @description Interface for the primary action.
61
+ */
62
+ export interface QdDialogPrimaryAction {
63
+ /**
64
+ * @description Label for a primary action button, used for translation.
65
+ *
66
+ * * If no custom translation key is provided, a standard label will be used by default.
67
+ */
68
+ label?: {
69
+ i18n: string;
70
+ };
71
+ /**
72
+ * @description Handler function that is triggered when the primary action is executed.
73
+ */
74
+ handler?: () => void;
75
+ }
76
+ /**
77
+ * @description Interface for the cancel action, including an optional confirmation message.
78
+ */
79
+ export interface QdDialogCancelAction {
80
+ /**
81
+ * @description Label for the cancel action, used for translation.
82
+ *
83
+ * * If no custom translation key is provided, a standard label will be used by default.
84
+ */
85
+ label?: {
86
+ i18n: string;
87
+ };
88
+ /**
89
+ * @description Handler function that is triggered when the cancel action is executed.
90
+ */
91
+ handler?: (formValues?: any) => void;
92
+ /**
93
+ * @description An optional confirmation message displayed in a dialog when the user attempts to cancel the operation, warning that all changes will be discarded.
94
+ * If no custom message is provided, a standard message will be shown by default.
95
+ *
96
+ * * The cancellation process checks whether there are unsaved changes in the form. If there are changes, the dialog will appear.
97
+ *
98
+ * * If no changes are detected, the cancellation proceeds without showing the confirmation dialog.
99
+ */
100
+ confirmationMessage?: {
101
+ i18n: string;
102
+ };
103
+ }
@@ -0,0 +1,13 @@
1
+ import { Observable } from 'rxjs';
2
+ import { QdDialogConfig } from '../models/dialog-config.model';
3
+ import { Dialog, DialogRef } from '@angular/cdk/dialog';
4
+ import { ComponentType } from '@angular/cdk/portal';
5
+ import * as i0 from "@angular/core";
6
+ export declare class QdConfirmationDialogOpenerService {
7
+ private dialog;
8
+ constructor(dialog: Dialog);
9
+ showCancelConfirmation(config: any): Observable<boolean>;
10
+ open<C>(component: ComponentType<C>, config: QdDialogConfig): DialogRef<unknown, C>;
11
+ static ɵfac: i0.ɵɵFactoryDeclaration<QdConfirmationDialogOpenerService, never>;
12
+ static ɵprov: i0.ɵɵInjectableDeclaration<QdConfirmationDialogOpenerService>;
13
+ }
@@ -0,0 +1,8 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class QdDialogChangeGuardService {
3
+ private _hasChanges;
4
+ get hasPendingChanges(): boolean;
5
+ setPendingChangesStatus(status: boolean): void;
6
+ static ɵfac: i0.ɵɵFactoryDeclaration<QdDialogChangeGuardService, never>;
7
+ static ɵprov: i0.ɵɵInjectableDeclaration<QdDialogChangeGuardService>;
8
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quadrel-enterprise-ui/framework",
3
- "version": "v19.2.0",
3
+ "version": "v19.3.0",
4
4
  "peerDependencies": {
5
5
  "@angular/cdk": "^19.2.9",
6
6
  "@angular/common": "^19.2.9",