import { Injectable } from "@angular/core" ; import { AppConsts } from "@shared/AppConsts" ; import { NzModalService } from "ng-zorro-antd/modal" ; @ Injectable ( ) export class NgZorroMessageService { constructor ( private _modalService ) { } init ( ) { abp . message . info = ( message , title ? , options ? ) => { const { title_normalize , message_normalize } = this . normalize ( message , title ) ; this . _modalService . info ( { nzTitle : title_normalize , nzContent : message_normalize , } ) ; } ; abp . message . success = ( message , title ? , options ? ) => { const { title_normalize , message_normalize } = this . normalize ( message , title ) ; this . _modalService . success ( { nzTitle : title_normalize , nzContent : message_normalize , } ) ; } ; abp . message . warn = ( message , title ? , options ? ) => { const { title_normalize , message_normalize } = this . normalize ( message , title ) ; this . _modalService . warning ( { nzTitle : title_normalize , nzContent : message_normalize , } ) ; } ; abp . message . error = ( message , title ? , options ? ) => { const { title_normalize , message_normalize } = this . normalize ( message , title ) ; this . _modalService . error ( { nzTitle : title_normalize , nzContent : message_normalize , } ) ; } ; abp . message . confirm = ( message , title ? , callback ? , options ? ) => { const title_normalize = title ?? < any > ( abp . localization . localize ( "AreYouSure" , AppConsts . localization . defaultLocalizationSourceName ) ) ; this . _modalService . confirm ( { nzTitle : title_normalize , nzContent : message , nzOnOk ( ) { if ( callback ) { callback ( true ) ; } } , nzOnCancel ( ) { if ( callback ) { callback ( false ) ; } } , } ) ; } ; } normalize ( message , title ? ) { if ( ! title ) { title = message ; message = "" ; } return { message_normalize : message , title_normalize : title } ; } }