UNPKG

bitfront-library

Version:

Angular CLI project with components and classes used by other Angular projects of the BIT foundation.

54 lines 2.45 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BitDomainValueComponent = void 0; var core_1 = require("@angular/core"); var i0 = require("@angular/core"); var BitDomainValueComponent = /** @class */ (function () { function BitDomainValueComponent() { this.translatedValue = "carregant..."; this.emptyText = ""; } BitDomainValueComponent.prototype.ngOnChanges = function () { // cada vez que cambia algo en el input, recalculamos this.translatedValue = this.resolveTranslatedValue(); }; BitDomainValueComponent.prototype.resolveTranslatedValue = function () { var _this = this; // buscar traducción para el valor en el dominio var domainMatch = this.data && this.data.find(function (obj) { return obj.value == _this.value; }); if (domainMatch) { return domainMatch.label; } else if (this.value) { return String("??" + this.value + "??"); } else { return this.emptyText; } }; BitDomainValueComponent.ɵfac = function BitDomainValueComponent_Factory(t) { return new (t || BitDomainValueComponent)(); }; BitDomainValueComponent.ɵcmp = i0.ɵɵdefineComponent({ type: BitDomainValueComponent, selectors: [["bit-domain-value"]], inputs: { value: "value", emptyText: "emptyText", data: "data" }, features: [i0.ɵɵNgOnChangesFeature], decls: 2, vars: 1, template: function BitDomainValueComponent_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementStart(0, "span"); i0.ɵɵtext(1); i0.ɵɵelementEnd(); } if (rf & 2) { i0.ɵɵadvance(1); i0.ɵɵtextInterpolate(ctx.translatedValue); } }, encapsulation: 2 }); return BitDomainValueComponent; }()); exports.BitDomainValueComponent = BitDomainValueComponent; (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(BitDomainValueComponent, [{ type: core_1.Component, args: [{ selector: "bit-domain-value", template: "\n <span>{{ translatedValue }}</span>\n " }] }], function () { return []; }, { value: [{ type: core_1.Input }], emptyText: [{ type: core_1.Input }], data: [{ type: core_1.Input }] }); })(); //# sourceMappingURL=bit-domain-value.component.js.map