@sd-angular/core 1.1.60 → 1.1.63
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/assets/scss/core/text.scss +3 -1
- package/bundles/sd-angular-core-db.umd.js +1 -1
- package/bundles/sd-angular-core-db.umd.js.map +1 -1
- package/bundles/sd-angular-core-db.umd.min.js +1 -1
- package/bundles/sd-angular-core-db.umd.min.js.map +1 -1
- package/bundles/sd-angular-core-header-title.umd.js +1 -1
- package/bundles/sd-angular-core-header-title.umd.js.map +1 -1
- package/bundles/sd-angular-core-header-title.umd.min.js +1 -1
- package/bundles/sd-angular-core-header-title.umd.min.js.map +1 -1
- package/bundles/sd-angular-core-notify.umd.js +99 -58
- 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/esm2015/db/src/lib/db.service.js +2 -2
- package/esm2015/header-title/src/lib/header-title.component.js +2 -2
- package/esm2015/notify/src/lib/components/dialog-confirm/dialog-confirm.component.js +15 -8
- package/esm2015/notify/src/lib/notify.module.js +3 -1
- package/esm2015/notify/src/lib/notify.service.js +94 -61
- package/fesm2015/sd-angular-core-db.js +1 -1
- package/fesm2015/sd-angular-core-db.js.map +1 -1
- package/fesm2015/sd-angular-core-header-title.js +1 -1
- package/fesm2015/sd-angular-core-header-title.js.map +1 -1
- package/fesm2015/sd-angular-core-notify.js +99 -58
- package/fesm2015/sd-angular-core-notify.js.map +1 -1
- package/header-title/sd-angular-core-header-title.metadata.json +1 -1
- package/notify/sd-angular-core-notify.metadata.json +1 -1
- package/notify/src/lib/components/dialog-confirm/dialog-confirm.component.d.ts +13 -4
- package/notify/src/lib/notify.service.d.ts +19 -8
- package/package.json +1 -1
- package/{sd-angular-core-1.1.60.tgz → sd-angular-core-1.1.63.tgz} +0 -0
|
@@ -10,25 +10,32 @@ import { ToastrService, ToastrModule } from 'ngx-toastr';
|
|
|
10
10
|
import { SdButtonModule } from '@sd-angular/core/button';
|
|
11
11
|
import { __classPrivateFieldGet } from 'tslib';
|
|
12
12
|
import '@sd-angular/core/common';
|
|
13
|
+
import { v4 } from 'uuid';
|
|
13
14
|
import { SdTranslateService } from '@sd-angular/core/translate';
|
|
14
15
|
import { take, takeUntil } from 'rxjs/operators';
|
|
15
16
|
import { timer } from 'rxjs';
|
|
16
|
-
import {
|
|
17
|
+
import { SdDateTimeModule } from '@sd-angular/core/date-time';
|
|
17
18
|
|
|
18
19
|
class DialogConfirmComponent {
|
|
19
20
|
constructor(dialogRef, data) {
|
|
20
|
-
var _a, _b, _c;
|
|
21
|
+
var _a, _b, _c, _d, _e;
|
|
21
22
|
this.dialogRef = dialogRef;
|
|
22
23
|
this.data = data;
|
|
23
24
|
this.isString = false;
|
|
24
|
-
this.
|
|
25
|
-
this.
|
|
25
|
+
this.id = `I${v4()}`;
|
|
26
|
+
this.isString = typeof ((_a = this.data) === null || _a === void 0 ? void 0 : _a.message) === 'string';
|
|
27
|
+
if (data === null || data === void 0 ? void 0 : data.input) {
|
|
28
|
+
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 : '';
|
|
29
|
+
}
|
|
30
|
+
if (data === null || data === void 0 ? void 0 : data.date) {
|
|
31
|
+
this.value = (_e = (_d = data === null || data === void 0 ? void 0 : data.date) === null || _d === void 0 ? void 0 : _d.defaultValue) !== null && _e !== void 0 ? _e : '';
|
|
32
|
+
}
|
|
26
33
|
}
|
|
27
34
|
}
|
|
28
35
|
DialogConfirmComponent.decorators = [
|
|
29
36
|
{ type: Component, args: [{
|
|
30
|
-
selector:
|
|
31
|
-
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
|
|
37
|
+
selector: 'sd-dialog-confirm',
|
|
38
|
+
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\">\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]=\"data.input?.required && !value\" cdkFocusInitial\r\n [title]=\"data?.yesTitle\" size=\"sm\"></sd-button>\r\n</div>",
|
|
32
39
|
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}"]
|
|
33
40
|
},] }
|
|
34
41
|
];
|
|
@@ -50,45 +57,45 @@ class SdNotifyService {
|
|
|
50
57
|
this.alert = {
|
|
51
58
|
info: (message, title, yesTitle, icon) => {
|
|
52
59
|
this.dialog.open(DialogConfirmComponent, {
|
|
53
|
-
width:
|
|
60
|
+
width: '400px',
|
|
54
61
|
data: {
|
|
55
|
-
icon: icon ||
|
|
56
|
-
title: title || this.translate(
|
|
57
|
-
message: message ||
|
|
58
|
-
yesTitle: yesTitle || this.translate(
|
|
62
|
+
icon: icon || 'info',
|
|
63
|
+
title: title || this.translate('Notice'),
|
|
64
|
+
message: message || 'Done!',
|
|
65
|
+
yesTitle: yesTitle || this.translate('Ok'),
|
|
59
66
|
},
|
|
60
67
|
});
|
|
61
68
|
},
|
|
62
69
|
success: (message, title, yesTitle, icon) => {
|
|
63
70
|
this.dialog.open(DialogConfirmComponent, {
|
|
64
|
-
width:
|
|
71
|
+
width: '400px',
|
|
65
72
|
data: {
|
|
66
|
-
icon: icon ||
|
|
67
|
-
title: title || this.translate(
|
|
68
|
-
message: message ||
|
|
69
|
-
yesTitle: yesTitle || this.translate(
|
|
73
|
+
icon: icon || 'done',
|
|
74
|
+
title: title || this.translate('Success'),
|
|
75
|
+
message: message || 'Done!',
|
|
76
|
+
yesTitle: yesTitle || this.translate('Ok'),
|
|
70
77
|
},
|
|
71
78
|
});
|
|
72
79
|
},
|
|
73
80
|
warning: (message, title, yesTitle, icon) => {
|
|
74
81
|
this.dialog.open(DialogConfirmComponent, {
|
|
75
|
-
width:
|
|
82
|
+
width: '400px',
|
|
76
83
|
data: {
|
|
77
|
-
icon: icon ||
|
|
78
|
-
title: title || this.translate(
|
|
79
|
-
message: message ||
|
|
80
|
-
yesTitle: yesTitle || this.translate(
|
|
84
|
+
icon: icon || 'warning',
|
|
85
|
+
title: title || this.translate('Warning'),
|
|
86
|
+
message: message || 'Something went wrong!',
|
|
87
|
+
yesTitle: yesTitle || this.translate('Ok'),
|
|
81
88
|
},
|
|
82
89
|
});
|
|
83
90
|
},
|
|
84
91
|
error: (message, title, yesTitle, icon) => {
|
|
85
92
|
this.dialog.open(DialogConfirmComponent, {
|
|
86
|
-
width:
|
|
93
|
+
width: '400px',
|
|
87
94
|
data: {
|
|
88
|
-
icon: icon ||
|
|
89
|
-
title: title || this.translate(
|
|
90
|
-
message: message ||
|
|
91
|
-
yesTitle: yesTitle || this.translate(
|
|
95
|
+
icon: icon || 'error',
|
|
96
|
+
title: title || this.translate('Error'),
|
|
97
|
+
message: message || 'Something went wrong!',
|
|
98
|
+
yesTitle: yesTitle || this.translate('Ok'),
|
|
92
99
|
},
|
|
93
100
|
});
|
|
94
101
|
},
|
|
@@ -98,9 +105,9 @@ class SdNotifyService {
|
|
|
98
105
|
// tslint:disable-next-line: max-line-length
|
|
99
106
|
// const style = `border-radius: 5px; margin: 0; padding: 12px; z-index: 99999; top: 5px; right: 5px; display: none; position: fixed;color: #4F8A10; background-color: #DFF2BF`;
|
|
100
107
|
// tslint:disable-next-line: max-line-length
|
|
101
|
-
// const html = `<div id=
|
|
108
|
+
// const html = `<div id='${this.notifyId}' style='${style}'><i class='fa fa-check'></i> ${message || this.translate('Success')}</div>`;
|
|
102
109
|
// this.showNotify(html, delay);
|
|
103
|
-
const content = message || this.translate(
|
|
110
|
+
const content = message || this.translate('Success');
|
|
104
111
|
this.toastr.success(content, title, {
|
|
105
112
|
enableHtml: true,
|
|
106
113
|
timeOut: delay || 3000,
|
|
@@ -210,16 +217,16 @@ class SdNotifyService {
|
|
|
210
217
|
const id = `sd-notify-ckb-${v4()}`;
|
|
211
218
|
const messageLength = messages.length;
|
|
212
219
|
const messageRests = messages.splice(showNum);
|
|
213
|
-
const messageContainer = `<ul class=
|
|
214
|
-
const messageTemp = `<li class=
|
|
220
|
+
const messageContainer = `<ul class='sd-notify__list'>{0}{1}</ul>`;
|
|
221
|
+
const messageTemp = `<li class='sd-notify__item'>- {0}</li>`;
|
|
215
222
|
let contentRest = '';
|
|
216
223
|
if (messageRests === null || messageRests === void 0 ? void 0 : messageRests.length) {
|
|
217
|
-
contentRest = `<input id=
|
|
218
|
-
<label class=
|
|
219
|
-
<div class=
|
|
224
|
+
contentRest = `<input id='${id}' class='cdk-visually-hidden sd-notify__checkbox' type='checkbox' />
|
|
225
|
+
<label class='sd-notify__text sd-notify__text--show' for='${id}'>${this.translate('Show more')}</label>
|
|
226
|
+
<div class='sd-notify__item--rest'>
|
|
220
227
|
${messageRests.map(m => String.format(messageTemp, m)).join('')}
|
|
221
228
|
</div>
|
|
222
|
-
<label class=
|
|
229
|
+
<label class='sd-notify__text sd-notify__text--less' for='${id}'>${this.translate('Show less')}</label>`;
|
|
223
230
|
}
|
|
224
231
|
const content = String.format(messageContainer, messages.map(m => String.format(messageTemp, m)).join(''), contentRest);
|
|
225
232
|
let toast;
|
|
@@ -256,46 +263,46 @@ class SdNotifyService {
|
|
|
256
263
|
});
|
|
257
264
|
this.handle = {
|
|
258
265
|
error: (err) => {
|
|
259
|
-
if (typeof err ===
|
|
266
|
+
if (typeof err === 'string') {
|
|
260
267
|
this.notify.warning(err);
|
|
261
268
|
}
|
|
262
|
-
else if (typeof err ===
|
|
269
|
+
else if (typeof err === 'object') {
|
|
263
270
|
let message = (err === null || err === void 0 ? void 0 : err.error) || (err === null || err === void 0 ? void 0 : err.message) || (err === null || err === void 0 ? void 0 : err.ExceptionMessage) || (err === null || err === void 0 ? void 0 : err.Message) ||
|
|
264
|
-
|
|
265
|
-
if (typeof err.json ===
|
|
271
|
+
'Unknown error';
|
|
272
|
+
if (typeof err.json === 'function') {
|
|
266
273
|
err = err.json();
|
|
267
274
|
if (err) {
|
|
268
275
|
message =
|
|
269
276
|
(err === null || err === void 0 ? void 0 : err.error) || (err === null || err === void 0 ? void 0 : err.message) || (err === null || err === void 0 ? void 0 : err.ExceptionMessage) || (err === null || err === void 0 ? void 0 : err.Message) ||
|
|
270
|
-
|
|
277
|
+
'Unknown error';
|
|
271
278
|
}
|
|
272
279
|
}
|
|
273
280
|
this.notify.warning(message);
|
|
274
281
|
}
|
|
275
282
|
else {
|
|
276
|
-
this.notify.warning(
|
|
283
|
+
this.notify.warning('Unknown error');
|
|
277
284
|
}
|
|
278
285
|
},
|
|
279
286
|
};
|
|
280
287
|
this.confirm = (message, option = {}) => {
|
|
281
288
|
const dialogRef = this.dialog.open(DialogConfirmComponent, {
|
|
282
|
-
width:
|
|
289
|
+
width: '400px',
|
|
283
290
|
data: {
|
|
284
|
-
title: (option === null || option === void 0 ? void 0 : option.title) || this.translate(
|
|
291
|
+
title: (option === null || option === void 0 ? void 0 : option.title) || this.translate('Confirm'),
|
|
285
292
|
message,
|
|
286
|
-
yesTitle: (option === null || option === void 0 ? void 0 : option.yesTitle) || this.translate(
|
|
287
|
-
noTitle: (option === null || option === void 0 ? void 0 : option.noTitle) || this.translate(
|
|
288
|
-
noButtonColor: (option === null || option === void 0 ? void 0 : option.noButtonColor) ||
|
|
289
|
-
yesButtonColor: (option === null || option === void 0 ? void 0 : option.yesButtonColor) ||
|
|
293
|
+
yesTitle: (option === null || option === void 0 ? void 0 : option.yesTitle) || this.translate('Yes'),
|
|
294
|
+
noTitle: (option === null || option === void 0 ? void 0 : option.noTitle) || this.translate('No'),
|
|
295
|
+
noButtonColor: (option === null || option === void 0 ? void 0 : option.noButtonColor) || 'secondary',
|
|
296
|
+
yesButtonColor: (option === null || option === void 0 ? void 0 : option.yesButtonColor) || 'primary',
|
|
290
297
|
},
|
|
291
298
|
});
|
|
292
299
|
return new Promise((resolve, reject) => {
|
|
293
300
|
dialogRef.afterClosed().subscribe((result) => {
|
|
294
301
|
if (result) {
|
|
295
|
-
if (result ===
|
|
302
|
+
if (result === 'ACCEPT') {
|
|
296
303
|
resolve(null);
|
|
297
304
|
}
|
|
298
|
-
else if (result ===
|
|
305
|
+
else if (result === 'CANCEL') {
|
|
299
306
|
reject(result);
|
|
300
307
|
}
|
|
301
308
|
else {
|
|
@@ -305,18 +312,18 @@ class SdNotifyService {
|
|
|
305
312
|
});
|
|
306
313
|
});
|
|
307
314
|
};
|
|
308
|
-
this.confirmDelete = () => this.confirm(this.translate(
|
|
309
|
-
this.confirmApprove = () => this.confirm(this.translate(
|
|
315
|
+
this.confirmDelete = () => this.confirm(this.translate('Delete record(s)'));
|
|
316
|
+
this.confirmApprove = () => this.confirm(this.translate('Approve record(s)'));
|
|
310
317
|
this.confirmWithInput = (title, option = {}) => {
|
|
311
318
|
const dialogRef = this.dialog.open(DialogConfirmComponent, {
|
|
312
|
-
width:
|
|
319
|
+
width: '400px',
|
|
313
320
|
data: {
|
|
314
|
-
title: title || this.translate(
|
|
321
|
+
title: title || this.translate('Confirm'),
|
|
315
322
|
message: option === null || option === void 0 ? void 0 : option.message,
|
|
316
|
-
yesTitle: (option === null || option === void 0 ? void 0 : option.yesTitle) || this.translate(
|
|
317
|
-
noTitle: (option === null || option === void 0 ? void 0 : option.noTitle) || this.translate(
|
|
318
|
-
noButtonColor: (option === null || option === void 0 ? void 0 : option.noButtonColor) ||
|
|
319
|
-
yesButtonColor: (option === null || option === void 0 ? void 0 : option.yesButtonColor) ||
|
|
323
|
+
yesTitle: (option === null || option === void 0 ? void 0 : option.yesTitle) || this.translate('Yes'),
|
|
324
|
+
noTitle: (option === null || option === void 0 ? void 0 : option.noTitle) || this.translate('No'),
|
|
325
|
+
noButtonColor: (option === null || option === void 0 ? void 0 : option.noButtonColor) || 'secondary',
|
|
326
|
+
yesButtonColor: (option === null || option === void 0 ? void 0 : option.yesButtonColor) || 'primary',
|
|
320
327
|
input: {
|
|
321
328
|
maxlength: (option === null || option === void 0 ? void 0 : option.maxlength) || 255,
|
|
322
329
|
required: option === null || option === void 0 ? void 0 : option.required,
|
|
@@ -327,10 +334,43 @@ class SdNotifyService {
|
|
|
327
334
|
return new Promise((resolve, reject) => {
|
|
328
335
|
dialogRef.afterClosed().subscribe((result) => {
|
|
329
336
|
if (result) {
|
|
330
|
-
if (result ===
|
|
337
|
+
if (result === 'ACCEPT') {
|
|
338
|
+
resolve(result);
|
|
339
|
+
}
|
|
340
|
+
else if (result === 'CANCEL') {
|
|
341
|
+
reject(result);
|
|
342
|
+
}
|
|
343
|
+
else {
|
|
344
|
+
resolve(result);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
});
|
|
349
|
+
};
|
|
350
|
+
this.confirmWithDate = (title, option = {}) => {
|
|
351
|
+
const dialogRef = this.dialog.open(DialogConfirmComponent, {
|
|
352
|
+
width: '400px',
|
|
353
|
+
data: {
|
|
354
|
+
title: title || this.translate('Confirm'),
|
|
355
|
+
message: option === null || option === void 0 ? void 0 : option.message,
|
|
356
|
+
yesTitle: (option === null || option === void 0 ? void 0 : option.yesTitle) || this.translate('Yes'),
|
|
357
|
+
noTitle: (option === null || option === void 0 ? void 0 : option.noTitle) || this.translate('No'),
|
|
358
|
+
noButtonColor: (option === null || option === void 0 ? void 0 : option.noButtonColor) || 'secondary',
|
|
359
|
+
yesButtonColor: (option === null || option === void 0 ? void 0 : option.yesButtonColor) || 'primary',
|
|
360
|
+
date: {
|
|
361
|
+
placeholder: option === null || option === void 0 ? void 0 : option.placeholder,
|
|
362
|
+
required: option === null || option === void 0 ? void 0 : option.required,
|
|
363
|
+
defaultValue: (option === null || option === void 0 ? void 0 : option.defaultValue) || '',
|
|
364
|
+
},
|
|
365
|
+
},
|
|
366
|
+
});
|
|
367
|
+
return new Promise((resolve, reject) => {
|
|
368
|
+
dialogRef.afterClosed().subscribe((result) => {
|
|
369
|
+
if (result) {
|
|
370
|
+
if (result === 'ACCEPT') {
|
|
331
371
|
resolve(result);
|
|
332
372
|
}
|
|
333
|
-
else if (result ===
|
|
373
|
+
else if (result === 'CANCEL') {
|
|
334
374
|
reject(result);
|
|
335
375
|
}
|
|
336
376
|
else {
|
|
@@ -364,6 +404,7 @@ SdNotifyModule.decorators = [
|
|
|
364
404
|
FormsModule,
|
|
365
405
|
MatFormFieldModule,
|
|
366
406
|
MatInputModule,
|
|
407
|
+
SdDateTimeModule,
|
|
367
408
|
MatIconModule,
|
|
368
409
|
MatButtonModule,
|
|
369
410
|
MatDialogModule,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sd-angular-core-notify.js","sources":["../../../../projects/sd-core/notify/src/lib/components/dialog-confirm/dialog-confirm.component.ts","../../../../projects/sd-core/notify/src/lib/notify.service.ts","../../../../projects/sd-core/notify/src/lib/notify.module.ts","../../../../projects/sd-core/notify/src/public-api.ts","../../../../projects/sd-core/notify/sd-angular-core-notify.ts"],"sourcesContent":["import { Component, Inject } from \"@angular/core\";\r\nimport { MatDialogRef, MAT_DIALOG_DATA } from \"@angular/material/dialog\";\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?: string;\r\n noButtonColor?: string;\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}\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: string;\r\n isString = false;\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 this.value = data?.input?.defaultValue ?? '';\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 { ActiveToast, ToastrService } from \"ngx-toastr\";\r\nimport { SdTranslateService } from \"@sd-angular/core/translate\";\r\nimport { debounceTime, take, takeUntil } from \"rxjs/operators\";\r\nimport { Subject, timer } from \"rxjs\";\r\nimport * as uuid from 'uuid';\r\n\r\n@Injectable()\r\nexport class SdNotifyService {\r\n #delayDuration = 500; // Các error/warning message sẽ tự động gộp sau khoảng thời gian trên\r\n #warningKey = uuid.v4();\r\n #errorKey = uuid.v4();\r\n #cache: {\r\n [key: string]: {\r\n createdDate: Date;\r\n data?: {\r\n title: string,\r\n messages: string[]\r\n }\r\n }\r\n } = {};\r\n constructor(\r\n private dialog: MatDialog,\r\n private toastr: ToastrService,\r\n private translateService: SdTranslateService\r\n ) { }\r\n\r\n alert = {\r\n info: (\r\n message?: string,\r\n title?: string,\r\n yesTitle?: string,\r\n icon?: string\r\n ) => {\r\n this.dialog.open(DialogConfirmComponent, {\r\n width: \"400px\",\r\n data: {\r\n icon: icon || \"info\",\r\n title: title || this.translate(\"Notice\"),\r\n message: message || \"Done!\",\r\n yesTitle: yesTitle || this.translate(\"Ok\"),\r\n },\r\n });\r\n },\r\n success: (\r\n message?: string,\r\n title?: string,\r\n yesTitle?: string,\r\n icon?: string\r\n ) => {\r\n this.dialog.open(DialogConfirmComponent, {\r\n width: \"400px\",\r\n data: {\r\n icon: icon || \"done\",\r\n title: title || this.translate(\"Success\"),\r\n message: message || \"Done!\",\r\n yesTitle: yesTitle || this.translate(\"Ok\"),\r\n },\r\n });\r\n },\r\n warning: (\r\n message?: string,\r\n title?: string,\r\n yesTitle?: string,\r\n icon?: string\r\n ) => {\r\n this.dialog.open(DialogConfirmComponent, {\r\n width: \"400px\",\r\n data: {\r\n icon: icon || \"warning\",\r\n title: title || this.translate(\"Warning\"),\r\n message: message || \"Something went wrong!\",\r\n yesTitle: yesTitle || this.translate(\"Ok\"),\r\n },\r\n });\r\n },\r\n error: (\r\n message?: string,\r\n title?: string,\r\n yesTitle?: string,\r\n icon?: string\r\n ) => {\r\n this.dialog.open(DialogConfirmComponent, {\r\n width: \"400px\",\r\n data: {\r\n icon: icon || \"error\",\r\n title: title || this.translate(\"Error\"),\r\n message: message || \"Something went wrong!\",\r\n yesTitle: yesTitle || this.translate(\"Ok\"),\r\n },\r\n });\r\n },\r\n };\r\n\r\n notify = {\r\n success: (message?: string, delay?: number, title?: string) => {\r\n // tslint:disable-next-line: max-line-length\r\n // const style = `border-radius: 5px; margin: 0; padding: 12px; z-index: 99999; top: 5px; right: 5px; display: none; position: fixed;color: #4F8A10; background-color: #DFF2BF`;\r\n // tslint:disable-next-line: max-line-length\r\n // const html = `<div id=\"${this.notifyId}\" style=\"${style}\"><i class=\"fa fa-check\"></i> ${message || this.translate('Success')}</div>`;\r\n // this.showNotify(html, delay);\r\n const content = message || this.translate(\"Success\");\r\n this.toastr.success(content, title, {\r\n enableHtml: true,\r\n timeOut: delay || 3000,\r\n closeButton: true,\r\n });\r\n },\r\n warning: (message?: string | string[], delay?: number, title?: string) => {\r\n if (!this.#cache[this.#warningKey] || Date.addMiliseconds(this.#cache[this.#warningKey].createdDate, this.#delayDuration) < new Date()) {\r\n this.#cache[this.#warningKey] = {\r\n createdDate: new Date(),\r\n data: {\r\n title: title,\r\n messages: [],\r\n }\r\n };\r\n timer(this.#delayDuration).pipe(take(1)).subscribe(() => {\r\n const messages = this.#cache[this.#warningKey].data.messages.union(null);\r\n if (messages.length === 1) {\r\n this.#notifyWarning({\r\n title: this.#cache[this.#warningKey].data.title,\r\n message: messages[0],\r\n delay\r\n });\r\n } else {\r\n this.#notifyWarning({\r\n title: this.#cache[this.#warningKey].data.title,\r\n message: messages,\r\n delay\r\n });\r\n }\r\n });\r\n }\r\n if (Array.isArray(message)) {\r\n this.#cache[this.#warningKey].data.messages = [...this.#cache[this.#warningKey].data.messages, ...message];\r\n } else {\r\n this.#cache[this.#warningKey].data.messages.push(message);\r\n }\r\n },\r\n error: (message?: string | string[], delay?: number, title?: string) => {\r\n if (!this.#cache[this.#errorKey] || Date.addMiliseconds(this.#cache[this.#errorKey].createdDate, this.#delayDuration) < new Date()) {\r\n this.#cache[this.#errorKey] = {\r\n createdDate: new Date(),\r\n data: {\r\n title,\r\n messages: [],\r\n }\r\n };\r\n timer(this.#delayDuration).pipe(take(1)).subscribe(() => {\r\n const messages = this.#cache[this.#errorKey].data.messages.union(null);\r\n if (messages.length === 1) {\r\n this.#notifyError({\r\n title: this.#cache[this.#errorKey].data.title,\r\n message: messages[0],\r\n delay\r\n });\r\n } else {\r\n this.#notifyError({\r\n title: this.#cache[this.#errorKey].data.title,\r\n message: messages,\r\n delay\r\n });\r\n }\r\n });\r\n }\r\n if (Array.isArray(message)) {\r\n this.#cache[this.#errorKey].data.messages = [...this.#cache[this.#errorKey].data.messages, ...message];\r\n } else {\r\n this.#cache[this.#errorKey].data.messages.push(message);\r\n }\r\n },\r\n };\r\n\r\n #notifyWarning = (args: {\r\n message?: string | string[],\r\n delay?: number,\r\n title?: string\r\n }) => {\r\n const { message, delay, title } = args;\r\n if (Array.isArray(message)) {\r\n this.#buildToastMultiMesssage('warning', message, delay, title);\r\n }\r\n else {\r\n const content = message || this.translate('Warning');\r\n this.toastr.warning(content, title, {\r\n enableHtml: true,\r\n timeOut: delay || 3000,\r\n closeButton: true,\r\n });\r\n }\r\n }\r\n\r\n #notifyError = (args: {\r\n message?: string | string[],\r\n delay?: number,\r\n title?: string\r\n }) => {\r\n const { message, delay, title } = args;\r\n if (Array.isArray(message)) {\r\n this.#buildToastMultiMesssage('error', message, delay, title);\r\n }\r\n else {\r\n const content = message || this.translate('Error');\r\n this.toastr.error(content, title, {\r\n enableHtml: true,\r\n timeOut: delay || 3000,\r\n closeButton: true,\r\n });\r\n }\r\n }\r\n\r\n #buildToastMultiMesssage = (type: 'warning' | 'error', messages: string[], delay?: number, title?: string) => {\r\n /** số lượng item hiển thị mặc định */\r\n const showNum = 2;\r\n const id = `sd-notify-ckb-${uuid.v4()}`;\r\n const messageLength = messages.length;\r\n const messageRests = messages.splice(showNum);\r\n const messageContainer = `<ul class=\"sd-notify__list\">{0}{1}</ul>`;\r\n const messageTemp = `<li class=\"sd-notify__item\">- {0}</li>`;\r\n let contentRest = '';\r\n if (messageRests?.length) {\r\n contentRest = `<input id=\"${id}\" class=\"cdk-visually-hidden sd-notify__checkbox\" type=\"checkbox\" />\r\n <label class=\"sd-notify__text sd-notify__text--show\" for=\"${id}\">${this.translate('Show more')}</label>\r\n <div class=\"sd-notify__item--rest\">\r\n ${messageRests.map(m => String.format(messageTemp, m)).join('')}\r\n </div>\r\n <label class=\"sd-notify__text sd-notify__text--less\" for=\"${id}\">${this.translate('Show less')}</label>`;\r\n }\r\n const content = String.format(messageContainer, messages.map(m => String.format(messageTemp, m)).join(''), contentRest);\r\n let toast: ActiveToast<any>;\r\n // khi truyền message html sẽ bị sanitize nên phải truyền innerHTML khi toast hiện lên\r\n // @see https://github.com/scttcper/ngx-toastr/blob/v12.1.0/src/lib/toastr/toastr.service.ts#L271\r\n switch (type) {\r\n case 'error':\r\n toast = this.toastr.error(content, `${title || this.translate('Error')} (${messageLength})`, {\r\n enableHtml: true,\r\n timeOut: delay || 3000,\r\n messageClass: `toast-message toast-message-${id}`,\r\n closeButton: true,\r\n tapToDismiss: false\r\n });\r\n break;\r\n case 'warning':\r\n toast = this.toastr.warning(content, `${title || this.translate('Warning')} (${messageLength})`, {\r\n enableHtml: true,\r\n timeOut: delay || 3000,\r\n messageClass: `toast-message toast-message-${id}`,\r\n closeButton: true,\r\n tapToDismiss: false\r\n });\r\n break;\r\n }\r\n\r\n if (toast) {\r\n toast.onShown\r\n .pipe(\r\n takeUntil(toast.onHidden)\r\n )\r\n .subscribe(() => {\r\n const messageEle: HTMLDivElement = document.querySelector(`.toast-message-${id}`);\r\n messageEle.innerHTML = content;\r\n })\r\n }\r\n }\r\n\r\n handle = {\r\n error: (err: any) => {\r\n if (typeof err === \"string\") {\r\n this.notify.warning(err);\r\n } else if (typeof err === \"object\") {\r\n let message =\r\n err?.error ||\r\n err?.message ||\r\n err?.ExceptionMessage ||\r\n err?.Message ||\r\n \"Unknown error\";\r\n if (typeof err.json === \"function\") {\r\n err = err.json();\r\n if (err) {\r\n message =\r\n err?.error ||\r\n err?.message ||\r\n err?.ExceptionMessage ||\r\n err?.Message ||\r\n \"Unknown error\";\r\n }\r\n }\r\n this.notify.warning(message);\r\n } else {\r\n this.notify.warning(\"Unknown error\");\r\n }\r\n },\r\n };\r\n\r\n confirm = (\r\n message: string,\r\n option: {\r\n title?: string;\r\n yesTitle?: string;\r\n noTitle?: string;\r\n yesButtonColor?: string;\r\n noButtonColor?: string;\r\n } = {}\r\n ) => {\r\n const dialogRef = this.dialog.open(DialogConfirmComponent, {\r\n width: \"400px\",\r\n data: {\r\n title: option?.title || this.translate(\"Confirm\"),\r\n message,\r\n yesTitle: option?.yesTitle || this.translate(\"Yes\"),\r\n noTitle: option?.noTitle || this.translate(\"No\"),\r\n noButtonColor: option?.noButtonColor || \"secondary\",\r\n yesButtonColor: option?.yesButtonColor || \"primary\",\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(null);\r\n } else if (result === \"CANCEL\") {\r\n reject(result);\r\n } else {\r\n resolve(null);\r\n }\r\n }\r\n });\r\n });\r\n };\r\n\r\n confirmDelete = () => this.confirm(this.translate(\"Delete record(s)\"));\r\n\r\n confirmApprove = () => this.confirm(this.translate(\"Approve record(s)\"));\r\n\r\n confirmWithInput = (\r\n title: string,\r\n option: {\r\n message?: string;\r\n yesTitle?: string;\r\n noTitle?: string;\r\n required?: boolean;\r\n maxlength?: number;\r\n yesButtonColor?: string;\r\n noButtonColor?: string;\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: title || this.translate(\"Confirm\"),\r\n message: option?.message,\r\n yesTitle: option?.yesTitle || this.translate(\"Yes\"),\r\n noTitle: option?.noTitle || this.translate(\"No\"),\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 private translate = (value: string): string => {\r\n return this.translateService.translate(value);\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 { ToastrService, ToastrModule } from \"ngx-toastr\";\r\nimport { SdButtonModule } from \"@sd-angular/core/button\";\r\n\r\nimport { SdNotifyService } from \"./notify.service\";\r\nimport { DialogConfirmComponent } from \"./components/dialog-confirm/dialog-confirm.component\";\r\n\r\n@NgModule({\r\n imports: [\r\n CommonModule,\r\n FormsModule,\r\n MatFormFieldModule,\r\n MatInputModule,\r\n MatIconModule,\r\n MatButtonModule,\r\n MatDialogModule,\r\n ToastrModule.forRoot(),\r\n\r\n SdButtonModule,\r\n ],\r\n declarations: [DialogConfirmComponent],\r\n entryComponents: [DialogConfirmComponent],\r\n exports: [],\r\n providers: [SdNotifyService],\r\n})\r\nexport class SdNotifyModule {}\r\n","/*\r\n * Public API Surface of superdev-angular-core\r\n */\r\n\r\nexport { SdNotifyModule } from './lib/notify.module';\r\nexport * from './lib/notify.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"],"mappings":";;;;;;;;;;;;;;;;;MAyBa,sBAAsB;IAGjC,YACS,SAA+C,EACtB,IAAgB;;QADzC,cAAS,GAAT,SAAS,CAAsC;QACtB,SAAI,GAAJ,IAAI,CAAY;QAHlD,aAAQ,GAAG,KAAK,CAAC;QAKf,IAAI,CAAC,QAAQ,GAAG,cAAO,IAAI,CAAC,IAAI,0CAAE,OAAO,CAAA,KAAK,QAAQ,CAAC;QACvD,IAAI,CAAC,KAAK,eAAG,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,0CAAE,YAAY,mCAAI,EAAE,CAAC;KAC9C;;;YAdF,SAAS,SAAC;gBACT,QAAQ,EAAE,mBAAmB;gBAC7B,m+CAA4C;;aAE7C;;;YAvBQ,YAAY;4CA6BhB,MAAM,SAAC,eAAe;;;;MCnBd,eAAe;IAa1B,YACU,MAAiB,EACjB,MAAqB,EACrB,gBAAoC;QAFpC,WAAM,GAAN,MAAM,CAAW;QACjB,WAAM,GAAN,MAAM,CAAe;QACrB,qBAAgB,GAAhB,gBAAgB,CAAoB;QAf9C,yBAAiB,GAAG,EAAC;QACrB,sBAAcA,EAAO,EAAE,EAAC;QACxB,oBAAYA,EAAO,EAAE,EAAC;QACtB,iBAQI,EAAE,EAAC;QAOP,UAAK,GAAG;YACN,IAAI,EAAE,CACJ,OAAgB,EAChB,KAAc,EACd,QAAiB,EACjB,IAAa;gBAEb,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,sBAAsB,EAAE;oBACvC,KAAK,EAAE,OAAO;oBACd,IAAI,EAAE;wBACJ,IAAI,EAAE,IAAI,IAAI,MAAM;wBACpB,KAAK,EAAE,KA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Y;oBACZ,WAAW;oBACX,kBAAkB;oBAClB,cAAc;oBACd,aAAa;oBACb,eAAe;oBACf,eAAe;oBACf,YAAY,CAAC,OAAO,EAAE;oBAEtB,cAAc;iBACf;gBACD,YAAY,EAAE,CAAC,sBAAsB,CAAC;gBACtC,eAAe,EAAE,CAAC,sBAAsB,CAAC;gBACzC,OAAO,EAAE,EAAE;gBACX,SAAS,EAAE,CAAC,eAAe,CAAC;aAC7B;;;AC/BD;;;;ACAA;;;;;;"}
|
|
1
|
+
{"version":3,"file":"sd-angular-core-notify.js","sources":["../../../../projects/sd-core/notify/src/lib/components/dialog-confirm/dialog-confirm.component.ts","../../../../projects/sd-core/notify/src/lib/notify.service.ts","../../../../projects/sd-core/notify/src/lib/notify.module.ts","../../../../projects/sd-core/notify/src/public-api.ts","../../../../projects/sd-core/notify/sd-angular-core-notify.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 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 }\r\n if (data?.date) {\r\n this.value = data?.date?.defaultValue ?? '';\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 { ActiveToast, ToastrService } from 'ngx-toastr';\r\nimport { SdTranslateService } from '@sd-angular/core/translate';\r\nimport { debounceTime, take, takeUntil } from 'rxjs/operators';\r\nimport { Subject, timer } from 'rxjs';\r\nimport * as uuid from 'uuid';\r\nimport { SdBadgeColor } from '@sd-angular/core/badge';\r\n\r\n@Injectable()\r\nexport class SdNotifyService {\r\n #delayDuration = 500; // Các error/warning message sẽ tự động gộp sau khoảng thời gian trên\r\n #warningKey = uuid.v4();\r\n #errorKey = uuid.v4();\r\n #cache: {\r\n [key: string]: {\r\n createdDate: Date;\r\n data?: {\r\n title: string,\r\n messages: string[]\r\n }\r\n }\r\n } = {};\r\n constructor(\r\n private dialog: MatDialog,\r\n private toastr: ToastrService,\r\n private translateService: SdTranslateService\r\n ) { }\r\n\r\n alert = {\r\n info: (\r\n message?: string,\r\n title?: string,\r\n yesTitle?: string,\r\n icon?: string\r\n ) => {\r\n this.dialog.open(DialogConfirmComponent, {\r\n width: '400px',\r\n data: {\r\n icon: icon || 'info',\r\n title: title || this.translate('Notice'),\r\n message: message || 'Done!',\r\n yesTitle: yesTitle || this.translate('Ok'),\r\n },\r\n });\r\n },\r\n success: (\r\n message?: string,\r\n title?: string,\r\n yesTitle?: string,\r\n icon?: string\r\n ) => {\r\n this.dialog.open(DialogConfirmComponent, {\r\n width: '400px',\r\n data: {\r\n icon: icon || 'done',\r\n title: title || this.translate('Success'),\r\n message: message || 'Done!',\r\n yesTitle: yesTitle || this.translate('Ok'),\r\n },\r\n });\r\n },\r\n warning: (\r\n message?: string,\r\n title?: string,\r\n yesTitle?: string,\r\n icon?: string\r\n ) => {\r\n this.dialog.open(DialogConfirmComponent, {\r\n width: '400px',\r\n data: {\r\n icon: icon || 'warning',\r\n title: title || this.translate('Warning'),\r\n message: message || 'Something went wrong!',\r\n yesTitle: yesTitle || this.translate('Ok'),\r\n },\r\n });\r\n },\r\n error: (\r\n message?: string,\r\n title?: string,\r\n yesTitle?: string,\r\n icon?: string\r\n ) => {\r\n this.dialog.open(DialogConfirmComponent, {\r\n width: '400px',\r\n data: {\r\n icon: icon || 'error',\r\n title: title || this.translate('Error'),\r\n message: message || 'Something went wrong!',\r\n yesTitle: yesTitle || this.translate('Ok'),\r\n },\r\n });\r\n },\r\n };\r\n\r\n notify = {\r\n success: (message?: string, delay?: number, title?: string) => {\r\n // tslint:disable-next-line: max-line-length\r\n // const style = `border-radius: 5px; margin: 0; padding: 12px; z-index: 99999; top: 5px; right: 5px; display: none; position: fixed;color: #4F8A10; background-color: #DFF2BF`;\r\n // tslint:disable-next-line: max-line-length\r\n // const html = `<div id='${this.notifyId}' style='${style}'><i class='fa fa-check'></i> ${message || this.translate('Success')}</div>`;\r\n // this.showNotify(html, delay);\r\n const content = message || this.translate('Success');\r\n this.toastr.success(content, title, {\r\n enableHtml: true,\r\n timeOut: delay || 3000,\r\n closeButton: true,\r\n });\r\n },\r\n warning: (message?: string | string[], delay?: number, title?: string) => {\r\n if (!this.#cache[this.#warningKey] || Date.addMiliseconds(this.#cache[this.#warningKey].createdDate, this.#delayDuration) < new Date()) {\r\n this.#cache[this.#warningKey] = {\r\n createdDate: new Date(),\r\n data: {\r\n title: title,\r\n messages: [],\r\n }\r\n };\r\n timer(this.#delayDuration).pipe(take(1)).subscribe(() => {\r\n const messages = this.#cache[this.#warningKey].data.messages.union(null);\r\n if (messages.length === 1) {\r\n this.#notifyWarning({\r\n title: this.#cache[this.#warningKey].data.title,\r\n message: messages[0],\r\n delay\r\n });\r\n } else {\r\n this.#notifyWarning({\r\n title: this.#cache[this.#warningKey].data.title,\r\n message: messages,\r\n delay\r\n });\r\n }\r\n });\r\n }\r\n if (Array.isArray(message)) {\r\n this.#cache[this.#warningKey].data.messages = [...this.#cache[this.#warningKey].data.messages, ...message];\r\n } else {\r\n this.#cache[this.#warningKey].data.messages.push(message);\r\n }\r\n },\r\n error: (message?: string | string[], delay?: number, title?: string) => {\r\n if (!this.#cache[this.#errorKey] || Date.addMiliseconds(this.#cache[this.#errorKey].createdDate, this.#delayDuration) < new Date()) {\r\n this.#cache[this.#errorKey] = {\r\n createdDate: new Date(),\r\n data: {\r\n title,\r\n messages: [],\r\n }\r\n };\r\n timer(this.#delayDuration).pipe(take(1)).subscribe(() => {\r\n const messages = this.#cache[this.#errorKey].data.messages.union(null);\r\n if (messages.length === 1) {\r\n this.#notifyError({\r\n title: this.#cache[this.#errorKey].data.title,\r\n message: messages[0],\r\n delay\r\n });\r\n } else {\r\n this.#notifyError({\r\n title: this.#cache[this.#errorKey].data.title,\r\n message: messages,\r\n delay\r\n });\r\n }\r\n });\r\n }\r\n if (Array.isArray(message)) {\r\n this.#cache[this.#errorKey].data.messages = [...this.#cache[this.#errorKey].data.messages, ...message];\r\n } else {\r\n this.#cache[this.#errorKey].data.messages.push(message);\r\n }\r\n },\r\n };\r\n\r\n #notifyWarning = (args: {\r\n message?: string | string[],\r\n delay?: number,\r\n title?: string\r\n }) => {\r\n const { message, delay, title } = args;\r\n if (Array.isArray(message)) {\r\n this.#buildToastMultiMesssage('warning', message, delay, title);\r\n }\r\n else {\r\n const content = message || this.translate('Warning');\r\n this.toastr.warning(content, title, {\r\n enableHtml: true,\r\n timeOut: delay || 3000,\r\n closeButton: true,\r\n });\r\n }\r\n }\r\n\r\n #notifyError = (args: {\r\n message?: string | string[],\r\n delay?: number,\r\n title?: string\r\n }) => {\r\n const { message, delay, title } = args;\r\n if (Array.isArray(message)) {\r\n this.#buildToastMultiMesssage('error', message, delay, title);\r\n }\r\n else {\r\n const content = message || this.translate('Error');\r\n this.toastr.error(content, title, {\r\n enableHtml: true,\r\n timeOut: delay || 3000,\r\n closeButton: true,\r\n });\r\n }\r\n }\r\n\r\n #buildToastMultiMesssage = (type: 'warning' | 'error', messages: string[], delay?: number, title?: string) => {\r\n /** số lượng item hiển thị mặc định */\r\n const showNum = 2;\r\n const id = `sd-notify-ckb-${uuid.v4()}`;\r\n const messageLength = messages.length;\r\n const messageRests = messages.splice(showNum);\r\n const messageContainer = `<ul class='sd-notify__list'>{0}{1}</ul>`;\r\n const messageTemp = `<li class='sd-notify__item'>- {0}</li>`;\r\n let contentRest = '';\r\n if (messageRests?.length) {\r\n contentRest = `<input id='${id}' class='cdk-visually-hidden sd-notify__checkbox' type='checkbox' />\r\n <label class='sd-notify__text sd-notify__text--show' for='${id}'>${this.translate('Show more')}</label>\r\n <div class='sd-notify__item--rest'>\r\n ${messageRests.map(m => String.format(messageTemp, m)).join('')}\r\n </div>\r\n <label class='sd-notify__text sd-notify__text--less' for='${id}'>${this.translate('Show less')}</label>`;\r\n }\r\n const content = String.format(messageContainer, messages.map(m => String.format(messageTemp, m)).join(''), contentRest);\r\n let toast: ActiveToast<any>;\r\n // khi truyền message html sẽ bị sanitize nên phải truyền innerHTML khi toast hiện lên\r\n // @see https://github.com/scttcper/ngx-toastr/blob/v12.1.0/src/lib/toastr/toastr.service.ts#L271\r\n switch (type) {\r\n case 'error':\r\n toast = this.toastr.error(content, `${title || this.translate('Error')} (${messageLength})`, {\r\n enableHtml: true,\r\n timeOut: delay || 3000,\r\n messageClass: `toast-message toast-message-${id}`,\r\n closeButton: true,\r\n tapToDismiss: false\r\n });\r\n break;\r\n case 'warning':\r\n toast = this.toastr.warning(content, `${title || this.translate('Warning')} (${messageLength})`, {\r\n enableHtml: true,\r\n timeOut: delay || 3000,\r\n messageClass: `toast-message toast-message-${id}`,\r\n closeButton: true,\r\n tapToDismiss: false\r\n });\r\n break;\r\n }\r\n\r\n if (toast) {\r\n toast.onShown\r\n .pipe(\r\n takeUntil(toast.onHidden)\r\n )\r\n .subscribe(() => {\r\n const messageEle: HTMLDivElement = document.querySelector(`.toast-message-${id}`);\r\n messageEle.innerHTML = content;\r\n })\r\n }\r\n }\r\n\r\n handle = {\r\n error: (err: any) => {\r\n if (typeof err === 'string') {\r\n this.notify.warning(err);\r\n } else if (typeof err === 'object') {\r\n let message =\r\n err?.error ||\r\n err?.message ||\r\n err?.ExceptionMessage ||\r\n err?.Message ||\r\n 'Unknown error';\r\n if (typeof err.json === 'function') {\r\n err = err.json();\r\n if (err) {\r\n message =\r\n err?.error ||\r\n err?.message ||\r\n err?.ExceptionMessage ||\r\n err?.Message ||\r\n 'Unknown error';\r\n }\r\n }\r\n this.notify.warning(message);\r\n } else {\r\n this.notify.warning('Unknown error');\r\n }\r\n },\r\n };\r\n\r\n confirm = (\r\n message: string,\r\n option: {\r\n title?: string;\r\n yesTitle?: string;\r\n noTitle?: string;\r\n yesButtonColor?: SdBadgeColor;\r\n noButtonColor?: SdBadgeColor;\r\n } = {}\r\n ) => {\r\n const dialogRef = this.dialog.open(DialogConfirmComponent, {\r\n width: '400px',\r\n data: {\r\n title: option?.title || this.translate('Confirm'),\r\n message,\r\n yesTitle: option?.yesTitle || this.translate('Yes'),\r\n noTitle: option?.noTitle || this.translate('No'),\r\n noButtonColor: option?.noButtonColor || 'secondary',\r\n yesButtonColor: option?.yesButtonColor || 'primary',\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(null);\r\n } else if (result === 'CANCEL') {\r\n reject(result);\r\n } else {\r\n resolve(null);\r\n }\r\n }\r\n });\r\n });\r\n };\r\n\r\n confirmDelete = () => this.confirm(this.translate('Delete record(s)'));\r\n\r\n confirmApprove = () => this.confirm(this.translate('Approve record(s)'));\r\n\r\n confirmWithInput = (\r\n title: string,\r\n option: {\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: title || this.translate('Confirm'),\r\n message: option?.message,\r\n yesTitle: option?.yesTitle || this.translate('Yes'),\r\n noTitle: option?.noTitle || this.translate('No'),\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 confirmWithDate = (\r\n title: string,\r\n option: {\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: title || this.translate('Confirm'),\r\n message: option?.message,\r\n yesTitle: option?.yesTitle || this.translate('Yes'),\r\n noTitle: option?.noTitle || this.translate('No'),\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 private translate = (value: string): string => {\r\n return this.translateService.translate(value);\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 { ToastrService, ToastrModule } from \"ngx-toastr\";\r\nimport { SdButtonModule } from \"@sd-angular/core/button\";\r\n\r\nimport { SdNotifyService } from \"./notify.service\";\r\nimport { DialogConfirmComponent } from \"./components/dialog-confirm/dialog-confirm.component\";\r\nimport { SdDateTimeModule } from \"@sd-angular/core/date-time\";\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 ToastrModule.forRoot(),\r\n\r\n SdButtonModule,\r\n ],\r\n declarations: [DialogConfirmComponent],\r\n entryComponents: [DialogConfirmComponent],\r\n exports: [],\r\n providers: [SdNotifyService],\r\n})\r\nexport class SdNotifyModule {}\r\n","/*\r\n * Public API Surface of superdev-angular-core\r\n */\r\n\r\nexport { SdNotifyModule } from './lib/notify.module';\r\nexport * from './lib/notify.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"],"mappings":";;;;;;;;;;;;;;;;;;MAkCa,sBAAsB;IAIjC,YACS,SAA+C,EACtB,IAAgB;;QADzC,cAAS,GAAT,SAAS,CAAsC;QACtB,SAAI,GAAJ,IAAI,CAAY;QAJlD,aAAQ,GAAG,KAAK,CAA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,SAAC;gBACR,OAAO,EAAE;oBACP,YAAY;oBACZ,WAAW;oBACX,kBAAkB;oBAClB,cAAc;oBACd,gBAAgB;oBAChB,aAAa;oBACb,eAAe;oBACf,eAAe;oBACf,YAAY,CAAC,OAAO,EAAE;oBAEtB,cAAc;iBACf;gBACD,YAAY,EAAE,CAAC,sBAAsB,CAAC;gBACtC,eAAe,EAAE,CAAC,sBAAsB,CAAC;gBACzC,OAAO,EAAE,EAAE;gBACX,SAAS,EAAE,CAAC,eAAe,CAAC;aAC7B;;;ACjCD;;;;ACAA;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"__symbolic":"module","version":4,"metadata":{"SdHeaderTitleModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":5,"character":1},"arguments":[{"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule","line":7,"character":4},{"__symbolic":"reference","module":"@angular/material/icon","name":"MatIconModule","line":8,"character":4},{"__symbolic":"reference","module":"@angular/material/tooltip","name":"MatTooltipModule","line":9,"character":4}],"declarations":[{"__symbolic":"reference","name":"ɵa"}],"exports":[{"__symbolic":"reference","name":"ɵa"}]}]}],"members":{}},"ɵa":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":2,"character":1},"arguments":[{"selector":"sd-header-title","template":"<div class=\"d-flex\">\r\n <div *ngIf=\"icon\" class=\"flex-shrink-1 c-header-icon\">\r\n <mat-icon
|
|
1
|
+
{"__symbolic":"module","version":4,"metadata":{"SdHeaderTitleModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":5,"character":1},"arguments":[{"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule","line":7,"character":4},{"__symbolic":"reference","module":"@angular/material/icon","name":"MatIconModule","line":8,"character":4},{"__symbolic":"reference","module":"@angular/material/tooltip","name":"MatTooltipModule","line":9,"character":4}],"declarations":[{"__symbolic":"reference","name":"ɵa"}],"exports":[{"__symbolic":"reference","name":"ɵa"}]}]}],"members":{}},"ɵa":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":2,"character":1},"arguments":[{"selector":"sd-header-title","template":"<div class=\"d-flex\">\r\n <div *ngIf=\"icon\" class=\"flex-shrink-1 c-header-icon\">\r\n <mat-icon class=\"material-symbols-outlined text-grey\">{{icon}}</mat-icon>\r\n </div>\r\n <div class=\"d-flex flex-column w-100 overflow-hidden\">\r\n <div class=\"d-flex\">\r\n <span class=\"T16M\">{{title}}</span>\r\n <ng-container *ngIf=\"tooltip\">\r\n <mat-icon\r\n [matTooltip]=\"tooltip\"\r\n class=\"material-icons-outlined c-header-icon-tooltip\"> info </mat-icon>\r\n </ng-container>\r\n </div>\r\n <span *ngIf=\"description\" class=\"c-header-description\">{{description}}</span>\r\n </div>\r\n <div class=\"flex-shrink-1\">\r\n <ng-content select=\"[sdHeaderRight]\"></ng-content>\r\n </div>\r\n</div>\r\n","styles":[".c-header-icon{align-items:center;display:flex;height:28px;margin-right:8px;width:28px}.c-header-icon-tooltip{align-items:center;color:#757575;display:flex;font-size:20px;height:28px!important;margin-left:10px}.c-header-description{font-size:14px;line-height:20px}"]}]}],"members":{"title":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":9,"character":3}}]}],"icon":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":10,"character":3}}]}],"description":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":11,"character":3}}]}],"tooltip":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":12,"character":3}}]}],"__ctor__":[{"__symbolic":"constructor"}],"ngOnInit":[{"__symbolic":"method"}]}}},"origins":{"SdHeaderTitleModule":"./src/lib/header-title.module","ɵa":"./src/lib/header-title.component"},"importAs":"@sd-angular/core/header-title"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"__symbolic":"module","version":4,"metadata":{"SdNotifyModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":
|
|
1
|
+
{"__symbolic":"module","version":4,"metadata":{"SdNotifyModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":15,"character":1},"arguments":[{"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule","line":17,"character":4},{"__symbolic":"reference","module":"@angular/forms","name":"FormsModule","line":18,"character":4},{"__symbolic":"reference","module":"@angular/material/form-field","name":"MatFormFieldModule","line":19,"character":4},{"__symbolic":"reference","module":"@angular/material/input","name":"MatInputModule","line":20,"character":4},{"__symbolic":"reference","module":"@sd-angular/core/date-time","name":"SdDateTimeModule","line":21,"character":4},{"__symbolic":"reference","module":"@angular/material/icon","name":"MatIconModule","line":22,"character":4},{"__symbolic":"reference","module":"@angular/material/button","name":"MatButtonModule","line":23,"character":4},{"__symbolic":"reference","module":"@angular/material/dialog","name":"MatDialogModule","line":24,"character":4},{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"ngx-toastr","name":"ToastrModule","line":25,"character":4},"member":"forRoot"}},{"__symbolic":"reference","module":"@sd-angular/core/button","name":"SdButtonModule","line":27,"character":4}],"declarations":[{"__symbolic":"reference","name":"DialogConfirmComponent"}],"entryComponents":[{"__symbolic":"reference","name":"DialogConfirmComponent"}],"exports":[],"providers":[{"__symbolic":"reference","name":"SdNotifyService"}]}]}],"members":{}},"SdNotifyService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":11,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/material/dialog","name":"MatDialog","line":26,"character":20},{"__symbolic":"reference","module":"ngx-toastr","name":"ToastrService","line":27,"character":20},{"__symbolic":"reference","module":"@sd-angular/core/translate","name":"SdTranslateService","line":28,"character":30}]}]}},"DialogData":{"__symbolic":"interface"},"DialogConfirmComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":29,"character":1},"arguments":[{"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\">\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]=\"data.input?.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}"]}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":40,"character":5},"arguments":[{"__symbolic":"reference","module":"@angular/material/dialog","name":"MAT_DIALOG_DATA","line":40,"character":12}]}]],"parameters":[{"__symbolic":"reference","name":"MatDialogRef","module":"@angular/material/dialog","arguments":[{"__symbolic":"reference","name":"DialogConfirmComponent"}]},{"__symbolic":"reference","name":"any"}]}]}}},"origins":{"SdNotifyModule":"./src/lib/notify.module","SdNotifyService":"./src/lib/notify.service","DialogData":"./src/lib/components/dialog-confirm/dialog-confirm.component","DialogConfirmComponent":"./src/lib/components/dialog-confirm/dialog-confirm.component"},"importAs":"@sd-angular/core/notify"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { MatDialogRef } from
|
|
1
|
+
import { MatDialogRef } from '@angular/material/dialog';
|
|
2
|
+
import { SdBadgeColor } from '@sd-angular/core/badge';
|
|
2
3
|
export interface DialogData {
|
|
3
4
|
icon?: string;
|
|
4
5
|
title?: string;
|
|
5
6
|
message?: string;
|
|
6
7
|
yesTitle?: string;
|
|
7
8
|
noTitle?: string;
|
|
8
|
-
yesButtonColor?:
|
|
9
|
-
noButtonColor?:
|
|
9
|
+
yesButtonColor?: SdBadgeColor;
|
|
10
|
+
noButtonColor?: SdBadgeColor;
|
|
10
11
|
input?: {
|
|
11
12
|
placeholder?: string;
|
|
12
13
|
minlength?: number;
|
|
@@ -14,11 +15,19 @@ export interface DialogData {
|
|
|
14
15
|
required?: boolean;
|
|
15
16
|
defaultValue?: string;
|
|
16
17
|
};
|
|
18
|
+
date?: {
|
|
19
|
+
required?: boolean;
|
|
20
|
+
placeholder?: string;
|
|
21
|
+
defaultValue?: string | Date;
|
|
22
|
+
min?: string | Date;
|
|
23
|
+
max?: string | Date;
|
|
24
|
+
};
|
|
17
25
|
}
|
|
18
26
|
export declare class DialogConfirmComponent {
|
|
19
27
|
dialogRef: MatDialogRef<DialogConfirmComponent>;
|
|
20
28
|
data: DialogData;
|
|
21
|
-
value:
|
|
29
|
+
value: any;
|
|
22
30
|
isString: boolean;
|
|
31
|
+
id: string;
|
|
23
32
|
constructor(dialogRef: MatDialogRef<DialogConfirmComponent>, data: DialogData);
|
|
24
33
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { MatDialog } from
|
|
3
|
-
import { ToastrService } from
|
|
4
|
-
import { SdTranslateService } from
|
|
1
|
+
import '@sd-angular/core/common';
|
|
2
|
+
import { MatDialog } from '@angular/material/dialog';
|
|
3
|
+
import { ToastrService } from 'ngx-toastr';
|
|
4
|
+
import { SdTranslateService } from '@sd-angular/core/translate';
|
|
5
|
+
import { SdBadgeColor } from '@sd-angular/core/badge';
|
|
5
6
|
export declare class SdNotifyService {
|
|
6
7
|
#private;
|
|
7
8
|
private dialog;
|
|
@@ -26,8 +27,8 @@ export declare class SdNotifyService {
|
|
|
26
27
|
title?: string;
|
|
27
28
|
yesTitle?: string;
|
|
28
29
|
noTitle?: string;
|
|
29
|
-
yesButtonColor?:
|
|
30
|
-
noButtonColor?:
|
|
30
|
+
yesButtonColor?: SdBadgeColor;
|
|
31
|
+
noButtonColor?: SdBadgeColor;
|
|
31
32
|
}) => Promise<unknown>;
|
|
32
33
|
confirmDelete: () => Promise<unknown>;
|
|
33
34
|
confirmApprove: () => Promise<unknown>;
|
|
@@ -37,9 +38,19 @@ export declare class SdNotifyService {
|
|
|
37
38
|
noTitle?: string;
|
|
38
39
|
required?: boolean;
|
|
39
40
|
maxlength?: number;
|
|
40
|
-
yesButtonColor?:
|
|
41
|
-
noButtonColor?:
|
|
41
|
+
yesButtonColor?: SdBadgeColor;
|
|
42
|
+
noButtonColor?: SdBadgeColor;
|
|
42
43
|
defaultValue?: string;
|
|
43
44
|
}) => Promise<string>;
|
|
45
|
+
confirmWithDate: (title: string, option?: {
|
|
46
|
+
message?: string;
|
|
47
|
+
yesTitle?: string;
|
|
48
|
+
noTitle?: string;
|
|
49
|
+
required?: boolean;
|
|
50
|
+
yesButtonColor?: SdBadgeColor;
|
|
51
|
+
noButtonColor?: SdBadgeColor;
|
|
52
|
+
defaultValue?: string | Date;
|
|
53
|
+
placeholder?: string;
|
|
54
|
+
}) => Promise<string>;
|
|
44
55
|
private translate;
|
|
45
56
|
}
|
package/package.json
CHANGED
|
index efb96c4..913bcf9 100644
|
|
|
Binary file
|