Icard/angular-clarity-master(work.../node_modules/primeng/esm2022/api/confirmationservice.mjs

43 lines
4.1 KiB
JavaScript
Raw Permalink Normal View History

2024-07-16 14:55:36 +00:00
import { Injectable } from '@angular/core';
import { Subject } from 'rxjs';
import * as i0 from "@angular/core";
/**
* Methods used in confirmation service.
* @group Service
*/
export class ConfirmationService {
requireConfirmationSource = new Subject();
acceptConfirmationSource = new Subject();
requireConfirmation$ = this.requireConfirmationSource.asObservable();
accept = this.acceptConfirmationSource.asObservable();
/**
* Callback to invoke on confirm.
* @param {Confirmation} confirmation - Represents a confirmation dialog configuration.
* @group Method
*/
confirm(confirmation) {
this.requireConfirmationSource.next(confirmation);
return this;
}
/**
* Closes the dialog.
* @group Method
*/
close() {
this.requireConfirmationSource.next(null);
return this;
}
/**
* Accepts the dialog.
* @group Method
*/
onAccept() {
this.acceptConfirmationSource.next(null);
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: ConfirmationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: ConfirmationService });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: ConfirmationService, decorators: [{
type: Injectable
}] });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlybWF0aW9uc2VydmljZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9hcHAvY29tcG9uZW50cy9hcGkvY29uZmlybWF0aW9uc2VydmljZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBQzNDLE9BQU8sRUFBRSxPQUFPLEVBQUUsTUFBTSxNQUFNLENBQUM7O0FBRS9COzs7R0FH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