@enigmatry/entry-components 1.2.60 → 1.2.62

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 (24) hide show
  1. package/dialog/README.md +7 -8
  2. package/dialog/dialogs/alert/entry-alert-dialog-data.interface.d.ts +6 -0
  3. package/dialog/dialogs/alert/entry-alert-dialog.component.d.ts +1 -3
  4. package/dialog/dialogs/confirm/entry-confirm-dialog-data.interface.d.ts +4 -0
  5. package/dialog/dialogs/confirm/entry-confirm-dialog.component.d.ts +1 -3
  6. package/dialog/dialogs/entry-dialog.component.d.ts +19 -3
  7. package/dialog/entry-dialog-config.model.d.ts +10 -0
  8. package/dialog/entry-dialog.service.d.ts +11 -6
  9. package/dialog/public-api.d.ts +0 -1
  10. package/esm2020/dialog/dialogs/alert/entry-alert-dialog-data.interface.mjs +1 -1
  11. package/esm2020/dialog/dialogs/alert/entry-alert-dialog.component.mjs +3 -9
  12. package/esm2020/dialog/dialogs/confirm/entry-confirm-dialog-data.interface.mjs +1 -1
  13. package/esm2020/dialog/dialogs/confirm/entry-confirm-dialog.component.mjs +3 -9
  14. package/esm2020/dialog/dialogs/entry-dialog.component.mjs +25 -11
  15. package/esm2020/dialog/entry-dialog-config.model.mjs +6 -1
  16. package/esm2020/dialog/entry-dialog.service.mjs +21 -9
  17. package/esm2020/dialog/public-api.mjs +1 -1
  18. package/fesm2015/enigmatry-entry-components-dialog.mjs +53 -36
  19. package/fesm2015/enigmatry-entry-components-dialog.mjs.map +1 -1
  20. package/fesm2020/enigmatry-entry-components-dialog.mjs +50 -33
  21. package/fesm2020/enigmatry-entry-components-dialog.mjs.map +1 -1
  22. package/package.json +1 -1
  23. package/dialog/entry-dialog-buttons-config.interface.d.ts +0 -4
  24. package/esm2020/dialog/entry-dialog-buttons-config.interface.mjs +0 -2
@@ -7,12 +7,17 @@ import * as i2 from '@angular/common';
7
7
  import { CommonModule } from '@angular/common';
8
8
  import { take } from 'rxjs/operators';
9
9
 
10
+ /**
11
+ * Used to provide default configurations on module level
12
+ */
10
13
  class EntryDialogConfig {
11
14
  constructor(config = {}) {
12
- var _a, _b, _c;
15
+ var _a, _b, _c, _d, _e;
13
16
  this.confirmButtonText = (_a = config.confirmButtonText) !== null && _a !== void 0 ? _a : 'Ok';
14
17
  this.cancelButtonText = (_b = config.cancelButtonText) !== null && _b !== void 0 ? _b : 'Cancel';
15
18
  this.buttonsAlignment = (_c = config.buttonsAlignment) !== null && _c !== void 0 ? _c : 'align-right';
19
+ this.hideClose = (_d = config.hideClose) !== null && _d !== void 0 ? _d : false;
20
+ this.disableClose = (_e = config.disableClose) !== null && _e !== void 0 ? _e : false;
16
21
  }
17
22
  }
