import { Component, OnInit } from '@angular/core'; import { Code } from './../../code/confirm'; import {ConfirmationService} from '../../component/ing/common/confirmationservice'; @Component({ templateUrl: './confirmdialog.component.html', providers: [ConfirmationService] }) export class ConfirmdialogComponent implements OnInit { code = Code; parameters: any[]; styleHeader: any[]; styleValue: any[]; headers: any[]; msgs: any[]; constructor(private confirmationService: ConfirmationService) { } ngOnInit() { this.parameters = [ {name: "header",type: "string",default: "null",des: "对话框的标题文本。"}, {name: "message",type: "string",default: "null",des: "确认信息。"}, {name: "key",type: "string",default: "null",des: "可选键匹配确认对象的键,必要时使用COMPO。"}, {name: "icon",type: "string",default: "null ",des: "显示消息旁边的图标。"}, {name: "acceptLabel",type: "string",default: "Yes",des: "接受按钮的标签。"}, {name: "acceptIcon",type: "string",default: "ion-checkmark-round ",des: "接受按钮图标。"}, {name: "acceptVisible",type: "boolean",default: "true",des: "接受按钮的可见性。"}, {name: "rejectLabel",type: "string",default: "No",des: "拒绝按钮的标签。"}, {name: "rejectIcon",type: "string",default: "ion-close-round",des: "拒绝按钮图标。"}, {name: "rejectVisible",type: "boolean",default: "true",des: "拒绝按钮的可见性。"}, {name: "width",type: "int",default: "300",des: "对话框的宽度。"}, {name: "height",type: "int",default: "auto",des: "对话框的高度。"}, {name: "closeOnEscape",type: "boolean",default: "true ",des: "指定按下转义键是否隐藏对话框。"}, {name: "rtl",type: "boolean",default: "false",des: "启用时对话框以RTL方向显示。"}, {name: "closable",type: "boolean",default: "true",des: "向头添加一个关闭图标来隐藏对话框。"}, {name: "responsive",type: "boolean",default: "null",des: "在响应模式下,对话框将自身调整为屏幕宽度。"}, {name: "appendTo",type: "any",default: "null",des: "目标元素附加对话框,有效值为'体'或局部NG-T。"}, {name: "acceptButtonStyleClass",type: "string",default: "null",des: "接受按钮的样式类。"}, {name: "rejectButtonStyleClass",type: "string",default: "null",des: "拒绝按钮的样式类。"} ]; this.headers = [ {name : "名字"}, {name : "类型"}, {name : "默认"}, {name : "描述"} ]; this.styleHeader = [ {name : "名字"}, {name : "元素"} ]; this.styleValue = [ {name : "ui-dialog",el : "容器元素。"}, {name : "ui-confirmdialog",el : "容器元素。"}, {name : "ui-dialog-titlebar",el : "集箱。"}, {name : "ui-dialog-title",el : "标题元素。"}, {name : "ui-dialog-titlebar-icon",el : "标题中的图标容器。"}, {name : "ui-dialog-titlebar-close",el : "关闭图标元素。"}, {name : "ui-dialog-content",el : "内容元素。"} ]; } confirm1() { this.confirmationService.confirm({ message: 'Are you sure that you want to proceed?', header: 'Confirmation', icon: 'fa fa-question-circle', accept: () => { this.msgs = [{severity:'info', summary:'Confirmed', detail:'You have accepted'}]; }, reject: () => { this.msgs = [{severity:'info', summary:'Rejected', detail:'You have rejected'}]; } }); } confirm2() { this.confirmationService.confirm({ message: 'Do you want to delete this record?', header: 'Delete Confirmation', icon: 'fa fa-trash', accept: () => { this.msgs = [{severity:'info', summary:'Confirmed', detail:'Record deleted'}]; }, reject: () => { this.msgs = [{severity:'info', summary:'Rejected', detail:'You have rejected'}]; } }); } }