@akveo/nga-theme
Version:
@akveo/nga-theme
116 lines • 4.76 kB
JavaScript
/**
* @license
* Copyright Akveo. All Rights Reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { Component, Input, HostBinding, forwardRef } from '@angular/core';
import { NG_VALUE_ACCESSOR } from '@angular/forms';
var NgaCheckboxComponent = NgaCheckboxComponent_1 = (function () {
function NgaCheckboxComponent() {
this._value = false;
this.onChange = function () { };
this.onTouched = function () { };
}
Object.defineProperty(NgaCheckboxComponent.prototype, "setStatus", {
set: function (val) {
this.status = val;
},
enumerable: true,
configurable: true
});
Object.defineProperty(NgaCheckboxComponent.prototype, "success", {
get: function () {
return this.status === 'success';
},
enumerable: true,
configurable: true
});
Object.defineProperty(NgaCheckboxComponent.prototype, "warning", {
get: function () {
return this.status === 'warning';
},
enumerable: true,
configurable: true
});
Object.defineProperty(NgaCheckboxComponent.prototype, "danger", {
get: function () {
return this.status === 'danger';
},
enumerable: true,
configurable: true
});
Object.defineProperty(NgaCheckboxComponent.prototype, "value", {
get: function () {
return this._value;
},
set: function (val) {
this._value = val;
this.onChange(val);
this.onTouched();
},
enumerable: true,
configurable: true
});
NgaCheckboxComponent.prototype.registerOnChange = function (fn) {
this.onChange = fn;
};
NgaCheckboxComponent.prototype.registerOnTouched = function (fn) {
this.onTouched = fn;
};
NgaCheckboxComponent.prototype.writeValue = function (val) {
this.value = val;
};
return NgaCheckboxComponent;
}());
__decorate([
Input('value'),
__metadata("design:type", Boolean)
], NgaCheckboxComponent.prototype, "_value", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], NgaCheckboxComponent.prototype, "disabled", void 0);
__decorate([
Input('status'),
__metadata("design:type", String),
__metadata("design:paramtypes", [String])
], NgaCheckboxComponent.prototype, "setStatus", null);
__decorate([
HostBinding('class.success'),
__metadata("design:type", Object),
__metadata("design:paramtypes", [])
], NgaCheckboxComponent.prototype, "success", null);
__decorate([
HostBinding('class.warning'),
__metadata("design:type", Object),
__metadata("design:paramtypes", [])
], NgaCheckboxComponent.prototype, "warning", null);
__decorate([
HostBinding('class.danger'),
__metadata("design:type", Object),
__metadata("design:paramtypes", [])
], NgaCheckboxComponent.prototype, "danger", null);
NgaCheckboxComponent = NgaCheckboxComponent_1 = __decorate([
Component({
selector: 'nga-checkbox',
styles: [""],
template: "\n <label class=\"custom-control custom-checkbox\">\n <input type=\"checkbox\" class=\"custom-control-input\"\n [disabled]=\"disabled\"\n [checked]=\"value\"\n (change)=\"value = !value\">\n <span class=\"custom-control-indicator\"></span>\n <span class=\"custom-control-description\">\n <ng-content></ng-content>\n </span>\n </label>\n ",
providers: [{
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(function () { return NgaCheckboxComponent_1; }),
multi: true,
}],
})
], NgaCheckboxComponent);
export { NgaCheckboxComponent };
var NgaCheckboxComponent_1;
//# sourceMappingURL=checkbox.component.js.map