bitfront-library
Version:
Angular CLI project with components and classes used by other Angular projects of the BIT foundation.
145 lines • 9.42 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.BitDateComponent = exports.CUSTOM_INPUT_DATE_CONTROL_VALUE_ACCESSOR = void 0;
var core_1 = require("@angular/core");
var forms_1 = require("@angular/forms");
var ayuda_service_1 = require("../../service/ayuda.service");
var general_utils_service_1 = require("../../service/general-utils.service");
var bit_calendar_component_1 = require("./bit-calendar.component");
var i0 = require("@angular/core");
var i1 = require("../../service/ayuda.service");
var i2 = require("@angular/common");
var i3 = require("primeng/calendar");
var i4 = require("@angular/forms");
var i5 = require("../bit-control-messages.component");
function BitDateComponent_label_0_span_3_Template(rf, ctx) { if (rf & 1) {
i0.ɵɵelement(0, "span", 7);
} }
function BitDateComponent_label_0_i_5_Template(rf, ctx) { if (rf & 1) {
var _r8 = i0.ɵɵgetCurrentView();
i0.ɵɵelementStart(0, "i", 8);
i0.ɵɵlistener("click", function BitDateComponent_label_0_i_5_Template_i_click_0_listener() { i0.ɵɵrestoreView(_r8); var ctx_r7 = i0.ɵɵnextContext(2); return ctx_r7.showAyuda(); });
i0.ɵɵelementEnd();
} }
function BitDateComponent_label_0_Template(rf, ctx) { if (rf & 1) {
i0.ɵɵelementStart(0, "label");
i0.ɵɵprojection(1);
i0.ɵɵtext(2, "\u00A0");
i0.ɵɵtemplate(3, BitDateComponent_label_0_span_3_Template, 1, 0, "span", 5);
i0.ɵɵtext(4, "\u00A0\u00A0 ");
i0.ɵɵtemplate(5, BitDateComponent_label_0_i_5_Template, 1, 0, "i", 6);
i0.ɵɵelementEnd();
} if (rf & 2) {
var ctx_r0 = i0.ɵɵnextContext();
i0.ɵɵadvance(3);
i0.ɵɵproperty("ngIf", ctx_r0.obligatorio);
i0.ɵɵadvance(2);
i0.ɵɵproperty("ngIf", ctx_r0.ayuda);
} }
function BitDateComponent_p_1_Template(rf, ctx) { if (rf & 1) {
i0.ɵɵelementStart(0, "p", 9);
i0.ɵɵtext(1);
i0.ɵɵelementEnd();
} if (rf & 2) {
var ctx_r1 = i0.ɵɵnextContext();
i0.ɵɵproperty("id", ctx_r1.nombre);
i0.ɵɵadvance(1);
i0.ɵɵtextInterpolate(ctx_r1.value_lectura);
} }
function BitDateComponent_p_calendar_2_Template(rf, ctx) { if (rf & 1) {
var _r10 = i0.ɵɵgetCurrentView();
i0.ɵɵelementStart(0, "p-calendar", 10);
i0.ɵɵlistener("ngModelChange", function BitDateComponent_p_calendar_2_Template_p_calendar_ngModelChange_0_listener($event) { i0.ɵɵrestoreView(_r10); var ctx_r9 = i0.ɵɵnextContext(); return ctx_r9.value = $event; });
i0.ɵɵelementEnd();
} if (rf & 2) {
var ctx_r2 = i0.ɵɵnextContext();
i0.ɵɵpropertyInterpolate("id", ctx_r2.nombre);
i0.ɵɵpropertyInterpolate("name", ctx_r2.nombre);
i0.ɵɵproperty("ngModel", ctx_r2.value)("monthNavigator", true)("readonlyInput", ctx_r2.calendarReadOnlyInput)("minDate", ctx_r2.fechaMinima)("maxDate", ctx_r2.fechaMaxima)("yearNavigator", true)("yearRange", ctx_r2.yearRange)("locale", ctx_r2.LOCALE_ES);
} }
function BitDateComponent_span_3_Template(rf, ctx) { if (rf & 1) {
i0.ɵɵelement(0, "span", 11);
} }
function BitDateComponent_control_messages_4_Template(rf, ctx) { if (rf & 1) {
i0.ɵɵelement(0, "control-messages", 12);
} if (rf & 2) {
var ctx_r4 = i0.ɵɵnextContext();
i0.ɵɵproperty("control", ctx_r4.control)("field", ctx_r4.nombre);
} }
var _c0 = ["*"];
exports.CUSTOM_INPUT_DATE_CONTROL_VALUE_ACCESSOR = {
provide: forms_1.NG_VALUE_ACCESSOR,
useExisting: core_1.forwardRef(function () { return BitDateComponent; }),
multi: true
};
var BitDateComponent = /** @class */ (function (_super) {
__extends(BitDateComponent, _super);
function BitDateComponent(ayudaService, changeDetectorRef) {
var _this = _super.call(this, ayudaService, changeDetectorRef) || this;
_this.ayudaService = ayudaService;
_this.changeDetectorRef = changeDetectorRef;
return _this;
}
BitDateComponent.prototype.transformData = function (value) {
var v = null;
if (value) {
v = general_utils_service_1.GeneralUtils.getDateAsString(general_utils_service_1.GeneralUtils.stringToDate(value));
}
return v;
};
Object.defineProperty(BitDateComponent.prototype, "value_lectura", {
get: function () {
if (this.value == null || this.value == "") {
return "";
} // si es null o undefined (es lo que evalúa el "==null")
else {
return general_utils_service_1.GeneralUtils.getDateAsString(general_utils_service_1.GeneralUtils.stringShortToDate(this.value));
}
},
enumerable: false,
configurable: true
});
BitDateComponent.ɵfac = function BitDateComponent_Factory(t) { return new (t || BitDateComponent)(i0.ɵɵdirectiveInject(i1.AyudaService), i0.ɵɵdirectiveInject(i0.ChangeDetectorRef)); };
BitDateComponent.ɵcmp = i0.ɵɵdefineComponent({ type: BitDateComponent, selectors: [["bit-date"]], features: [i0.ɵɵProvidersFeature([exports.CUSTOM_INPUT_DATE_CONTROL_VALUE_ACCESSOR]), i0.ɵɵInheritDefinitionFeature], ngContentSelectors: _c0, decls: 5, vars: 5, consts: [[4, "ngIf"], ["class", "lectura", 3, "id", 4, "ngIf"], ["class", "FormControl", "dateFormat", "dd/mm/yy", "placeholder", "dd/mm/yyyy", 3, "id", "name", "ngModel", "monthNavigator", "readonlyInput", "minDate", "maxDate", "yearNavigator", "yearRange", "locale", "ngModelChange", 4, "ngIf"], ["class", "glyphicon glyphicon-calendar icono-input", 4, "ngIf"], [3, "control", "field", 4, "ngIf"], ["class", "obligatorio fa fa-asterisk", 4, "ngIf"], ["class", "btn-ayuda fa fa-question", 3, "click", 4, "ngIf"], [1, "obligatorio", "fa", "fa-asterisk"], [1, "btn-ayuda", "fa", "fa-question", 3, "click"], [1, "lectura", 3, "id"], ["dateFormat", "dd/mm/yy", "placeholder", "dd/mm/yyyy", 1, "FormControl", 3, "id", "name", "ngModel", "monthNavigator", "readonlyInput", "minDate", "maxDate", "yearNavigator", "yearRange", "locale", "ngModelChange"], [1, "glyphicon", "glyphicon-calendar", "icono-input"], [3, "control", "field"]], template: function BitDateComponent_Template(rf, ctx) { if (rf & 1) {
i0.ɵɵprojectionDef();
i0.ɵɵtemplate(0, BitDateComponent_label_0_Template, 6, 2, "label", 0);
i0.ɵɵtemplate(1, BitDateComponent_p_1_Template, 2, 2, "p", 1);
i0.ɵɵtemplate(2, BitDateComponent_p_calendar_2_Template, 1, 10, "p-calendar", 2);
i0.ɵɵtemplate(3, BitDateComponent_span_3_Template, 1, 0, "span", 3);
i0.ɵɵtemplate(4, BitDateComponent_control_messages_4_Template, 1, 2, "control-messages", 4);
} if (rf & 2) {
i0.ɵɵproperty("ngIf", !ctx.hideLabel);
i0.ɵɵadvance(1);
i0.ɵɵproperty("ngIf", ctx.readOnly);
i0.ɵɵadvance(1);
i0.ɵɵproperty("ngIf", !ctx.readOnly);
i0.ɵɵadvance(1);
i0.ɵɵproperty("ngIf", !ctx.readOnly);
i0.ɵɵadvance(1);
i0.ɵɵproperty("ngIf", ctx.control != null);
} }, directives: [i2.NgIf, i3.Calendar, i4.NgControlStatus, i4.NgModel, i5.BitControlMessages], encapsulation: 2 });
return BitDateComponent;
}(bit_calendar_component_1.BitCalendarComponent));
exports.BitDateComponent = BitDateComponent;
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(BitDateComponent, [{
type: core_1.Component,
args: [{
selector: "bit-date",
template: "\n <label *ngIf=\"!hideLabel\">\n <ng-content></ng-content> <span *ngIf=\"obligatorio\" class=\"obligatorio fa fa-asterisk\"></span> \n <i *ngIf=\"ayuda\" class=\"btn-ayuda fa fa-question\" (click)=\"showAyuda()\"></i>\n </label>\n <p *ngIf=\"readOnly\" class=\"lectura\" [id]=\"nombre\">{{value_lectura}}</p>\n <p-calendar \n *ngIf=\"!readOnly\"\n class=\"FormControl\" \n id=\"{{nombre}}\" \n name=\"{{nombre}}\" \n [(ngModel)]=\"value\" \n dateFormat=\"dd/mm/yy\" \n placeholder=\"dd/mm/yyyy\" \n [monthNavigator]=\"true\" \n [readonlyInput]=\"calendarReadOnlyInput\"\n [minDate]=\"fechaMinima\" \n [maxDate]=\"fechaMaxima\"\n [yearNavigator]=\"true\" \n [yearRange]=\"yearRange\"\n [locale]=\"LOCALE_ES\">\n </p-calendar>\n <span *ngIf=\"!readOnly\" class=\"glyphicon glyphicon-calendar icono-input\"></span>\n <control-messages *ngIf=\"control != null\" [control]=\"control\" [field]=\"nombre\"></control-messages>\n ",
providers: [exports.CUSTOM_INPUT_DATE_CONTROL_VALUE_ACCESSOR]
}]
}], function () { return [{ type: i1.AyudaService }, { type: i0.ChangeDetectorRef }]; }, null); })();
//# sourceMappingURL=bit-date.component.js.map