18
23
  const ENTRY_DIALOG_CONFIG = new InjectionToken('EntryDialogConfig', {
@@ -20,17 +25,21 @@ const ENTRY_DIALOG_CONFIG = new InjectionToken('EntryDialogConfig', {
20
25
  factory: () => new EntryDialogConfig()
21
26
  });
22
27
 
28
+ /**
29
+ * Base Entry dialog component. Must be extended when building custom dialogs.
30
+ */
23
31
  class EntryDialogComponent {
24
32
  constructor(mdDialogRef, config) {
25
33
  this.mdDialogRef = mdDialogRef;
26
34
  this.config = config;
27
- this.buttons = {
28
- buttonsAlignment: this.config.buttonsAlignment,
29
- confirmButtonText: this.config.confirmButtonText,
30
- cancelButtonText: this.config.cancelButtonText,
31
- visible: true
32
- };
33
- this.disableConfirm = false;
35
+ /** @property buttonsAlignment - Dialog buttons horizontal alignment */
36
+ this.buttonsAlignment = this.config.buttonsAlignment;
37
+ /** @property confirmButtonText - Confirm button label */
38
+ this.confirmButtonText = this.config.confirmButtonText;
39
+ /** @property cancelButtonText - Cancel button label */
40
+ this.cancelButtonText = this.config.cancelButtonText;
41
+ /** @property hideClose - Show or hide dialog close button */
42
+ this.hideClose = this.config.hideClose;
34
43
  this.confirm = () => of(true);
35
44
  this.cancel = () => this.close(false);
36
45
  this.onEsc = () => this.cancel();
@@ -47,10 +56,10 @@ class EntryDialogComponent {
47
56
  }
48
57
  }
49
58
  EntryDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: EntryDialogComponent, deps: [{ token: i1.MatDialogRef }, { token: ENTRY_DIALOG_CONFIG }], target: i0.ɵɵFactoryTarget.Component });
50
- EntryDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: EntryDialogComponent, selector: "entry-dialog", inputs: { title: "title", buttons: "buttons", disableConfirm: "disableConfirm", buttonsTemplate: "buttonsTemplate", confirm: "confirm", cancel: "cancel" }, host: { listeners: { "keydown.esc": "onEsc()" } }, ngImport: i0, template: "<div class=\"dialog-form\">\n <div class=\"dialog-header\">\n <h1 class=\"dialog-title\">\n {{ title }}\n </h1>\n\n <button type=\"button\" class=\"dialog-close-button\" (click)=\"cancel()\">\n <span class=\"icon-close dialog-close-icon\"></span>\n </button>\n </div>\n\n <mat-dialog-content\n class=\"dialog-content\"\n [ngClass]=\"{'with-actions': buttons.visible}\">\n <ng-content></ng-content>\n </mat-dialog-content>\n\n <ng-template [ngIf]=\"buttonsTemplate\" [ngIfElse]=\"defaultButtonsTemplate\">\n <ng-template [ngTemplateOutlet]=\"buttonsTemplate\"></ng-template>\n </ng-template>\n\n <ng-template #defaultButtonsTemplate>\n <div *ngIf=\"buttons.visible\" class=\"dialog-footer {{ buttons.buttonsAlignment }}\">\n <button\n type=\"button\"\n class=\"button button-accent dialog-footer-button\"\n cdkFocusInitial\n (click)=\"onSubmit()\">{{buttons.confirmButtonText}}</button>\n <button\n type=\"button\"\n class=\"button button-primary dialog-footer-button\"\n *ngIf=\"buttons.cancelButtonText !== ''\"\n (click)=\"cancel()\">{{buttons.cancelButtonText}}</button>\n </div>\n </ng-template>\n</div>", styles: [".align-center{margin:auto}\n"], directives: [{ type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
59
+ EntryDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: EntryDialogComponent, selector: "entry-dialog", inputs: { title: "title", buttonsAlignment: "buttonsAlignment", confirmButtonText: "confirmButtonText", cancelButtonText: "cancelButtonText", hideButtons: "hideButtons", hideCancel: "hideCancel", hideClose: "hideClose", disableConfirm: "disableConfirm", buttonsTemplate: "buttonsTemplate", confirm: "confirm", cancel: "cancel" }, host: { listeners: { "keydown.esc": "onEsc()" } }, ngImport: i0, template: "<div class=\"dialog-form\">\n <div class=\"dialog-header\">\n <h1 class=\"dialog-title\">{{title}}</h1>\n\n <button *ngIf=\"!hideClose\" type=\"button\" class=\"dialog-close-button\" (click)=\"cancel()\">\n <span class=\"icon-close dialog-close-icon\"></span>\n </button>\n </div>\n\n <mat-dialog-content class=\"dialog-content\" [ngClass]=\"{'with-actions': !hideButtons}\">\n <ng-content></ng-content>\n </mat-dialog-content>\n\n <ng-template [ngIf]=\"buttonsTemplate\" [ngIfElse]=\"defaultButtonsTemplate\">\n <ng-template [ngTemplateOutlet]=\"buttonsTemplate\"></ng-template>\n </ng-template>\n\n <ng-template #defaultButtonsTemplate>\n <div *ngIf=\"!hideButtons\" class=\"dialog-footer {{ buttonsAlignment }}\">\n <button\n type=\"button\"\n class=\"button button-accent dialog-footer-button\"\n cdkFocusInitial\n (click)=\"onSubmit()\">{{confirmButtonText}}</button>\n <button\n type=\"button\"\n class=\"button button-primary dialog-footer-button\"\n *ngIf=\"!hideCancel\"\n (click)=\"cancel()\">{{cancelButtonText}}</button>\n </div>\n </ng-template>\n</div>", styles: [".align-center{margin:auto}\n"], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
51
60
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: EntryDialogComponent, decorators: [{
52
61
  type: Component,
53
- args: [{ selector: 'entry-dialog', template: "<div class=\"dialog-form\">\n <div class=\"dialog-header\">\n <h1 class=\"dialog-title\">\n {{ title }}\n </h1>\n\n <button type=\"button\" class=\"dialog-close-button\" (click)=\"cancel()\">\n <span class=\"icon-close dialog-close-icon\"></span>\n </button>\n </div>\n\n <mat-dialog-content\n class=\"dialog-content\"\n [ngClass]=\"{'with-actions': buttons.visible}\">\n <ng-content></ng-content>\n </mat-dialog-content>\n\n <ng-template [ngIf]=\"buttonsTemplate\" [ngIfElse]=\"defaultButtonsTemplate\">\n <ng-template [ngTemplateOutlet]=\"buttonsTemplate\"></ng-template>\n </ng-template>\n\n <ng-template #defaultButtonsTemplate>\n <div *ngIf=\"buttons.visible\" class=\"dialog-footer {{ buttons.buttonsAlignment }}\">\n <button\n type=\"button\"\n class=\"button button-accent dialog-footer-button\"\n cdkFocusInitial\n (click)=\"onSubmit()\">{{buttons.confirmButtonText}}</button>\n <button\n type=\"button\"\n class=\"button button-primary dialog-footer-button\"\n *ngIf=\"buttons.cancelButtonText !== ''\"\n (click)=\"cancel()\">{{buttons.cancelButtonText}}</button>\n </div>\n </ng-template>\n</div>", styles: [".align-center{margin:auto}\n"] }]
62
+ args: [{ selector: 'entry-dialog', template: "<div class=\"dialog-form\">\n <div class=\"dialog-header\">\n <h1 class=\"dialog-title\">{{title}}</h1>\n\n <button *ngIf=\"!hideClose\" type=\"button\" class=\"dialog-close-button\" (click)=\"cancel()\">\n <span class=\"icon-close dialog-close-icon\"></span>\n </button>\n </div>\n\n <mat-dialog-content class=\"dialog-content\" [ngClass]=\"{'with-actions': !hideButtons}\">\n <ng-content></ng-content>\n </mat-dialog-content>\n\n <ng-template [ngIf]=\"buttonsTemplate\" [ngIfElse]=\"defaultButtonsTemplate\">\n <ng-template [ngTemplateOutlet]=\"buttonsTemplate\"></ng-template>\n </ng-template>\n\n <ng-template #defaultButtonsTemplate>\n <div *ngIf=\"!hideButtons\" class=\"dialog-footer {{ buttonsAlignment }}\">\n <button\n type=\"button\"\n class=\"button button-accent dialog-footer-button\"\n cdkFocusInitial\n (click)=\"onSubmit()\">{{confirmButtonText}}</button>\n <button\n type=\"button\"\n class=\"button button-primary dialog-footer-button\"\n *ngIf=\"!hideCancel\"\n (click)=\"cancel()\">{{cancelButtonText}}</button>\n </div>\n </ng-template>\n</div>", styles: [".align-center{margin:auto}\n"] }]
54
63
  }], ctorParameters: function () {
55
64
  return [{ type: i1.MatDialogRef }, { type: EntryDialogConfig, decorators: [{
56
65
  type: Inject,
@@ -58,7 +67,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
58
67
  }] }];
59
68
  }, propDecorators: { title: [{
60
69
  type: Input
61
- }], buttons: [{
70
+ }], buttonsAlignment: [{
71
+ type: Input
72
+ }], confirmButtonText: [{
73
+ type: Input
74
+ }], cancelButtonText: [{
75
+ type: Input
76
+ }], hideButtons: [{
77
+ type: Input
78
+ }], hideCancel: [{
79
+ type: Input
80
+ }], hideClose: [{
62
81
  type: Input
63
82
  }], disableConfirm: [{
64
83
  type: Input
@@ -75,24 +94,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
75
94
 
76
95
  class EntryAlertDialogComponent extends EntryDialogComponent {
77
96
  constructor(mdDialogRef, config, data) {
78
- var _a;
79
97
  super(mdDialogRef, config);
80
98
  this.mdDialogRef = mdDialogRef;
81
99
  this.config = config;
82
100
  this.data = data;
83
- this.buttons = {
84
- confirmButtonText: (_a = this.data.confirmText) !== null && _a !== void 0 ? _a : this.config.confirmButtonText,
85
- cancelButtonText: '',
86
- buttonsAlignment: 'align-center',
87
- visible: true
88
- };
89
101
  }
90
102
  }
91
103
  EntryAlertDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: EntryAlertDialogComponent, deps: [{ token: i1.MatDialogRef }, { token: ENTRY_DIALOG_CONFIG }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component });
92
- EntryAlertDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: EntryAlertDialogComponent, selector: "entry-alert-dialog", usesInheritance: true, ngImport: i0, template: "<entry-dialog [title]='data.title' [buttons]=\"buttons\">\n <p>{{data.message}}</p>\n</entry-dialog>", styles: [""], components: [{ type: EntryDialogComponent, selector: "entry-dialog", inputs: ["title", "buttons", "disableConfirm", "buttonsTemplate", "confirm", "cancel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
104
+ EntryAlertDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: EntryAlertDialogComponent, selector: "entry-alert-dialog", usesInheritance: true, ngImport: i0, template: "<entry-dialog\n [title]=\"data.title\"\n [confirmButtonText]=\"data.confirmText ?? config.confirmButtonText\"\n [buttonsAlignment]=\"'align-center'\"\n [hideCancel]=\"true\">\n <p>{{data.message}}</p>\n</entry-dialog>", styles: [""], components: [{ type: EntryDialogComponent, selector: "entry-dialog", inputs: ["title", "buttonsAlignment", "confirmButtonText", "cancelButtonText", "hideButtons", "hideCancel", "hideClose", "disableConfirm", "buttonsTemplate", "confirm", "cancel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
93
105
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: EntryAlertDialogComponent, decorators: [{
94
106
  type: Component,
95
- args: [{ selector: 'entry-alert-dialog', changeDetection: ChangeDetectionStrategy.OnPush, template: "<entry-dialog [title]='data.title' [buttons]=\"buttons\">\n <p>{{data.message}}</p>\n</entry-dialog>", styles: [""] }]
107
+ args: [{ selector: 'entry-alert-dialog', changeDetection: ChangeDetectionStrategy.OnPush, template: "<entry-dialog\n [title]=\"data.title\"\n [confirmButtonText]=\"data.confirmText ?? config.confirmButtonText\"\n [buttonsAlignment]=\"'align-center'\"\n [hideCancel]=\"true\">\n <p>{{data.message}}</p>\n</entry-dialog>", styles: [""] }]
96
108
  }], ctorParameters: function () {
97
109
  return [{ type: i1.MatDialogRef }, { type: EntryDialogConfig, decorators: [{
98
110
  type: Inject,
@@ -105,24 +117,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
105
117
 
106
118
  class EntryConfirmDialogComponent extends EntryDialogComponent {
107
119
  constructor(mdDialogRef, config, data) {
108
- var _a, _b;
109
120
  super(mdDialogRef, config);
110
121
  this.mdDialogRef = mdDialogRef;
111
122
  this.config = config;
112
123
  this.data = data;
113
- this.buttons = {
114
- confirmButtonText: (_a = this.data.confirmText) !== null && _a !== void 0 ? _a : this.config.confirmButtonText,
115
- cancelButtonText: (_b = this.data.cancelText) !== null && _b !== void 0 ? _b : this.config.cancelButtonText,
116
- buttonsAlignment: 'align-right',
117
- visible: true
118
- };
119
124
  }
120
125
  }
121
126
  EntryConfirmDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: EntryConfirmDialogComponent, deps: [{ token: i1.MatDialogRef }, { token: ENTRY_DIALOG_CONFIG }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component });
122
- EntryConfirmDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: EntryConfirmDialogComponent, selector: "entry-confirm-dialog", usesInheritance: true, ngImport: i0, template: "<entry-dialog [title]='data.title' [buttons]=\"buttons\">\n <p>{{data.message}}</p>\n</entry-dialog>", styles: [""], components: [{ type: EntryDialogComponent, selector: "entry-dialog", inputs: ["title", "buttons", "disableConfirm", "buttonsTemplate", "confirm", "cancel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
127
+ EntryConfirmDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: EntryConfirmDialogComponent, selector: "entry-confirm-dialog", usesInheritance: true, ngImport: i0, template: "<entry-dialog\n [title]=\"data.title\"\n [confirmButtonText]=\"data.confirmText ?? config.confirmButtonText\"\n [cancelButtonText]=\"data.cancelText ?? config.cancelButtonText\"\n [buttonsAlignment]=\"'align-right'\"\n [hideClose]=\"true\">\n <p>{{data.message}}</p>\n</entry-dialog>", styles: [""], components: [{ type: EntryDialogComponent, selector: "entry-dialog", inputs: ["title", "buttonsAlignment", "confirmButtonText", "cancelButtonText", "hideButtons", "hideCancel", "hideClose", "disableConfirm", "buttonsTemplate", "confirm", "cancel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
123
128
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: EntryConfirmDialogComponent, decorators: [{
124
129
  type: Component,
125
- args: [{ selector: 'entry-confirm-dialog', changeDetection: ChangeDetectionStrategy.OnPush, template: "<entry-dialog [title]='data.title' [buttons]=\"buttons\">\n <p>{{data.message}}</p>\n</entry-dialog>", styles: [""] }]
130
+ args: [{ selector: 'entry-confirm-dialog', changeDetection: ChangeDetectionStrategy.OnPush, template: "<entry-dialog\n [title]=\"data.title\"\n [confirmButtonText]=\"data.confirmText ?? config.confirmButtonText\"\n [cancelButtonText]=\"data.cancelText ?? config.cancelButtonText\"\n [buttonsAlignment]=\"'align-right'\"\n [hideClose]=\"true\">\n <p>{{data.message}}</p>\n</entry-dialog>", styles: [""] }]
126
131
  }], ctorParameters: function () {
127
132
  return [{ type: i1.MatDialogRef }, { type: EntryDialogConfig, decorators: [{
128
133
  type: Inject,
@@ -134,34 +139,41 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
134
139
  } });
135
140
 
136
141
  class EntryDialogService {
137
- constructor(matDialog) {
142
+ constructor(config, matDialog) {
143
+ this.config = config;
138
144
  this.matDialog = matDialog;
139
145
  /**
140
146
  * Opens alert dialog
141
147
  *
142
148
  * @param data - Contains title, message and optional confirm button text of IEntryAlertDialogData type
149
+ * @param disableClose - Optional parameter that disable closing dialog when pressing escape or clicking on backdrop
143
150
  * @returns Observable of any
144
151
  */
145
- this.openAlert = (data) => this.open(EntryAlertDialogComponent, data);
152
+ this.openAlert = (data, disableClose = undefined) => this.open(EntryAlertDialogComponent, data, disableClose);
146
153
  /**
147
154
  * Opens confirm dialog
148
155
  *
149
156
  * @param data - Contains title, message and optional confirm/cancel buttons text of IEntryConfirmDialogData type
157
+ * @param disableClose - Optional parameter that disable closing dialog when pressing escape or clicking on backdrop
150
158
  * @returns Observable of bool or undefined, `true` if confirmed, `false` if canceled or closed
151
- * , `undefined` if closed by clicking outside of the dialog
159
+ * , `undefined` if closed by clicking on backdrop or pressing escape
152
160
  */
153
- this.openConfirm = (data) => this.open(EntryConfirmDialogComponent, data);
161
+ this.openConfirm = (data, disableClose = true) => this.open(EntryConfirmDialogComponent, data, disableClose);
154
162
  /**
155
163
  * Opens dialog with custom component
156
164
  *
157
165
  * @param component - Dialog custom component implementation
158
166
  * @param data - Optional parameter used to supply component with input parameters
167
+ * @param disableClose - Optional parameter that disable closing dialog when pressing escape or clicking on backdrop
159
168
  * @param cssClass - Optional parameter used to set custom class to Material overlay pane
160
169
  * @returns Observable of any containing result of dialog with custom component
161
170
  */
162
- this.open = (component, data = undefined, cssClass = '') => {
171
+ this.open = (component, data = undefined, disableClose = undefined, cssClass = '') => {
163
172
  const configuration = new MatDialogConfig();
164
173
  configuration.data = data;
174
+ configuration.disableClose = disableClose === undefined
175
+ ? this.config.disableClose
176
+ : disableClose;
165
177
  this.setPanelClassFor(configuration, cssClass);
166
178
  return this.matDialog
167
179
  .open(component, configuration)
@@ -174,14 +186,19 @@ class EntryDialogService {
174
186
  };
175
187
  }
176
188
  }
177
- EntryDialogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: EntryDialogService, deps: [{ token: i1.MatDialog }], target: i0.ɵɵFactoryTarget.Injectable });
189
+ EntryDialogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: EntryDialogService, deps: [{ token: ENTRY_DIALOG_CONFIG }, { token: i1.MatDialog }], target: i0.ɵɵFactoryTarget.Injectable });
178
190
  EntryDialogService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: EntryDialogService, providedIn: 'root' });
179
191
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: EntryDialogService, decorators: [{
180
192
  type: Injectable,
181
193
  args: [{
182
194
  providedIn: 'root'
183
195
  }]
184
- }], ctorParameters: function () { return [{ type: i1.MatDialog }]; } });
196
+ }], ctorParameters: function () {
197
+ return [{ type: EntryDialogConfig, decorators: [{
198
+ type: Inject,
199
+ args: [ENTRY_DIALOG_CONFIG]
200
+ }] }, { type: i1.MatDialog }];
201
+ } });
185
202
 
186
203
  class EntryDialogModule {
187
204
  }
@@ -1 +1 @@
1
- {"version":3,"file":"enigmatry-entry-components-dialog.mjs","sources":["../../../../projects/entry-components/dialog/entry-dialog-config.model.ts","../../../../projects/entry-components/dialog/dialogs/entry-dialog.component.ts","../../../../projects/entry-components/dialog/dialogs/entry-dialog.component.html","../../../../projects/entry-components/dialog/dialogs/alert/entry-alert-dialog.component.ts","../../../../projects/entry-components/dialog/dialogs/alert/entry-alert-dialog.component.html","../../../../projects/entry-components/dialog/dialogs/confirm/entry-confirm-dialog.component.ts","../../../../projects/entry-components/dialog/dialogs/confirm/entry-confirm-dialog.component.html","../../../../projects/entry-components/dialog/entry-dialog.service.ts","../../../../projects/entry-components/dialog/entry-dialog.module.ts","../../../../projects/entry-components/dialog/enigmatry-entry-components-dialog.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nexport class EntryDialogConfig {\n confirmButtonText: string;\n cancelButtonText: string;\n buttonsAlignment: 'align-right' | 'align-center' | '';\n\n constructor(config: Partial<EntryDialogConfig> = {}) {\n this.confirmButtonText = config.confirmButtonText ?? 'Ok';\n this.cancelButtonText = config.cancelButtonText ?? 'Cancel';\n this.buttonsAlignment = config.buttonsAlignment ?? 'align-right';\n }\n}\nexport const ENTRY_DIALOG_CONFIG = new InjectionToken<EntryDialogConfig>('EntryDialogConfig',\n {\n providedIn: 'root',\n factory: () => new EntryDialogConfig()\n }\n);\n","import { Component, HostListener, Inject, Input, TemplateRef } from '@angular/core';\nimport { MatDialogRef } from '@angular/material/dialog';\nimport { Observable, of } from 'rxjs';\nimport { IEntryDialogButtonsConfig } from '../entry-dialog-buttons-config.interface';\nimport { ENTRY_DIALOG_CONFIG, EntryDialogConfig } from '../entry-dialog-config.model';\n\n@Component({\n selector: 'entry-dialog',\n templateUrl: './entry-dialog.component.html',\n styleUrls: ['./entry-dialog.component.scss']\n})\nexport class EntryDialogComponent {\n\n @Input() title: string;\n @Input() buttons: IEntryDialogButtonsConfig = {\n buttonsAlignment: this.config.buttonsAlignment,\n confirmButtonText: this.config.confirmButtonText,\n cancelButtonText: this.config.cancelButtonText,\n visible: true\n };\n\n @Input() disableConfirm = false;\n @Input() buttonsTemplate: TemplateRef<any> | null | undefined;\n\n constructor(\n protected readonly mdDialogRef: MatDialogRef<EntryDialogComponent>,\n @Inject(ENTRY_DIALOG_CONFIG) protected readonly config: EntryDialogConfig) { }\n\n @Input() confirm: () => Observable<unknown> = () => of(true);\n @Input() cancel = () => this.close(false);\n\n @HostListener('keydown.esc')\n readonly onEsc = () => this.cancel();\n\n readonly onSubmit = () => {\n this.confirm().subscribe({\n next: closeDialog => {\n if (closeDialog) {\n this.close(closeDialog);\n }\n }\n });\n };\n\n readonly close = (value: unknown = true) => this.mdDialogRef.close(value);\n}\n","<div class=\"dialog-form\">\n <div class=\"dialog-header\">\n <h1 class=\"dialog-title\">\n {{ title }}\n </h1>\n\n <button type=\"button\" class=\"dialog-close-button\" (click)=\"cancel()\">\n <span class=\"icon-close dialog-close-icon\"></span>\n </button>\n </div>\n\n <mat-dialog-content\n class=\"dialog-content\"\n [ngClass]=\"{'with-actions': buttons.visible}\">\n <ng-content></ng-content>\n </mat-dialog-content>\n\n <ng-template [ngIf]=\"buttonsTemplate\" [ngIfElse]=\"defaultButtonsTemplate\">\n <ng-template [ngTemplateOutlet]=\"buttonsTemplate\"></ng-template>\n </ng-template>\n\n <ng-template #defaultButtonsTemplate>\n <div *ngIf=\"buttons.visible\" class=\"dialog-footer {{ buttons.buttonsAlignment }}\">\n <button\n type=\"button\"\n class=\"button button-accent dialog-footer-button\"\n cdkFocusInitial\n (click)=\"onSubmit()\">{{buttons.confirmButtonText}}</button>\n <button\n type=\"button\"\n class=\"button button-primary dialog-footer-button\"\n *ngIf=\"buttons.cancelButtonText !== ''\"\n (click)=\"cancel()\">{{buttons.cancelButtonText}}</button>\n </div>\n </ng-template>\n</div>","import { ChangeDetectionStrategy, Component, Inject } from '@angular/core';\nimport { EntryDialogComponent } from '../entry-dialog.component';\nimport { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';\nimport { IEntryAlertDialogData } from './entry-alert-dialog-data.interface';\nimport { IEntryDialogButtonsConfig } from '../../entry-dialog-buttons-config.interface';\nimport { ENTRY_DIALOG_CONFIG, EntryDialogConfig } from '../../entry-dialog-config.model';\n\n@Component({\n selector: 'entry-alert-dialog',\n templateUrl: './entry-alert-dialog.component.html',\n styleUrls: ['./entry-alert-dialog.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class EntryAlertDialogComponent extends EntryDialogComponent {\n readonly buttons: IEntryDialogButtonsConfig = {\n confirmButtonText: this.data.confirmText ?? this.config.confirmButtonText,\n cancelButtonText: '',\n buttonsAlignment: 'align-center',\n visible: true\n };\n\n constructor(\n protected readonly mdDialogRef: MatDialogRef<EntryDialogComponent>,\n @Inject(ENTRY_DIALOG_CONFIG) protected readonly config: EntryDialogConfig,\n @Inject(MAT_DIALOG_DATA) public data: IEntryAlertDialogData) {\n super(mdDialogRef, config);\n }\n}\n","<entry-dialog [title]='data.title' [buttons]=\"buttons\">\n <p>{{data.message}}</p>\n</entry-dialog>","import { ChangeDetectionStrategy, Component, Inject } from '@angular/core';\nimport { IEntryDialogButtonsConfig } from '../../entry-dialog-buttons-config.interface';\nimport { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';\nimport { EntryDialogComponent } from '../entry-dialog.component';\nimport { IEntryConfirmDialogData } from './entry-confirm-dialog-data.interface';\nimport { ENTRY_DIALOG_CONFIG, EntryDialogConfig } from '../../entry-dialog-config.model';\n\n@Component({\n selector: 'entry-confirm-dialog',\n templateUrl: './entry-confirm-dialog.component.html',\n styleUrls: ['./entry-confirm-dialog.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class EntryConfirmDialogComponent extends EntryDialogComponent {\n readonly buttons: IEntryDialogButtonsConfig = {\n confirmButtonText: this.data.confirmText ?? this.config.confirmButtonText,\n cancelButtonText: this.data.cancelText ?? this.config.cancelButtonText,\n buttonsAlignment: 'align-right',\n visible: true\n };\n\n constructor(\n protected readonly mdDialogRef: MatDialogRef<EntryDialogComponent>,\n @Inject(ENTRY_DIALOG_CONFIG) protected readonly config: EntryDialogConfig,\n @Inject(MAT_DIALOG_DATA) readonly data: IEntryConfirmDialogData) {\n super(mdDialogRef, config);\n }\n}\n","<entry-dialog [title]='data.title' [buttons]=\"buttons\">\n <p>{{data.message}}</p>\n</entry-dialog>","import { Injectable, Type } from '@angular/core';\nimport { MatDialog, MatDialogConfig } from '@angular/material/dialog';\nimport { EntryDialogComponent } from './dialogs/entry-dialog.component';\nimport { take } from 'rxjs/operators';\nimport { IEntryAlertDialogData } from './dialogs/alert/entry-alert-dialog-data.interface';\nimport { EntryAlertDialogComponent } from './dialogs/alert/entry-alert-dialog.component';\nimport { Observable } from 'rxjs';\nimport { EntryConfirmDialogComponent } from './dialogs/confirm/entry-confirm-dialog.component';\nimport { IEntryConfirmDialogData } from './dialogs/confirm/entry-confirm-dialog-data.interface';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class EntryDialogService {\n constructor(private readonly matDialog: MatDialog) { }\n\n /**\n * Opens alert dialog\n *\n * @param data - Contains title, message and optional confirm button text of IEntryAlertDialogData type\n * @returns Observable of any\n */\n openAlert = (data: IEntryAlertDialogData): Observable<any> =>\n this.open(EntryAlertDialogComponent, data);\n\n /**\n * Opens confirm dialog\n *\n * @param data - Contains title, message and optional confirm/cancel buttons text of IEntryConfirmDialogData type\n * @returns Observable of bool or undefined, `true` if confirmed, `false` if canceled or closed\n * , `undefined` if closed by clicking outside of the dialog\n */\n openConfirm = (data: IEntryConfirmDialogData): Observable<boolean | undefined> =>\n this.open(EntryConfirmDialogComponent, data);\n\n /**\n * Opens dialog with custom component\n *\n * @param component - Dialog custom component implementation\n * @param data - Optional parameter used to supply component with input parameters\n * @param cssClass - Optional parameter used to set custom class to Material overlay pane\n * @returns Observable of any containing result of dialog with custom component\n */\n open = (\n component: Type<EntryDialogComponent>,\n data: unknown = undefined,\n cssClass: string = ''): Observable<any> => {\n const configuration = new MatDialogConfig<unknown>();\n configuration.data = data;\n this.setPanelClassFor(configuration, cssClass);\n\n return this.matDialog\n .open(component, configuration)\n .afterClosed()\n .pipe(take(1));\n };\n\n readonly close = (): void => this.matDialog.closeAll();\n\n private setPanelClassFor = <T>(configuration: MatDialogConfig<T>, cssClass: string) => {\n configuration.panelClass = ['dialog-container', cssClass];\n };\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { MatDialogModule } from '@angular/material/dialog';\nimport { EntryAlertDialogComponent } from './dialogs/alert/entry-alert-dialog.component';\nimport { EntryConfirmDialogComponent } from './dialogs/confirm/entry-confirm-dialog.component';\nimport { EntryDialogComponent } from './dialogs/entry-dialog.component';\n\n@NgModule({\n declarations: [\n EntryDialogComponent,\n EntryAlertDialogComponent,\n EntryConfirmDialogComponent\n ],\n imports: [\n CommonModule,\n MatDialogModule\n ],\n exports: [\n EntryDialogComponent,\n EntryAlertDialogComponent,\n EntryConfirmDialogComponent\n ]\n})\nexport class EntryDialogModule { }\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i2.EntryDialogComponent"],"mappings":";;;;;;;;;MAEa,iBAAiB,CAAA;IAK1B,WAAY,CAAA,SAAqC,EAAE,EAAA;;QAC/C,IAAI,CAAC,iBAAiB,GAAG,CAAA,EAAA,GAAA,MAAM,CAAC,iBAAiB,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,IAAI,CAAC;QAC1D,IAAI,CAAC,gBAAgB,GAAG,CAAA,EAAA,GAAA,MAAM,CAAC,gBAAgB,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,QAAQ,CAAC;QAC5D,IAAI,CAAC,gBAAgB,GAAG,CAAA,EAAA,GAAA,MAAM,CAAC,gBAAgB,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,aAAa,CAAC;KACpE;AACJ,CAAA;MACY,mBAAmB,GAAG,IAAI,cAAc,CAAoB,mBAAmB,EACxF;AACI,IAAA,UAAU,EAAE,MAAM;AAClB,IAAA,OAAO,EAAE,MAAM,IAAI,iBAAiB,EAAE;AACzC,CAAA;;MCNQ,oBAAoB,CAAA;IAa7B,WACuB,CAAA,WAA+C,EAClB,MAAyB,EAAA;AADtD,QAAA,IAAW,CAAA,WAAA,GAAX,WAAW,CAAoC;AAClB,QAAA,IAAM,CAAA,MAAA,GAAN,MAAM,CAAmB;QAZpE,IAAA,C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EAAA,IAAA,EAAA,iBAAiB,iBAd1B,oBAAoB;QACpB,yBAAyB;AACzB,QAAA,2BAA2B,aAG3B,YAAY;AACZ,QAAA,eAAe,aAGf,oBAAoB;QACpB,yBAAyB;QACzB,2BAA2B,CAAA,EAAA,CAAA,CAAA;AAGlB,iBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,iBAAiB,EAVnB,OAAA,EAAA,CAAA;YACP,YAAY;YACZ,eAAe;SAChB,CAAA,EAAA,CAAA,CAAA;4FAOU,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAhB7B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE;wBACZ,oBAAoB;wBACpB,yBAAyB;wBACzB,2BAA2B;AAC5B,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACP,YAAY;wBACZ,eAAe;AAChB,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACP,oBAAoB;wBACpB,yBAAyB;wBACzB,2BAA2B;AAC5B,qBAAA;iBACF,CAAA;;;ACtBD;;AAEG;;;;"}
1
+ {"version":3,"file":"enigmatry-entry-components-dialog.mjs","sources":["../../../../projects/entry-components/dialog/entry-dialog-config.model.ts","../../../../projects/entry-components/dialog/dialogs/entry-dialog.component.ts","../../../../projects/entry-components/dialog/dialogs/entry-dialog.component.html","../../../../projects/entry-components/dialog/dialogs/alert/entry-alert-dialog.component.ts","../../../../projects/entry-components/dialog/dialogs/alert/entry-alert-dialog.component.html","../../../../projects/entry-components/dialog/dialogs/confirm/entry-confirm-dialog.component.ts","../../../../projects/entry-components/dialog/dialogs/confirm/entry-confirm-dialog.component.html","../../../../projects/entry-components/dialog/entry-dialog.service.ts","../../../../projects/entry-components/dialog/entry-dialog.module.ts","../../../../projects/entry-components/dialog/enigmatry-entry-components-dialog.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\n/**\n * Used to provide default configurations on module level\n */\nexport class EntryDialogConfig {\n /** @property confirmButtonText - Confirm button label (default 'Ok') */\n confirmButtonText: string;\n /** @property cancelButtonText - Cancel button label (default 'Cancel') */\n cancelButtonText: string;\n /** @property buttonsAlignment - Buttons alignment on dialog (default 'align-right') */\n buttonsAlignment: 'align-right' | 'align-center' | '';\n /** @property hideClose - Determines if close button is visible (default is false) */\n hideClose: boolean;\n /** @property disableClose - Disable closing dialog when pressing escape or clicking on backdrop (default false) */\n disableClose: boolean;\n\n constructor(config: Partial<EntryDialogConfig> = {}) {\n this.confirmButtonText = config.confirmButtonText ?? 'Ok';\n this.cancelButtonText = config.cancelButtonText ?? 'Cancel';\n this.buttonsAlignment = config.buttonsAlignment ?? 'align-right';\n this.hideClose = config.hideClose ?? false;\n this.disableClose = config.disableClose ?? false;\n }\n}\nexport const ENTRY_DIALOG_CONFIG = new InjectionToken<EntryDialogConfig>('EntryDialogConfig',\n {\n providedIn: 'root',\n factory: () => new EntryDialogConfig()\n }\n);\n","import { Component, HostListener, Inject, Input, TemplateRef } from '@angular/core';\nimport { MatDialogRef } from '@angular/material/dialog';\nimport { Observable, of } from 'rxjs';\nimport { ENTRY_DIALOG_CONFIG, EntryDialogConfig } from '../entry-dialog-config.model';\n\n/**\n * Base Entry dialog component. Must be extended when building custom dialogs.\n */\n@Component({\n selector: 'entry-dialog',\n templateUrl: './entry-dialog.component.html',\n styleUrls: ['./entry-dialog.component.scss']\n})\nexport class EntryDialogComponent {\n /** @property title - Dialog header title */\n @Input() title: string;\n /** @property buttonsAlignment - Dialog buttons horizontal alignment */\n @Input() buttonsAlignment: 'align-right' | 'align-center' | '' = this.config.buttonsAlignment;\n /** @property confirmButtonText - Confirm button label */\n @Input() confirmButtonText = this.config.confirmButtonText;\n /** @property cancelButtonText - Cancel button label */\n @Input() cancelButtonText = this.config.cancelButtonText;\n /** @property hideButtons - Show or hide dialog buttons */\n @Input() hideButtons: boolean;\n /** @property hideCancel - Show or hide dialog cancel button */\n @Input() hideCancel: boolean;\n /** @property hideClose - Show or hide dialog close button */\n @Input() hideClose: boolean = this.config.hideClose;\n /** @property disableConfirm - Enable or disable dialog confirm button */\n @Input() disableConfirm: boolean;\n /** @property buttonsTemplate - Provide custom buttons template */\n @Input() buttonsTemplate: TemplateRef<any> | null | undefined;\n\n constructor(\n protected readonly mdDialogRef: MatDialogRef<EntryDialogComponent>,\n @Inject(ENTRY_DIALOG_CONFIG) protected readonly config: EntryDialogConfig) { }\n\n @Input() confirm: () => Observable<unknown> = () => of(true);\n @Input() cancel = () => this.close(false);\n\n @HostListener('keydown.esc')\n readonly onEsc = () => this.cancel();\n\n readonly onSubmit = () => {\n this.confirm().subscribe({\n next: closeDialog => {\n if (closeDialog) {\n this.close(closeDialog);\n }\n }\n });\n };\n\n readonly close = (value: unknown = true) => this.mdDialogRef.close(value);\n}\n","<div class=\"dialog-form\">\n <div class=\"dialog-header\">\n <h1 class=\"dialog-title\">{{title}}</h1>\n\n <button *ngIf=\"!hideClose\" type=\"button\" class=\"dialog-close-button\" (click)=\"cancel()\">\n <span class=\"icon-close dialog-close-icon\"></span>\n </button>\n </div>\n\n <mat-dialog-content class=\"dialog-content\" [ngClass]=\"{'with-actions': !hideButtons}\">\n <ng-content></ng-content>\n </mat-dialog-content>\n\n <ng-template [ngIf]=\"buttonsTemplate\" [ngIfElse]=\"defaultButtonsTemplate\">\n <ng-template [ngTemplateOutlet]=\"buttonsTemplate\"></ng-template>\n </ng-template>\n\n <ng-template #defaultButtonsTemplate>\n <div *ngIf=\"!hideButtons\" class=\"dialog-footer {{ buttonsAlignment }}\">\n <button\n type=\"button\"\n class=\"button button-accent dialog-footer-button\"\n cdkFocusInitial\n (click)=\"onSubmit()\">{{confirmButtonText}}</button>\n <button\n type=\"button\"\n class=\"button button-primary dialog-footer-button\"\n *ngIf=\"!hideCancel\"\n (click)=\"cancel()\">{{cancelButtonText}}</button>\n </div>\n </ng-template>\n</div>","import { ChangeDetectionStrategy, Component, Inject } from '@angular/core';\nimport { EntryDialogComponent } from '../entry-dialog.component';\nimport { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';\nimport { IEntryAlertDialogData } from './entry-alert-dialog-data.interface';\nimport { ENTRY_DIALOG_CONFIG, EntryDialogConfig } from '../../entry-dialog-config.model';\n\n@Component({\n selector: 'entry-alert-dialog',\n templateUrl: './entry-alert-dialog.component.html',\n styleUrls: ['./entry-alert-dialog.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class EntryAlertDialogComponent extends EntryDialogComponent {\n constructor(\n protected readonly mdDialogRef: MatDialogRef<EntryDialogComponent>,\n @Inject(ENTRY_DIALOG_CONFIG) public readonly config: EntryDialogConfig,\n @Inject(MAT_DIALOG_DATA) public data: IEntryAlertDialogData) {\n super(mdDialogRef, config);\n }\n}\n","<entry-dialog\n [title]=\"data.title\"\n [confirmButtonText]=\"data.confirmText ?? config.confirmButtonText\"\n [buttonsAlignment]=\"'align-center'\"\n [hideCancel]=\"true\">\n <p>{{data.message}}</p>\n</entry-dialog>","import { ChangeDetectionStrategy, Component, Inject } from '@angular/core';\nimport { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';\nimport { EntryDialogComponent } from '../entry-dialog.component';\nimport { IEntryConfirmDialogData } from './entry-confirm-dialog-data.interface';\nimport { ENTRY_DIALOG_CONFIG, EntryDialogConfig } from '../../entry-dialog-config.model';\n\n@Component({\n selector: 'entry-confirm-dialog',\n templateUrl: './entry-confirm-dialog.component.html',\n styleUrls: ['./entry-confirm-dialog.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class EntryConfirmDialogComponent extends EntryDialogComponent {\n constructor(\n protected readonly mdDialogRef: MatDialogRef<EntryDialogComponent>,\n @Inject(ENTRY_DIALOG_CONFIG) public readonly config: EntryDialogConfig,\n @Inject(MAT_DIALOG_DATA) readonly data: IEntryConfirmDialogData) {\n super(mdDialogRef, config);\n }\n}\n","<entry-dialog\n [title]=\"data.title\"\n [confirmButtonText]=\"data.confirmText ?? config.confirmButtonText\"\n [cancelButtonText]=\"data.cancelText ?? config.cancelButtonText\"\n [buttonsAlignment]=\"'align-right'\"\n [hideClose]=\"true\">\n <p>{{data.message}}</p>\n</entry-dialog>","import { Inject, Injectable, Type } from '@angular/core';\nimport { MatDialog, MatDialogConfig } from '@angular/material/dialog';\nimport { EntryDialogComponent } from './dialogs/entry-dialog.component';\nimport { take } from 'rxjs/operators';\nimport { IEntryAlertDialogData } from './dialogs/alert/entry-alert-dialog-data.interface';\nimport { EntryAlertDialogComponent } from './dialogs/alert/entry-alert-dialog.component';\nimport { Observable } from 'rxjs';\nimport { EntryConfirmDialogComponent } from './dialogs/confirm/entry-confirm-dialog.component';\nimport { IEntryConfirmDialogData } from './dialogs/confirm/entry-confirm-dialog-data.interface';\nimport { ENTRY_DIALOG_CONFIG, EntryDialogConfig } from './entry-dialog-config.model';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class EntryDialogService {\n constructor(\n @Inject(ENTRY_DIALOG_CONFIG) protected readonly config: EntryDialogConfig,\n private readonly matDialog: MatDialog) { }\n\n /**\n * Opens alert dialog\n *\n * @param data - Contains title, message and optional confirm button text of IEntryAlertDialogData type\n * @param disableClose - Optional parameter that disable closing dialog when pressing escape or clicking on backdrop\n * @returns Observable of any\n */\n openAlert = (\n data: IEntryAlertDialogData,\n disableClose: boolean | undefined = undefined): Observable<any> =>\n this.open(EntryAlertDialogComponent, data, disableClose);\n\n /**\n * Opens confirm dialog\n *\n * @param data - Contains title, message and optional confirm/cancel buttons text of IEntryConfirmDialogData type\n * @param disableClose - Optional parameter that disable closing dialog when pressing escape or clicking on backdrop\n * @returns Observable of bool or undefined, `true` if confirmed, `false` if canceled or closed\n * , `undefined` if closed by clicking on backdrop or pressing escape\n */\n openConfirm = (\n data: IEntryConfirmDialogData,\n disableClose: boolean | undefined = true): Observable<boolean | undefined> =>\n this.open(EntryConfirmDialogComponent, data, disableClose);\n\n /**\n * Opens dialog with custom component\n *\n * @param component - Dialog custom component implementation\n * @param data - Optional parameter used to supply component with input parameters\n * @param disableClose - Optional parameter that disable closing dialog when pressing escape or clicking on backdrop\n * @param cssClass - Optional parameter used to set custom class to Material overlay pane\n * @returns Observable of any containing result of dialog with custom component\n */\n open = (\n component: Type<EntryDialogComponent>,\n data: unknown = undefined,\n disableClose: boolean | undefined = undefined,\n cssClass: string = ''): Observable<any> => {\n const configuration = new MatDialogConfig<unknown>();\n configuration.data = data;\n configuration.disableClose = disableClose === undefined\n ? this.config.disableClose\n : disableClose;\n this.setPanelClassFor(configuration, cssClass);\n\n return this.matDialog\n .open(component, configuration)\n .afterClosed()\n .pipe(take(1));\n };\n\n close = (): void => this.matDialog.closeAll();\n\n private setPanelClassFor = <T>(configuration: MatDialogConfig<T>, cssClass: string) => {\n configuration.panelClass = ['dialog-container', cssClass];\n };\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { MatDialogModule } from '@angular/material/dialog';\nimport { EntryAlertDialogComponent } from './dialogs/alert/entry-alert-dialog.component';\nimport { EntryConfirmDialogComponent } from './dialogs/confirm/entry-confirm-dialog.component';\nimport { EntryDialogComponent } from './dialogs/entry-dialog.component';\n\n@NgModule({\n declarations: [\n EntryDialogComponent,\n EntryAlertDialogComponent,\n EntryConfirmDialogComponent\n ],\n imports: [\n CommonModule,\n MatDialogModule\n ],\n exports: [\n EntryDialogComponent,\n EntryAlertDialogComponent,\n EntryConfirmDialogComponent\n ]\n})\nexport class EntryDialogModule { }\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i2.EntryDialogComponent"],"mappings":";;;;;;;;;AAEA;;AAEG;MACU,iBAAiB,CAAA;IAY1B,WAAY,CAAA,SAAqC,EAAE,EAAA;;QAC/C,IAAI,CAAC,iBAAiB,GAAG,CAAA,EAAA,GAAA,MAAM,CAAC,iBAAiB,MAAI,IAAA,IAAA,EAAA,KAAA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A,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,iBAAiB,EAVnB,OAAA,EAAA,CAAA;YACP,YAAY;YACZ,eAAe;SAChB,CAAA,EAAA,CAAA,CAAA;4FAOU,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAhB7B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE;wBACZ,oBAAoB;wBACpB,yBAAyB;wBACzB,2BAA2B;AAC5B,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACP,YAAY;wBACZ,eAAe;AAChB,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACP,oBAAoB;wBACpB,yBAAyB;wBACzB,2BAA2B;AAC5B,qBAAA;iBACF,CAAA;;;ACtBD;;AAEG;;;;"}
@@ -7,11 +7,16 @@ import * as i2 from '@angular/common';
7
7
  import { CommonModule } from '@angular/common';
8
8
  import { take } from 'rxjs/operators';
9
9
 
10
+ /**
11
+ * Used to provide default configurations on module level
12
+ */
10
13
  class EntryDialogConfig {
11
14
  constructor(config = {}) {
12
15
  this.confirmButtonText = config.confirmButtonText ?? 'Ok';
13
16
  this.cancelButtonText = config.cancelButtonText ?? 'Cancel';
14
17
  this.buttonsAlignment = config.buttonsAlignment ?? 'align-right';
18
+ this.hideClose = config.hideClose ?? false;
19
+ this.disableClose = config.disableClose ?? false;
15
20
  }
16
21
  }
17
22
  const ENTRY_DIALOG_CONFIG = new InjectionToken('EntryDialogConfig', {
@@ -19,17 +24,21 @@ const ENTRY_DIALOG_CONFIG = new InjectionToken('EntryDialogConfig', {
19
24
  factory: () => new EntryDialogConfig()
20
25
  });
21
26
 
27
+ /**
28
+ * Base Entry dialog component. Must be extended when building custom dialogs.
29
+ */
22
30
  class EntryDialogComponent {
23
31
  constructor(mdDialogRef, config) {
24
32
  this.mdDialogRef = mdDialogRef;
25
33
  this.config = config;
26
- this.buttons = {
27
- buttonsAlignment: this.config.buttonsAlignment,
28
- confirmButtonText: this.config.confirmButtonText,
29
- cancelButtonText: this.config.cancelButtonText,
30
- visible: true
31
- };
32
- this.disableConfirm = false;
34
+ /** @property buttonsAlignment - Dialog buttons horizontal alignment */
35
+ this.buttonsAlignment = this.config.buttonsAlignment;
36
+ /** @property confirmButtonText - Confirm button label */
37
+ this.confirmButtonText = this.config.confirmButtonText;
38
+ /** @property cancelButtonText - Cancel button label */
39
+ this.cancelButtonText = this.config.cancelButtonText;
40
+ /** @property hideClose - Show or hide dialog close button */
41
+ this.hideClose = this.config.hideClose;
33
42
  this.confirm = () => of(true);
34
43
  this.cancel = () => this.close(false);
35
44
  this.onEsc = () => this.cancel();
@@ -46,16 +55,26 @@ class EntryDialogComponent {
46
55
  }
47
56
  }
48
57
  EntryDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: EntryDialogComponent, deps: [{ token: i1.MatDialogRef }, { token: ENTRY_DIALOG_CONFIG }], target: i0.ɵɵFactoryTarget.Component });
49
- EntryDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: EntryDialogComponent, selector: "entry-dialog", inputs: { title: "title", buttons: "buttons", disableConfirm: "disableConfirm", buttonsTemplate: "buttonsTemplate", confirm: "confirm", cancel: "cancel" }, host: { listeners: { "keydown.esc": "onEsc()" } }, ngImport: i0, template: "<div class=\"dialog-form\">\n <div class=\"dialog-header\">\n <h1 class=\"dialog-title\">\n {{ title }}\n </h1>\n\n <button type=\"button\" class=\"dialog-close-button\" (click)=\"cancel()\">\n <span class=\"icon-close dialog-close-icon\"></span>\n </button>\n </div>\n\n <mat-dialog-content\n class=\"dialog-content\"\n [ngClass]=\"{'with-actions': buttons.visible}\">\n <ng-content></ng-content>\n </mat-dialog-content>\n\n <ng-template [ngIf]=\"buttonsTemplate\" [ngIfElse]=\"defaultButtonsTemplate\">\n <ng-template [ngTemplateOutlet]=\"buttonsTemplate\"></ng-template>\n </ng-template>\n\n <ng-template #defaultButtonsTemplate>\n <div *ngIf=\"buttons.visible\" class=\"dialog-footer {{ buttons.buttonsAlignment }}\">\n <button\n type=\"button\"\n class=\"button button-accent dialog-footer-button\"\n cdkFocusInitial\n (click)=\"onSubmit()\">{{buttons.confirmButtonText}}</button>\n <button\n type=\"button\"\n class=\"button button-primary dialog-footer-button\"\n *ngIf=\"buttons.cancelButtonText !== ''\"\n (click)=\"cancel()\">{{buttons.cancelButtonText}}</button>\n </div>\n </ng-template>\n</div>", styles: [".align-center{margin:auto}\n"], directives: [{ type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
58
+ EntryDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: EntryDialogComponent, selector: "entry-dialog", inputs: { title: "title", buttonsAlignment: "buttonsAlignment", confirmButtonText: "confirmButtonText", cancelButtonText: "cancelButtonText", hideButtons: "hideButtons", hideCancel: "hideCancel", hideClose: "hideClose", disableConfirm: "disableConfirm", buttonsTemplate: "buttonsTemplate", confirm: "confirm", cancel: "cancel" }, host: { listeners: { "keydown.esc": "onEsc()" } }, ngImport: i0, template: "<div class=\"dialog-form\">\n <div class=\"dialog-header\">\n <h1 class=\"dialog-title\">{{title}}</h1>\n\n <button *ngIf=\"!hideClose\" type=\"button\" class=\"dialog-close-button\" (click)=\"cancel()\">\n <span class=\"icon-close dialog-close-icon\"></span>\n </button>\n </div>\n\n <mat-dialog-content class=\"dialog-content\" [ngClass]=\"{'with-actions': !hideButtons}\">\n <ng-content></ng-content>\n </mat-dialog-content>\n\n <ng-template [ngIf]=\"buttonsTemplate\" [ngIfElse]=\"defaultButtonsTemplate\">\n <ng-template [ngTemplateOutlet]=\"buttonsTemplate\"></ng-template>\n </ng-template>\n\n <ng-template #defaultButtonsTemplate>\n <div *ngIf=\"!hideButtons\" class=\"dialog-footer {{ buttonsAlignment }}\">\n <button\n type=\"button\"\n class=\"button button-accent dialog-footer-button\"\n cdkFocusInitial\n (click)=\"onSubmit()\">{{confirmButtonText}}</button>\n <button\n type=\"button\"\n class=\"button button-primary dialog-footer-button\"\n *ngIf=\"!hideCancel\"\n (click)=\"cancel()\">{{cancelButtonText}}</button>\n </div>\n </ng-template>\n</div>", styles: [".align-center{margin:auto}\n"], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
50
59
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: EntryDialogComponent, decorators: [{
51
60
  type: Component,
52
- args: [{ selector: 'entry-dialog', template: "<div class=\"dialog-form\">\n <div class=\"dialog-header\">\n <h1 class=\"dialog-title\">\n {{ title }}\n </h1>\n\n <button type=\"button\" class=\"dialog-close-button\" (click)=\"cancel()\">\n <span class=\"icon-close dialog-close-icon\"></span>\n </button>\n </div>\n\n <mat-dialog-content\n class=\"dialog-content\"\n [ngClass]=\"{'with-actions': buttons.visible}\">\n <ng-content></ng-content>\n </mat-dialog-content>\n\n <ng-template [ngIf]=\"buttonsTemplate\" [ngIfElse]=\"defaultButtonsTemplate\">\n <ng-template [ngTemplateOutlet]=\"buttonsTemplate\"></ng-template>\n </ng-template>\n\n <ng-template #defaultButtonsTemplate>\n <div *ngIf=\"buttons.visible\" class=\"dialog-footer {{ buttons.buttonsAlignment }}\">\n <button\n type=\"button\"\n class=\"button button-accent dialog-footer-button\"\n cdkFocusInitial\n (click)=\"onSubmit()\">{{buttons.confirmButtonText}}</button>\n <button\n type=\"button\"\n class=\"button button-primary dialog-footer-button\"\n *ngIf=\"buttons.cancelButtonText !== ''\"\n (click)=\"cancel()\">{{buttons.cancelButtonText}}</button>\n </div>\n </ng-template>\n</div>", styles: [".align-center{margin:auto}\n"] }]
61
+ args: [{ selector: 'entry-dialog', template: "<div class=\"dialog-form\">\n <div class=\"dialog-header\">\n <h1 class=\"dialog-title\">{{title}}</h1>\n\n <button *ngIf=\"!hideClose\" type=\"button\" class=\"dialog-close-button\" (click)=\"cancel()\">\n <span class=\"icon-close dialog-close-icon\"></span>\n </button>\n </div>\n\n <mat-dialog-content class=\"dialog-content\" [ngClass]=\"{'with-actions': !hideButtons}\">\n <ng-content></ng-content>\n </mat-dialog-content>\n\n <ng-template [ngIf]=\"buttonsTemplate\" [ngIfElse]=\"defaultButtonsTemplate\">\n <ng-template [ngTemplateOutlet]=\"buttonsTemplate\"></ng-template>\n </ng-template>\n\n <ng-template #defaultButtonsTemplate>\n <div *ngIf=\"!hideButtons\" class=\"dialog-footer {{ buttonsAlignment }}\">\n <button\n type=\"button\"\n class=\"button button-accent dialog-footer-button\"\n cdkFocusInitial\n (click)=\"onSubmit()\">{{confirmButtonText}}</button>\n <button\n type=\"button\"\n class=\"button button-primary dialog-footer-button\"\n *ngIf=\"!hideCancel\"\n (click)=\"cancel()\">{{cancelButtonText}}</button>\n </div>\n </ng-template>\n</div>", styles: [".align-center{margin:auto}\n"] }]
53
62
  }], ctorParameters: function () { return [{ type: i1.MatDialogRef }, { type: EntryDialogConfig, decorators: [{
54
63
  type: Inject,
55
64
  args: [ENTRY_DIALOG_CONFIG]
56
65
  }] }]; }, propDecorators: { title: [{
57
66
  type: Input
58
- }], buttons: [{
67
+ }], buttonsAlignment: [{
68
+ type: Input
69
+ }], confirmButtonText: [{
70
+ type: Input
71
+ }], cancelButtonText: [{
72
+ type: Input
73
+ }], hideButtons: [{
74
+ type: Input
75
+ }], hideCancel: [{
76
+ type: Input
77
+ }], hideClose: [{
59
78
  type: Input
60
79
  }], disableConfirm: [{
61
80
  type: Input
@@ -76,19 +95,13 @@ class EntryAlertDialogComponent extends EntryDialogComponent {
76
95
  this.mdDialogRef = mdDialogRef;
77
96
  this.config = config;
78
97
  this.data = data;
79
- this.buttons = {
80
- confirmButtonText: this.data.confirmText ?? this.config.confirmButtonText,
81
- cancelButtonText: '',
82
- buttonsAlignment: 'align-center',
83
- visible: true
84
- };
85
98
  }
86
99
  }
87
100
  EntryAlertDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: EntryAlertDialogComponent, deps: [{ token: i1.MatDialogRef }, { token: ENTRY_DIALOG_CONFIG }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component });
88
- EntryAlertDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: EntryAlertDialogComponent, selector: "entry-alert-dialog", usesInheritance: true, ngImport: i0, template: "<entry-dialog [title]='data.title' [buttons]=\"buttons\">\n <p>{{data.message}}</p>\n</entry-dialog>", styles: [""], components: [{ type: EntryDialogComponent, selector: "entry-dialog", inputs: ["title", "buttons", "disableConfirm", "buttonsTemplate", "confirm", "cancel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
101
+ EntryAlertDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: EntryAlertDialogComponent, selector: "entry-alert-dialog", usesInheritance: true, ngImport: i0, template: "<entry-dialog\n [title]=\"data.title\"\n [confirmButtonText]=\"data.confirmText ?? config.confirmButtonText\"\n [buttonsAlignment]=\"'align-center'\"\n [hideCancel]=\"true\">\n <p>{{data.message}}</p>\n</entry-dialog>", styles: [""], components: [{ type: EntryDialogComponent, selector: "entry-dialog", inputs: ["title", "buttonsAlignment", "confirmButtonText", "cancelButtonText", "hideButtons", "hideCancel", "hideClose", "disableConfirm", "buttonsTemplate", "confirm", "cancel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
89
102
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: EntryAlertDialogComponent, decorators: [{
90
103
  type: Component,
91
- args: [{ selector: 'entry-alert-dialog', changeDetection: ChangeDetectionStrategy.OnPush, template: "<entry-dialog [title]='data.title' [buttons]=\"buttons\">\n <p>{{data.message}}</p>\n</entry-dialog>", styles: [""] }]
104
+ args: [{ selector: 'entry-alert-dialog', changeDetection: ChangeDetectionStrategy.OnPush, template: "<entry-dialog\n [title]=\"data.title\"\n [confirmButtonText]=\"data.confirmText ?? config.confirmButtonText\"\n [buttonsAlignment]=\"'align-center'\"\n [hideCancel]=\"true\">\n <p>{{data.message}}</p>\n</entry-dialog>", styles: [""] }]
92
105
  }], ctorParameters: function () { return [{ type: i1.MatDialogRef }, { type: EntryDialogConfig, decorators: [{
93
106
  type: Inject,
94
107
  args: [ENTRY_DIALOG_CONFIG]
@@ -103,19 +116,13 @@ class EntryConfirmDialogComponent extends EntryDialogComponent {
103
116
  this.mdDialogRef = mdDialogRef;
104
117
  this.config = config;
105
118
  this.data = data;
106
- this.buttons = {
107
- confirmButtonText: this.data.confirmText ?? this.config.confirmButtonText,
108
- cancelButtonText: this.data.cancelText ?? this.config.cancelButtonText,
109
- buttonsAlignment: 'align-right',
110
- visible: true
111
- };
112
119
  }
113
120
  }
114
121
  EntryConfirmDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: EntryConfirmDialogComponent, deps: [{ token: i1.MatDialogRef }, { token: ENTRY_DIALOG_CONFIG }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component });
115
- EntryConfirmDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: EntryConfirmDialogComponent, selector: "entry-confirm-dialog", usesInheritance: true, ngImport: i0, template: "<entry-dialog [title]='data.title' [buttons]=\"buttons\">\n <p>{{data.message}}</p>\n</entry-dialog>", styles: [""], components: [{ type: EntryDialogComponent, selector: "entry-dialog", inputs: ["title", "buttons", "disableConfirm", "buttonsTemplate", "confirm", "cancel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
122
+ EntryConfirmDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: EntryConfirmDialogComponent, selector: "entry-confirm-dialog", usesInheritance: true, ngImport: i0, template: "<entry-dialog\n [title]=\"data.title\"\n [confirmButtonText]=\"data.confirmText ?? config.confirmButtonText\"\n [cancelButtonText]=\"data.cancelText ?? config.cancelButtonText\"\n [buttonsAlignment]=\"'align-right'\"\n [hideClose]=\"true\">\n <p>{{data.message}}</p>\n</entry-dialog>", styles: [""], components: [{ type: EntryDialogComponent, selector: "entry-dialog", inputs: ["title", "buttonsAlignment", "confirmButtonText", "cancelButtonText", "hideButtons", "hideCancel", "hideClose", "disableConfirm", "buttonsTemplate", "confirm", "cancel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
116
123
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: EntryConfirmDialogComponent, decorators: [{
117
124
  type: Component,
118
- args: [{ selector: 'entry-confirm-dialog', changeDetection: ChangeDetectionStrategy.OnPush, template: "<entry-dialog [title]='data.title' [buttons]=\"buttons\">\n <p>{{data.message}}</p>\n</entry-dialog>", styles: [""] }]
125
+ args: [{ selector: 'entry-confirm-dialog', changeDetection: ChangeDetectionStrategy.OnPush, template: "<entry-dialog\n [title]=\"data.title\"\n [confirmButtonText]=\"data.confirmText ?? config.confirmButtonText\"\n [cancelButtonText]=\"data.cancelText ?? config.cancelButtonText\"\n [buttonsAlignment]=\"'align-right'\"\n [hideClose]=\"true\">\n <p>{{data.message}}</p>\n</entry-dialog>", styles: [""] }]
119
126
  }], ctorParameters: function () { return [{ type: i1.MatDialogRef }, { type: EntryDialogConfig, decorators: [{
120
127
  type: Inject,
121
128
  args: [ENTRY_DIALOG_CONFIG]
@@ -125,34 +132,41 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
125
132
  }] }]; } });
126
133
 
127
134
  class EntryDialogService {
128
- constructor(matDialog) {
135
+ constructor(config, matDialog) {
136
+ this.config = config;
129
137
  this.matDialog = matDialog;
130
138
  /**
131
139
  * Opens alert dialog
132
140
  *
133
141
  * @param data - Contains title, message and optional confirm button text of IEntryAlertDialogData type
142
+ * @param disableClose - Optional parameter that disable closing dialog when pressing escape or clicking on backdrop
134
143
  * @returns Observable of any
135
144
  */
136
- this.openAlert = (data) => this.open(EntryAlertDialogComponent, data);
145
+ this.openAlert = (data, disableClose = undefined) => this.open(EntryAlertDialogComponent, data, disableClose);
137
146
  /**
138
147
  * Opens confirm dialog
139
148
  *
140
149
  * @param data - Contains title, message and optional confirm/cancel buttons text of IEntryConfirmDialogData type
150
+ * @param disableClose - Optional parameter that disable closing dialog when pressing escape or clicking on backdrop
141
151
  * @returns Observable of bool or undefined, `true` if confirmed, `false` if canceled or closed
142
- * , `undefined` if closed by clicking outside of the dialog
152
+ * , `undefined` if closed by clicking on backdrop or pressing escape
143
153
  */
144
- this.openConfirm = (data) => this.open(EntryConfirmDialogComponent, data);
154
+ this.openConfirm = (data, disableClose = true) => this.open(EntryConfirmDialogComponent, data, disableClose);
145
155
  /**
146
156
  * Opens dialog with custom component
147
157
  *
148
158
  * @param component - Dialog custom component implementation
149
159
  * @param data - Optional parameter used to supply component with input parameters
160
+ * @param disableClose - Optional parameter that disable closing dialog when pressing escape or clicking on backdrop
150
161
  * @param cssClass - Optional parameter used to set custom class to Material overlay pane
151
162
  * @returns Observable of any containing result of dialog with custom component
152
163
  */
153
- this.open = (component, data = undefined, cssClass = '') => {
164
+ this.open = (component, data = undefined, disableClose = undefined, cssClass = '') => {
154
165
  const configuration = new MatDialogConfig();
155
166
  configuration.data = data;
167
+ configuration.disableClose = disableClose === undefined
168
+ ? this.config.disableClose
169
+ : disableClose;
156
170
  this.setPanelClassFor(configuration, cssClass);
157
171
  return this.matDialog
158
172
  .open(component, configuration)
@@ -165,14 +179,17 @@ class EntryDialogService {
165
179
  };
166
180
  }
167
181
  }
168
- EntryDialogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: EntryDialogService, deps: [{ token: i1.MatDialog }], target: i0.ɵɵFactoryTarget.Injectable });
182
+ EntryDialogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: EntryDialogService, deps: [{ token: ENTRY_DIALOG_CONFIG }, { token: i1.MatDialog }], target: i0.ɵɵFactoryTarget.Injectable });
169
183
  EntryDialogService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: EntryDialogService, providedIn: 'root' });
170
184
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: EntryDialogService, decorators: [{
171
185
  type: Injectable,
172
186
  args: [{
173
187
  providedIn: 'root'
174
188
  }]
175
- }], ctorParameters: function () { return [{ type: i1.MatDialog }]; } });
189
+ }], ctorParameters: function () { return [{ type: EntryDialogConfig, decorators: [{
190
+ type: Inject,
191
+ args: [ENTRY_DIALOG_CONFIG]
192
+ }] }, { type: i1.MatDialog }]; } });
176
193
 
177
194
  class EntryDialogModule {
178
195
  }