@apipass/modals 0.1.1-beta.4 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apipass-modals.metadata.json +1 -1
- package/bundles/apipass-modals.umd.js +49 -19
- package/bundles/apipass-modals.umd.js.map +1 -1
- package/bundles/apipass-modals.umd.min.js +1 -1
- package/bundles/apipass-modals.umd.min.js.map +1 -1
- package/esm2015/lib/confirm-remove-modal.component.js +41 -17
- package/esm2015/modals.module.js +5 -1
- package/fesm2015/apipass-modals.js +44 -16
- package/fesm2015/apipass-modals.js.map +1 -1
- package/lib/confirm-remove-modal.component.d.ts +38 -0
- package/package.json +4 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"__symbolic":"module","version":4,"metadata":{"ModalsModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":
|
|
1
|
+
{"__symbolic":"module","version":4,"metadata":{"ModalsModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":11,"character":1},"arguments":[{"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule","line":13,"character":4},{"__symbolic":"reference","module":"@angular/material/dialog","name":"MatDialogModule","line":14,"character":4},{"__symbolic":"reference","module":"@angular/material/form-field","name":"MatFormFieldModule","line":15,"character":4},{"__symbolic":"reference","module":"@angular/forms","name":"FormsModule","line":16,"character":4},{"__symbolic":"reference","module":"@angular/material/input","name":"MatInputModule","line":17,"character":4},{"__symbolic":"reference","module":"@apipass/inputs","name":"InputsModule","line":18,"character":4},{"__symbolic":"reference","module":"@apipass/buttons","name":"ButtonsModule","line":19,"character":4},{"__symbolic":"reference","module":"@apipass/icons","name":"IconsModule","line":20,"character":4}],"declarations":[{"__symbolic":"reference","name":"ConfirmRemoveModalComponent"},{"__symbolic":"reference","name":"ConfirmRemoveModalDataComponent"}],"exports":[{"__symbolic":"reference","name":"ConfirmRemoveModalComponent"},{"__symbolic":"reference","name":"ConfirmRemoveModalDataComponent"}],"entryComponents":[{"__symbolic":"reference","name":"ConfirmRemoveModalDataComponent"}],"providers":[]}]}],"members":{}},"DialogRole":{"__symbolic":"interface"},"DialogPosition":{"__symbolic":"interface"},"DialogConfig":{"__symbolic":"class","members":{}},"DialogData":{"__symbolic":"interface"},"ConfirmRemoveModalComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":51,"character":1},"arguments":[{"selector":"confirm-remove-modal","template":""}]}],"members":{"title":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":57,"character":3}}]}],"content":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":58,"character":3}}]}],"confirmIcon":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":59,"character":3}}]}],"confirmText":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":60,"character":3}}]}],"removeTextLabel":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":61,"character":3}}]}],"removeTextConfirm":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":62,"character":3}}]}],"showCloseIcon":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":63,"character":3}}]}],"closeLabel":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":64,"character":3}}]}],"dialogConfig":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":66,"character":3}}]}],"openModal":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":68,"character":3}}]}],"confirmModal":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":69,"character":3}}]}],"closeModal":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":70,"character":3}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/material/dialog","name":"MatDialog","line":72,"character":29}]}],"ngOnInit":[{"__symbolic":"method"}]}},"ConfirmRemoveModalDataComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":108,"character":1},"arguments":[{"selector":"confirm-remove-modal-data","template":"<div class=\"modal-title\">\r\n <h3 *ngIf=\"data.title\" mat-dialog-title>\r\n {{data.title}}\r\n </h3>\r\n <icon *ngIf=\"data.showCloseIcon\" type=\"tertiary clickable\" name=\"fas fa-times\" [title]=\"data.closeLabel\" (onClick)=\"closeClick()\"></icon>\r\n</div>\r\n\r\n<div class=\"modal-content\" mat-dialog-content>\r\n <p *ngIf=\"data.content\" [innerHTML]=\"data.content\"></p>\r\n <input-text *ngIf=\"data.removeTextConfirm\" [label]=\"data.removeTextLabel\" [(ngModel)]=\"data.removeText\"></input-text>\r\n</div>\r\n\r\n<div class=\"modal-actions\" mat-dialog-actions>\r\n <secondary-button [btnDisabled]=\"isConfirmDisabled()\" [icon]=\"data.confirmIcon\" [label]=\"data.confirmText\" (onClick)=\"confirmClick()\"></secondary-button>\r\n</div>\r\n","styles":[".modal-title{align-items:flex-start;display:flex;justify-content:center;position:relative;width:100%}.modal-title h3{font-weight:700;margin:0;text-align:center;width:100%}.modal-title icon{position:absolute;right:-5px;top:-5px}.modal-content{margin-top:20px;text-align:center;width:100%}.modal-content input-text{width:80%}.modal-actions{align-items:center;display:flex;justify-content:center;width:100%}"]}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":117,"character":5},"arguments":[{"__symbolic":"reference","module":"@angular/material/dialog","name":"MAT_DIALOG_DATA","line":117,"character":12}]}]],"parameters":[{"__symbolic":"reference","name":"MatDialogRef","module":"@angular/material/dialog","arguments":[{"__symbolic":"reference","name":"ConfirmRemoveModalDataComponent"}]},{"__symbolic":"reference","name":"any"}]}],"closeClick":[{"__symbolic":"method"}],"confirmClick":[{"__symbolic":"method"}],"isConfirmDisabled":[{"__symbolic":"method"}]}}},"origins":{"ModalsModule":"./modals.module","DialogRole":"./lib/confirm-remove-modal.component","DialogPosition":"./lib/confirm-remove-modal.component","DialogConfig":"./lib/confirm-remove-modal.component","DialogData":"./lib/confirm-remove-modal.component","ConfirmRemoveModalComponent":"./lib/confirm-remove-modal.component","ConfirmRemoveModalDataComponent":"./lib/confirm-remove-modal.component"},"importAs":"@apipass/modals"}
|
|
@@ -1,18 +1,26 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/material/dialog'), require('@angular/material/form-field'), require('@angular/forms'), require('@angular/material/input'), require('@apipass/buttons')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@apipass/modals', ['exports', '@angular/core', '@angular/common', '@angular/material/dialog', '@angular/material/form-field', '@angular/forms', '@angular/material/input', '@apipass/buttons'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.apipass = global.apipass || {}, global.apipass.modals = {}), global.ng.core, global.ng.common, global.ng.material.dialog, global.ng.material.formField, global.ng.forms, global.ng.material.input, global.buttons));
|
|
5
|
-
}(this, (function (exports, core, common, dialog, formField, forms, input, buttons) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/material/dialog'), require('@angular/material/form-field'), require('@angular/forms'), require('@angular/material/input'), require('@apipass/buttons'), require('@apipass/icons'), require('@apipass/inputs')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@apipass/modals', ['exports', '@angular/core', '@angular/common', '@angular/material/dialog', '@angular/material/form-field', '@angular/forms', '@angular/material/input', '@apipass/buttons', '@apipass/icons', '@apipass/inputs'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.apipass = global.apipass || {}, global.apipass.modals = {}), global.ng.core, global.ng.common, global.ng.material.dialog, global.ng.material.formField, global.ng.forms, global.ng.material.input, global.buttons, global.icons, global.inputs));
|
|
5
|
+
}(this, (function (exports, core, common, dialog, formField, forms, input, buttons, icons, inputs) { 'use strict';
|
|
6
6
|
|
|
7
|
+
var DialogConfig = /** @class */ (function () {
|
|
8
|
+
function DialogConfig() {
|
|
9
|
+
}
|
|
10
|
+
return DialogConfig;
|
|
11
|
+
}());
|
|
7
12
|
var ConfirmRemoveModalComponent = /** @class */ (function () {
|
|
8
13
|
function ConfirmRemoveModalComponent(dialog) {
|
|
9
14
|
this.dialog = dialog;
|
|
10
15
|
this.title = '';
|
|
11
16
|
this.content = '';
|
|
12
17
|
this.confirmIcon = '';
|
|
13
|
-
this.confirmText =
|
|
18
|
+
this.confirmText = 'Remove';
|
|
14
19
|
this.removeTextLabel = '';
|
|
15
20
|
this.removeTextConfirm = '';
|
|
21
|
+
this.showCloseIcon = true;
|
|
22
|
+
this.closeLabel = 'Close';
|
|
23
|
+
this.dialogConfig = new DialogConfig();
|
|
16
24
|
this.openModal = new core.EventEmitter();
|
|
17
25
|
this.confirmModal = new core.EventEmitter();
|
|
18
26
|
this.closeModal = new core.EventEmitter();
|
|
@@ -20,23 +28,26 @@
|
|
|
20
28
|
ConfirmRemoveModalComponent.prototype.ngOnInit = function () {
|
|
21
29
|
var _this = this;
|
|
22
30
|
this.openModal.subscribe(function () {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
_this.dialogConfig.data = {
|
|
32
|
+
title: _this.title,
|
|
33
|
+
content: _this.content,
|
|
34
|
+
confirmIcon: _this.confirmIcon,
|
|
35
|
+
confirmText: _this.confirmText,
|
|
36
|
+
removeText: '',
|
|
37
|
+
removeTextLabel: _this.removeTextLabel,
|
|
38
|
+
removeTextConfirm: _this.removeTextConfirm,
|
|
39
|
+
showCloseIcon: _this.showCloseIcon,
|
|
40
|
+
closeLabel: _this.closeLabel
|
|
41
|
+
};
|
|
42
|
+
var dialogRef = _this.dialog.open(ConfirmRemoveModalDataComponent, _this.dialogConfig);
|
|
35
43
|
dialogRef.afterClosed().subscribe(function (result) {
|
|
36
44
|
if (!result) {
|
|
37
45
|
_this.closeModal.next();
|
|
38
46
|
_this.confirmModal.next(false);
|
|
39
47
|
}
|
|
48
|
+
if (!_this.removeTextConfirm) {
|
|
49
|
+
_this.confirmModal.next(true);
|
|
50
|
+
}
|
|
40
51
|
if ((result === null || result === void 0 ? void 0 : result.removeText) !== _this.removeTextConfirm) {
|
|
41
52
|
_this.confirmModal.next(false);
|
|
42
53
|
}
|
|
@@ -64,6 +75,9 @@
|
|
|
64
75
|
confirmText: [{ type: core.Input }],
|
|
65
76
|
removeTextLabel: [{ type: core.Input }],
|
|
66
77
|
removeTextConfirm: [{ type: core.Input }],
|
|
78
|
+
showCloseIcon: [{ type: core.Input }],
|
|
79
|
+
closeLabel: [{ type: core.Input }],
|
|
80
|
+
dialogConfig: [{ type: core.Input }],
|
|
67
81
|
openModal: [{ type: core.Input }],
|
|
68
82
|
confirmModal: [{ type: core.Output }],
|
|
69
83
|
closeModal: [{ type: core.Output }]
|
|
@@ -76,13 +90,26 @@
|
|
|
76
90
|
ConfirmRemoveModalDataComponent.prototype.closeClick = function () {
|
|
77
91
|
this.dialogRef.close();
|
|
78
92
|
};
|
|
93
|
+
ConfirmRemoveModalDataComponent.prototype.confirmClick = function () {
|
|
94
|
+
var _a, _b, _c;
|
|
95
|
+
if (!((_a = this.data) === null || _a === void 0 ? void 0 : _a.removeTextConfirm) || ((_b = this.data) === null || _b === void 0 ? void 0 : _b.removeText) === ((_c = this.data) === null || _c === void 0 ? void 0 : _c.removeTextConfirm)) {
|
|
96
|
+
this.dialogRef.close(this.data);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
ConfirmRemoveModalDataComponent.prototype.isConfirmDisabled = function () {
|
|
100
|
+
var _a, _b, _c;
|
|
101
|
+
if (!((_a = this.data) === null || _a === void 0 ? void 0 : _a.removeTextConfirm)) {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
return ((_b = this.data) === null || _b === void 0 ? void 0 : _b.removeText) !== ((_c = this.data) === null || _c === void 0 ? void 0 : _c.removeTextConfirm);
|
|
105
|
+
};
|
|
79
106
|
return ConfirmRemoveModalDataComponent;
|
|
80
107
|
}());
|
|
81
108
|
ConfirmRemoveModalDataComponent.decorators = [
|
|
82
109
|
{ type: core.Component, args: [{
|
|
83
110
|
selector: 'confirm-remove-modal-data',
|
|
84
|
-
template: "<
|
|
85
|
-
styles: [".
|
|
111
|
+
template: "<div class=\"modal-title\">\r\n <h3 *ngIf=\"data.title\" mat-dialog-title>\r\n {{data.title}}\r\n </h3>\r\n <icon *ngIf=\"data.showCloseIcon\" type=\"tertiary clickable\" name=\"fas fa-times\" [title]=\"data.closeLabel\" (onClick)=\"closeClick()\"></icon>\r\n</div>\r\n\r\n<div class=\"modal-content\" mat-dialog-content>\r\n <p *ngIf=\"data.content\" [innerHTML]=\"data.content\"></p>\r\n <input-text *ngIf=\"data.removeTextConfirm\" [label]=\"data.removeTextLabel\" [(ngModel)]=\"data.removeText\"></input-text>\r\n</div>\r\n\r\n<div class=\"modal-actions\" mat-dialog-actions>\r\n <secondary-button [btnDisabled]=\"isConfirmDisabled()\" [icon]=\"data.confirmIcon\" [label]=\"data.confirmText\" (onClick)=\"confirmClick()\"></secondary-button>\r\n</div>\r\n",
|
|
112
|
+
styles: [".modal-title{align-items:flex-start;display:flex;justify-content:center;position:relative;width:100%}.modal-title h3{font-weight:700;margin:0;text-align:center;width:100%}.modal-title icon{position:absolute;right:-5px;top:-5px}.modal-content{margin-top:20px;text-align:center;width:100%}.modal-content input-text{width:80%}.modal-actions{align-items:center;display:flex;justify-content:center;width:100%}"]
|
|
86
113
|
},] }
|
|
87
114
|
];
|
|
88
115
|
ConfirmRemoveModalDataComponent.ctorParameters = function () { return [
|
|
@@ -103,7 +130,9 @@
|
|
|
103
130
|
formField.MatFormFieldModule,
|
|
104
131
|
forms.FormsModule,
|
|
105
132
|
input.MatInputModule,
|
|
133
|
+
inputs.InputsModule,
|
|
106
134
|
buttons.ButtonsModule,
|
|
135
|
+
icons.IconsModule,
|
|
107
136
|
],
|
|
108
137
|
declarations: [
|
|
109
138
|
ConfirmRemoveModalComponent,
|
|
@@ -126,6 +155,7 @@
|
|
|
126
155
|
|
|
127
156
|
exports.ConfirmRemoveModalComponent = ConfirmRemoveModalComponent;
|
|
128
157
|
exports.ConfirmRemoveModalDataComponent = ConfirmRemoveModalDataComponent;
|
|
158
|
+
exports.DialogConfig = DialogConfig;
|
|
129
159
|
exports.ModalsModule = ModalsModule;
|
|
130
160
|
|
|
131
161
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apipass-modals.umd.js","sources":["../../../projects/modals/src/lib/confirm-remove-modal.component.ts","../../../projects/modals/src/modals.module.ts","../../../projects/modals/src/apipass-modals.ts"],"sourcesContent":["import {Component,
|
|
1
|
+
{"version":3,"file":"apipass-modals.umd.js","sources":["../../../projects/modals/src/lib/confirm-remove-modal.component.ts","../../../projects/modals/src/modals.module.ts","../../../projects/modals/src/apipass-modals.ts"],"sourcesContent":["import {Component, EventEmitter, Inject, Input, OnInit, Output} from '@angular/core';\r\nimport {MAT_DIALOG_DATA, MatDialog, MatDialogRef} from \"@angular/material/dialog\";\r\nimport {Direction} from \"@angular/cdk/bidi\";\r\n\r\nexport declare type DialogRole = 'dialog' | 'alertdialog';\r\n\r\nexport interface DialogPosition {\r\n top?: string;\r\n bottom?: string;\r\n left?: string;\r\n right?: string;\r\n}\r\n\r\nexport class DialogConfig {\r\n id?: string;\r\n role?: DialogRole;\r\n panelClass?: string | string[];\r\n hasBackdrop?: boolean;\r\n backdropClass?: string;\r\n disableClose?: boolean;\r\n\r\n width?: string;\r\n height?: string;\r\n minWidth?: number | string;\r\n minHeight?: number | string;\r\n maxWidth?: number | string;\r\n maxHeight?: number | string;\r\n\r\n data?: any;\r\n position?: DialogPosition;\r\n direction?: Direction;\r\n ariaDescribedBy?: string | null;\r\n ariaLabelledBy?: string | null;\r\n ariaLabel?: string | null;\r\n autoFocus?: boolean;\r\n restoreFocus?: boolean;\r\n closeOnNavigation?: boolean;\r\n}\r\n\r\nexport interface DialogData {\r\n title: string;\r\n content: string;\r\n confirmIcon: string;\r\n confirmText: string;\r\n removeText: string;\r\n removeTextLabel: string;\r\n removeTextConfirm: string;\r\n showCloseIcon: boolean;\r\n closeLabel: string;\r\n}\r\n\r\n@Component({\r\n selector: 'confirm-remove-modal',\r\n template: ``\r\n})\r\nexport class ConfirmRemoveModalComponent implements OnInit {\r\n\r\n @Input() public title: string = '';\r\n @Input() public content: string = '';\r\n @Input() public confirmIcon: string = '';\r\n @Input() public confirmText: string = 'Remove';\r\n @Input() public removeTextLabel: string = '';\r\n @Input() public removeTextConfirm: string = '';\r\n @Input() public showCloseIcon: boolean = true;\r\n @Input() public closeLabel: string = 'Close';\r\n\r\n @Input() public dialogConfig: DialogConfig = new DialogConfig();\r\n\r\n @Input() public openModal: EventEmitter<void> = new EventEmitter();\r\n @Output() public confirmModal: EventEmitter<boolean> = new EventEmitter();\r\n @Output() public closeModal: EventEmitter<void> = new EventEmitter();\r\n\r\n constructor(public dialog: MatDialog) {\r\n }\r\n\r\n ngOnInit(): void {\r\n this.openModal.subscribe(() => {\r\n this.dialogConfig.data = {\r\n title: this.title,\r\n content: this.content,\r\n confirmIcon: this.confirmIcon,\r\n confirmText: this.confirmText,\r\n removeText: '',\r\n removeTextLabel: this.removeTextLabel,\r\n removeTextConfirm: this.removeTextConfirm,\r\n showCloseIcon: this.showCloseIcon,\r\n closeLabel: this.closeLabel\r\n };\r\n const dialogRef = this.dialog.open(ConfirmRemoveModalDataComponent, this.dialogConfig);\r\n dialogRef.afterClosed().subscribe((result: DialogData) => {\r\n if (!result) {\r\n this.closeModal.next()\r\n this.confirmModal.next(false);\r\n }\r\n if (!this.removeTextConfirm) {\r\n this.confirmModal.next(true);\r\n }\r\n if (result?.removeText !== this.removeTextConfirm) {\r\n this.confirmModal.next(false);\r\n } else {\r\n this.confirmModal.next(true);\r\n }\r\n });\r\n })\r\n }\r\n\r\n}\r\n\r\n@Component({\r\n selector: 'confirm-remove-modal-data',\r\n templateUrl: 'confirm-remove-modal.component.html',\r\n styleUrls: ['confirm-remove-modal.component.scss']\r\n})\r\nexport class ConfirmRemoveModalDataComponent {\r\n\r\n constructor(\r\n public dialogRef: MatDialogRef<ConfirmRemoveModalDataComponent>,\r\n @Inject(MAT_DIALOG_DATA) public data: DialogData,\r\n ) {\r\n }\r\n\r\n closeClick(): void {\r\n this.dialogRef.close();\r\n }\r\n\r\n confirmClick(): void {\r\n if (!this.data?.removeTextConfirm || this.data?.removeText === this.data?.removeTextConfirm) {\r\n this.dialogRef.close(this.data);\r\n }\r\n }\r\n\r\n isConfirmDisabled(): boolean {\r\n if (!this.data?.removeTextConfirm) {\r\n return false;\r\n }\r\n return this.data?.removeText !== this.data?.removeTextConfirm;\r\n }\r\n\r\n}\r\n","import {NgModule} from '@angular/core';\r\nimport {CommonModule} from '@angular/common';\r\nimport {ConfirmRemoveModalComponent, ConfirmRemoveModalDataComponent} from \"./lib/confirm-remove-modal.component\";\r\nimport {MatDialogModule} from \"@angular/material/dialog\";\r\nimport {MatFormFieldModule} from \"@angular/material/form-field\";\r\nimport {FormsModule} from \"@angular/forms\";\r\nimport {MatInputModule} from \"@angular/material/input\";\r\nimport {ButtonsModule} from \"@apipass/buttons\";\r\nimport {IconsModule} from \"@apipass/icons\";\r\nimport {InputsModule} from \"@apipass/inputs\";\r\n\r\n@NgModule({\r\n imports: [\r\n CommonModule,\r\n MatDialogModule,\r\n MatFormFieldModule,\r\n FormsModule,\r\n MatInputModule,\r\n InputsModule,\r\n ButtonsModule,\r\n IconsModule,\r\n ],\r\n declarations: [\r\n ConfirmRemoveModalComponent,\r\n ConfirmRemoveModalDataComponent\r\n ],\r\n exports: [\r\n ConfirmRemoveModalComponent,\r\n ConfirmRemoveModalDataComponent\r\n ],\r\n entryComponents: [\r\n ConfirmRemoveModalDataComponent\r\n ],\r\n providers: []\r\n})\r\nexport class ModalsModule { }\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["EventEmitter","Component","MatDialog","Input","Output","MatDialogRef","Inject","MAT_DIALOG_DATA","NgModule","CommonModule","MatDialogModule","MatFormFieldModule","FormsModule","MatInputModule","InputsModule","ButtonsModule","IconsModule"],"mappings":";;;;;;;QAaA;SAwBC;2BAAA;KAAA,IAAA;;QAmCC,qCAAmB,MAAiB;YAAjB,WAAM,GAAN,MAAM,CAAW;YAfpB,UAAK,GAAW,EAAE,CAAC;YACnB,YAAO,GAAW,EAAE,CAAC;YACrB,gBAAW,GAAW,EAAE,CAAC;YACzB,gBAAW,GAAW,QAAQ,CAAC;YAC/B,oBAAe,GAAW,EAAE,CAAC;YAC7B,sBAAiB,GAAW,EAAE,CAAC;YAC/B,kBAAa,GAAY,IAAI,CAAC;YAC9B,eAAU,GAAW,OAAO,CAAC;YAE7B,iBAAY,GAAiB,IAAI,YAAY,EAAE,CAAC;YAEhD,cAAS,GAAuB,IAAIA,iBAAY,EAAE,CAAC;YAClD,iBAAY,GAA0B,IAAIA,iBAA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bC,iBAAW;qBACZ;oBACD,YAAY,EAAE;wBACZ,2BAA2B;wBAC3B,+BAA+B;qBAChC;oBACD,OAAO,EAAE;wBACP,2BAA2B;wBAC3B,+BAA+B;qBAChC;oBACD,eAAe,EAAE;wBACf,+BAA+B;qBAChC;oBACD,SAAS,EAAE,EAAE;iBACd;;;IClCD;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("@angular/material/dialog"),require("@angular/material/form-field"),require("@angular/forms"),require("@angular/material/input"),require("@apipass/buttons")):"function"==typeof define&&define.amd?define("@apipass/modals",["exports","@angular/core","@angular/common","@angular/material/dialog","@angular/material/form-field","@angular/forms","@angular/material/input","@apipass/buttons"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).apipass=e.apipass||{},e.apipass.modals={}),e.ng.core,e.ng.common,e.ng.material.dialog,e.ng.material.formField,e.ng.forms,e.ng.material.input,e.buttons)}(this,(function(e,t,o,
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("@angular/material/dialog"),require("@angular/material/form-field"),require("@angular/forms"),require("@angular/material/input"),require("@apipass/buttons"),require("@apipass/icons"),require("@apipass/inputs")):"function"==typeof define&&define.amd?define("@apipass/modals",["exports","@angular/core","@angular/common","@angular/material/dialog","@angular/material/form-field","@angular/forms","@angular/material/input","@apipass/buttons","@apipass/icons","@apipass/inputs"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).apipass=e.apipass||{},e.apipass.modals={}),e.ng.core,e.ng.common,e.ng.material.dialog,e.ng.material.formField,e.ng.forms,e.ng.material.input,e.buttons,e.icons,e.inputs)}(this,(function(e,t,o,n,i,a,r,l,s,d){"use strict";var m=function(){},c=function(){function e(e){this.dialog=e,this.title="",this.content="",this.confirmIcon="",this.confirmText="Remove",this.removeTextLabel="",this.removeTextConfirm="",this.showCloseIcon=!0,this.closeLabel="Close",this.dialogConfig=new m,this.openModal=new t.EventEmitter,this.confirmModal=new t.EventEmitter,this.closeModal=new t.EventEmitter}return e.prototype.ngOnInit=function(){var e=this;this.openModal.subscribe((function(){e.dialogConfig.data={title:e.title,content:e.content,confirmIcon:e.confirmIcon,confirmText:e.confirmText,removeText:"",removeTextLabel:e.removeTextLabel,removeTextConfirm:e.removeTextConfirm,showCloseIcon:e.showCloseIcon,closeLabel:e.closeLabel},e.dialog.open(p,e.dialogConfig).afterClosed().subscribe((function(t){t||(e.closeModal.next(),e.confirmModal.next(!1)),e.removeTextConfirm||e.confirmModal.next(!0),(null==t?void 0:t.removeText)!==e.removeTextConfirm?e.confirmModal.next(!1):e.confirmModal.next(!0)}))}))},e}();c.decorators=[{type:t.Component,args:[{selector:"confirm-remove-modal",template:""}]}],c.ctorParameters=function(){return[{type:n.MatDialog}]},c.propDecorators={title:[{type:t.Input}],content:[{type:t.Input}],confirmIcon:[{type:t.Input}],confirmText:[{type:t.Input}],removeTextLabel:[{type:t.Input}],removeTextConfirm:[{type:t.Input}],showCloseIcon:[{type:t.Input}],closeLabel:[{type:t.Input}],dialogConfig:[{type:t.Input}],openModal:[{type:t.Input}],confirmModal:[{type:t.Output}],closeModal:[{type:t.Output}]};var p=function(){function e(e,t){this.dialogRef=e,this.data=t}return e.prototype.closeClick=function(){this.dialogRef.close()},e.prototype.confirmClick=function(){var e,t,o;(null===(e=this.data)||void 0===e?void 0:e.removeTextConfirm)&&(null===(t=this.data)||void 0===t?void 0:t.removeText)!==(null===(o=this.data)||void 0===o?void 0:o.removeTextConfirm)||this.dialogRef.close(this.data)},e.prototype.isConfirmDisabled=function(){var e,t,o;return!!(null===(e=this.data)||void 0===e?void 0:e.removeTextConfirm)&&(null===(t=this.data)||void 0===t?void 0:t.removeText)!==(null===(o=this.data)||void 0===o?void 0:o.removeTextConfirm)},e}();p.decorators=[{type:t.Component,args:[{selector:"confirm-remove-modal-data",template:'<div class="modal-title">\r\n <h3 *ngIf="data.title" mat-dialog-title>\r\n {{data.title}}\r\n </h3>\r\n <icon *ngIf="data.showCloseIcon" type="tertiary clickable" name="fas fa-times" [title]="data.closeLabel" (onClick)="closeClick()"></icon>\r\n</div>\r\n\r\n<div class="modal-content" mat-dialog-content>\r\n <p *ngIf="data.content" [innerHTML]="data.content"></p>\r\n <input-text *ngIf="data.removeTextConfirm" [label]="data.removeTextLabel" [(ngModel)]="data.removeText"></input-text>\r\n</div>\r\n\r\n<div class="modal-actions" mat-dialog-actions>\r\n <secondary-button [btnDisabled]="isConfirmDisabled()" [icon]="data.confirmIcon" [label]="data.confirmText" (onClick)="confirmClick()"></secondary-button>\r\n</div>\r\n',styles:[".modal-title{align-items:flex-start;display:flex;justify-content:center;position:relative;width:100%}.modal-title h3{font-weight:700;margin:0;text-align:center;width:100%}.modal-title icon{position:absolute;right:-5px;top:-5px}.modal-content{margin-top:20px;text-align:center;width:100%}.modal-content input-text{width:80%}.modal-actions{align-items:center;display:flex;justify-content:center;width:100%}"]}]}],p.ctorParameters=function(){return[{type:n.MatDialogRef},{type:void 0,decorators:[{type:t.Inject,args:[n.MAT_DIALOG_DATA]}]}]};var u=function(){};u.decorators=[{type:t.NgModule,args:[{imports:[o.CommonModule,n.MatDialogModule,i.MatFormFieldModule,a.FormsModule,r.MatInputModule,d.InputsModule,l.ButtonsModule,s.IconsModule],declarations:[c,p],exports:[c,p],entryComponents:[p],providers:[]}]}],e.ConfirmRemoveModalComponent=c,e.ConfirmRemoveModalDataComponent=p,e.DialogConfig=m,e.ModalsModule=u,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
2
2
|
//# sourceMappingURL=apipass-modals.umd.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../projects/modals/src/lib/confirm-remove-modal.component.ts","../../../projects/modals/src/modals.module.ts"],"names":["ConfirmRemoveModalComponent","dialog","this","title","content","confirmIcon","confirmText","removeTextLabel","removeTextConfirm","openModal","EventEmitter","confirmModal","closeModal","prototype","ngOnInit","_this","subscribe","
|
|
1
|
+
{"version":3,"sources":["../../../projects/modals/src/lib/confirm-remove-modal.component.ts","../../../projects/modals/src/modals.module.ts"],"names":["ConfirmRemoveModalComponent","dialog","this","title","content","confirmIcon","confirmText","removeTextLabel","removeTextConfirm","showCloseIcon","closeLabel","dialogConfig","DialogConfig","openModal","EventEmitter","confirmModal","closeModal","prototype","ngOnInit","_this","subscribe","data","removeText","open","ConfirmRemoveModalDataComponent","afterClosed","result","next","Component","args","selector","template","MatDialog","Input","Output","dialogRef","closeClick","close","confirmClick","_a","_b","_c","isConfirmDisabled","MatDialogRef","Inject","MAT_DIALOG_DATA","NgModule","imports","CommonModule","MatDialogModule","MatFormFieldModule","FormsModule","MatInputModule","InputsModule","ButtonsModule","IconsModule","declarations","exports","entryComponents","providers"],"mappings":"k4BAaA,0BA2DE,SAAAA,EAAmBC,GAAAC,KAAAD,OAAAA,EAfHC,KAAAC,MAAgB,GAChBD,KAAAE,QAAkB,GAClBF,KAAAG,YAAsB,GACtBH,KAAAI,YAAsB,SACtBJ,KAAAK,gBAA0B,GAC1BL,KAAAM,kBAA4B,GAC5BN,KAAAO,eAAyB,EACzBP,KAAAQ,WAAqB,QAErBR,KAAAS,aAA6B,IAAIC,EAEjCV,KAAAW,UAAgC,IAAIC,EAAAA,aACnCZ,KAAAa,aAAsC,IAAID,EAAAA,aAC1CZ,KAAAc,WAAiC,IAAIF,EAAAA,oBAKtDd,EAAAiB,UAAAC,SAAA,WAAA,IAAAC,EAAAjB,KACEA,KAAKW,UAAUO,WAAU,WACvBD,EAAKR,aAAaU,KAAO,CACvBlB,MAAOgB,EAAKhB,MACZC,QAASe,EAAKf,QACdC,YAAac,EAAKd,YAClBC,YAAaa,EAAKb,YAClBgB,WAAY,GACZf,gBAAiBY,EAAKZ,gBACtBC,kBAAmBW,EAAKX,kBACxBC,cAAeU,EAAKV,cACpBC,WAAYS,EAAKT,YAEDS,EAAKlB,O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CA7GkCY,EAAAA,6CAoH/BC,EAAAA,OAAMf,KAAA,CAACgB,EAAAA,4BClFZ,iCAxBCC,EAAAA,SAAQjB,KAAA,CAAC,CACRkB,QAAS,CACPC,EAAAA,aACAC,EAAAA,gBACAC,EAAAA,mBACAC,EAAAA,YACAC,EAAAA,eACAC,EAAAA,aACAC,EAAAA,cACAC,EAAAA,aAEFC,aAAc,CACZxD,EACAwB,GAEFiC,QAAS,CACPzD,EACAwB,GAEFkC,gBAAiB,CACflC,GAEFmC,UAAW","sourcesContent":["import {Component, EventEmitter, Inject, Input, OnInit, Output} from '@angular/core';\r\nimport {MAT_DIALOG_DATA, MatDialog, MatDialogRef} from \"@angular/material/dialog\";\r\nimport {Direction} from \"@angular/cdk/bidi\";\r\n\r\nexport declare type DialogRole = 'dialog' | 'alertdialog';\r\n\r\nexport interface DialogPosition {\r\n top?: string;\r\n bottom?: string;\r\n left?: string;\r\n right?: string;\r\n}\r\n\r\nexport class DialogConfig {\r\n id?: string;\r\n role?: DialogRole;\r\n panelClass?: string | string[];\r\n hasBackdrop?: boolean;\r\n backdropClass?: string;\r\n disableClose?: boolean;\r\n\r\n width?: string;\r\n height?: string;\r\n minWidth?: number | string;\r\n minHeight?: number | string;\r\n maxWidth?: number | string;\r\n maxHeight?: number | string;\r\n\r\n data?: any;\r\n position?: DialogPosition;\r\n direction?: Direction;\r\n ariaDescribedBy?: string | null;\r\n ariaLabelledBy?: string | null;\r\n ariaLabel?: string | null;\r\n autoFocus?: boolean;\r\n restoreFocus?: boolean;\r\n closeOnNavigation?: boolean;\r\n}\r\n\r\nexport interface DialogData {\r\n title: string;\r\n content: string;\r\n confirmIcon: string;\r\n confirmText: string;\r\n removeText: string;\r\n removeTextLabel: string;\r\n removeTextConfirm: string;\r\n showCloseIcon: boolean;\r\n closeLabel: string;\r\n}\r\n\r\n@Component({\r\n selector: 'confirm-remove-modal',\r\n template: ``\r\n})\r\nexport class ConfirmRemoveModalComponent implements OnInit {\r\n\r\n @Input() public title: string = '';\r\n @Input() public content: string = '';\r\n @Input() public confirmIcon: string = '';\r\n @Input() public confirmText: string = 'Remove';\r\n @Input() public removeTextLabel: string = '';\r\n @Input() public removeTextConfirm: string = '';\r\n @Input() public showCloseIcon: boolean = true;\r\n @Input() public closeLabel: string = 'Close';\r\n\r\n @Input() public dialogConfig: DialogConfig = new DialogConfig();\r\n\r\n @Input() public openModal: EventEmitter<void> = new EventEmitter();\r\n @Output() public confirmModal: EventEmitter<boolean> = new EventEmitter();\r\n @Output() public closeModal: EventEmitter<void> = new EventEmitter();\r\n\r\n constructor(public dialog: MatDialog) {\r\n }\r\n\r\n ngOnInit(): void {\r\n this.openModal.subscribe(() => {\r\n this.dialogConfig.data = {\r\n title: this.title,\r\n content: this.content,\r\n confirmIcon: this.confirmIcon,\r\n confirmText: this.confirmText,\r\n removeText: '',\r\n removeTextLabel: this.removeTextLabel,\r\n removeTextConfirm: this.removeTextConfirm,\r\n showCloseIcon: this.showCloseIcon,\r\n closeLabel: this.closeLabel\r\n };\r\n const dialogRef = this.dialog.open(ConfirmRemoveModalDataComponent, this.dialogConfig);\r\n dialogRef.afterClosed().subscribe((result: DialogData) => {\r\n if (!result) {\r\n this.closeModal.next()\r\n this.confirmModal.next(false);\r\n }\r\n if (!this.removeTextConfirm) {\r\n this.confirmModal.next(true);\r\n }\r\n if (result?.removeText !== this.removeTextConfirm) {\r\n this.confirmModal.next(false);\r\n } else {\r\n this.confirmModal.next(true);\r\n }\r\n });\r\n })\r\n }\r\n\r\n}\r\n\r\n@Component({\r\n selector: 'confirm-remove-modal-data',\r\n templateUrl: 'confirm-remove-modal.component.html',\r\n styleUrls: ['confirm-remove-modal.component.scss']\r\n})\r\nexport class ConfirmRemoveModalDataComponent {\r\n\r\n constructor(\r\n public dialogRef: MatDialogRef<ConfirmRemoveModalDataComponent>,\r\n @Inject(MAT_DIALOG_DATA) public data: DialogData,\r\n ) {\r\n }\r\n\r\n closeClick(): void {\r\n this.dialogRef.close();\r\n }\r\n\r\n confirmClick(): void {\r\n if (!this.data?.removeTextConfirm || this.data?.removeText === this.data?.removeTextConfirm) {\r\n this.dialogRef.close(this.data);\r\n }\r\n }\r\n\r\n isConfirmDisabled(): boolean {\r\n if (!this.data?.removeTextConfirm) {\r\n return false;\r\n }\r\n return this.data?.removeText !== this.data?.removeTextConfirm;\r\n }\r\n\r\n}\r\n","import {NgModule} from '@angular/core';\r\nimport {CommonModule} from '@angular/common';\r\nimport {ConfirmRemoveModalComponent, ConfirmRemoveModalDataComponent} from \"./lib/confirm-remove-modal.component\";\r\nimport {MatDialogModule} from \"@angular/material/dialog\";\r\nimport {MatFormFieldModule} from \"@angular/material/form-field\";\r\nimport {FormsModule} from \"@angular/forms\";\r\nimport {MatInputModule} from \"@angular/material/input\";\r\nimport {ButtonsModule} from \"@apipass/buttons\";\r\nimport {IconsModule} from \"@apipass/icons\";\r\nimport {InputsModule} from \"@apipass/inputs\";\r\n\r\n@NgModule({\r\n imports: [\r\n CommonModule,\r\n MatDialogModule,\r\n MatFormFieldModule,\r\n FormsModule,\r\n MatInputModule,\r\n InputsModule,\r\n ButtonsModule,\r\n IconsModule,\r\n ],\r\n declarations: [\r\n ConfirmRemoveModalComponent,\r\n ConfirmRemoveModalDataComponent\r\n ],\r\n exports: [\r\n ConfirmRemoveModalComponent,\r\n ConfirmRemoveModalDataComponent\r\n ],\r\n entryComponents: [\r\n ConfirmRemoveModalDataComponent\r\n ],\r\n providers: []\r\n})\r\nexport class ModalsModule { }\r\n"]}
|
|
@@ -1,37 +1,45 @@
|
|
|
1
|
-
import { Component,
|
|
1
|
+
import { Component, EventEmitter, Inject, Input, Output } from '@angular/core';
|
|
2
2
|
import { MAT_DIALOG_DATA, MatDialog, MatDialogRef } from "@angular/material/dialog";
|
|
3
|
+
export class DialogConfig {
|
|
4
|
+
}
|
|
3
5
|
export class ConfirmRemoveModalComponent {
|
|
4
6
|
constructor(dialog) {
|
|
5
7
|
this.dialog = dialog;
|
|
6
8
|
this.title = '';
|
|
7
9
|
this.content = '';
|
|
8
10
|
this.confirmIcon = '';
|
|
9
|
-
this.confirmText =
|
|
11
|
+
this.confirmText = 'Remove';
|
|
10
12
|
this.removeTextLabel = '';
|
|
11
13
|
this.removeTextConfirm = '';
|
|
14
|
+
this.showCloseIcon = true;
|
|
15
|
+
this.closeLabel = 'Close';
|
|
16
|
+
this.dialogConfig = new DialogConfig();
|
|
12
17
|
this.openModal = new EventEmitter();
|
|
13
18
|
this.confirmModal = new EventEmitter();
|
|
14
19
|
this.closeModal = new EventEmitter();
|
|
15
20
|
}
|
|
16
21
|
ngOnInit() {
|
|
17
22
|
this.openModal.subscribe(() => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
this.dialogConfig.data = {
|
|
24
|
+
title: this.title,
|
|
25
|
+
content: this.content,
|
|
26
|
+
confirmIcon: this.confirmIcon,
|
|
27
|
+
confirmText: this.confirmText,
|
|
28
|
+
removeText: '',
|
|
29
|
+
removeTextLabel: this.removeTextLabel,
|
|
30
|
+
removeTextConfirm: this.removeTextConfirm,
|
|
31
|
+
showCloseIcon: this.showCloseIcon,
|
|
32
|
+
closeLabel: this.closeLabel
|
|
33
|
+
};
|
|
34
|
+
const dialogRef = this.dialog.open(ConfirmRemoveModalDataComponent, this.dialogConfig);
|
|
30
35
|
dialogRef.afterClosed().subscribe((result) => {
|
|
31
36
|
if (!result) {
|
|
32
37
|
this.closeModal.next();
|
|
33
38
|
this.confirmModal.next(false);
|
|
34
39
|
}
|
|
40
|
+
if (!this.removeTextConfirm) {
|
|
41
|
+
this.confirmModal.next(true);
|
|
42
|
+
}
|
|
35
43
|
if ((result === null || result === void 0 ? void 0 : result.removeText) !== this.removeTextConfirm) {
|
|
36
44
|
this.confirmModal.next(false);
|
|
37
45
|
}
|
|
@@ -58,6 +66,9 @@ ConfirmRemoveModalComponent.propDecorators = {
|
|
|
58
66
|
confirmText: [{ type: Input }],
|
|
59
67
|
removeTextLabel: [{ type: Input }],
|
|
60
68
|
removeTextConfirm: [{ type: Input }],
|
|
69
|
+
showCloseIcon: [{ type: Input }],
|
|
70
|
+
closeLabel: [{ type: Input }],
|
|
71
|
+
dialogConfig: [{ type: Input }],
|
|
61
72
|
openModal: [{ type: Input }],
|
|
62
73
|
confirmModal: [{ type: Output }],
|
|
63
74
|
closeModal: [{ type: Output }]
|
|
@@ -70,16 +81,29 @@ export class ConfirmRemoveModalDataComponent {
|
|
|
70
81
|
closeClick() {
|
|
71
82
|
this.dialogRef.close();
|
|
72
83
|
}
|
|
84
|
+
confirmClick() {
|
|
85
|
+
var _a, _b, _c;
|
|
86
|
+
if (!((_a = this.data) === null || _a === void 0 ? void 0 : _a.removeTextConfirm) || ((_b = this.data) === null || _b === void 0 ? void 0 : _b.removeText) === ((_c = this.data) === null || _c === void 0 ? void 0 : _c.removeTextConfirm)) {
|
|
87
|
+
this.dialogRef.close(this.data);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
isConfirmDisabled() {
|
|
91
|
+
var _a, _b, _c;
|
|
92
|
+
if (!((_a = this.data) === null || _a === void 0 ? void 0 : _a.removeTextConfirm)) {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
return ((_b = this.data) === null || _b === void 0 ? void 0 : _b.removeText) !== ((_c = this.data) === null || _c === void 0 ? void 0 : _c.removeTextConfirm);
|
|
96
|
+
}
|
|
73
97
|
}
|
|
74
98
|
ConfirmRemoveModalDataComponent.decorators = [
|
|
75
99
|
{ type: Component, args: [{
|
|
76
100
|
selector: 'confirm-remove-modal-data',
|
|
77
|
-
template: "<
|
|
78
|
-
styles: [".
|
|
101
|
+
template: "<div class=\"modal-title\">\r\n <h3 *ngIf=\"data.title\" mat-dialog-title>\r\n {{data.title}}\r\n </h3>\r\n <icon *ngIf=\"data.showCloseIcon\" type=\"tertiary clickable\" name=\"fas fa-times\" [title]=\"data.closeLabel\" (onClick)=\"closeClick()\"></icon>\r\n</div>\r\n\r\n<div class=\"modal-content\" mat-dialog-content>\r\n <p *ngIf=\"data.content\" [innerHTML]=\"data.content\"></p>\r\n <input-text *ngIf=\"data.removeTextConfirm\" [label]=\"data.removeTextLabel\" [(ngModel)]=\"data.removeText\"></input-text>\r\n</div>\r\n\r\n<div class=\"modal-actions\" mat-dialog-actions>\r\n <secondary-button [btnDisabled]=\"isConfirmDisabled()\" [icon]=\"data.confirmIcon\" [label]=\"data.confirmText\" (onClick)=\"confirmClick()\"></secondary-button>\r\n</div>\r\n",
|
|
102
|
+
styles: [".modal-title{align-items:flex-start;display:flex;justify-content:center;position:relative;width:100%}.modal-title h3{font-weight:700;margin:0;text-align:center;width:100%}.modal-title icon{position:absolute;right:-5px;top:-5px}.modal-content{margin-top:20px;text-align:center;width:100%}.modal-content input-text{width:80%}.modal-actions{align-items:center;display:flex;justify-content:center;width:100%}"]
|
|
79
103
|
},] }
|
|
80
104
|
];
|
|
81
105
|
ConfirmRemoveModalDataComponent.ctorParameters = () => [
|
|
82
106
|
{ type: MatDialogRef },
|
|
83
107
|
{ type: undefined, decorators: [{ type: Inject, args: [MAT_DIALOG_DATA,] }] }
|
|
84
108
|
];
|
|
85
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
109
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlybS1yZW1vdmUtbW9kYWwuY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vcHJvamVjdHMvbW9kYWxzL3NyYy9saWIvY29uZmlybS1yZW1vdmUtbW9kYWwuY29tcG9uZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBQyxTQUFTLEVBQUUsWUFBWSxFQUFFLE1BQU0sRUFBRSxLQUFLLEVBQVUsTU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5kYXRhKTtcclxuICAgIH1cclxuICB9XHJcblxyXG4gIGlzQ29uZmlybURpc2FibGVkKCk6IGJvb2xlYW4ge1xyXG4gICAgaWYgKCF0aGlzLmRhdGE/LnJlbW92ZVRleHRDb25maXJtKSB7XHJcbiAgICAgIHJldHVybiBmYWxzZTtcclxuICAgIH1cclxuICAgIHJldHVybiB0aGlzLmRhdGE/LnJlbW92ZVRleHQgIT09IHRoaXMuZGF0YT8ucmVtb3ZlVGV4dENvbmZpcm07XHJcbiAgfVxyXG5cclxufVxyXG4iXX0=
|
package/esm2015/modals.module.js
CHANGED
|
@@ -6,6 +6,8 @@ import { MatFormFieldModule } from "@angular/material/form-field";
|
|
|
6
6
|
import { FormsModule } from "@angular/forms";
|
|
7
7
|
import { MatInputModule } from "@angular/material/input";
|
|
8
8
|
import { ButtonsModule } from "@apipass/buttons";
|
|
9
|
+
import { IconsModule } from "@apipass/icons";
|
|
10
|
+
import { InputsModule } from "@apipass/inputs";
|
|
9
11
|
export class ModalsModule {
|
|
10
12
|
}
|
|
11
13
|
ModalsModule.decorators = [
|
|
@@ -16,7 +18,9 @@ ModalsModule.decorators = [
|
|
|
16
18
|
MatFormFieldModule,
|
|
17
19
|
FormsModule,
|
|
18
20
|
MatInputModule,
|
|
21
|
+
InputsModule,
|
|
19
22
|
ButtonsModule,
|
|
23
|
+
IconsModule,
|
|
20
24
|
],
|
|
21
25
|
declarations: [
|
|
22
26
|
ConfirmRemoveModalComponent,
|
|
@@ -32,4 +36,4 @@ ModalsModule.decorators = [
|
|
|
32
36
|
providers: []
|
|
33
37
|
},] }
|
|
34
38
|
];
|
|
35
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
39
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9kYWxzLm1vZHVsZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3Byb2plY3RzL21vZGFscy9zcmMvbW9kYWxzL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gICBJbnB1dHNNb2R1bGUsXHJcbiAgICBCdXR0b25zTW9kdWxlLFxyXG4gICAgSWNvbnNNb2R1bGUsXHJcbiAgXSxcclxuICBkZWNsYXJhdGlvbnM6IFtcclxuICAgIENvbmZpcm1SZW1vdmVNb2RhbENvbXBvbmVudCxcclxuICAgIENvbmZpcm1SZW1vdmVNb2RhbERhdGFDb21wb25lbnRcclxuICBdLFxyXG4gIGV4cG9ydHM6IFtcclxuICAgIENvbmZpcm1SZW1vdmVNb2RhbENvbXBvbmVudCxcclxuICAgIENvbmZpcm1SZW1vdmVNb2RhbERhdGFDb21wb25lbnRcclxuICBdLFxyXG4gIGVudHJ5Q29tcG9uZW50czogW1xyXG4gICAgQ29uZmlybVJlbW92ZU1vZGFsRGF0YUNvbXBvbmVudFxyXG4gIF0sXHJcbiAgcHJvdmlkZXJzOiBbXVxyXG59KVxyXG5leHBvcnQgY2xhc3MgTW9kYWxzTW9kdWxlIHsgfVxyXG4iXX0=
|
|
@@ -5,39 +5,49 @@ import { MatFormFieldModule } from '@angular/material/form-field';
|
|
|
5
5
|
import { FormsModule } from '@angular/forms';
|
|
6
6
|
import { MatInputModule } from '@angular/material/input';
|
|
7
7
|
import { ButtonsModule } from '@apipass/buttons';
|
|
8
|
+
import { IconsModule } from '@apipass/icons';
|
|
9
|
+
import { InputsModule } from '@apipass/inputs';
|
|
8
10
|
|
|
11
|
+
class DialogConfig {
|
|
12
|
+
}
|
|
9
13
|
class ConfirmRemoveModalComponent {
|
|
10
14
|
constructor(dialog) {
|
|
11
15
|
this.dialog = dialog;
|
|
12
16
|
this.title = '';
|
|
13
17
|
this.content = '';
|
|
14
18
|
this.confirmIcon = '';
|
|
15
|
-
this.confirmText =
|
|
19
|
+
this.confirmText = 'Remove';
|
|
16
20
|
this.removeTextLabel = '';
|
|
17
21
|
this.removeTextConfirm = '';
|
|
22
|
+
this.showCloseIcon = true;
|
|
23
|
+
this.closeLabel = 'Close';
|
|
24
|
+
this.dialogConfig = new DialogConfig();
|
|
18
25
|
this.openModal = new EventEmitter();
|
|
19
26
|
this.confirmModal = new EventEmitter();
|
|
20
27
|
this.closeModal = new EventEmitter();
|
|
21
28
|
}
|
|
22
29
|
ngOnInit() {
|
|
23
30
|
this.openModal.subscribe(() => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
this.dialogConfig.data = {
|
|
32
|
+
title: this.title,
|
|
33
|
+
content: this.content,
|
|
34
|
+
confirmIcon: this.confirmIcon,
|
|
35
|
+
confirmText: this.confirmText,
|
|
36
|
+
removeText: '',
|
|
37
|
+
removeTextLabel: this.removeTextLabel,
|
|
38
|
+
removeTextConfirm: this.removeTextConfirm,
|
|
39
|
+
showCloseIcon: this.showCloseIcon,
|
|
40
|
+
closeLabel: this.closeLabel
|
|
41
|
+
};
|
|
42
|
+
const dialogRef = this.dialog.open(ConfirmRemoveModalDataComponent, this.dialogConfig);
|
|
36
43
|
dialogRef.afterClosed().subscribe((result) => {
|
|
37
44
|
if (!result) {
|
|
38
45
|
this.closeModal.next();
|
|
39
46
|
this.confirmModal.next(false);
|
|
40
47
|
}
|
|
48
|
+
if (!this.removeTextConfirm) {
|
|
49
|
+
this.confirmModal.next(true);
|
|
50
|
+
}
|
|
41
51
|
if ((result === null || result === void 0 ? void 0 : result.removeText) !== this.removeTextConfirm) {
|
|
42
52
|
this.confirmModal.next(false);
|
|
43
53
|
}
|
|
@@ -64,6 +74,9 @@ ConfirmRemoveModalComponent.propDecorators = {
|
|
|
64
74
|
confirmText: [{ type: Input }],
|
|
65
75
|
removeTextLabel: [{ type: Input }],
|
|
66
76
|
removeTextConfirm: [{ type: Input }],
|
|
77
|
+
showCloseIcon: [{ type: Input }],
|
|
78
|
+
closeLabel: [{ type: Input }],
|
|
79
|
+
dialogConfig: [{ type: Input }],
|
|
67
80
|
openModal: [{ type: Input }],
|
|
68
81
|
confirmModal: [{ type: Output }],
|
|
69
82
|
closeModal: [{ type: Output }]
|
|
@@ -76,12 +89,25 @@ class ConfirmRemoveModalDataComponent {
|
|
|
76
89
|
closeClick() {
|
|
77
90
|
this.dialogRef.close();
|
|
78
91
|
}
|
|
92
|
+
confirmClick() {
|
|
93
|
+
var _a, _b, _c;
|
|
94
|
+
if (!((_a = this.data) === null || _a === void 0 ? void 0 : _a.removeTextConfirm) || ((_b = this.data) === null || _b === void 0 ? void 0 : _b.removeText) === ((_c = this.data) === null || _c === void 0 ? void 0 : _c.removeTextConfirm)) {
|
|
95
|
+
this.dialogRef.close(this.data);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
isConfirmDisabled() {
|
|
99
|
+
var _a, _b, _c;
|
|
100
|
+
if (!((_a = this.data) === null || _a === void 0 ? void 0 : _a.removeTextConfirm)) {
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
return ((_b = this.data) === null || _b === void 0 ? void 0 : _b.removeText) !== ((_c = this.data) === null || _c === void 0 ? void 0 : _c.removeTextConfirm);
|
|
104
|
+
}
|
|
79
105
|
}
|
|
80
106
|
ConfirmRemoveModalDataComponent.decorators = [
|
|
81
107
|
{ type: Component, args: [{
|
|
82
108
|
selector: 'confirm-remove-modal-data',
|
|
83
|
-
template: "<
|
|
84
|
-
styles: [".
|
|
109
|
+
template: "<div class=\"modal-title\">\r\n <h3 *ngIf=\"data.title\" mat-dialog-title>\r\n {{data.title}}\r\n </h3>\r\n <icon *ngIf=\"data.showCloseIcon\" type=\"tertiary clickable\" name=\"fas fa-times\" [title]=\"data.closeLabel\" (onClick)=\"closeClick()\"></icon>\r\n</div>\r\n\r\n<div class=\"modal-content\" mat-dialog-content>\r\n <p *ngIf=\"data.content\" [innerHTML]=\"data.content\"></p>\r\n <input-text *ngIf=\"data.removeTextConfirm\" [label]=\"data.removeTextLabel\" [(ngModel)]=\"data.removeText\"></input-text>\r\n</div>\r\n\r\n<div class=\"modal-actions\" mat-dialog-actions>\r\n <secondary-button [btnDisabled]=\"isConfirmDisabled()\" [icon]=\"data.confirmIcon\" [label]=\"data.confirmText\" (onClick)=\"confirmClick()\"></secondary-button>\r\n</div>\r\n",
|
|
110
|
+
styles: [".modal-title{align-items:flex-start;display:flex;justify-content:center;position:relative;width:100%}.modal-title h3{font-weight:700;margin:0;text-align:center;width:100%}.modal-title icon{position:absolute;right:-5px;top:-5px}.modal-content{margin-top:20px;text-align:center;width:100%}.modal-content input-text{width:80%}.modal-actions{align-items:center;display:flex;justify-content:center;width:100%}"]
|
|
85
111
|
},] }
|
|
86
112
|
];
|
|
87
113
|
ConfirmRemoveModalDataComponent.ctorParameters = () => [
|
|
@@ -99,7 +125,9 @@ ModalsModule.decorators = [
|
|
|
99
125
|
MatFormFieldModule,
|
|
100
126
|
FormsModule,
|
|
101
127
|
MatInputModule,
|
|
128
|
+
InputsModule,
|
|
102
129
|
ButtonsModule,
|
|
130
|
+
IconsModule,
|
|
103
131
|
],
|
|
104
132
|
declarations: [
|
|
105
133
|
ConfirmRemoveModalComponent,
|
|
@@ -120,5 +148,5 @@ ModalsModule.decorators = [
|
|
|
120
148
|
* Generated bundle index. Do not edit.
|
|
121
149
|
*/
|
|
122
150
|
|
|
123
|
-
export { ConfirmRemoveModalComponent, ConfirmRemoveModalDataComponent, ModalsModule };
|
|
151
|
+
export { ConfirmRemoveModalComponent, ConfirmRemoveModalDataComponent, DialogConfig, ModalsModule };
|
|
124
152
|
//# sourceMappingURL=apipass-modals.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apipass-modals.js","sources":["../../../projects/modals/src/lib/confirm-remove-modal.component.ts","../../../projects/modals/src/modals.module.ts","../../../projects/modals/src/apipass-modals.ts"],"sourcesContent":["import {Component,
|
|
1
|
+
{"version":3,"file":"apipass-modals.js","sources":["../../../projects/modals/src/lib/confirm-remove-modal.component.ts","../../../projects/modals/src/modals.module.ts","../../../projects/modals/src/apipass-modals.ts"],"sourcesContent":["import {Component, EventEmitter, Inject, Input, OnInit, Output} from '@angular/core';\r\nimport {MAT_DIALOG_DATA, MatDialog, MatDialogRef} from \"@angular/material/dialog\";\r\nimport {Direction} from \"@angular/cdk/bidi\";\r\n\r\nexport declare type DialogRole = 'dialog' | 'alertdialog';\r\n\r\nexport interface DialogPosition {\r\n top?: string;\r\n bottom?: string;\r\n left?: string;\r\n right?: string;\r\n}\r\n\r\nexport class DialogConfig {\r\n id?: string;\r\n role?: DialogRole;\r\n panelClass?: string | string[];\r\n hasBackdrop?: boolean;\r\n backdropClass?: string;\r\n disableClose?: boolean;\r\n\r\n width?: string;\r\n height?: string;\r\n minWidth?: number | string;\r\n minHeight?: number | string;\r\n maxWidth?: number | string;\r\n maxHeight?: number | string;\r\n\r\n data?: any;\r\n position?: DialogPosition;\r\n direction?: Direction;\r\n ariaDescribedBy?: string | null;\r\n ariaLabelledBy?: string | null;\r\n ariaLabel?: string | null;\r\n autoFocus?: boolean;\r\n restoreFocus?: boolean;\r\n closeOnNavigation?: boolean;\r\n}\r\n\r\nexport interface DialogData {\r\n title: string;\r\n content: string;\r\n confirmIcon: string;\r\n confirmText: string;\r\n removeText: string;\r\n removeTextLabel: string;\r\n removeTextConfirm: string;\r\n showCloseIcon: boolean;\r\n closeLabel: string;\r\n}\r\n\r\n@Component({\r\n selector: 'confirm-remove-modal',\r\n template: ``\r\n})\r\nexport class ConfirmRemoveModalComponent implements OnInit {\r\n\r\n @Input() public title: string = '';\r\n @Input() public content: string = '';\r\n @Input() public confirmIcon: string = '';\r\n @Input() public confirmText: string = 'Remove';\r\n @Input() public removeTextLabel: string = '';\r\n @Input() public removeTextConfirm: string = '';\r\n @Input() public showCloseIcon: boolean = true;\r\n @Input() public closeLabel: string = 'Close';\r\n\r\n @Input() public dialogConfig: DialogConfig = new DialogConfig();\r\n\r\n @Input() public openModal: EventEmitter<void> = new EventEmitter();\r\n @Output() public confirmModal: EventEmitter<boolean> = new EventEmitter();\r\n @Output() public closeModal: EventEmitter<void> = new EventEmitter();\r\n\r\n constructor(public dialog: MatDialog) {\r\n }\r\n\r\n ngOnInit(): void {\r\n this.openModal.subscribe(() => {\r\n this.dialogConfig.data = {\r\n title: this.title,\r\n content: this.content,\r\n confirmIcon: this.confirmIcon,\r\n confirmText: this.confirmText,\r\n removeText: '',\r\n removeTextLabel: this.removeTextLabel,\r\n removeTextConfirm: this.removeTextConfirm,\r\n showCloseIcon: this.showCloseIcon,\r\n closeLabel: this.closeLabel\r\n };\r\n const dialogRef = this.dialog.open(ConfirmRemoveModalDataComponent, this.dialogConfig);\r\n dialogRef.afterClosed().subscribe((result: DialogData) => {\r\n if (!result) {\r\n this.closeModal.next()\r\n this.confirmModal.next(false);\r\n }\r\n if (!this.removeTextConfirm) {\r\n this.confirmModal.next(true);\r\n }\r\n if (result?.removeText !== this.removeTextConfirm) {\r\n this.confirmModal.next(false);\r\n } else {\r\n this.confirmModal.next(true);\r\n }\r\n });\r\n })\r\n }\r\n\r\n}\r\n\r\n@Component({\r\n selector: 'confirm-remove-modal-data',\r\n templateUrl: 'confirm-remove-modal.component.html',\r\n styleUrls: ['confirm-remove-modal.component.scss']\r\n})\r\nexport class ConfirmRemoveModalDataComponent {\r\n\r\n constructor(\r\n public dialogRef: MatDialogRef<ConfirmRemoveModalDataComponent>,\r\n @Inject(MAT_DIALOG_DATA) public data: DialogData,\r\n ) {\r\n }\r\n\r\n closeClick(): void {\r\n this.dialogRef.close();\r\n }\r\n\r\n confirmClick(): void {\r\n if (!this.data?.removeTextConfirm || this.data?.removeText === this.data?.removeTextConfirm) {\r\n this.dialogRef.close(this.data);\r\n }\r\n }\r\n\r\n isConfirmDisabled(): boolean {\r\n if (!this.data?.removeTextConfirm) {\r\n return false;\r\n }\r\n return this.data?.removeText !== this.data?.removeTextConfirm;\r\n }\r\n\r\n}\r\n","import {NgModule} from '@angular/core';\r\nimport {CommonModule} from '@angular/common';\r\nimport {ConfirmRemoveModalComponent, ConfirmRemoveModalDataComponent} from \"./lib/confirm-remove-modal.component\";\r\nimport {MatDialogModule} from \"@angular/material/dialog\";\r\nimport {MatFormFieldModule} from \"@angular/material/form-field\";\r\nimport {FormsModule} from \"@angular/forms\";\r\nimport {MatInputModule} from \"@angular/material/input\";\r\nimport {ButtonsModule} from \"@apipass/buttons\";\r\nimport {IconsModule} from \"@apipass/icons\";\r\nimport {InputsModule} from \"@apipass/inputs\";\r\n\r\n@NgModule({\r\n imports: [\r\n CommonModule,\r\n MatDialogModule,\r\n MatFormFieldModule,\r\n FormsModule,\r\n MatInputModule,\r\n InputsModule,\r\n ButtonsModule,\r\n IconsModule,\r\n ],\r\n declarations: [\r\n ConfirmRemoveModalComponent,\r\n ConfirmRemoveModalDataComponent\r\n ],\r\n exports: [\r\n ConfirmRemoveModalComponent,\r\n ConfirmRemoveModalDataComponent\r\n ],\r\n entryComponents: [\r\n ConfirmRemoveModalDataComponent\r\n ],\r\n providers: []\r\n})\r\nexport class ModalsModule { }\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;MAaa,YAAY;CAwBxB;MAkBY,2BAA2B;IAiBtC,YAAmB,MAAiB;QAAjB,WAAM,GAAN,MAAM,CAAW;QAfpB,UAAK,GAAW,EAAE,CAAC;QACnB,YAAO,GAAW,EAAE,CAAC;QACrB,gBAAW,GAAW,EAAE,CAAC;QACzB,gBAAW,GAAW,QAAQ,CAAC;QAC/B,oBAAe,GAAW,EAAE,CAAC;QAC7B,sBAAiB,GAAW,EAAE,CAAC;QAC/B,kBAAa,GAAY,IAAI,CAAC;QAC9B,eAAU,GAAW,OAAO,CAAC;QAE7B,iBAAY,GAAiB,IAAI,YAAY,EAAE,CAAC;QAEhD,cAAS,GAAuB,IAAI,YAAY,EAAE,CAAC;QAClD,iBAAY,GAA0B,IAAI,YAAY,EAAE,CAAC;QACzD,eAAU,GAAuB,IAAI,YAAY,EAAE,CAAC;KAGpE;IAED,QAA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iBAChC;gBACD,SAAS,EAAE,EAAE;aACd;;;AClCD;;;;;;"}
|
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
import { EventEmitter, OnInit } from '@angular/core';
|
|
2
2
|
import { MatDialog, MatDialogRef } from "@angular/material/dialog";
|
|
3
|
+
import { Direction } from "@angular/cdk/bidi";
|
|
4
|
+
export declare type DialogRole = 'dialog' | 'alertdialog';
|
|
5
|
+
export interface DialogPosition {
|
|
6
|
+
top?: string;
|
|
7
|
+
bottom?: string;
|
|
8
|
+
left?: string;
|
|
9
|
+
right?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare class DialogConfig {
|
|
12
|
+
id?: string;
|
|
13
|
+
role?: DialogRole;
|
|
14
|
+
panelClass?: string | string[];
|
|
15
|
+
hasBackdrop?: boolean;
|
|
16
|
+
backdropClass?: string;
|
|
17
|
+
disableClose?: boolean;
|
|
18
|
+
width?: string;
|
|
19
|
+
height?: string;
|
|
20
|
+
minWidth?: number | string;
|
|
21
|
+
minHeight?: number | string;
|
|
22
|
+
maxWidth?: number | string;
|
|
23
|
+
maxHeight?: number | string;
|
|
24
|
+
data?: any;
|
|
25
|
+
position?: DialogPosition;
|
|
26
|
+
direction?: Direction;
|
|
27
|
+
ariaDescribedBy?: string | null;
|
|
28
|
+
ariaLabelledBy?: string | null;
|
|
29
|
+
ariaLabel?: string | null;
|
|
30
|
+
autoFocus?: boolean;
|
|
31
|
+
restoreFocus?: boolean;
|
|
32
|
+
closeOnNavigation?: boolean;
|
|
33
|
+
}
|
|
3
34
|
export interface DialogData {
|
|
4
35
|
title: string;
|
|
5
36
|
content: string;
|
|
@@ -8,6 +39,8 @@ export interface DialogData {
|
|
|
8
39
|
removeText: string;
|
|
9
40
|
removeTextLabel: string;
|
|
10
41
|
removeTextConfirm: string;
|
|
42
|
+
showCloseIcon: boolean;
|
|
43
|
+
closeLabel: string;
|
|
11
44
|
}
|
|
12
45
|
export declare class ConfirmRemoveModalComponent implements OnInit {
|
|
13
46
|
dialog: MatDialog;
|
|
@@ -17,6 +50,9 @@ export declare class ConfirmRemoveModalComponent implements OnInit {
|
|
|
17
50
|
confirmText: string;
|
|
18
51
|
removeTextLabel: string;
|
|
19
52
|
removeTextConfirm: string;
|
|
53
|
+
showCloseIcon: boolean;
|
|
54
|
+
closeLabel: string;
|
|
55
|
+
dialogConfig: DialogConfig;
|
|
20
56
|
openModal: EventEmitter<void>;
|
|
21
57
|
confirmModal: EventEmitter<boolean>;
|
|
22
58
|
closeModal: EventEmitter<void>;
|
|
@@ -28,4 +64,6 @@ export declare class ConfirmRemoveModalDataComponent {
|
|
|
28
64
|
data: DialogData;
|
|
29
65
|
constructor(dialogRef: MatDialogRef<ConfirmRemoveModalDataComponent>, data: DialogData);
|
|
30
66
|
closeClick(): void;
|
|
67
|
+
confirmClick(): void;
|
|
68
|
+
isConfirmDisabled(): boolean;
|
|
31
69
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apipass/modals",
|
|
3
|
-
"version": "0.1.1
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@angular/animations": "10.0.11",
|
|
6
6
|
"@angular/cdk": "10.0.2",
|
|
@@ -15,7 +15,9 @@
|
|
|
15
15
|
"@angular/core": "10.0.11",
|
|
16
16
|
"@angular/forms": "10.0.11",
|
|
17
17
|
"@angular/material": "10.0.2",
|
|
18
|
-
"@apipass/buttons": "^0.
|
|
18
|
+
"@apipass/buttons": "^0.1.1",
|
|
19
|
+
"@apipass/icons": "^0.1.1",
|
|
20
|
+
"@apipass/inputs": "^0.1.1",
|
|
19
21
|
"tslib": "2.0.0"
|
|
20
22
|
},
|
|
21
23
|
"main": "bundles/apipass-modals.umd.js",
|