bitfront-library
Version:
Angular CLI project with components and classes used by other Angular projects of the BIT foundation.
138 lines • 9.88 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.BitAutoCompleteComponent = exports.CUSTOM_INPUT_AUTOCOMPLETE_CONTROL_VALUE_ACCESSOR = void 0;
var core_1 = require("@angular/core");
var ayuda_service_1 = require("../../service/ayuda.service");
var forms_1 = require("@angular/forms");
var bit_custom_component_1 = require("./bit-custom.component");
var i0 = require("@angular/core");
var i1 = require("../../service/ayuda.service");
var i2 = require("@angular/common");
var i3 = require("primeng/autocomplete");
var i4 = require("@angular/forms");
var i5 = require("../bit-control-messages.component");
function BitAutoCompleteComponent_label_0_span_3_Template(rf, ctx) { if (rf & 1) {
i0.ɵɵelement(0, "span", 6);
} }
function BitAutoCompleteComponent_label_0_i_5_Template(rf, ctx) { if (rf & 1) {
var _r7 = i0.ɵɵgetCurrentView();
i0.ɵɵelementStart(0, "i", 7);
i0.ɵɵlistener("click", function BitAutoCompleteComponent_label_0_i_5_Template_i_click_0_listener() { i0.ɵɵrestoreView(_r7); var ctx_r6 = i0.ɵɵnextContext(2); return ctx_r6.showAyuda(); });
i0.ɵɵelementEnd();
} }
function BitAutoCompleteComponent_label_0_Template(rf, ctx) { if (rf & 1) {
i0.ɵɵelementStart(0, "label");
i0.ɵɵprojection(1);
i0.ɵɵtext(2, "\u00A0");
i0.ɵɵtemplate(3, BitAutoCompleteComponent_label_0_span_3_Template, 1, 0, "span", 4);
i0.ɵɵtext(4, "\u00A0\u00A0 ");
i0.ɵɵtemplate(5, BitAutoCompleteComponent_label_0_i_5_Template, 1, 0, "i", 5);
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 BitAutoCompleteComponent_p_1_Template(rf, ctx) { if (rf & 1) {
i0.ɵɵelementStart(0, "p", 8);
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 BitAutoCompleteComponent_p_autoComplete_2_Template(rf, ctx) { if (rf & 1) {
var _r9 = i0.ɵɵgetCurrentView();
i0.ɵɵelementStart(0, "p-autoComplete", 9);
i0.ɵɵlistener("ngModelChange", function BitAutoCompleteComponent_p_autoComplete_2_Template_p_autoComplete_ngModelChange_0_listener($event) { i0.ɵɵrestoreView(_r9); var ctx_r8 = i0.ɵɵnextContext(); return ctx_r8.value = $event; })("completeMethod", function BitAutoCompleteComponent_p_autoComplete_2_Template_p_autoComplete_completeMethod_0_listener($event) { i0.ɵɵrestoreView(_r9); var ctx_r10 = i0.ɵɵnextContext(); return ctx_r10.search($event); })("onSelect", function BitAutoCompleteComponent_p_autoComplete_2_Template_p_autoComplete_onSelect_0_listener($event) { i0.ɵɵrestoreView(_r9); var ctx_r11 = i0.ɵɵnextContext(); return ctx_r11.selectValue($event); })("blur", function BitAutoCompleteComponent_p_autoComplete_2_Template_p_autoComplete_blur_0_listener() { i0.ɵɵrestoreView(_r9); var ctx_r12 = i0.ɵɵnextContext(); return ctx_r12.onBlur(); })("focus", function BitAutoCompleteComponent_p_autoComplete_2_Template_p_autoComplete_focus_0_listener() { i0.ɵɵrestoreView(_r9); var ctx_r13 = i0.ɵɵnextContext(); return ctx_r13.onFocus(); });
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)("placeholder", ctx_r2.placeholder)("immutable", false)("suggestions", ctx_r2.suggestions)("field", ctx_r2.suggestionField)("multiple", ctx_r2.multiple);
} }
function BitAutoCompleteComponent_control_messages_3_Template(rf, ctx) { if (rf & 1) {
i0.ɵɵelement(0, "control-messages", 10);
} if (rf & 2) {
var ctx_r3 = i0.ɵɵnextContext();
i0.ɵɵproperty("control", ctx_r3.control)("field", ctx_r3.nombre);
} }
var _c0 = ["*"];
exports.CUSTOM_INPUT_AUTOCOMPLETE_CONTROL_VALUE_ACCESSOR = {
provide: forms_1.NG_VALUE_ACCESSOR,
useExisting: core_1.forwardRef(function () { return BitAutoCompleteComponent; }),
multi: true
};
var BitAutoCompleteComponent = /** @class */ (function (_super) {
__extends(BitAutoCompleteComponent, _super);
function BitAutoCompleteComponent(ayudaService, changeDetectorRef) {
var _this = _super.call(this, ayudaService, changeDetectorRef) || this;
_this.ayudaService = ayudaService;
_this.changeDetectorRef = changeDetectorRef;
_this.multiple = false;
_this.completeMethod = new core_1.EventEmitter();
_this.onSelect = new core_1.EventEmitter();
return _this;
}
BitAutoCompleteComponent.prototype.search = function (event) {
this.completeMethod.emit(event);
};
BitAutoCompleteComponent.prototype.selectValue = function (event) {
this.onSelect.emit(event);
};
BitAutoCompleteComponent.ɵfac = function BitAutoCompleteComponent_Factory(t) { return new (t || BitAutoCompleteComponent)(i0.ɵɵdirectiveInject(i1.AyudaService), i0.ɵɵdirectiveInject(i0.ChangeDetectorRef)); };
BitAutoCompleteComponent.ɵcmp = i0.ɵɵdefineComponent({ type: BitAutoCompleteComponent, selectors: [["bit-autocomplete"]], inputs: { suggestions: "suggestions", suggestionField: "suggestionField", multiple: "multiple" }, outputs: { completeMethod: "completeMethod", onSelect: "onSelect" }, features: [i0.ɵɵProvidersFeature([exports.CUSTOM_INPUT_AUTOCOMPLETE_CONTROL_VALUE_ACCESSOR]), i0.ɵɵInheritDefinitionFeature], ngContentSelectors: _c0, decls: 4, vars: 4, consts: [[4, "ngIf"], ["class", "lectura", 3, "id", 4, "ngIf"], ["delay", "400", 3, "ngModel", "id", "name", "placeholder", "immutable", "suggestions", "field", "multiple", "ngModelChange", "completeMethod", "onSelect", "blur", "focus", 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"], ["delay", "400", 3, "ngModel", "id", "name", "placeholder", "immutable", "suggestions", "field", "multiple", "ngModelChange", "completeMethod", "onSelect", "blur", "focus"], [3, "control", "field"]], template: function BitAutoCompleteComponent_Template(rf, ctx) { if (rf & 1) {
i0.ɵɵprojectionDef();
i0.ɵɵtemplate(0, BitAutoCompleteComponent_label_0_Template, 6, 2, "label", 0);
i0.ɵɵtemplate(1, BitAutoCompleteComponent_p_1_Template, 2, 2, "p", 1);
i0.ɵɵtemplate(2, BitAutoCompleteComponent_p_autoComplete_2_Template, 1, 8, "p-autoComplete", 2);
i0.ɵɵtemplate(3, BitAutoCompleteComponent_control_messages_3_Template, 1, 2, "control-messages", 3);
} 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.control != null);
} }, directives: [i2.NgIf, i3.AutoComplete, i4.NgControlStatus, i4.NgModel, i5.BitControlMessages], encapsulation: 2 });
return BitAutoCompleteComponent;
}(bit_custom_component_1.BitCustomComponent));
exports.BitAutoCompleteComponent = BitAutoCompleteComponent;
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(BitAutoCompleteComponent, [{
type: core_1.Component,
args: [{
selector: "bit-autocomplete",
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-autoComplete \n *ngIf=\"!readOnly\"\n [(ngModel)]=\"value\" \n id=\"{{nombre}}\" \n name=\"{{nombre}}\" \n [placeholder]=\"placeholder\"\n delay=\"400\" \n [immutable]=\"false\"\n [suggestions]=\"suggestions\" \n [field]=\"suggestionField\" \n [multiple]=\"multiple\"\n (completeMethod)=\"search($event)\" \n (onSelect)=\"selectValue($event)\" \n (blur)=\"onBlur()\" \n (focus)=\"onFocus()\" \n ></p-autoComplete>\n <control-messages *ngIf=\"control != null\" [control]=\"control\" [field]=\"nombre\"></control-messages>\n ",
providers: [exports.CUSTOM_INPUT_AUTOCOMPLETE_CONTROL_VALUE_ACCESSOR]
}]
}], function () { return [{ type: i1.AyudaService }, { type: i0.ChangeDetectorRef }]; }, { suggestions: [{
type: core_1.Input
}], suggestionField: [{
type: core_1.Input
}], multiple: [{
type: core_1.Input
}], completeMethod: [{
type: core_1.Output
}], onSelect: [{
type: core_1.Output
}] }); })();
//# sourceMappingURL=bit-autocomplete.component.js.map