@sd-angular/core 1.0.20 → 1.0.21
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/toastr.scss +39 -0
- package/bundles/sd-angular-core-common.umd.js +11 -0
- package/bundles/sd-angular-core-common.umd.js.map +1 -1
- package/bundles/sd-angular-core-common.umd.min.js +1 -1
- package/bundles/sd-angular-core-common.umd.min.js.map +1 -1
- package/bundles/sd-angular-core-grid-material.umd.js +7 -3
- package/bundles/sd-angular-core-grid-material.umd.js.map +1 -1
- package/bundles/sd-angular-core-grid-material.umd.min.js +1 -1
- package/bundles/sd-angular-core-grid-material.umd.min.js.map +1 -1
- package/bundles/sd-angular-core-notify.umd.js +392 -16
- package/bundles/sd-angular-core-notify.umd.js.map +1 -1
- package/bundles/sd-angular-core-notify.umd.min.js +15 -1
- package/bundles/sd-angular-core-notify.umd.min.js.map +1 -1
- package/common/src/lib/typings/string.extension.d.ts +1 -0
- package/esm2015/common/src/lib/typings/string.extension.js +8 -1
- package/esm2015/grid-material/src/lib/grid-material.component.js +8 -4
- package/esm2015/grid-material/src/lib/models/grid-editor.model.js +1 -1
- package/esm2015/notify/src/lib/notify.service.js +79 -13
- package/fesm2015/sd-angular-core-common.js +7 -0
- package/fesm2015/sd-angular-core-common.js.map +1 -1
- package/fesm2015/sd-angular-core-grid-material.js +7 -3
- package/fesm2015/sd-angular-core-grid-material.js.map +1 -1
- package/fesm2015/sd-angular-core-notify.js +78 -12
- package/fesm2015/sd-angular-core-notify.js.map +1 -1
- package/grid-material/src/lib/models/grid-editor.model.d.ts +1 -0
- package/notify/sd-angular-core-notify.metadata.json +1 -1
- package/notify/src/lib/notify.service.d.ts +4 -2
- package/package.json +1 -1
- package/{sd-angular-core-1.0.20.tgz → sd-angular-core-1.0.21.tgz} +0 -0
|
@@ -1,2 +1,16 @@
|
|
|
1
|
-
!function(t,
|
|
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("ngx-toastr"),require("@sd-angular/core/button"),require("@sd-angular/core/common"),require("@sd-angular/core/translate"),require("rxjs/operators")):"function"==typeof define&&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","@sd-angular/core/translate","rxjs/operators"],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.notify={}),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["ngx-toastr"],t["sd-angular"].core.button,t["sd-angular"].core.common,t["sd-angular"].core.translate,t.rxjs.operators)}(this,(function(t,e,n,a,o,r,i,l,s,u,d,c,g,m){"use strict";
|
|
2
|
+
/*! *****************************************************************************
|
|
3
|
+
Copyright (c) Microsoft Corporation.
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted.
|
|
7
|
+
|
|
8
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
9
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
10
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
11
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
12
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
+
***************************************************************************** */Object.create;Object.create;function f(t,e,n,a){if("a"===n&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!a:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?a:"a"===n?a.call(t):a?a.value:e.get(t)}var p,y=function(t,e){var n,a,o;this.dialogRef=t,this.data=e,this.isString=!1,this.isString="string"==typeof(null===(n=this.data)||void 0===n?void 0:n.message),this.value=null!==(o=null===(a=null==e?void 0:e.input)||void 0===a?void 0:a.defaultValue)&&void 0!==o?o:""};y.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\r\n style="width: 100%"\r\n matInput\r\n placeholder="{{ data.input?.placeholder }}"\r\n [(ngModel)]="value"\r\n autocomplete="off"\r\n rows="5"\r\n [maxlength]="data.input?.maxlength"\r\n ></textarea>\r\n \x3c!-- <span *ngIf="data.input?.maxlength" matSuffix>{{value?.length || 0}}/{{data.input?.maxlength}}</span> --\x3e\r\n </mat-form-field>\r\n </div>\r\n</div>\r\n<div mat-dialog-actions align="end">\r\n <sd-button\r\n *ngIf="data?.noTitle"\r\n [color]="data?.noButtonColor || \'secondary\'"\r\n [mat-dialog-close]="\'CANCEL\'"\r\n [title]="data?.noTitle"\r\n size="sm"\r\n ></sd-button>\r\n <sd-button\r\n class="ml-12"\r\n *ngIf="data?.yesTitle"\r\n [mat-dialog-close]="value || \'ACCEPT\'"\r\n [color]="data?.yesButtonColor || \'primary\'"\r\n [disabled]="data.input?.required && !value"\r\n cdkFocusInitial\r\n [title]="data?.yesTitle"\r\n size="sm"\r\n ></sd-button>\r\n</div>\r\n',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}"]}]}],y.ctorParameters=function(){return[{type:a.MatDialogRef},{type:void 0,decorators:[{type:e.Inject,args:[a.MAT_DIALOG_DATA]}]}]};var v=0,h=function(t,e,n){var a=this;this.dialog=t,this.toastr=e,this.translateService=n,this.alert={info:function(t,e,n,o){a.dialog.open(y,{width:"400px",data:{icon:o||"info",title:e||a.translate("Notice"),message:t||"Done!",yesTitle:n||a.translate("Ok")}})},success:function(t,e,n,o){a.dialog.open(y,{width:"400px",data:{icon:o||"done",title:e||a.translate("Success"),message:t||"Done!",yesTitle:n||a.translate("Ok")}})},warning:function(t,e,n,o){a.dialog.open(y,{width:"400px",data:{icon:o||"warning",title:e||a.translate("Warning"),message:t||"Something went wrong!",yesTitle:n||a.translate("Ok")}})},error:function(t,e,n,o){a.dialog.open(y,{width:"400px",data:{icon:o||"error",title:e||a.translate("Error"),message:t||"Something went wrong!",yesTitle:n||a.translate("Ok")}})}},this.notify={success:function(t,e,n){var o=t||a.translate("Success");a.toastr.success(o,n,{enableHtml:!0,timeOut:e||3e3,closeButton:!0})},warning:function(t,e,n){if(Array.isArray(t))f(a,p).call(a,"warning",t,e,n);else{var o=t||a.translate("Warning");a.toastr.warning(o,n,{enableHtml:!0,timeOut:e||3e3,closeButton:!0})}},error:function(t,e,n){if(Array.isArray(t))f(a,p).call(a,"error",t,e,n);else{var o=t||a.translate("Error");a.toastr.error(o,n,{enableHtml:!0,timeOut:e||3e3,closeButton:!0})}}},p.set(this,(function(t,e,n,o){var r=v++,i=e.length,l=e.splice(2),s='<li class="sd-notify__item">- {0}</li>',u="";(null==l?void 0:l.length)&&(u='<input id="sd-notify-ckb-'+r+'" class="cdk-visually-hidden sd-notify__checkbox" type="checkbox" />\n <label class="sd-notify__text sd-notify__text--show text-secondary" for="sd-notify-ckb-'+r+'">'+a.translate("Show more")+'</label>\n <div class="sd-notify__item--rest">\n '+l.map((function(t){return String.format(s,t)})).join("")+'\n </div>\n <label class="sd-notify__text sd-notify__text--less text-secondary" for="sd-notify-ckb-'+r+'">'+a.translate("Show less")+"</label>");var d,c=String.format('<ul class="sd-notify__list">{0}{1}</ul>',e.map((function(t){return String.format(s,t)})).join(""),u);switch(t){case"error":d=a.toastr.error(c,(o||a.translate("Error"))+" ("+i+")",{enableHtml:!0,timeOut:n||3e3,messageClass:"toast-message toast-message-"+r,closeButton:!0,tapToDismiss:!1});break;case"warning":d=a.toastr.warning(c,(o||a.translate("Warning"))+" ("+i+")",{enableHtml:!0,timeOut:n||3e3,messageClass:"toast-message toast-message-"+r,closeButton:!0,tapToDismiss:!1})}d&&d.onShown.pipe(m.takeUntil(d.onHidden)).subscribe((function(){document.querySelector(".toast-message-"+r).innerHTML=c}))})),this.handle={error:function(t){if("string"==typeof t)a.notify.warning(t);else if("object"==typeof t){var e=(null==t?void 0:t.error)||(null==t?void 0:t.message)||(null==t?void 0:t.ExceptionMessage)||(null==t?void 0:t.Message)||"Unknown error";"function"==typeof t.json&&(t=t.json())&&(e=(null==t?void 0:t.error)||(null==t?void 0:t.message)||(null==t?void 0:t.ExceptionMessage)||(null==t?void 0:t.Message)||"Unknown error"),a.notify.warning(e)}else a.notify.warning("Unknown error")}},this.confirm=function(t,e){void 0===e&&(e={});var n=a.dialog.open(y,{width:"400px",data:{title:(null==e?void 0:e.title)||a.translate("Confirm"),message:t,yesTitle:(null==e?void 0:e.yesTitle)||a.translate("Yes"),noTitle:(null==e?void 0:e.noTitle)||a.translate("No"),noButtonColor:(null==e?void 0:e.noButtonColor)||"secondary",yesButtonColor:(null==e?void 0:e.yesButtonColor)||"primary"}});return new Promise((function(t,e){n.afterClosed().subscribe((function(n){n&&("ACCEPT"===n?t(null):"CANCEL"===n?e(n):t(null))}))}))},this.confirmDelete=function(){return a.confirm(a.translate("Delete record(s)"))},this.confirmApprove=function(){return a.confirm(a.translate("Approve record(s)"))},this.confirmWithInput=function(t,e){void 0===e&&(e={});var n=a.dialog.open(y,{width:"400px",data:{title:t||a.translate("Confirm"),message:null==e?void 0:e.message,yesTitle:(null==e?void 0:e.yesTitle)||a.translate("Yes"),noTitle:(null==e?void 0:e.noTitle)||a.translate("No"),noButtonColor:(null==e?void 0:e.noButtonColor)||"secondary",yesButtonColor:(null==e?void 0:e.yesButtonColor)||"primary",input:{maxlength:(null==e?void 0:e.maxlength)||255,required:null==e?void 0:e.required,defaultValue:(null==e?void 0:e.defaultValue)||""}}});return new Promise((function(t,e){n.afterClosed().subscribe((function(n){n&&("ACCEPT"===n?t(n):"CANCEL"===n?e(n):t(n))}))}))},this.translate=function(t){return a.translateService.translate(t)}};p=new WeakMap,h.decorators=[{type:e.Injectable}],h.ctorParameters=function(){return[{type:a.MatDialog},{type:u.ToastrService},{type:g.SdTranslateService}]};var b=function(){};b.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,s.FormsModule,i.MatFormFieldModule,l.MatInputModule,o.MatIconModule,r.MatButtonModule,a.MatDialogModule,u.ToastrModule.forRoot(),d.SdButtonModule],declarations:[y],entryComponents:[y],exports:[],providers:[h]}]}],t.DialogConfirmComponent=y,t.SdNotifyModule=b,t.SdNotifyService=h,Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
2
16
|
//# sourceMappingURL=sd-angular-core-notify.umd.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"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"],"names":["dialogRef","data","this","isString","_a","message","value","_c","_b","input","defaultValue","Component","args","selector","template","MatDialogRef","Inject","MAT_DIALOG_DATA","dialog","toastr","translateService","_this","alert","info","title","yesTitle","icon","open","DialogConfirmComponent","width","translate","success","warning","error","notify","delay","content","enableHtml","timeOut","closeButton","handle","err","ExceptionMessage","Message","json","confirm","option","noTitle","noButtonColor","yesButtonColor","Promise","resolve","reject","afterClosed","subscribe","result","confirmDelete","confirmApprove","confirmWithInput","maxlength","required","Injectable","MatDialog","ToastrService","SdTranslateService","NgModule","imports","CommonModule","FormsModule","MatFormFieldModule","MatInputModule","MatIconModule","MatButtonModule","MatDialogModule","ToastrModule","forRoot","SdButtonModule","declarations","entryComponents","exports","providers","SdNotifyService"],"mappings":"isCA4BE,SACSA,EACyBC,aADzBC,KAAAF,UAAAA,EACyBE,KAAAD,KAAAA,EAHlCC,KAAAC,UAAW,EAKTD,KAAKC,SAAyC,iBAAd,QAAhBC,EAAOF,KAAKD,YAAI,IAAAG,OAAA,EAAAA,EAAEC,SAClCH,KAAKI,MAAiC,QAA5BC,EAAc,QAAdC,EAAGP,MAAAA,OAAI,EAAJA,EAAMQ,aAAK,IAAAD,OAAA,EAAAA,EAAEE,oBAAY,IAAAH,EAAAA,EAAI,wBAb7CI,EAAAA,UAASC,KAAA,CAAC,CACTC,SAAU,oBACVC,SAAA,09DArBOC,EAAAA,6CA6BJC,EAAAA,OAAMJ,KAAA,CAACK,EAAAA,4BCtBV,SACUC,EACAC,EACAC,GAHV,IAAAC,EAAAnB,KACUA,KAAAgB,OAAAA,EACAhB,KAAAiB,OAAAA,EACAjB,KAAAkB,iBAAAA,EAGVlB,KAAAoB,MAAQ,CACNC,KAAM,SACJlB,EACAmB,EACAC,EACAC,GAE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C,EAAAA,gBACAC,EAAAA,aAAaC,UAEbC,EAAAA,gBAEFC,aAAc,CAACjD,GACfkD,gBAAiB,CAAClD,GAClBmD,QAAS,GACTC,UAAW,CAACC","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 { Injectable } from \"@angular/core\";\r\nimport { MatDialog } from \"@angular/material/dialog\";\r\nimport { DialogConfirmComponent } from \"./components/dialog-confirm/dialog-confirm.component\";\r\nimport { ToastrService } from \"ngx-toastr\";\r\nimport { SdTranslateService } from \"@sd-angular/core/translate\";\r\n\r\n@Injectable()\r\nexport class SdNotifyService {\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, 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: #9F6000; background-color: #FEEFB3`;\r\n // tslint:disable-next-line: max-line-length\r\n // const html = `<div id=\"${this.notifyId}\" style=\"${style}\"><i class=\"fa fa-exclamation-triangle\"></i> ${message || this.translate('Warning')}</div>`;\r\n // this.showNotify(html, delay);\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 error: (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: #D8000C; background-color: #FFD2D2`;\r\n // tslint:disable-next-line: max-line-length\r\n // const html = `<div id=\"${this.notifyId}\" style=\"${style}\"><i class=\"fa fa-times\"></i> ${message || this.translate('Error')}</div>`;\r\n // this.showNotify(html, delay);\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 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"]}
|
|
1
|
+
{"version":3,"sources":["../../../../node_modules/tslib/tslib.es6.js","../../../../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"],"names":["Object","create","__classPrivateFieldGet","receiver","state","kind","f","TypeError","has","call","value","get","dialogRef","data","this","isString","_a","message","_c","_b","input","defaultValue","Component","args","selector","template","MatDialogRef","Inject","MAT_DIALOG_DATA","notifyId","dialog","toastr","translateService","_this","alert","info","title","yesTitle","icon","open","DialogConfirmComponent","width","translate","success","warning","error","notify","delay","content","enableHtml","timeOut","closeButton","Array","isArray","_buildToastMultiMesssage","set","type","messages","id","messageLength","length","messageRests","splice","messageTemp","contentRest","map","m","String","format","join","toast","messageClass","tapToDismiss","onShown","pipe","takeUntil","onHidden","subscribe","document","querySelector","innerHTML","handle","err","ExceptionMessage","Message","json","confirm","option","noTitle","noButtonColor","yesButtonColor","Promise","resolve","reject","afterClosed","result","confirmDelete","confirmApprove","confirmWithInput","maxlength","required","Injectable","MatDialog","ToastrService","SdTranslateService","NgModule","imports","CommonModule","FormsModule","MatFormFieldModule","MatInputModule","MatIconModule","MatButtonModule","MatDialogModule","ToastrModule","forRoot","SdButtonModule","declarations","entryComponents","exports","providers","SdNotifyService"],"mappings":";;;;;;;;;;;;;;oFA2G6BA,OAAOC,OAsGXD,OAAOC,gBAkBhBC,EAAuBC,EAAUC,EAAOC,EAAMC,GAC1D,GAAa,MAATD,IAAiBC,EAAG,MAAM,IAAIC,UAAU,iDAC5C,GAAqB,mBAAVH,EAAuBD,IAAaC,IAAUE,GAAKF,EAAMI,IAAIL,GAAW,MAAM,IAAII,UAAU,4EACvG,MAAgB,MAATF,EAAeC,EAAa,MAATD,EAAeC,EAAEG,KAAKN,GAAYG,EAAIA,EAAEI,MAAQN,EAAMO,IAAIR,WC1MtF,SACSS,EACyBC,aADzBC,KAAAF,UAAAA,EACyBE,KAAAD,KAAAA,EAHlCC,KAAAC,UAAW,EAKTD,KAAKC,SAAyC,iBAAd,QAAhBC,EAAOF,KAAKD,YAAI,IAAAG,OAAA,EAAAA,EAAEC,SAClCH,KAAKJ,MAAiC,QAA5BQ,EAAc,QAAdC,EAAGN,MAAAA,OAAI,EAAJA,EAAMO,aAAK,IAAAD,OAAA,EAAAA,EAAEE,oBAAY,IAAAH,EAAAA,EAAI,wBAb7CI,EAAAA,UAASC,KAAA,CAAC,CACTC,SAAU,oBACVC,SAAA,09DArBOC,EAAAA,6CA6BJC,EAAAA,OAAMJ,KAAA,CAACK,EAAAA,sBCtBZ,IAAIC,EAAW,IAIb,SACUC,EACAC,EACAC,GAHV,IAAAC,EAAAnB,KACUA,KAAAgB,OAAAA,EACAhB,KAAAiB,OAAAA,EACAjB,KAAAkB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A,CAAC,CACRmF,QAAS,CACPC,EAAAA,aACAC,EAAAA,YACAC,EAAAA,mBACAC,EAAAA,eACAC,EAAAA,cACAC,EAAAA,gBACAC,EAAAA,gBACAC,EAAAA,aAAaC,UAEbC,EAAAA,gBAEFC,aAAc,CAAC7E,GACf8E,gBAAiB,CAAC9E,GAClB+E,QAAS,GACTC,UAAW,CAACC","sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n","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 { takeUntil } from \"rxjs/operators\";\r\n\r\nlet notifyId = 0;\r\n\r\n@Injectable()\r\nexport class SdNotifyService {\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 // 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: #9F6000; background-color: #FEEFB3`;\r\n // tslint:disable-next-line: max-line-length\r\n // const html = `<div id=\"${this.notifyId}\" style=\"${style}\"><i class=\"fa fa-exclamation-triangle\"></i> ${message || this.translate('Warning')}</div>`;\r\n // this.showNotify(html, delay);\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 error: (message?: string | 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: #D8000C; background-color: #FFD2D2`;\r\n // tslint:disable-next-line: max-line-length\r\n // const html = `<div id=\"${this.notifyId}\" style=\"${style}\"><i class=\"fa fa-times\"></i> ${message || this.translate('Error')}</div>`;\r\n // this.showNotify(html, delay);\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\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 = notifyId++;\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=\"sd-notify-ckb-${id}\" class=\"cdk-visually-hidden sd-notify__checkbox\" type=\"checkbox\" />\r\n <label class=\"sd-notify__text sd-notify__text--show text-secondary\" for=\"sd-notify-ckb-${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 text-secondary\" for=\"sd-notify-ckb-${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"]}
|
|
@@ -38,5 +38,12 @@ String.changeAliasLowerCase = (alias) => {
|
|
|
38
38
|
String.aliasIncludes = (alias, searchText) => {
|
|
39
39
|
return String.changeAliasLowerCase(alias).includes(String.changeAliasLowerCase(searchText));
|
|
40
40
|
};
|
|
41
|
+
String.format = (template, ...arr) => {
|
|
42
|
+
for (let i = 0; i < arr.length; i++) {
|
|
43
|
+
const regexp = new RegExp(`\\{${i}\\}`, 'gi');
|
|
44
|
+
template = template.replace(regexp, arr[i]);
|
|
45
|
+
}
|
|
46
|
+
return template;
|
|
47
|
+
};
|
|
41
48
|
export {};
|
|
42
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
49
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RyaW5nLmV4dGVuc2lvbi5qcyIsInNvdXJjZVJvb3QiOiJDOi9Vc2Vycy91c2VyL0RvY3VtZW50cy9saWItY29yZS11aS9wcm9qZ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