UNPKG

@c-standard/angular-devui-extension

Version:

an extensional components lib for devui

100 lines (94 loc) 3.93 kB
import * as i0 from '@angular/core'; import { Injectable, NgModule } from '@angular/core'; import * as i1 from 'ng-devui'; import { CommonModule } from '@angular/common'; var ConfirmType; (function (ConfirmType) { ConfirmType["SUCCESS"] = "success"; ConfirmType["FAILED"] = "failed"; ConfirmType["WARNING"] = "warning"; ConfirmType["INFO"] = "info"; })(ConfirmType || (ConfirmType = {})); const ConfirmSizeData = { default: { width: '346px', maxHeight: '600px', }, large: { width: '346px', maxHeight: '600px', }, small: { width: '346px', maxHeight: '600px', }, }; class ConfirmService { constructor(service) { this.service = service; } confirm(option, resolve, reject) { const ref = this.service.open({ width: ConfirmSizeData[option.size || 'default'].width, maxHeight: ConfirmSizeData[option.size || 'default'].maxHeight, title: option.title || '提示', content: option.message, dialogtype: option.type || 'info', showCloseBtn: false, backdropCloseable: true, buttons: [ { cssClass: 'primary', text: '确认', disabled: false, autofocus: true, handler: () => { if (!(resolve === null || resolve === void 0 ? void 0 : resolve())) { ref.modalInstance.hide(); } }, }, { id: 'btn-cancel', cssClass: 'common', text: '取消', handler: () => { if (!(reject === null || reject === void 0 ? void 0 : reject())) { ref.modalInstance.hide(); } }, }, ], }); } } ConfirmService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: ConfirmService, deps: [{ token: i1.DialogService }], target: i0.ɵɵFactoryTarget.Injectable }); ConfirmService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: ConfirmService, providedIn: 'root' }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: ConfirmService, decorators: [{ type: Injectable, args: [{ providedIn: 'root', }] }], ctorParameters: function () { return [{ type: i1.DialogService }]; } }); class ConfirmModule { } ConfirmModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: ConfirmModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); ConfirmModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: ConfirmModule, imports: [CommonModule] }); ConfirmModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: ConfirmModule, providers: [ConfirmService], imports: [[ CommonModule, ]] }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: ConfirmModule, decorators: [{ type: NgModule, args: [{ declarations: [], imports: [ CommonModule, ], providers: [ConfirmService], }] }] }); /** * Generated bundle index. Do not edit. */ export { ConfirmModule, ConfirmService, ConfirmSizeData, ConfirmType }; //# sourceMappingURL=c-standard-angular-devui-extension-confirm.mjs.map