@apipass/modals 0.1.1-beta.4 → 0.1.3
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 +51 -27
- 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 +44 -26
- package/esm2015/modals.module.js +11 -7
- package/fesm2015/apipass-modals.js +46 -24
- package/fesm2015/apipass-modals.js.map +1 -1
- package/lib/confirm-remove-modal.component.d.ts +42 -4
- 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":103,"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{border:none!important;margin:20px 0!important;text-align:center!important;width:100%!important}.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":112,"character":5},"arguments":[{"__symbolic":"reference","module":"@angular/material/dialog","name":"MAT_DIALOG_DATA","line":112,"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,47 +1,52 @@
|
|
|
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();
|
|
19
27
|
}
|
|
20
28
|
ConfirmRemoveModalComponent.prototype.ngOnInit = function () {
|
|
21
29
|
var _this = this;
|
|
22
|
-
this.openModal.subscribe(function () {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
30
|
+
this.openModal.subscribe(function (item) {
|
|
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
|
+
item: item
|
|
42
|
+
};
|
|
43
|
+
var dialogRef = _this.dialog.open(ConfirmRemoveModalDataComponent, _this.dialogConfig);
|
|
35
44
|
dialogRef.afterClosed().subscribe(function (result) {
|
|
36
45
|
if (!result) {
|
|
37
|
-
_this.closeModal.next();
|
|
38
|
-
_this.confirmModal.next(false);
|
|
46
|
+
_this.closeModal.next(item);
|
|
39
47
|
}
|
|
40
|
-
if ((result === null || result === void 0 ? void 0 : result.removeText)
|
|
41
|
-
_this.confirmModal.next(
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
_this.confirmModal.next(true);
|
|
48
|
+
if (!_this.removeTextConfirm || (result === null || result === void 0 ? void 0 : result.removeText) === _this.removeTextConfirm) {
|
|
49
|
+
_this.confirmModal.next(item);
|
|
45
50
|
}
|
|
46
51
|
});
|
|
47
52
|
});
|
|
@@ -64,6 +69,9 @@
|
|
|
64
69
|
confirmText: [{ type: core.Input }],
|
|
65
70
|
removeTextLabel: [{ type: core.Input }],
|
|
66
71
|
removeTextConfirm: [{ type: core.Input }],
|
|
72
|
+
showCloseIcon: [{ type: core.Input }],
|
|
73
|
+
closeLabel: [{ type: core.Input }],
|
|
74
|
+
dialogConfig: [{ type: core.Input }],
|
|
67
75
|
openModal: [{ type: core.Input }],
|
|
68
76
|
confirmModal: [{ type: core.Output }],
|
|
69
77
|
closeModal: [{ type: core.Output }]
|
|
@@ -76,13 +84,26 @@
|
|
|
76
84
|
ConfirmRemoveModalDataComponent.prototype.closeClick = function () {
|
|
77
85
|
this.dialogRef.close();
|
|
78
86
|
};
|
|
87
|
+
ConfirmRemoveModalDataComponent.prototype.confirmClick = function () {
|
|
88
|
+
var _a, _b, _c;
|
|
89
|
+
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)) {
|
|
90
|
+
this.dialogRef.close(this.data);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
ConfirmRemoveModalDataComponent.prototype.isConfirmDisabled = function () {
|
|
94
|
+
var _a, _b, _c;
|
|
95
|
+
if (!((_a = this.data) === null || _a === void 0 ? void 0 : _a.removeTextConfirm)) {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
return ((_b = this.data) === null || _b === void 0 ? void 0 : _b.removeText) !== ((_c = this.data) === null || _c === void 0 ? void 0 : _c.removeTextConfirm);
|
|
99
|
+
};
|
|
79
100
|
return ConfirmRemoveModalDataComponent;
|
|
80
101
|
}());
|
|
81
102
|
ConfirmRemoveModalDataComponent.decorators = [
|
|
82
103
|
{ type: core.Component, args: [{
|
|
83
104
|
selector: 'confirm-remove-modal-data',
|
|
84
|
-
template: "<
|
|
85
|
-
styles: [".
|
|
105
|
+
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",
|
|
106
|
+
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{border:none!important;margin:20px 0!important;text-align:center!important;width:100%!important}.modal-content input-text{width:80%}.modal-actions{align-items:center;display:flex;justify-content:center;width:100%}"]
|
|
86
107
|
},] }
|
|
87
108
|
];
|
|
88
109
|
ConfirmRemoveModalDataComponent.ctorParameters = function () { return [
|
|
@@ -103,7 +124,9 @@
|
|
|
103
124
|
formField.MatFormFieldModule,
|
|
104
125
|
forms.FormsModule,
|
|
105
126
|
input.MatInputModule,
|
|
127
|
+
inputs.InputsModule,
|
|
106
128
|
buttons.ButtonsModule,
|
|
129
|
+
icons.IconsModule,
|
|
107
130
|
],
|
|
108
131
|
declarations: [
|
|
109
132
|
ConfirmRemoveModalComponent,
|
|
@@ -126,6 +149,7 @@
|
|
|
126
149
|
|
|
127
150
|
exports.ConfirmRemoveModalComponent = ConfirmRemoveModalComponent;
|
|
128
151
|
exports.ConfirmRemoveModalDataComponent = ConfirmRemoveModalDataComponent;
|
|
152
|
+
exports.DialogConfig = DialogConfig;
|
|
129
153
|
exports.ModalsModule = ModalsModule;
|
|
130
154
|
|
|
131
155
|
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 = '';\r\n @Input() public content = '';\r\n @Input() public confirmIcon = '';\r\n @Input() public confirmText = 'Remove';\r\n @Input() public removeTextLabel = '';\r\n @Input() public removeTextConfirm = '';\r\n @Input() public showCloseIcon = true;\r\n @Input() public closeLabel = 'Close';\r\n\r\n @Input() public dialogConfig: DialogConfig = new DialogConfig();\r\n\r\n @Input() public openModal: EventEmitter<any> = new EventEmitter();\r\n @Output() public confirmModal: EventEmitter<any> = new EventEmitter();\r\n @Output() public closeModal: EventEmitter<any> = new EventEmitter();\r\n\r\n constructor(public dialog: MatDialog) {\r\n }\r\n\r\n ngOnInit(): void {\r\n this.openModal.subscribe((item: any) => {\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 item\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(item);\r\n }\r\n if (!this.removeTextConfirm || result?.removeText === this.removeTextConfirm) {\r\n this.confirmModal.next(item);\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,GAAG,EAAE,CAAC;YACX,YAAO,GAAG,EAAE,CAAC;YACb,gBAAW,GAAG,EAAE,CAAC;YACjB,gBAAW,GAAG,QAAQ,CAAC;YACvB,oBAAe,GAAG,EAAE,CAAC;YACrB,sBAAiB,GAAG,EAAE,CAAC;YACvB,kBAAa,GAAG,IAAI,CAAC;YACrB,eAAU,GAAG,OAAO,CAAC;YAErB,iBAAY,GAAiB,IAAI,YAAY,EAAE,CAAC;YAEhD,cAA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2B;wBAC3B,+BAA+B;qBAChC;oBACD,eAAe,EAAE;wBACf,+BAA+B;qBAChC;oBACD,SAAS,EAAE,EAAE;iBACd;;;IClCD;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(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"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).apipass=t.apipass||{},t.apipass.modals={}),t.ng.core,t.ng.common,t.ng.material.dialog,t.ng.material.formField,t.ng.forms,t.ng.material.input,t.buttons,t.icons,t.inputs)}(this,(function(t,e,o,n,i,a,r,l,s,d){"use strict";var m=function(){},c=function(){function t(t){this.dialog=t,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 e.EventEmitter,this.confirmModal=new e.EventEmitter,this.closeModal=new e.EventEmitter}return t.prototype.ngOnInit=function(){var t=this;this.openModal.subscribe((function(e){t.dialogConfig.data={title:t.title,content:t.content,confirmIcon:t.confirmIcon,confirmText:t.confirmText,removeText:"",removeTextLabel:t.removeTextLabel,removeTextConfirm:t.removeTextConfirm,showCloseIcon:t.showCloseIcon,closeLabel:t.closeLabel,item:e},t.dialog.open(p,t.dialogConfig).afterClosed().subscribe((function(o){o||t.closeModal.next(e),t.removeTextConfirm&&(null==o?void 0:o.removeText)!==t.removeTextConfirm||t.confirmModal.next(e)}))}))},t}();c.decorators=[{type:e.Component,args:[{selector:"confirm-remove-modal",template:""}]}],c.ctorParameters=function(){return[{type:n.MatDialog}]},c.propDecorators={title:[{type:e.Input}],content:[{type:e.Input}],confirmIcon:[{type:e.Input}],confirmText:[{type:e.Input}],removeTextLabel:[{type:e.Input}],removeTextConfirm:[{type:e.Input}],showCloseIcon:[{type:e.Input}],closeLabel:[{type:e.Input}],dialogConfig:[{type:e.Input}],openModal:[{type:e.Input}],confirmModal:[{type:e.Output}],closeModal:[{type:e.Output}]};var p=function(){function t(t,e){this.dialogRef=t,this.data=e}return t.prototype.closeClick=function(){this.dialogRef.close()},t.prototype.confirmClick=function(){var t,e,o;(null===(t=this.data)||void 0===t?void 0:t.removeTextConfirm)&&(null===(e=this.data)||void 0===e?void 0:e.removeText)!==(null===(o=this.data)||void 0===o?void 0:o.removeTextConfirm)||this.dialogRef.close(this.data)},t.prototype.isConfirmDisabled=function(){var t,e,o;return!!(null===(t=this.data)||void 0===t?void 0:t.removeTextConfirm)&&(null===(e=this.data)||void 0===e?void 0:e.removeText)!==(null===(o=this.data)||void 0===o?void 0:o.removeTextConfirm)},t}();p.decorators=[{type:e.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{border:none!important;margin:20px 0!important;text-align:center!important;width:100%!important}.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:e.Inject,args:[n.MAT_DIALOG_DATA]}]}]};var u=function(){};u.decorators=[{type:e.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:[]}]}],t.ConfirmRemoveModalComponent=c,t.ConfirmRemoveModalDataComponent=p,t.DialogConfig=m,t.ModalsModule=u,Object.defineProperty(t,"__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","item","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","decl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ACyBlC,KAAAoB,KAAAA,SAIlCG,EAAAR,UAAAoB,WAAA,WACEnC,KAAKkC,UAAUE,SAGjBb,EAAAR,UAAAsB,aAAA,sBACgB,QAAVC,EAACtC,KAAKoB,YAAI,IAAAkB,OAAA,EAAAA,EAAEhC,qBAA8B,QAATiC,EAAAvC,KAAKoB,YAAI,IAAAmB,OAAA,EAAAA,EAAElB,eAAwB,QAAdmB,EAAKxC,KAAKoB,YAAI,IAAAoB,OAAA,EAAAA,EAAElC,oBACxEN,KAAKkC,UAAUE,MAAMpC,KAAKoB,OAI9BG,EAAAR,UAAA0B,kBAAA,qBACE,SAAc,QAAVH,EAACtC,KAAKoB,YAAI,IAAAkB,OAAA,EAAAA,EAAEhC,qBAGA,QAATiC,EAAAvC,KAAKoB,YAAI,IAAAmB,OAAA,EAAAA,EAAElB,eAAwB,QAAdmB,EAAKxC,KAAKoB,YAAI,IAAAoB,OAAA,EAAAA,EAAElC,6CA3B/CqB,EAAAA,UAASC,KAAA,CAAC,CACTC,SAAU,4BACVC,SAAA,8tCAxGkCY,EAAAA,6CA+G/BC,EAAAA,OAAMf,KAAA,CAACgB,EAAAA,4BC7EZ,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,CACZzD,EACAyB,GAEFiC,QAAS,CACP1D,EACAyB,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 = '';\r\n @Input() public content = '';\r\n @Input() public confirmIcon = '';\r\n @Input() public confirmText = 'Remove';\r\n @Input() public removeTextLabel = '';\r\n @Input() public removeTextConfirm = '';\r\n @Input() public showCloseIcon = true;\r\n @Input() public closeLabel = 'Close';\r\n\r\n @Input() public dialogConfig: DialogConfig = new DialogConfig();\r\n\r\n @Input() public openModal: EventEmitter<any> = new EventEmitter();\r\n @Output() public confirmModal: EventEmitter<any> = new EventEmitter();\r\n @Output() public closeModal: EventEmitter<any> = new EventEmitter();\r\n\r\n constructor(public dialog: MatDialog) {\r\n }\r\n\r\n ngOnInit(): void {\r\n this.openModal.subscribe((item: any) => {\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 item\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(item);\r\n }\r\n if (!this.removeTextConfirm || result?.removeText === this.removeTextConfirm) {\r\n this.confirmModal.next(item);\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,42 +1,44 @@
|
|
|
1
|
-
import { Component,
|
|
2
|
-
import { MAT_DIALOG_DATA, MatDialog, MatDialogRef } from
|
|
1
|
+
import { Component, EventEmitter, Inject, Input, Output } from '@angular/core';
|
|
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
|
-
this.openModal.subscribe(() => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
22
|
+
this.openModal.subscribe((item) => {
|
|
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
|
+
item
|
|
34
|
+
};
|
|
35
|
+
const dialogRef = this.dialog.open(ConfirmRemoveModalDataComponent, this.dialogConfig);
|
|
30
36
|
dialogRef.afterClosed().subscribe((result) => {
|
|
31
37
|
if (!result) {
|
|
32
|
-
this.closeModal.next();
|
|
33
|
-
this.confirmModal.next(false);
|
|
34
|
-
}
|
|
35
|
-
if ((result === null || result === void 0 ? void 0 : result.removeText) !== this.removeTextConfirm) {
|
|
36
|
-
this.confirmModal.next(false);
|
|
38
|
+
this.closeModal.next(item);
|
|
37
39
|
}
|
|
38
|
-
|
|
39
|
-
this.confirmModal.next(
|
|
40
|
+
if (!this.removeTextConfirm || (result === null || result === void 0 ? void 0 : result.removeText) === this.removeTextConfirm) {
|
|
41
|
+
this.confirmModal.next(item);
|
|
40
42
|
}
|
|
41
43
|
});
|
|
42
44
|
});
|
|
@@ -58,6 +60,9 @@ ConfirmRemoveModalComponent.propDecorators = {
|
|
|
58
60
|
confirmText: [{ type: Input }],
|
|
59
61
|
removeTextLabel: [{ type: Input }],
|
|
60
62
|
removeTextConfirm: [{ type: Input }],
|
|
63
|
+
showCloseIcon: [{ type: Input }],
|
|
64
|
+
closeLabel: [{ type: Input }],
|
|
65
|
+
dialogConfig: [{ type: Input }],
|
|
61
66
|
openModal: [{ type: Input }],
|
|
62
67
|
confirmModal: [{ type: Output }],
|
|
63
68
|
closeModal: [{ type: Output }]
|
|
@@ -70,16 +75,29 @@ export class ConfirmRemoveModalDataComponent {
|
|
|
70
75
|
closeClick() {
|
|
71
76
|
this.dialogRef.close();
|
|
72
77
|
}
|
|
78
|
+
confirmClick() {
|
|
79
|
+
var _a, _b, _c;
|
|
80
|
+
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)) {
|
|
81
|
+
this.dialogRef.close(this.data);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
isConfirmDisabled() {
|
|
85
|
+
var _a, _b, _c;
|
|
86
|
+
if (!((_a = this.data) === null || _a === void 0 ? void 0 : _a.removeTextConfirm)) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
return ((_b = this.data) === null || _b === void 0 ? void 0 : _b.removeText) !== ((_c = this.data) === null || _c === void 0 ? void 0 : _c.removeTextConfirm);
|
|
90
|
+
}
|
|
73
91
|
}
|
|
74
92
|
ConfirmRemoveModalDataComponent.decorators = [
|
|
75
93
|
{ type: Component, args: [{
|
|
76
94
|
selector: 'confirm-remove-modal-data',
|
|
77
|
-
template: "<
|
|
78
|
-
styles: [".
|
|
95
|
+
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",
|
|
96
|
+
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{border:none!important;margin:20px 0!important;text-align:center!important;width:100%!important}.modal-content input-text{width:80%}.modal-actions{align-items:center;display:flex;justify-content:center;width:100%}"]
|
|
79
97
|
},] }
|
|
80
98
|
];
|
|
81
99
|
ConfirmRemoveModalDataComponent.ctorParameters = () => [
|
|
82
100
|
{ type: MatDialogRef },
|
|
83
101
|
{ type: undefined, decorators: [{ type: Inject, args: [MAT_DIALOG_DATA,] }] }
|
|
84
102
|
];
|
|
85
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
103
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlybS1yZW1vdmUtbW9kYWwuY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vcHJvamVjdHMvbW9kYWxzL3NyYy9saWIvY29uZmlybS1yZW1vdmUtbW9kYWwuY29tcG9uZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBQyxTQUFTLEVBQUUsWUFBWSxFQUFFLE1BQU0sRUFBRSxLQUFLLEVBQVUsTUFBTSxFQUFDLE1BQU0sZUFBZSxDQUFDO0FBQ3JGLE9BQU8sRUFBQyxlQUFlLEVBQUUsU0FBUyxFQUFFLFlBQVksRUFBQyxNQUFNLDBCQUEwQixDQUFDO0FBWWxGLE1BQU0sT0FBTyxZQUFZO0NBd0J4QjtBQWtCRCxNQUFNLE9BQU8sMkJBQTJCO0lBaUJ0QyxZQUFtQixNQUFpQjtRQUFqQixXQUFNLEdBQU4sTUFBTSxDQUFXO1FBZnBCLFVBQUssR0FBRyxFQUFFLENBQUM7UUFDWCxZQUFPLEdBQUcsRUFBRSxDQUFDO1FBQ2IsZ0JBQVcsR0FBRyxFQUFFLENBQUM7UUFDakIsZ0JBQVcsR0FBRyxRQUFRLENB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biAgY29uZmlybUNsaWNrKCk6IHZvaWQge1xyXG4gICAgaWYgKCF0aGlzLmRhdGE/LnJlbW92ZVRleHRDb25maXJtIHx8IHRoaXMuZGF0YT8ucmVtb3ZlVGV4dCA9PT0gdGhpcy5kYXRhPy5yZW1vdmVUZXh0Q29uZmlybSkge1xyXG4gICAgICB0aGlzLmRpYWxvZ1JlZi5jbG9zZSh0aGlzLmRhdGEpO1xyXG4gICAgfVxyXG4gIH1cclxuXHJcbiAgaXNDb25maXJtRGlzYWJsZWQoKTogYm9vbGVhbiB7XHJcbiAgICBpZiAoIXRoaXMuZGF0YT8ucmVtb3ZlVGV4dENvbmZpcm0pIHtcclxuICAgICAgcmV0dXJuIGZhbHNlO1xyXG4gICAgfVxyXG4gICAgcmV0dXJuIHRoaXMuZGF0YT8ucmVtb3ZlVGV4dCAhPT0gdGhpcy5kYXRhPy5yZW1vdmVUZXh0Q29uZmlybTtcclxuICB9XHJcblxyXG59XHJcbiJdfQ==
|
package/esm2015/modals.module.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { NgModule } from '@angular/core';
|
|
2
2
|
import { CommonModule } from '@angular/common';
|
|
3
|
-
import { ConfirmRemoveModalComponent, ConfirmRemoveModalDataComponent } from
|
|
4
|
-
import { MatDialogModule } from
|
|
5
|
-
import { MatFormFieldModule } from
|
|
6
|
-
import { FormsModule } from
|
|
7
|
-
import { MatInputModule } from
|
|
8
|
-
import { ButtonsModule } from
|
|
3
|
+
import { ConfirmRemoveModalComponent, ConfirmRemoveModalDataComponent } from './lib/confirm-remove-modal.component';
|
|
4
|
+
import { MatDialogModule } from '@angular/material/dialog';
|
|
5
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
6
|
+
import { FormsModule } from '@angular/forms';
|
|
7
|
+
import { MatInputModule } from '@angular/material/input';
|
|
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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9kYWxzLm1vZHVsZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3Byb2plY3RzL21vZGFscy9zcmMvbW9kYWxzLm1vZHVsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUMsUUFBUSxFQUFDLE1BQU0sZUFBZSxDQUFDO0FBQ3ZDLE9BQU8sRUFBQyxZQUFZLEVBQUMsTUFBTSxpQkFBaUIsQ0FBQztBQUM3QyxPQUFPLEVBQUMsMkJBQTJCLEVBQUUsK0JBQStCLEVBQUMsTUFBTSxzQ0FBc0MsQ0FBQztBQUNsSCxPQUFPLEVBQUMsZUFBZSxFQUFDLE1BQU0sMEJBQTBCLENBQUM7QUFDekQsT0FBTyxFQUFDLGtCQUFrQixFQUFDLE1BQU0sOEJBQThCLENBQUM7QUFDaEUsT0FBTyxFQUFDLFdBQVcsRUFBQyxNQUFNLGdCQUFnQixDQUFDO0FBQzNDLE9BQU8sRUFBQyxjQUFjLEVBQUMsTUFBTSx5QkFBeUIsQ0FBQztBQUN2RCxPQUFPLEVBQUMsYUFBYSxFQU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5,48 @@ 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
|
-
this.openModal.subscribe(() => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
30
|
+
this.openModal.subscribe((item) => {
|
|
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
|
+
item
|
|
42
|
+
};
|
|
43
|
+
const dialogRef = this.dialog.open(ConfirmRemoveModalDataComponent, this.dialogConfig);
|
|
36
44
|
dialogRef.afterClosed().subscribe((result) => {
|
|
37
45
|
if (!result) {
|
|
38
|
-
this.closeModal.next();
|
|
39
|
-
this.confirmModal.next(false);
|
|
40
|
-
}
|
|
41
|
-
if ((result === null || result === void 0 ? void 0 : result.removeText) !== this.removeTextConfirm) {
|
|
42
|
-
this.confirmModal.next(false);
|
|
46
|
+
this.closeModal.next(item);
|
|
43
47
|
}
|
|
44
|
-
|
|
45
|
-
this.confirmModal.next(
|
|
48
|
+
if (!this.removeTextConfirm || (result === null || result === void 0 ? void 0 : result.removeText) === this.removeTextConfirm) {
|
|
49
|
+
this.confirmModal.next(item);
|
|
46
50
|
}
|
|
47
51
|
});
|
|
48
52
|
});
|
|
@@ -64,6 +68,9 @@ ConfirmRemoveModalComponent.propDecorators = {
|
|
|
64
68
|
confirmText: [{ type: Input }],
|
|
65
69
|
removeTextLabel: [{ type: Input }],
|
|
66
70
|
removeTextConfirm: [{ type: Input }],
|
|
71
|
+
showCloseIcon: [{ type: Input }],
|
|
72
|
+
closeLabel: [{ type: Input }],
|
|
73
|
+
dialogConfig: [{ type: Input }],
|
|
67
74
|
openModal: [{ type: Input }],
|
|
68
75
|
confirmModal: [{ type: Output }],
|
|
69
76
|
closeModal: [{ type: Output }]
|
|
@@ -76,12 +83,25 @@ class ConfirmRemoveModalDataComponent {
|
|
|
76
83
|
closeClick() {
|
|
77
84
|
this.dialogRef.close();
|
|
78
85
|
}
|
|
86
|
+
confirmClick() {
|
|
87
|
+
var _a, _b, _c;
|
|
88
|
+
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)) {
|
|
89
|
+
this.dialogRef.close(this.data);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
isConfirmDisabled() {
|
|
93
|
+
var _a, _b, _c;
|
|
94
|
+
if (!((_a = this.data) === null || _a === void 0 ? void 0 : _a.removeTextConfirm)) {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
return ((_b = this.data) === null || _b === void 0 ? void 0 : _b.removeText) !== ((_c = this.data) === null || _c === void 0 ? void 0 : _c.removeTextConfirm);
|
|
98
|
+
}
|
|
79
99
|
}
|
|
80
100
|
ConfirmRemoveModalDataComponent.decorators = [
|
|
81
101
|
{ type: Component, args: [{
|
|
82
102
|
selector: 'confirm-remove-modal-data',
|
|
83
|
-
template: "<
|
|
84
|
-
styles: [".
|
|
103
|
+
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",
|
|
104
|
+
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{border:none!important;margin:20px 0!important;text-align:center!important;width:100%!important}.modal-content input-text{width:80%}.modal-actions{align-items:center;display:flex;justify-content:center;width:100%}"]
|
|
85
105
|
},] }
|
|
86
106
|
];
|
|
87
107
|
ConfirmRemoveModalDataComponent.ctorParameters = () => [
|
|
@@ -99,7 +119,9 @@ ModalsModule.decorators = [
|
|
|
99
119
|
MatFormFieldModule,
|
|
100
120
|
FormsModule,
|
|
101
121
|
MatInputModule,
|
|
122
|
+
InputsModule,
|
|
102
123
|
ButtonsModule,
|
|
124
|
+
IconsModule,
|
|
103
125
|
],
|
|
104
126
|
declarations: [
|
|
105
127
|
ConfirmRemoveModalComponent,
|
|
@@ -120,5 +142,5 @@ ModalsModule.decorators = [
|
|
|
120
142
|
* Generated bundle index. Do not edit.
|
|
121
143
|
*/
|
|
122
144
|
|
|
123
|
-
export { ConfirmRemoveModalComponent, ConfirmRemoveModalDataComponent, ModalsModule };
|
|
145
|
+
export { ConfirmRemoveModalComponent, ConfirmRemoveModalDataComponent, DialogConfig, ModalsModule };
|
|
124
146
|
//# 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 = '';\r\n @Input() public content = '';\r\n @Input() public confirmIcon = '';\r\n @Input() public confirmText = 'Remove';\r\n @Input() public removeTextLabel = '';\r\n @Input() public removeTextConfirm = '';\r\n @Input() public showCloseIcon = true;\r\n @Input() public closeLabel = 'Close';\r\n\r\n @Input() public dialogConfig: DialogConfig = new DialogConfig();\r\n\r\n @Input() public openModal: EventEmitter<any> = new EventEmitter();\r\n @Output() public confirmModal: EventEmitter<any> = new EventEmitter();\r\n @Output() public closeModal: EventEmitter<any> = new EventEmitter();\r\n\r\n constructor(public dialog: MatDialog) {\r\n }\r\n\r\n ngOnInit(): void {\r\n this.openModal.subscribe((item: any) => {\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 item\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(item);\r\n }\r\n if (!this.removeTextConfirm || result?.removeText === this.removeTextConfirm) {\r\n this.confirmModal.next(item);\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,GAAG,EAAE,CAAC;QACX,YAAO,GAAG,EAAE,CAAC;QACb,gBAAW,GAAG,EAAE,CAAC;QACjB,gBAAW,GAAG,QAAQ,CAAC;QACvB,oBAAe,GAAG,EAAE,CAAC;QACrB,sBAAiB,GAAG,EAAE,CAAC;QACvB,kBAAa,GAAG,IAAI,CAAC;QACrB,eAAU,GAAG,OAAO,CAAC;QAErB,iBAAY,GAAiB,IAAI,YAAY,EAAE,CAAC;QAEhD,cAAS,GAAsB,IAAI,YAAY,EAAE,CAAC;QACjD,iBAAY,GAAsB,IAAI,YAAY,EAAE,CAAC;QACrD,eAAU,GAAsB,IAAI,YAAY,EAAE,CAAC;KAGnE;IAED,QAAQ;QACN,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,IAAS;YACjC,IAAI,CAAC,YAAY,CAAC,IAAI,GAAG;gBACvB,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,WAAW,EAAE,IAAI,CAAC,WAAW;gBAC7B,WAAW,EAAE,IAAI,CAAC,WAAW;gBAC7B,UAAU,EAAE,EAAE;gBACd,eAAe,EAAE,IAAI,CAAC,eAAe;gBACrC,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;gBACzC,aAAa,EAAE,IAAI,CAAC,aAAa;gBACjC,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,IAAI;aACL,CAAC;YACF,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,+BAA+B,EAAE,IAAI,CAAC,YAAY,C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,0CAAE,UAAU,aAAK,IAAI,CAAC,IAAI,0CAAE,iBAAiB,CAAA,CAAC;KAC/D;;;YA5BF,SAAS,SAAC;gBACT,QAAQ,EAAE,2BAA2B;gBACrC,4wBAAkD;;aAEnD;;;YA1GmC,YAAY;4CA+G3C,MAAM,SAAC,eAAe;;;MC7Ed,YAAY;;;YAxBxB,QAAQ,SAAC;gBACR,OAAO,EAAE;oBACP,YAAY;oBACZ,eAAe;oBACf,kBAAkB;oBAClB,WAAW;oBACX,cAAc;oBACd,YAAY;oBACZ,aAAa;oBACb,WAAW;iBACZ;gBACD,YAAY,EAAE;oBACZ,2BAA2B;oBAC3B,+BAA+B;iBAChC;gBACD,OAAO,EAAE;oBACP,2BAA2B;oBAC3B,+BAA+B;iBAChC;gBACD,eAAe,EAAE;oBACf,+BAA+B;iBAChC;gBACD,SAAS,EAAE,EAAE;aACd;;;AClCD;;;;;;"}
|
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
import { EventEmitter, OnInit } from '@angular/core';
|
|
2
|
-
import { MatDialog, MatDialogRef } from
|
|
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,9 +50,12 @@ export declare class ConfirmRemoveModalComponent implements OnInit {
|
|
|
17
50
|
confirmText: string;
|
|
18
51
|
removeTextLabel: string;
|
|
19
52
|
removeTextConfirm: string;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
53
|
+
showCloseIcon: boolean;
|
|
54
|
+
closeLabel: string;
|
|
55
|
+
dialogConfig: DialogConfig;
|
|
56
|
+
openModal: EventEmitter<any>;
|
|
57
|
+
confirmModal: EventEmitter<any>;
|
|
58
|
+
closeModal: EventEmitter<any>;
|
|
23
59
|
constructor(dialog: MatDialog);
|
|
24
60
|
ngOnInit(): void;
|
|
25
61
|
}
|
|
@@ -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.
|
|
3
|
+
"version": "0.1.3",
|
|
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",
|