@sd-angular/core 1.2.11 → 1.2.12
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/bundles/sd-angular-core-confirm.umd.js +159 -0
- package/bundles/sd-angular-core-confirm.umd.js.map +1 -0
- package/bundles/sd-angular-core-confirm.umd.min.js +2 -0
- package/bundles/sd-angular-core-confirm.umd.min.js.map +1 -0
- package/bundles/sd-angular-core-notify.umd.js +6 -45
- package/bundles/sd-angular-core-notify.umd.js.map +1 -1
- package/bundles/sd-angular-core-notify.umd.min.js +2 -2
- package/bundles/sd-angular-core-notify.umd.min.js.map +1 -1
- package/bundles/sd-angular-core.umd.js +4 -4
- package/bundles/sd-angular-core.umd.min.js +1 -1
- package/bundles/sd-angular-core.umd.min.js.map +1 -1
- package/confirm/index.d.ts +1 -0
- package/confirm/package.json +12 -0
- package/confirm/sd-angular-core-confirm.d.ts +4 -0
- package/confirm/sd-angular-core-confirm.metadata.json +1 -0
- package/confirm/src/lib/components/dialog-confirm/dialog-confirm.component.d.ts +34 -0
- package/confirm/src/lib/confirm.module.d.ts +2 -0
- package/confirm/src/lib/confirm.service.d.ts +29 -0
- package/confirm/src/public-api.d.ts +3 -0
- package/esm2015/confirm/index.js +2 -0
- package/esm2015/confirm/sd-angular-core-confirm.js +5 -0
- package/esm2015/confirm/src/lib/components/dialog-confirm/dialog-confirm.component.js +34 -0
- package/esm2015/confirm/src/lib/confirm.module.js +34 -0
- package/esm2015/confirm/src/lib/confirm.service.js +82 -0
- package/esm2015/confirm/src/public-api.js +7 -0
- package/esm2015/notify/src/lib/components/dialog-confirm/dialog-confirm.component.js +3 -7
- package/esm2015/notify/src/lib/notify.module.js +1 -3
- package/esm2015/notify/src/lib/notify.service.js +1 -34
- package/esm2015/public-api.js +2 -1
- package/fesm2015/sd-angular-core-confirm.js +154 -0
- package/fesm2015/sd-angular-core-confirm.js.map +1 -0
- package/fesm2015/sd-angular-core-notify.js +2 -41
- package/fesm2015/sd-angular-core-notify.js.map +1 -1
- package/fesm2015/sd-angular-core.js +1 -0
- package/fesm2015/sd-angular-core.js.map +1 -1
- package/notify/sd-angular-core-notify.metadata.json +1 -1
- package/notify/src/lib/components/dialog-confirm/dialog-confirm.component.d.ts +0 -7
- package/notify/src/lib/notify.service.d.ts +0 -10
- package/package.json +1 -1
- package/public-api.d.ts +1 -0
- package/{sd-angular-core-1.2.11.tgz → sd-angular-core-1.2.12.tgz} +0 -0
|
@@ -0,0 +1,159 @@
|
|
|
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/icon'), require('@angular/material/button'), require('@angular/material/form-field'), require('@angular/material/input'), require('@angular/forms'), require('@sd-angular/core/button'), require('uuid'), require('@sd-angular/core/date-time'), require('@sd-angular/core/common')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@sd-angular/core/confirm', ['exports', '@angular/core', '@angular/common', '@angular/material/dialog', '@angular/material/icon', '@angular/material/button', '@angular/material/form-field', '@angular/material/input', '@angular/forms', '@sd-angular/core/button', 'uuid', '@sd-angular/core/date-time', '@sd-angular/core/common'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global['sd-angular'] = global['sd-angular'] || {}, global['sd-angular'].core = global['sd-angular'].core || {}, global['sd-angular'].core.confirm = {}), global.ng.core, global.ng.common, global.ng.material.dialog, global.ng.material.icon, global.ng.material.button, global.ng.material.formField, global.ng.material.input, global.ng.forms, global['sd-angular'].core.button, global.uuid, global['sd-angular'].core['date-time']));
|
|
5
|
+
}(this, (function (exports, core, common, dialog, icon, button, formField, input, forms, button$1, uuid, dateTime) { 'use strict';
|
|
6
|
+
|
|
7
|
+
var DialogConfirmComponent = /** @class */ (function () {
|
|
8
|
+
function DialogConfirmComponent(dialogRef, data) {
|
|
9
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
10
|
+
this.dialogRef = dialogRef;
|
|
11
|
+
this.data = data;
|
|
12
|
+
this.required = false;
|
|
13
|
+
this.isString = false;
|
|
14
|
+
this.id = "I" + uuid.v4();
|
|
15
|
+
this.isString = typeof ((_a = this.data) === null || _a === void 0 ? void 0 : _a.message) === 'string';
|
|
16
|
+
if (data === null || data === void 0 ? void 0 : data.input) {
|
|
17
|
+
this.value = (_c = (_b = data === null || data === void 0 ? void 0 : data.input) === null || _b === void 0 ? void 0 : _b.defaultValue) !== null && _c !== void 0 ? _c : '';
|
|
18
|
+
this.required = ((_d = data === null || data === void 0 ? void 0 : data.input) === null || _d === void 0 ? void 0 : _d.required) || false;
|
|
19
|
+
}
|
|
20
|
+
if (data === null || data === void 0 ? void 0 : data.date) {
|
|
21
|
+
this.value = (_f = (_e = data === null || data === void 0 ? void 0 : data.date) === null || _e === void 0 ? void 0 : _e.defaultValue) !== null && _f !== void 0 ? _f : '';
|
|
22
|
+
this.required = ((_g = data === null || data === void 0 ? void 0 : data.date) === null || _g === void 0 ? void 0 : _g.required) || false;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return DialogConfirmComponent;
|
|
26
|
+
}());
|
|
27
|
+
DialogConfirmComponent.decorators = [
|
|
28
|
+
{ type: core.Component, args: [{
|
|
29
|
+
selector: 'sd-dialog-confirm',
|
|
30
|
+
template: "<h1 mat-dialog-title class=\"\">\r\n <mat-icon *ngIf=\"data?.icon\" [ngClass]=\"data?.icon\">\r\n {{ data?.icon }}\r\n </mat-icon>\r\n <span [innerHtml]=\"data?.title || 'Confirm'\"></span>\r\n</h1>\r\n<div mat-dialog-content>\r\n <div *ngIf=\"isString\" [innerHtml]=\"data?.message\"></div>\r\n <div *ngIf=\"!isString\" [innerHtml]=\"data?.message | json\"></div>\r\n <div *ngIf=\"data?.input\">\r\n <mat-form-field appearance=\"outline\">\r\n <textarea style=\"width: 100%\" matInput [placeholder]=\"data.input?.placeholder\" [(ngModel)]=\"value\"\r\n autocomplete=\"off\" rows=\"5\" [maxlength]=\"data.input?.maxlength\"></textarea>\r\n </mat-form-field>\r\n </div>\r\n <div *ngIf=\"data?.date\">\r\n <sd-date-time [placeholder]=\"data.date?.placeholder\" [(model)]=\"value\" type=\"date\" [min]=\"data.date?.min\"\r\n [max]=\"data.date?.max\" [required]=\"required\">\r\n </sd-date-time>\r\n </div>\r\n</div>\r\n<div mat-dialog-actions align=\"end\">\r\n <sd-button *ngIf=\"data?.noTitle\" [color]=\"data?.noButtonColor || 'secondary'\" [mat-dialog-close]=\"'CANCEL'\"\r\n [title]=\"data?.noTitle\" size=\"sm\"></sd-button>\r\n <sd-button class=\"ml-12\" *ngIf=\"data?.yesTitle\" [mat-dialog-close]=\"value || 'ACCEPT'\"\r\n [color]=\"data?.yesButtonColor || 'primary'\" [disabled]=\"required && !value\" cdkFocusInitial\r\n [title]=\"data?.yesTitle\" size=\"sm\"></sd-button>\r\n</div>",
|
|
31
|
+
styles: [":host .mat-dialog-content{margin:0 -16px 16px!important}:host .mat-button{background-color:#f5f5f5}:host>>>.mat-dialog-title{align-items:center;display:flex;justify-content:flex-start}:host>>>.mat-dialog-title .mat-icon{margin-right:5px}:host{display:block;padding:12px 16px}:host>>>.mat-dialog-title .mat-icon.info{color:#2962ff}:host>>>.mat-dialog-title .mat-icon.warning{color:#ffc107}:host>>>.mat-dialog-title .mat-icon.done{color:#4caf50}:host>>>.mat-dialog-title .mat-icon.error{color:#d32f2f}"]
|
|
32
|
+
},] }
|
|
33
|
+
];
|
|
34
|
+
DialogConfirmComponent.ctorParameters = function () { return [
|
|
35
|
+
{ type: dialog.MatDialogRef },
|
|
36
|
+
{ type: undefined, decorators: [{ type: core.Inject, args: [dialog.MAT_DIALOG_DATA,] }] }
|
|
37
|
+
]; };
|
|
38
|
+
|
|
39
|
+
var SdConfirmService = /** @class */ (function () {
|
|
40
|
+
function SdConfirmService(dialog) {
|
|
41
|
+
var _this = this;
|
|
42
|
+
this.dialog = dialog;
|
|
43
|
+
this.withInput = function (option) {
|
|
44
|
+
var dialogRef = _this.dialog.open(DialogConfirmComponent, {
|
|
45
|
+
width: '400px',
|
|
46
|
+
data: {
|
|
47
|
+
title: (option === null || option === void 0 ? void 0 : option.title) || 'Xác nhận',
|
|
48
|
+
message: option === null || option === void 0 ? void 0 : option.message,
|
|
49
|
+
yesTitle: (option === null || option === void 0 ? void 0 : option.yesTitle) || 'Có',
|
|
50
|
+
noTitle: (option === null || option === void 0 ? void 0 : option.noTitle) || 'Không',
|
|
51
|
+
noButtonColor: (option === null || option === void 0 ? void 0 : option.noButtonColor) || 'secondary',
|
|
52
|
+
yesButtonColor: (option === null || option === void 0 ? void 0 : option.yesButtonColor) || 'primary',
|
|
53
|
+
input: {
|
|
54
|
+
maxlength: (option === null || option === void 0 ? void 0 : option.maxlength) || 255,
|
|
55
|
+
required: option === null || option === void 0 ? void 0 : option.required,
|
|
56
|
+
defaultValue: (option === null || option === void 0 ? void 0 : option.defaultValue) || ''
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
return new Promise(function (resolve, reject) {
|
|
61
|
+
dialogRef.afterClosed().subscribe(function (result) {
|
|
62
|
+
if (result) {
|
|
63
|
+
if (result === 'ACCEPT') {
|
|
64
|
+
resolve(result);
|
|
65
|
+
}
|
|
66
|
+
else if (result === 'CANCEL') {
|
|
67
|
+
reject(result);
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
resolve(result);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
this.withDate = function (option) {
|
|
77
|
+
var dialogRef = _this.dialog.open(DialogConfirmComponent, {
|
|
78
|
+
width: '400px',
|
|
79
|
+
data: {
|
|
80
|
+
title: (option === null || option === void 0 ? void 0 : option.title) || 'Xác nhận',
|
|
81
|
+
message: option === null || option === void 0 ? void 0 : option.message,
|
|
82
|
+
yesTitle: (option === null || option === void 0 ? void 0 : option.yesTitle) || 'Có',
|
|
83
|
+
noTitle: (option === null || option === void 0 ? void 0 : option.noTitle) || 'Không',
|
|
84
|
+
noButtonColor: (option === null || option === void 0 ? void 0 : option.noButtonColor) || 'secondary',
|
|
85
|
+
yesButtonColor: (option === null || option === void 0 ? void 0 : option.yesButtonColor) || 'primary',
|
|
86
|
+
date: {
|
|
87
|
+
placeholder: option === null || option === void 0 ? void 0 : option.placeholder,
|
|
88
|
+
required: option === null || option === void 0 ? void 0 : option.required,
|
|
89
|
+
defaultValue: (option === null || option === void 0 ? void 0 : option.defaultValue) || '',
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
return new Promise(function (resolve, reject) {
|
|
94
|
+
dialogRef.afterClosed().subscribe(function (result) {
|
|
95
|
+
if (result) {
|
|
96
|
+
if (result === 'ACCEPT') {
|
|
97
|
+
resolve(result);
|
|
98
|
+
}
|
|
99
|
+
else if (result === 'CANCEL') {
|
|
100
|
+
reject(result);
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
resolve(result);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
return SdConfirmService;
|
|
111
|
+
}());
|
|
112
|
+
SdConfirmService.decorators = [
|
|
113
|
+
{ type: core.Injectable }
|
|
114
|
+
];
|
|
115
|
+
SdConfirmService.ctorParameters = function () { return [
|
|
116
|
+
{ type: dialog.MatDialog }
|
|
117
|
+
]; };
|
|
118
|
+
|
|
119
|
+
var SdConfirmModule = /** @class */ (function () {
|
|
120
|
+
function SdConfirmModule() {
|
|
121
|
+
}
|
|
122
|
+
return SdConfirmModule;
|
|
123
|
+
}());
|
|
124
|
+
SdConfirmModule.decorators = [
|
|
125
|
+
{ type: core.NgModule, args: [{
|
|
126
|
+
imports: [
|
|
127
|
+
common.CommonModule,
|
|
128
|
+
forms.FormsModule,
|
|
129
|
+
formField.MatFormFieldModule,
|
|
130
|
+
input.MatInputModule,
|
|
131
|
+
dateTime.SdDateTimeModule,
|
|
132
|
+
icon.MatIconModule,
|
|
133
|
+
button.MatButtonModule,
|
|
134
|
+
dialog.MatDialogModule,
|
|
135
|
+
button$1.SdButtonModule,
|
|
136
|
+
],
|
|
137
|
+
declarations: [DialogConfirmComponent],
|
|
138
|
+
entryComponents: [DialogConfirmComponent],
|
|
139
|
+
exports: [],
|
|
140
|
+
providers: [SdConfirmService],
|
|
141
|
+
},] }
|
|
142
|
+
];
|
|
143
|
+
|
|
144
|
+
/*
|
|
145
|
+
* Public API Surface of superdev-angular-core
|
|
146
|
+
*/
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Generated bundle index. Do not edit.
|
|
150
|
+
*/
|
|
151
|
+
|
|
152
|
+
exports.DialogConfirmComponent = DialogConfirmComponent;
|
|
153
|
+
exports.SdConfirmModule = SdConfirmModule;
|
|
154
|
+
exports.SdConfirmService = SdConfirmService;
|
|
155
|
+
|
|
156
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
157
|
+
|
|
158
|
+
})));
|
|
159
|
+
//# sourceMappingURL=sd-angular-core-confirm.umd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sd-angular-core-confirm.umd.js","sources":["../../../../projects/sd-core/confirm/src/lib/components/dialog-confirm/dialog-confirm.component.ts","../../../../projects/sd-core/confirm/src/lib/confirm.service.ts","../../../../projects/sd-core/confirm/src/lib/confirm.module.ts","../../../../projects/sd-core/confirm/src/public-api.ts","../../../../projects/sd-core/confirm/sd-angular-core-confirm.ts"],"sourcesContent":["import { Component, Inject } from '@angular/core';\r\nimport { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';\r\nimport { SdBadgeColor } from '@sd-angular/core/badge';\r\nimport * as uuid from 'uuid';\r\n\r\nexport interface DialogData {\r\n icon?: string;\r\n title?: string;\r\n message?: string;\r\n yesTitle?: string;\r\n noTitle?: string;\r\n yesButtonColor?: SdBadgeColor;\r\n noButtonColor?: SdBadgeColor;\r\n input?: {\r\n placeholder?: string;\r\n minlength?: number;\r\n maxlength?: number;\r\n required?: boolean;\r\n defaultValue?: string;\r\n };\r\n date?: {\r\n required?: boolean;\r\n placeholder?: string;\r\n defaultValue?: string | Date;\r\n min?: string | Date;\r\n max?: string | Date;\r\n }\r\n}\r\n\r\n@Component({\r\n selector: 'sd-dialog-confirm',\r\n templateUrl: 'dialog-confirm.component.html',\r\n styleUrls: ['./dialog-confirm.component.css'],\r\n})\r\nexport class DialogConfirmComponent {\r\n value: any;\r\n required = false;\r\n isString = false;\r\n id = `I${uuid.v4()}`\r\n constructor(\r\n public dialogRef: MatDialogRef<DialogConfirmComponent>,\r\n @Inject(MAT_DIALOG_DATA) public data: DialogData\r\n ) {\r\n this.isString = typeof this.data?.message === 'string';\r\n if (data?.input) {\r\n this.value = data?.input?.defaultValue ?? '';\r\n this.required = data?.input?.required || false;\r\n }\r\n if (data?.date) {\r\n this.value = data?.date?.defaultValue ?? '';\r\n this.required = data?.date?.required || false;\r\n }\r\n }\r\n}\r\n","import '@sd-angular/core/common';\r\nimport { Injectable } from '@angular/core';\r\nimport { MatDialog } from '@angular/material/dialog';\r\nimport { DialogConfirmComponent } from './components/dialog-confirm/dialog-confirm.component';\r\nimport { SdBadgeColor } from '@sd-angular/core/badge';\r\n\r\n@Injectable()\r\nexport class SdConfirmService {\r\n constructor(\r\n private dialog: MatDialog,\r\n ) { }\r\n\r\n withInput = (\r\n option?: {\r\n title?: string;\r\n message?: string;\r\n yesTitle?: string;\r\n noTitle?: string;\r\n required?: boolean;\r\n maxlength?: number;\r\n yesButtonColor?: SdBadgeColor;\r\n noButtonColor?: SdBadgeColor;\r\n defaultValue?: string;\r\n }\r\n ): Promise<string> => {\r\n const dialogRef = this.dialog.open(DialogConfirmComponent, {\r\n width: '400px',\r\n data: {\r\n title: option?.title || 'Xác nhận',\r\n message: option?.message,\r\n yesTitle: option?.yesTitle || 'Có',\r\n noTitle: option?.noTitle || 'Không',\r\n noButtonColor: option?.noButtonColor || 'secondary',\r\n yesButtonColor: option?.yesButtonColor || 'primary',\r\n input: {\r\n maxlength: option?.maxlength || 255,\r\n required: option?.required,\r\n defaultValue: option?.defaultValue || ''\r\n },\r\n },\r\n });\r\n return new Promise((resolve, reject) => {\r\n dialogRef.afterClosed().subscribe((result) => {\r\n if (result) {\r\n if (result === 'ACCEPT') {\r\n resolve(result);\r\n } else if (result === 'CANCEL') {\r\n reject(result);\r\n } else {\r\n resolve(result);\r\n }\r\n }\r\n });\r\n });\r\n };\r\n\r\n withDate = (\r\n option?: {\r\n title?: string;\r\n message?: string;\r\n yesTitle?: string;\r\n noTitle?: string;\r\n required?: boolean;\r\n yesButtonColor?: SdBadgeColor;\r\n noButtonColor?: SdBadgeColor;\r\n defaultValue?: string | Date;\r\n placeholder?: string\r\n }\r\n ): Promise<string> => {\r\n const dialogRef = this.dialog.open(DialogConfirmComponent, {\r\n width: '400px',\r\n data: {\r\n title: option?.title || 'Xác nhận',\r\n message: option?.message,\r\n yesTitle: option?.yesTitle || 'Có',\r\n noTitle: option?.noTitle || 'Không',\r\n noButtonColor: option?.noButtonColor || 'secondary',\r\n yesButtonColor: option?.yesButtonColor || 'primary',\r\n date: {\r\n placeholder: option?.placeholder,\r\n required: option?.required,\r\n defaultValue: option?.defaultValue || '',\r\n },\r\n },\r\n });\r\n return new Promise((resolve, reject) => {\r\n dialogRef.afterClosed().subscribe((result) => {\r\n if (result) {\r\n if (result === 'ACCEPT') {\r\n resolve(result);\r\n } else if (result === 'CANCEL') {\r\n reject(result);\r\n } else {\r\n resolve(result);\r\n }\r\n }\r\n });\r\n });\r\n };\r\n}\r\n","import { NgModule } from \"@angular/core\";\r\nimport { CommonModule } from \"@angular/common\";\r\nimport { MatDialogModule } from \"@angular/material/dialog\";\r\nimport { MatIconModule } from \"@angular/material/icon\";\r\nimport { MatButtonModule } from \"@angular/material/button\";\r\nimport { MatFormFieldModule } from \"@angular/material/form-field\";\r\nimport { MatInputModule } from \"@angular/material/input\";\r\nimport { FormsModule } from \"@angular/forms\";\r\nimport { SdButtonModule } from \"@sd-angular/core/button\";\r\n\r\nimport { DialogConfirmComponent } from \"./components/dialog-confirm/dialog-confirm.component\";\r\nimport { SdDateTimeModule } from \"@sd-angular/core/date-time\";\r\nimport { SdConfirmService } from \"./confirm.service\";\r\n\r\n@NgModule({\r\n imports: [\r\n CommonModule,\r\n FormsModule,\r\n MatFormFieldModule,\r\n MatInputModule,\r\n SdDateTimeModule,\r\n MatIconModule,\r\n MatButtonModule,\r\n MatDialogModule,\r\n SdButtonModule,\r\n ],\r\n declarations: [DialogConfirmComponent],\r\n entryComponents: [DialogConfirmComponent],\r\n exports: [],\r\n providers: [SdConfirmService],\r\n})\r\nexport class SdConfirmModule {}\r\n","/*\r\n * Public API Surface of superdev-angular-core\r\n */\r\n\r\nexport * from './lib/confirm.module';\r\nexport * from './lib/confirm.service';\r\nexport * from './lib/components/dialog-confirm/dialog-confirm.component';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["uuid.v4","Component","MatDialogRef","Inject","MAT_DIALOG_DATA","Injectable","MatDialog","NgModule","CommonModule","FormsModule","MatFormFieldModule","MatInputModule","SdDateTimeModule","MatIconModule","MatButtonModule","MatDialogModule","SdButtonModule"],"mappings":";;;;;;;QAuCE,gCACS,SAA+C,EACtB,IAAgB;;YADzC,cAAS,GAAT,SAAS,CAAsC;YACtB,SAAI,GAAJ,IAAI,CAAY;YALlD,aAAQ,GAAG,KAAK,CAAC;YACjB,aAAQ,GAAG,KAAK,CAAC;YACjB,OAAE,GAAG,MAAIA,OAAO,EAAI,CAAA;YAKlB,IAAI,CAAC,QAAQ,GAAG,cAAO,IAAI,CAAC,IAAI,0CAAE,OAAO,CAAA,KAAK,QAAQ,CAAC;YACvD,IAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,EAAE;gBACf,IAAI,CAAC,KAAK,eAAG,IAAI,aAAJ,IAAI,uBAAJ,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}
|
|
@@ -0,0 +1,2 @@
|
|
|
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/icon"),require("@angular/material/button"),require("@angular/material/form-field"),require("@angular/material/input"),require("@angular/forms"),require("@sd-angular/core/button"),require("uuid"),require("@sd-angular/core/date-time"),require("@sd-angular/core/common")):"function"==typeof define&&define.amd?define("@sd-angular/core/confirm",["exports","@angular/core","@angular/common","@angular/material/dialog","@angular/material/icon","@angular/material/button","@angular/material/form-field","@angular/material/input","@angular/forms","@sd-angular/core/button","uuid","@sd-angular/core/date-time","@sd-angular/core/common"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self)["sd-angular"]=t["sd-angular"]||{},t["sd-angular"].core=t["sd-angular"].core||{},t["sd-angular"].core.confirm={}),t.ng.core,t.ng.common,t.ng.material.dialog,t.ng.material.icon,t.ng.material.button,t.ng.material.formField,t.ng.material.input,t.ng.forms,t["sd-angular"].core.button,t.uuid,t["sd-angular"].core["date-time"])}(this,(function(t,e,a,o,n,i,l,r,d,u,s,m){"use strict";var g=function(t,e){var a,o,n,i,l,r,d;this.dialogRef=t,this.data=e,this.required=!1,this.isString=!1,this.id="I"+s.v4(),this.isString="string"==typeof(null===(a=this.data)||void 0===a?void 0:a.message),(null==e?void 0:e.input)&&(this.value=null!==(n=null===(o=null==e?void 0:e.input)||void 0===o?void 0:o.defaultValue)&&void 0!==n?n:"",this.required=(null===(i=null==e?void 0:e.input)||void 0===i?void 0:i.required)||!1),(null==e?void 0:e.date)&&(this.value=null!==(r=null===(l=null==e?void 0:e.date)||void 0===l?void 0:l.defaultValue)&&void 0!==r?r:"",this.required=(null===(d=null==e?void 0:e.date)||void 0===d?void 0:d.required)||!1)};g.decorators=[{type:e.Component,args:[{selector:"sd-dialog-confirm",template:'<h1 mat-dialog-title class="">\r\n <mat-icon *ngIf="data?.icon" [ngClass]="data?.icon">\r\n {{ data?.icon }}\r\n </mat-icon>\r\n <span [innerHtml]="data?.title || \'Confirm\'"></span>\r\n</h1>\r\n<div mat-dialog-content>\r\n <div *ngIf="isString" [innerHtml]="data?.message"></div>\r\n <div *ngIf="!isString" [innerHtml]="data?.message | json"></div>\r\n <div *ngIf="data?.input">\r\n <mat-form-field appearance="outline">\r\n <textarea style="width: 100%" matInput [placeholder]="data.input?.placeholder" [(ngModel)]="value"\r\n autocomplete="off" rows="5" [maxlength]="data.input?.maxlength"></textarea>\r\n </mat-form-field>\r\n </div>\r\n <div *ngIf="data?.date">\r\n <sd-date-time [placeholder]="data.date?.placeholder" [(model)]="value" type="date" [min]="data.date?.min"\r\n [max]="data.date?.max" [required]="required">\r\n </sd-date-time>\r\n </div>\r\n</div>\r\n<div mat-dialog-actions align="end">\r\n <sd-button *ngIf="data?.noTitle" [color]="data?.noButtonColor || \'secondary\'" [mat-dialog-close]="\'CANCEL\'"\r\n [title]="data?.noTitle" size="sm"></sd-button>\r\n <sd-button class="ml-12" *ngIf="data?.yesTitle" [mat-dialog-close]="value || \'ACCEPT\'"\r\n [color]="data?.yesButtonColor || \'primary\'" [disabled]="required && !value" cdkFocusInitial\r\n [title]="data?.yesTitle" size="sm"></sd-button>\r\n</div>',styles:[":host .mat-dialog-content{margin:0 -16px 16px!important}:host .mat-button{background-color:#f5f5f5}:host>>>.mat-dialog-title{align-items:center;display:flex;justify-content:flex-start}:host>>>.mat-dialog-title .mat-icon{margin-right:5px}:host{display:block;padding:12px 16px}:host>>>.mat-dialog-title .mat-icon.info{color:#2962ff}:host>>>.mat-dialog-title .mat-icon.warning{color:#ffc107}:host>>>.mat-dialog-title .mat-icon.done{color:#4caf50}:host>>>.mat-dialog-title .mat-icon.error{color:#d32f2f}"]}]}],g.ctorParameters=function(){return[{type:o.MatDialogRef},{type:void 0,decorators:[{type:e.Inject,args:[o.MAT_DIALOG_DATA]}]}]};var c=function(t){var e=this;this.dialog=t,this.withInput=function(t){var a=e.dialog.open(g,{width:"400px",data:{title:(null==t?void 0:t.title)||"Xác nhận",message:null==t?void 0:t.message,yesTitle:(null==t?void 0:t.yesTitle)||"Có",noTitle:(null==t?void 0:t.noTitle)||"Không",noButtonColor:(null==t?void 0:t.noButtonColor)||"secondary",yesButtonColor:(null==t?void 0:t.yesButtonColor)||"primary",input:{maxlength:(null==t?void 0:t.maxlength)||255,required:null==t?void 0:t.required,defaultValue:(null==t?void 0:t.defaultValue)||""}}});return new Promise((function(t,e){a.afterClosed().subscribe((function(a){a&&("ACCEPT"===a?t(a):"CANCEL"===a?e(a):t(a))}))}))},this.withDate=function(t){var a=e.dialog.open(g,{width:"400px",data:{title:(null==t?void 0:t.title)||"Xác nhận",message:null==t?void 0:t.message,yesTitle:(null==t?void 0:t.yesTitle)||"Có",noTitle:(null==t?void 0:t.noTitle)||"Không",noButtonColor:(null==t?void 0:t.noButtonColor)||"secondary",yesButtonColor:(null==t?void 0:t.yesButtonColor)||"primary",date:{placeholder:null==t?void 0:t.placeholder,required:null==t?void 0:t.required,defaultValue:(null==t?void 0:t.defaultValue)||""}}});return new Promise((function(t,e){a.afterClosed().subscribe((function(a){a&&("ACCEPT"===a?t(a):"CANCEL"===a?e(a):t(a))}))}))}};c.decorators=[{type:e.Injectable}],c.ctorParameters=function(){return[{type:o.MatDialog}]};var f=function(){};f.decorators=[{type:e.NgModule,args:[{imports:[a.CommonModule,d.FormsModule,l.MatFormFieldModule,r.MatInputModule,m.SdDateTimeModule,n.MatIconModule,i.MatButtonModule,o.MatDialogModule,u.SdButtonModule],declarations:[g],entryComponents:[g],exports:[],providers:[c]}]}],t.DialogConfirmComponent=g,t.SdConfirmModule=f,t.SdConfirmService=c,Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
2
|
+
//# sourceMappingURL=sd-angular-core-confirm.umd.min.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../projects/sd-core/confirm/src/lib/components/dialog-confirm/dialog-confirm.component.ts","../../../../projects/sd-core/confirm/src/lib/confirm.service.ts","../../../../projects/sd-core/confirm/src/lib/confirm.module.ts"],"names":["dialogRef","data","this","required","isString","id","uuid.v4","_a","message","input","value","_c","_b","defaultValue","_d","date","_f","_e","_g","Component","args","selector","template","MatDialogRef","Inject","MAT_DIALOG_DATA","dialog","_this","withInput","option","open","DialogConfirmComponent","width","title","yesTitle","noTitle","noButtonColor","yesButtonColor","maxlength","Promise","resolve","reject","afterClosed","subscribe","result","withDate","placeholder","Injectable","MatDialog","NgModule","imports","CommonModule","FormsModule","MatFormFieldModule","MatInputModule","SdDateTimeModule","MatIconModule","MatButtonModule","MatDialogModule","SdButtonModule","declarations","entryComponents","exports","providers","SdConfirmService"],"mappings":"8uCAuCE,SACSA,EACyBC,qBADzBC,KAAAF,UAAAA,EACyBE,KAAAD,KAAAA,EALlCC,KAAAC,UAAW,EACXD,KAAAE,UAAW,EACXF,KAAAG,GAAK,IAAIC,EAAAA,KAKPJ,KAAKE,SAAyC,iBAAd,QAAhBG,EAAOL,KAAKD,YAAI,IAAAM,OAAA,EAAAA,EAAEC,UAC9BP,MAAAA,OAAI,EAAJA,EAAMQ,SACRP,KAAKQ,MAAiC,QAA5BC,EAAc,QAAdC,EAAGX,MAAAA,OAAI,EAAJA,EAAMQ,aAAK,IAAAG,OAAA,EAAAA,EAAEC,oBAAY,IAAAF,EAAAA,EAAI,GAC1CT,KAAKC,UAAsB,QAAXW,EAAAb,MAAAA,OAAI,EAAJA,EAAMQ,aAAK,IAAAK,OAAA,EAAAA,EAAEX,YAAY,IAEvCF,MAAAA,OAAI,EAAJA,EAAMc,QACRb,KAAKQ,MAAgC,QAA3BM,EAAa,QAAbC,EAAGhB,MAAAA,OAAI,EAAJA,EAAMc,YAAI,IAAAE,OAAA,EAAAA,EAAEJ,oBAAY,IAAAG,EAAAA,EAAI,GACzCd,KAAKC,UAAqB,QAAVe,EAAAjB,MAAAA,OAAI,EAAJA,EAAMc,YAAI,IAAAG,OAAA,EAAAA,EAAEf,YAAY,wBArB7CgB,EAAAA,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R,MAAAA,OAAM,EAANA,EAAQQ,iBAAkB,UAC1CtB,KAAM,CACJ+B,YAAajB,MAAAA,OAAM,EAANA,EAAQiB,YACrB3C,SAAU0B,MAAAA,OAAM,EAANA,EAAQ1B,SAClBU,cAAcgB,MAAAA,OAAM,EAANA,EAAQhB,eAAgB,OAI5C,OAAO,IAAI0B,SAAQ,SAACC,EAASC,GAC3BzC,EAAU0C,cAAcC,WAAU,SAACC,GAC7BA,IACa,WAAXA,EACFJ,EAAQI,GACY,WAAXA,EACTH,EAAOG,GAEPJ,EAAQI,gCAvFnBG,EAAAA,sDAJQC,EAAAA,mBC6BT,iCAjBCC,EAAAA,SAAQ7B,KAAA,CAAC,CACR8B,QAAS,CACPC,EAAAA,aACAC,EAAAA,YACAC,EAAAA,mBACAC,EAAAA,eACAC,EAAAA,iBACAC,EAAAA,cACAC,EAAAA,gBACAC,EAAAA,gBACAC,EAAAA,gBAEFC,aAAc,CAAC7B,GACf8B,gBAAiB,CAAC9B,GAClB+B,QAAS,GACTC,UAAW,CAACC","sourcesContent":["import { Component, Inject } from '@angular/core';\r\nimport { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';\r\nimport { SdBadgeColor } from '@sd-angular/core/badge';\r\nimport * as uuid from 'uuid';\r\n\r\nexport interface DialogData {\r\n icon?: string;\r\n title?: string;\r\n message?: string;\r\n yesTitle?: string;\r\n noTitle?: string;\r\n yesButtonColor?: SdBadgeColor;\r\n noButtonColor?: SdBadgeColor;\r\n input?: {\r\n placeholder?: string;\r\n minlength?: number;\r\n maxlength?: number;\r\n required?: boolean;\r\n defaultValue?: string;\r\n };\r\n date?: {\r\n required?: boolean;\r\n placeholder?: string;\r\n defaultValue?: string | Date;\r\n min?: string | Date;\r\n max?: string | Date;\r\n }\r\n}\r\n\r\n@Component({\r\n selector: 'sd-dialog-confirm',\r\n templateUrl: 'dialog-confirm.component.html',\r\n styleUrls: ['./dialog-confirm.component.css'],\r\n})\r\nexport class DialogConfirmComponent {\r\n value: any;\r\n required = false;\r\n isString = false;\r\n id = `I${uuid.v4()}`\r\n constructor(\r\n public dialogRef: MatDialogRef<DialogConfirmComponent>,\r\n @Inject(MAT_DIALOG_DATA) public data: DialogData\r\n ) {\r\n this.isString = typeof this.data?.message === 'string';\r\n if (data?.input) {\r\n this.value = data?.input?.defaultValue ?? '';\r\n this.required = data?.input?.required || false;\r\n }\r\n if (data?.date) {\r\n this.value = data?.date?.defaultValue ?? '';\r\n this.required = data?.date?.required || false;\r\n }\r\n }\r\n}\r\n","import '@sd-angular/core/common';\r\nimport { Injectable } from '@angular/core';\r\nimport { MatDialog } from '@angular/material/dialog';\r\nimport { DialogConfirmComponent } from './components/dialog-confirm/dialog-confirm.component';\r\nimport { SdBadgeColor } from '@sd-angular/core/badge';\r\n\r\n@Injectable()\r\nexport class SdConfirmService {\r\n constructor(\r\n private dialog: MatDialog,\r\n ) { }\r\n\r\n withInput = (\r\n option?: {\r\n title?: string;\r\n message?: string;\r\n yesTitle?: string;\r\n noTitle?: string;\r\n required?: boolean;\r\n maxlength?: number;\r\n yesButtonColor?: SdBadgeColor;\r\n noButtonColor?: SdBadgeColor;\r\n defaultValue?: string;\r\n }\r\n ): Promise<string> => {\r\n const dialogRef = this.dialog.open(DialogConfirmComponent, {\r\n width: '400px',\r\n data: {\r\n title: option?.title || 'Xác nhận',\r\n message: option?.message,\r\n yesTitle: option?.yesTitle || 'Có',\r\n noTitle: option?.noTitle || 'Không',\r\n noButtonColor: option?.noButtonColor || 'secondary',\r\n yesButtonColor: option?.yesButtonColor || 'primary',\r\n input: {\r\n maxlength: option?.maxlength || 255,\r\n required: option?.required,\r\n defaultValue: option?.defaultValue || ''\r\n },\r\n },\r\n });\r\n return new Promise((resolve, reject) => {\r\n dialogRef.afterClosed().subscribe((result) => {\r\n if (result) {\r\n if (result === 'ACCEPT') {\r\n resolve(result);\r\n } else if (result === 'CANCEL') {\r\n reject(result);\r\n } else {\r\n resolve(result);\r\n }\r\n }\r\n });\r\n });\r\n };\r\n\r\n withDate = (\r\n option?: {\r\n title?: string;\r\n message?: string;\r\n yesTitle?: string;\r\n noTitle?: string;\r\n required?: boolean;\r\n yesButtonColor?: SdBadgeColor;\r\n noButtonColor?: SdBadgeColor;\r\n defaultValue?: string | Date;\r\n placeholder?: string\r\n }\r\n ): Promise<string> => {\r\n const dialogRef = this.dialog.open(DialogConfirmComponent, {\r\n width: '400px',\r\n data: {\r\n title: option?.title || 'Xác nhận',\r\n message: option?.message,\r\n yesTitle: option?.yesTitle || 'Có',\r\n noTitle: option?.noTitle || 'Không',\r\n noButtonColor: option?.noButtonColor || 'secondary',\r\n yesButtonColor: option?.yesButtonColor || 'primary',\r\n date: {\r\n placeholder: option?.placeholder,\r\n required: option?.required,\r\n defaultValue: option?.defaultValue || '',\r\n },\r\n },\r\n });\r\n return new Promise((resolve, reject) => {\r\n dialogRef.afterClosed().subscribe((result) => {\r\n if (result) {\r\n if (result === 'ACCEPT') {\r\n resolve(result);\r\n } else if (result === 'CANCEL') {\r\n reject(result);\r\n } else {\r\n resolve(result);\r\n }\r\n }\r\n });\r\n });\r\n };\r\n}\r\n","import { NgModule } from \"@angular/core\";\r\nimport { CommonModule } from \"@angular/common\";\r\nimport { MatDialogModule } from \"@angular/material/dialog\";\r\nimport { MatIconModule } from \"@angular/material/icon\";\r\nimport { MatButtonModule } from \"@angular/material/button\";\r\nimport { MatFormFieldModule } from \"@angular/material/form-field\";\r\nimport { MatInputModule } from \"@angular/material/input\";\r\nimport { FormsModule } from \"@angular/forms\";\r\nimport { SdButtonModule } from \"@sd-angular/core/button\";\r\n\r\nimport { DialogConfirmComponent } from \"./components/dialog-confirm/dialog-confirm.component\";\r\nimport { SdDateTimeModule } from \"@sd-angular/core/date-time\";\r\nimport { SdConfirmService } from \"./confirm.service\";\r\n\r\n@NgModule({\r\n imports: [\r\n CommonModule,\r\n FormsModule,\r\n MatFormFieldModule,\r\n MatInputModule,\r\n SdDateTimeModule,\r\n MatIconModule,\r\n MatButtonModule,\r\n MatDialogModule,\r\n SdButtonModule,\r\n ],\r\n declarations: [DialogConfirmComponent],\r\n entryComponents: [DialogConfirmComponent],\r\n exports: [],\r\n providers: [SdConfirmService],\r\n})\r\nexport class SdConfirmModule {}\r\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
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/icon'), require('@angular/material/button'), require('@angular/material/form-field'), require('@angular/material/input'), require('@angular/forms'), require('ngx-toastr'), require('@sd-angular/core/button'), require('@sd-angular/core/common'), require('uuid'), require('@sd-angular/core/translate'), require('rxjs/operators'), require('rxjs')
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@sd-angular/core/notify', ['exports', '@angular/core', '@angular/common', '@angular/material/dialog', '@angular/material/icon', '@angular/material/button', '@angular/material/form-field', '@angular/material/input', '@angular/forms', 'ngx-toastr', '@sd-angular/core/button', '@sd-angular/core/common', 'uuid', '@sd-angular/core/translate', 'rxjs/operators', 'rxjs'
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global['sd-angular'] = global['sd-angular'] || {}, global['sd-angular'].core = global['sd-angular'].core || {}, global['sd-angular'].core.notify = {}), global.ng.core, global.ng.common, global.ng.material.dialog, global.ng.material.icon, global.ng.material.button, global.ng.material.formField, global.ng.material.input, global.ng.forms, global['ngx-toastr'], global['sd-angular'].core.button, global['sd-angular'].core.common, global.uuid, global['sd-angular'].core.translate, global.rxjs.operators, global.rxjs
|
|
5
|
-
}(this, (function (exports, core, common, dialog, icon, button, formField, input, forms, ngxToastr, button$1, common$1, uuid, translate, operators, rxjs
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/material/dialog'), require('@angular/material/icon'), require('@angular/material/button'), require('@angular/material/form-field'), require('@angular/material/input'), require('@angular/forms'), require('ngx-toastr'), require('@sd-angular/core/button'), require('@sd-angular/core/common'), require('uuid'), require('@sd-angular/core/translate'), require('rxjs/operators'), require('rxjs')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@sd-angular/core/notify', ['exports', '@angular/core', '@angular/common', '@angular/material/dialog', '@angular/material/icon', '@angular/material/button', '@angular/material/form-field', '@angular/material/input', '@angular/forms', 'ngx-toastr', '@sd-angular/core/button', '@sd-angular/core/common', 'uuid', '@sd-angular/core/translate', 'rxjs/operators', 'rxjs'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global['sd-angular'] = global['sd-angular'] || {}, global['sd-angular'].core = global['sd-angular'].core || {}, global['sd-angular'].core.notify = {}), global.ng.core, global.ng.common, global.ng.material.dialog, global.ng.material.icon, global.ng.material.button, global.ng.material.formField, global.ng.material.input, global.ng.forms, global['ngx-toastr'], global['sd-angular'].core.button, global['sd-angular'].core.common, global.uuid, global['sd-angular'].core.translate, global.rxjs.operators, global.rxjs));
|
|
5
|
+
}(this, (function (exports, core, common, dialog, icon, button, formField, input, forms, ngxToastr, button$1, common$1, uuid, translate, operators, rxjs) { 'use strict';
|
|
6
6
|
|
|
7
7
|
/*! *****************************************************************************
|
|
8
8
|
Copyright (c) Microsoft Corporation.
|
|
@@ -324,7 +324,7 @@
|
|
|
324
324
|
|
|
325
325
|
var DialogConfirmComponent = /** @class */ (function () {
|
|
326
326
|
function DialogConfirmComponent(dialogRef, data) {
|
|
327
|
-
var _a, _b, _c, _d
|
|
327
|
+
var _a, _b, _c, _d;
|
|
328
328
|
this.dialogRef = dialogRef;
|
|
329
329
|
this.data = data;
|
|
330
330
|
this.required = false;
|
|
@@ -335,17 +335,13 @@
|
|
|
335
335
|
this.value = (_c = (_b = data === null || data === void 0 ? void 0 : data.input) === null || _b === void 0 ? void 0 : _b.defaultValue) !== null && _c !== void 0 ? _c : '';
|
|
336
336
|
this.required = ((_d = data === null || data === void 0 ? void 0 : data.input) === null || _d === void 0 ? void 0 : _d.required) || false;
|
|
337
337
|
}
|
|
338
|
-
if (data === null || data === void 0 ? void 0 : data.date) {
|
|
339
|
-
this.value = (_f = (_e = data === null || data === void 0 ? void 0 : data.date) === null || _e === void 0 ? void 0 : _e.defaultValue) !== null && _f !== void 0 ? _f : '';
|
|
340
|
-
this.required = ((_g = data === null || data === void 0 ? void 0 : data.date) === null || _g === void 0 ? void 0 : _g.required) || false;
|
|
341
|
-
}
|
|
342
338
|
}
|
|
343
339
|
return DialogConfirmComponent;
|
|
344
340
|
}());
|
|
345
341
|
DialogConfirmComponent.decorators = [
|
|
346
342
|
{ type: core.Component, args: [{
|
|
347
343
|
selector: 'sd-dialog-confirm',
|
|
348
|
-
template: "<h1 mat-dialog-title class=\"\">\r\n <mat-icon *ngIf=\"data?.icon\" [ngClass]=\"data?.icon\">\r\n {{ data?.icon }}\r\n </mat-icon>\r\n <span [innerHtml]=\"data?.title || 'Confirm'\"></span>\r\n</h1>\r\n<div mat-dialog-content>\r\n <div *ngIf=\"isString\" [innerHtml]=\"data?.message\"></div>\r\n <div *ngIf=\"!isString\" [innerHtml]=\"data?.message | json\"></div>\r\n <div *ngIf=\"data?.input\">\r\n <mat-form-field appearance=\"outline\">\r\n <textarea style=\"width: 100%\" matInput [placeholder]=\"data.input?.placeholder\" [(ngModel)]=\"value\"\r\n autocomplete=\"off\" rows=\"5\" [maxlength]=\"data.input?.maxlength\"></textarea>\r\n </mat-form-field>\r\n </div>\r\n
|
|
344
|
+
template: "<h1 mat-dialog-title class=\"\">\r\n <mat-icon *ngIf=\"data?.icon\" [ngClass]=\"data?.icon\">\r\n {{ data?.icon }}\r\n </mat-icon>\r\n <span [innerHtml]=\"data?.title || 'Confirm'\"></span>\r\n</h1>\r\n<div mat-dialog-content>\r\n <div *ngIf=\"isString\" [innerHtml]=\"data?.message\"></div>\r\n <div *ngIf=\"!isString\" [innerHtml]=\"data?.message | json\"></div>\r\n <div *ngIf=\"data?.input\">\r\n <mat-form-field appearance=\"outline\">\r\n <textarea style=\"width: 100%\" matInput [placeholder]=\"data.input?.placeholder\" [(ngModel)]=\"value\"\r\n autocomplete=\"off\" rows=\"5\" [maxlength]=\"data.input?.maxlength\"></textarea>\r\n </mat-form-field>\r\n </div>\r\n</div>\r\n<div mat-dialog-actions align=\"end\">\r\n <sd-button *ngIf=\"data?.noTitle\" [color]=\"data?.noButtonColor || 'secondary'\" [mat-dialog-close]=\"'CANCEL'\"\r\n [title]=\"data?.noTitle\" size=\"sm\"></sd-button>\r\n <sd-button class=\"ml-12\" *ngIf=\"data?.yesTitle\" [mat-dialog-close]=\"value || 'ACCEPT'\"\r\n [color]=\"data?.yesButtonColor || 'primary'\" [disabled]=\"required && !value\" cdkFocusInitial\r\n [title]=\"data?.yesTitle\" size=\"sm\"></sd-button>\r\n</div>",
|
|
349
345
|
styles: [":host .mat-dialog-content{margin:0 -16px 16px!important}:host .mat-button{background-color:#f5f5f5}:host>>>.mat-dialog-title{align-items:center;display:flex;justify-content:flex-start}:host>>>.mat-dialog-title .mat-icon{margin-right:5px}:host{display:block;padding:12px 16px}:host>>>.mat-dialog-title .mat-icon.info{color:#2962ff}:host>>>.mat-dialog-title .mat-icon.warning{color:#ffc107}:host>>>.mat-dialog-title .mat-icon.done{color:#4caf50}:host>>>.mat-dialog-title .mat-icon.error{color:#d32f2f}"]
|
|
350
346
|
},] }
|
|
351
347
|
];
|
|
@@ -655,40 +651,6 @@
|
|
|
655
651
|
});
|
|
656
652
|
});
|
|
657
653
|
};
|
|
658
|
-
this.confirmWithDate = function (title, option) {
|
|
659
|
-
if (option === void 0) { option = {}; }
|
|
660
|
-
var dialogRef = _this.dialog.open(DialogConfirmComponent, {
|
|
661
|
-
width: '400px',
|
|
662
|
-
data: {
|
|
663
|
-
title: title || _this.translate('Confirm'),
|
|
664
|
-
message: option === null || option === void 0 ? void 0 : option.message,
|
|
665
|
-
yesTitle: (option === null || option === void 0 ? void 0 : option.yesTitle) || _this.translate('Yes'),
|
|
666
|
-
noTitle: (option === null || option === void 0 ? void 0 : option.noTitle) || _this.translate('No'),
|
|
667
|
-
noButtonColor: (option === null || option === void 0 ? void 0 : option.noButtonColor) || 'secondary',
|
|
668
|
-
yesButtonColor: (option === null || option === void 0 ? void 0 : option.yesButtonColor) || 'primary',
|
|
669
|
-
date: {
|
|
670
|
-
placeholder: option === null || option === void 0 ? void 0 : option.placeholder,
|
|
671
|
-
required: option === null || option === void 0 ? void 0 : option.required,
|
|
672
|
-
defaultValue: (option === null || option === void 0 ? void 0 : option.defaultValue) || '',
|
|
673
|
-
},
|
|
674
|
-
},
|
|
675
|
-
});
|
|
676
|
-
return new Promise(function (resolve, reject) {
|
|
677
|
-
dialogRef.afterClosed().subscribe(function (result) {
|
|
678
|
-
if (result) {
|
|
679
|
-
if (result === 'ACCEPT') {
|
|
680
|
-
resolve(result);
|
|
681
|
-
}
|
|
682
|
-
else if (result === 'CANCEL') {
|
|
683
|
-
reject(result);
|
|
684
|
-
}
|
|
685
|
-
else {
|
|
686
|
-
resolve(result);
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
});
|
|
690
|
-
});
|
|
691
|
-
};
|
|
692
654
|
this.translate = function (value) {
|
|
693
655
|
return _this.translateService.translate(value);
|
|
694
656
|
};
|
|
@@ -717,7 +679,6 @@
|
|
|
717
679
|
forms.FormsModule,
|
|
718
680
|
formField.MatFormFieldModule,
|
|
719
681
|
input.MatInputModule,
|
|
720
|
-
dateTime.SdDateTimeModule,
|
|
721
682
|
icon.MatIconModule,
|
|
722
683
|
button.MatButtonModule,
|
|
723
684
|
dialog.MatDialogModule,
|