ngx-academia-uniandes-library
Version:
This library is used for Academia-Uniandes system.
87 lines • 3.96 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var core_1 = require("@angular/core");
var forms_1 = require("@angular/forms");
var SearchAcademyComboBoxComponent = /** @class */ (function () {
function SearchAcademyComboBoxComponent(urlService, searchBoxUtils, transService, model, titlecasePipe) {
this.urlService = urlService;
this.searchBoxUtils = searchBoxUtils;
this.transService = transService;
this.model = model;
this.titlecasePipe = titlecasePipe;
this.itemSelected = new core_1.EventEmitter();
this.noResults = new core_1.EventEmitter();
this.typeLoading = new core_1.EventEmitter();
this.totalRecordsForSearch = new core_1.EventEmitter();
}
SearchAcademyComboBoxComponent.prototype.ngOnInit = function () {
var _this = this;
if (this.placeHolder != null && this.placeHolder != '') {
this.transService.stream(this.placeHolder).subscribe(function (res) {
_this.model.placeholder = res;
});
}
this.prepareQueryParams(this.queryParams);
};
SearchAcademyComboBoxComponent.prototype.ngOnChanges = function (changes) {
if (changes['queryParams']) {
this.prepareQueryParams(changes['queryParams'].currentValue);
}
};
SearchAcademyComboBoxComponent.prototype.prepareQueryParams = function (queryParams) {
var _this = this;
if (queryParams) {
queryParams.forEach(function (element) {
_this.addQueryParams(element);
});
}
};
SearchAcademyComboBoxComponent.prototype.addQueryParams = function (qp) {
var oldValue = this.model.queryParams.find(function (elm) { return qp.name === elm.name; });
if (!oldValue) {
this.model.queryParams.push(qp);
}
else {
this.model.queryParams.splice(this.model.queryParams.indexOf(oldValue), 1, qp);
}
};
SearchAcademyComboBoxComponent.prototype.sendItemSelectedEvent = function (event) {
if (event) {
this.itemControl.setValue(this.titlecasePipe.transform(event.value));
}
this.itemSelected.emit(event);
};
SearchAcademyComboBoxComponent.prototype.sendNoResults = function (event) {
this.noResults.emit(event);
};
SearchAcademyComboBoxComponent.prototype.sendLoading = function (event) {
this.typeLoading.emit(event);
};
SearchAcademyComboBoxComponent.prototype.addUserNameRestriction = function (userData, param) {
if (userData != null) {
if (userData['dependency'] != null) {
this.genCombo.componentModel = this.model;
var extId = userData['dependency']['externalId'];
this.addQueryParams({ "name": param, "value": extId });
var selectParam = { name: "externalId", value: extId };
this.genCombo.setInitialValue(selectParam);
}
}
};
SearchAcademyComboBoxComponent.propDecorators = {
"itemControl": [{ type: core_1.Input },],
"debugFlag": [{ type: core_1.Input },],
"isScrollable": [{ type: core_1.Input },],
"placeHolder": [{ type: core_1.Input },],
"preSelectedValue": [{ type: core_1.Input },],
"queryParams": [{ type: core_1.Input },],
"itemSelected": [{ type: core_1.Output },],
"noResults": [{ type: core_1.Output },],
"typeLoading": [{ type: core_1.Output },],
"totalRecordsForSearch": [{ type: core_1.Output },],
"genCombo": [{ type: core_1.ViewChild, args: ["genCombo",] },],
};
return SearchAcademyComboBoxComponent;
}());
exports.SearchAcademyComboBoxComponent = SearchAcademyComboBoxComponent;
//# sourceMappingURL=search-academy-combo-box.component.js.map