UNPKG

@c8y/ngx-components

Version:

Angular modules for Cumulocity IoT applications

35 lines 10.7 kB
import { Component, Output, EventEmitter } from '@angular/core'; import { BsModalRef } from 'ngx-bootstrap/modal'; import * as i0 from "@angular/core"; import * as i1 from "ngx-bootstrap/modal"; import * as i2 from "@angular/forms"; import * as i3 from "../forms/form-group.component"; import * as i4 from "../forms/message.directive"; import * as i5 from "../forms/messages.component"; import * as i6 from "../forms/required-input-placeholder.directive"; import * as i7 from "../i18n/c8y-translate.directive"; import * as i8 from "../modal/modal.component"; import * as i9 from "../i18n/c8y-translate.pipe"; export class CurrentPasswordModalComponent { constructor(modal) { this.modal = modal; this.currentPasswordEmitter = new EventEmitter(); } passwordConfirm() { this.currentPasswordEmitter.emit(this.password); this.modal.hide(); } cancel() { this.currentPasswordEmitter.emit(null); this.modal.hide(); } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CurrentPasswordModalComponent, deps: [{ token: i1.BsModalRef }], target: i0.ɵɵFactoryTarget.Component }); } static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: CurrentPasswordModalComponent, selector: "c8y-current-password-modal", outputs: { currentPasswordEmitter: "currentPasswordEmitter" }, ngImport: i0, template: "<c8y-modal [customFooter]=\"true\" [title]=\"'Confirm your current password' | translate\" #modal>\n <form #confirmForm=\"ngForm\" (ngSubmit)=\"confirmForm.form.valid && passwordConfirm()\">\n <div class=\"d-block p-24\">\n <c8y-form-group [hasWarning]=\"true\">\n <label translate for=\"currentPassword\">Enter your password</label>\n <input\n id=\"currentPassword\"\n [(ngModel)]=\"password\"\n type=\"password\"\n name=\"password\"\n class=\"form-control\"\n required\n />\n <c8y-messages>\n <c8y-message translate>\n The password of the user that you are currently logged in with.\n </c8y-message>\n </c8y-messages>\n </c8y-form-group>\n </div>\n <div class=\"modal-footer separator-top bg-level-0 sticky-bottom\">\n <button\n title=\"{{ 'Cancel' | translate }}\"\n class=\"btn btn-default\"\n type=\"button\"\n (click)=\"cancel()\"\n >\n {{ 'Cancel' | translate }}\n </button>\n <button\n title=\"{{ 'Confirm' | translate }}\"\n class=\"btn btn-primary\"\n [attr.data-cy]=\"'confirm-current-password-confirm-button'\"\n type=\"submit\"\n [disabled]=\"!confirmForm.form.valid\"\n >\n {{ 'Confirm' | translate }}\n </button>\n </div>\n </form>\n</c8y-modal>\n", dependencies: [{ kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i2.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i3.FormGroupComponent, selector: "c8y-form-group", inputs: ["hasError", "hasWarning", "hasSuccess", "novalidation", "status"] }, { kind: "directive", type: i4.MessageDirective, selector: "c8y-message", inputs: ["name", "text"] }, { kind: "component", type: i5.MessagesComponent, selector: "c8y-messages", inputs: ["show", "defaults", "helpMessage"] }, { kind: "directive", type: i6.RequiredInputPlaceholderDirective, selector: "input[required], input[formControlName]" }, { kind: "directive", type: i7.C8yTranslateDirective, selector: "[translate],[ngx-translate]" }, { kind: "component", type: i8.ModalComponent, selector: "c8y-modal", inputs: ["disabled", "close", "dismiss", "title", "body", "customFooter", "headerClasses", "labels"], outputs: ["onDismiss", "onClose"] }, { kind: "pipe", type: i9.C8yTranslatePipe, name: "translate" }] }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CurrentPasswordModalComponent, decorators: [{ type: Component, args: [{ selector: 'c8y-current-password-modal', template: "<c8y-modal [customFooter]=\"true\" [title]=\"'Confirm your current password' | translate\" #modal>\n <form #confirmForm=\"ngForm\" (ngSubmit)=\"confirmForm.form.valid && passwordConfirm()\">\n <div class=\"d-block p-24\">\n <c8y-form-group [hasWarning]=\"true\">\n <label translate for=\"currentPassword\">Enter your password</label>\n <input\n id=\"currentPassword\"\n [(ngModel)]=\"password\"\n type=\"password\"\n name=\"password\"\n class=\"form-control\"\n required\n />\n <c8y-messages>\n <c8y-message translate>\n The password of the user that you are currently logged in with.\n </c8y-message>\n </c8y-messages>\n </c8y-form-group>\n </div>\n <div class=\"modal-footer separator-top bg-level-0 sticky-bottom\">\n <button\n title=\"{{ 'Cancel' | translate }}\"\n class=\"btn btn-default\"\n type=\"button\"\n (click)=\"cancel()\"\n >\n {{ 'Cancel' | translate }}\n </button>\n <button\n title=\"{{ 'Confirm' | translate }}\"\n class=\"btn btn-primary\"\n [attr.data-cy]=\"'confirm-current-password-confirm-button'\"\n type=\"submit\"\n [disabled]=\"!confirmForm.form.valid\"\n >\n {{ 'Confirm' | translate }}\n </button>\n </div>\n </form>\n</c8y-modal>\n" }] }], ctorParameters: () => [{ type: i1.BsModalRef }], propDecorators: { currentPasswordEmitter: [{ type: Output }] } }); //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3VycmVudC1wYXNzd29yZC1tb2RhbC5jb21wb25lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmN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