bit-ng-library 13.1.10 → 13.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -2
- package/esm2020/lib/sharedlibrary/components/form/dropdown/bit-dropdown-multiple.component.mjs +20 -5
- package/esm2020/lib/sharedlibrary/components/form/dropdown/bit-dropdown.component.mjs +38 -3
- package/fesm2015/bit-ng-library.mjs +55 -6
- package/fesm2015/bit-ng-library.mjs.map +1 -1
- package/fesm2020/bit-ng-library.mjs +55 -6
- package/fesm2020/bit-ng-library.mjs.map +1 -1
- package/lib/sharedlibrary/components/form/dropdown/bit-dropdown-multiple.component.d.ts +1 -0
- package/lib/sharedlibrary/components/form/dropdown/bit-dropdown-multiple.component.d.ts.map +1 -1
- package/lib/sharedlibrary/components/form/dropdown/bit-dropdown.component.d.ts +2 -0
- package/lib/sharedlibrary/components/form/dropdown/bit-dropdown.component.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -4167,12 +4167,46 @@ class BitDropDownComponent extends BitDropDownGeneralV2Component {
|
|
|
4167
4167
|
this.postRetrieveData();
|
|
4168
4168
|
}
|
|
4169
4169
|
}
|
|
4170
|
+
// custom processing after retrieving data array from service
|
|
4171
|
+
postRetrieveData() {
|
|
4172
|
+
console.log("llamando a postRetrieveData para " + this.nombre + "{opciones:" + this.listaOpciones + "}");
|
|
4173
|
+
if (this.listaOpciones) {
|
|
4174
|
+
this.listaOpcionesVisible = Object.assign([], this.listaOpciones);
|
|
4175
|
+
// repasamos si hay opciones a excluir que debamos eliminar
|
|
4176
|
+
if (this.excludedValues) {
|
|
4177
|
+
this.listaOpcionesVisible = this.listaOpcionesVisible.filter((op) => this.excludedValues.indexOf(op.value) < 0);
|
|
4178
|
+
}
|
|
4179
|
+
}
|
|
4180
|
+
else {
|
|
4181
|
+
this.listaOpcionesVisible = [];
|
|
4182
|
+
}
|
|
4183
|
+
// determinamos si debemos incluir la opción "sin selección" y con qué texto
|
|
4184
|
+
if (this.includeEmpty) {
|
|
4185
|
+
console.log("hay valor empty que hay que traducir para " + this.nombre);
|
|
4186
|
+
this.translateService
|
|
4187
|
+
.selectTranslateWithContext(this.emptyText)
|
|
4188
|
+
.pipe(take(1))
|
|
4189
|
+
.subscribe((translation) => {
|
|
4190
|
+
let newOption = { value: null, label: translation };
|
|
4191
|
+
newOption[this.atributoValue] = null;
|
|
4192
|
+
newOption[this.atributoLabel] = translation;
|
|
4193
|
+
this.listaOpcionesVisible.splice(0, 0, newOption);
|
|
4194
|
+
this.emptyTextResolved = translation;
|
|
4195
|
+
//console.log("la lista de opciones vale", this.listaOpcionesVisible);
|
|
4196
|
+
});
|
|
4197
|
+
}
|
|
4198
|
+
}
|
|
4199
|
+
get value_lectura() {
|
|
4200
|
+
let val = this.control.value;
|
|
4201
|
+
let dom = this.listaOpciones && this.listaOpciones.find((d) => d.value == val);
|
|
4202
|
+
return dom ? dom.label : null;
|
|
4203
|
+
}
|
|
4170
4204
|
}
|
|
4171
4205
|
BitDropDownComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: BitDropDownComponent, deps: [{ token: i1.ActivatedRoute }, { token: SessionSharedService }, { token: AyudaService }, { token: TranslateService }], target: i0.ɵɵFactoryTarget.Component });
|
|
4172
|
-
BitDropDownComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.3", type: BitDropDownComponent, selector: "bit-dropdown", inputs: { filter: "filter", atributoLabel: "atributoLabel", atributoValue: "atributoValue", atributoDisabled: "atributoDisabled" }, usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<label *ngIf=\"!hideLabel\">\r\n <ng-content></ng-content> \r\n <span *ngIf=\"obligatorio\" class=\"obligatorio fa fa-asterisk\"></span> \r\n <i *ngIf=\"ayuda\" (click)=\"showAyuda()\" class=\"btn-ayuda fa fa-question\"></i>\r\n</label>\r\n<p *ngIf=\"readOnly\" class=\"lectura\" [id]=\"nombre\">{{value_lectura}}</p>\r\n<ng-container *ngIf=\"!readOnly && !!myForm\">\r\n<div [formGroup]=\"myForm\">\r\n <p-dropdown\r\n id=\"{{nombre}}\"\r\n [options]=\"listaOpcionesVisible\"\r\n [formControl]=\"control\"\r\n [filter]=\"filter\"\r\n \r\n [optionLabel]=\"atributoLabel\"\r\n [optionValue]=\"atributoValue\"\r\n [optionDisabled]=\"atributoDisabled\"\r\n \r\n (onFocus)=\"onFocus()\"\r\n (onBlur)=\"onBlur()\">\r\n <ng-template let-item pTemplate=\"item\">\r\n <span [ngClass]=\"{'opcion-desactivada': item
|
|
4206
|
+
BitDropDownComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.3", type: BitDropDownComponent, selector: "bit-dropdown", inputs: { filter: "filter", atributoLabel: "atributoLabel", atributoValue: "atributoValue", atributoDisabled: "atributoDisabled" }, usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<label *ngIf=\"!hideLabel\">\r\n <ng-content></ng-content> \r\n <span *ngIf=\"obligatorio\" class=\"obligatorio fa fa-asterisk\"></span> \r\n <i *ngIf=\"ayuda\" (click)=\"showAyuda()\" class=\"btn-ayuda fa fa-question\"></i>\r\n</label>\r\n<p *ngIf=\"readOnly\" class=\"lectura\" [id]=\"nombre\">{{value_lectura}}</p>\r\n<ng-container *ngIf=\"!readOnly && !!myForm\">\r\n<div [formGroup]=\"myForm\">\r\n <p-dropdown\r\n id=\"{{nombre}}\"\r\n [options]=\"listaOpcionesVisible\"\r\n [formControl]=\"control\"\r\n [filter]=\"filter\"\r\n \r\n [optionLabel]=\"atributoLabel\"\r\n [optionValue]=\"atributoValue\"\r\n [optionDisabled]=\"atributoDisabled\"\r\n \r\n (onFocus)=\"onFocus()\"\r\n (onBlur)=\"onBlur()\">\r\n <ng-template let-item pTemplate=\"item\">\r\n <span [ngClass]=\"{'opcion-desactivada': item[atributoDisabled]}\">{{item[atributoLabel]}}</span>\r\n </ng-template>\r\n </p-dropdown>\r\n <control-messages *ngIf=\"control!=null\" [control]=\"control\" [field]=\"id\"></control-messages>\r\n</div>\r\n</ng-container>\r\n", components: [{ type: i3$3.Dropdown, selector: "p-dropdown", inputs: ["scrollHeight", "filter", "name", "style", "panelStyle", "styleClass", "panelStyleClass", "readonly", "required", "editable", "appendTo", "tabindex", "placeholder", "filterPlaceholder", "filterLocale", "inputId", "selectId", "dataKey", "filterBy", "autofocus", "resetFilterOnHide", "dropdownIcon", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "autoDisplayFirst", "group", "showClear", "emptyFilterMessage", "emptyMessage", "virtualScroll", "itemSize", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "maxlength", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "autofocusFilter", "disabled", "options", "filterValue"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear"] }, { type: BitControlMessages, selector: "control-messages", inputs: ["control", "field"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i5$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i5$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i5$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i2$2.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
4173
4207
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: BitDropDownComponent, decorators: [{
|
|
4174
4208
|
type: Component,
|
|
4175
|
-
args: [{ selector: "bit-dropdown", template: "<label *ngIf=\"!hideLabel\">\r\n <ng-content></ng-content> \r\n <span *ngIf=\"obligatorio\" class=\"obligatorio fa fa-asterisk\"></span> \r\n <i *ngIf=\"ayuda\" (click)=\"showAyuda()\" class=\"btn-ayuda fa fa-question\"></i>\r\n</label>\r\n<p *ngIf=\"readOnly\" class=\"lectura\" [id]=\"nombre\">{{value_lectura}}</p>\r\n<ng-container *ngIf=\"!readOnly && !!myForm\">\r\n<div [formGroup]=\"myForm\">\r\n <p-dropdown\r\n id=\"{{nombre}}\"\r\n [options]=\"listaOpcionesVisible\"\r\n [formControl]=\"control\"\r\n [filter]=\"filter\"\r\n \r\n [optionLabel]=\"atributoLabel\"\r\n [optionValue]=\"atributoValue\"\r\n [optionDisabled]=\"atributoDisabled\"\r\n \r\n (onFocus)=\"onFocus()\"\r\n (onBlur)=\"onBlur()\">\r\n <ng-template let-item pTemplate=\"item\">\r\n <span [ngClass]=\"{'opcion-desactivada': item
|
|
4209
|
+
args: [{ selector: "bit-dropdown", template: "<label *ngIf=\"!hideLabel\">\r\n <ng-content></ng-content> \r\n <span *ngIf=\"obligatorio\" class=\"obligatorio fa fa-asterisk\"></span> \r\n <i *ngIf=\"ayuda\" (click)=\"showAyuda()\" class=\"btn-ayuda fa fa-question\"></i>\r\n</label>\r\n<p *ngIf=\"readOnly\" class=\"lectura\" [id]=\"nombre\">{{value_lectura}}</p>\r\n<ng-container *ngIf=\"!readOnly && !!myForm\">\r\n<div [formGroup]=\"myForm\">\r\n <p-dropdown\r\n id=\"{{nombre}}\"\r\n [options]=\"listaOpcionesVisible\"\r\n [formControl]=\"control\"\r\n [filter]=\"filter\"\r\n \r\n [optionLabel]=\"atributoLabel\"\r\n [optionValue]=\"atributoValue\"\r\n [optionDisabled]=\"atributoDisabled\"\r\n \r\n (onFocus)=\"onFocus()\"\r\n (onBlur)=\"onBlur()\">\r\n <ng-template let-item pTemplate=\"item\">\r\n <span [ngClass]=\"{'opcion-desactivada': item[atributoDisabled]}\">{{item[atributoLabel]}}</span>\r\n </ng-template>\r\n </p-dropdown>\r\n <control-messages *ngIf=\"control!=null\" [control]=\"control\" [field]=\"id\"></control-messages>\r\n</div>\r\n</ng-container>\r\n" }]
|
|
4176
4210
|
}], ctorParameters: function () { return [{ type: i1.ActivatedRoute }, { type: SessionSharedService }, { type: AyudaService }, { type: TranslateService }]; }, propDecorators: { filter: [{
|
|
4177
4211
|
type: Input
|
|
4178
4212
|
}], atributoLabel: [{
|
|
@@ -4237,16 +4271,31 @@ class BitDropDownMultipleComponent extends BitDropDownGeneralV2Component {
|
|
|
4237
4271
|
deleteSelectedItem(event, item) {
|
|
4238
4272
|
event.preventDefault();
|
|
4239
4273
|
let index = this.control.value.indexOf(item);
|
|
4240
|
-
|
|
4274
|
+
var currentValue = this.control.value;
|
|
4275
|
+
currentValue.splice(index, 1);
|
|
4241
4276
|
// se clona el array. Si no, el texto "{0} elementos seleccionados" del select de Prime no se actualiza.
|
|
4242
|
-
this.control.setValue(
|
|
4277
|
+
this.control.setValue(currentValue.slice(0));
|
|
4278
|
+
}
|
|
4279
|
+
get value_lectura() {
|
|
4280
|
+
let vals = this.control.value;
|
|
4281
|
+
if (!!vals) {
|
|
4282
|
+
let value = [];
|
|
4283
|
+
for (var val of vals) {
|
|
4284
|
+
let opcion = this.listaOpciones.find((d) => d.value == val);
|
|
4285
|
+
if (opcion) {
|
|
4286
|
+
value.push(opcion.label);
|
|
4287
|
+
}
|
|
4288
|
+
}
|
|
4289
|
+
return value.join(", ");
|
|
4290
|
+
}
|
|
4291
|
+
return "";
|
|
4243
4292
|
}
|
|
4244
4293
|
}
|
|
4245
4294
|
BitDropDownMultipleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: BitDropDownMultipleComponent, deps: [{ token: i1.ActivatedRoute }, { token: SessionSharedService }, { token: AyudaService }, { token: TranslateService }], target: i0.ɵɵFactoryTarget.Component });
|
|
4246
|
-
BitDropDownMultipleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.3", type: BitDropDownMultipleComponent, selector: "bit-dropdown-multiple", inputs: { maxSelectedLabels: "maxSelectedLabels", showSeparateSelectedLabels: "showSeparateSelectedLabels", title: "title", filter: "filter" }, usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<div class=\"row separador\" *ngIf=\"showSeparateSelectedLabels; else normalBitSelectMultiple\">\r\n <div> <!-- class=\"col-sm-4\"-->\r\n <ng-container *ngTemplateOutlet=\"normalBitSelectMultiple\"></ng-container>\r\n </div>\r\n <div><!-- elementos seleccionados -->\r\n <label> </label>\r\n <div class=\"multiselect-labels\">\r\n <div class=\"label label-primary multiselect-labels-lg\" *ngFor=\"let item of control.value\">\r\n <span>{{labelSelectedItem(item)}}</span>\r\n \r\n
|
|
4295
|
+
BitDropDownMultipleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.3", type: BitDropDownMultipleComponent, selector: "bit-dropdown-multiple", inputs: { maxSelectedLabels: "maxSelectedLabels", showSeparateSelectedLabels: "showSeparateSelectedLabels", title: "title", filter: "filter" }, usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<div class=\"row separador\" *ngIf=\"showSeparateSelectedLabels; else normalBitSelectMultiple\">\r\n <div> <!-- class=\"col-sm-4\"-->\r\n <ng-container *ngTemplateOutlet=\"normalBitSelectMultiple\"></ng-container>\r\n </div>\r\n <div><!-- elementos seleccionados -->\r\n <label> </label>\r\n <div class=\"multiselect-labels\">\r\n <div class=\"label label-primary multiselect-labels-lg\" *ngFor=\"let item of control.value\">\r\n <span>{{labelSelectedItem(item)}}</span>\r\n <ng-container *ngIf=\"!readOnly\">\r\n \r\n <a (click)=\"deleteSelectedItem($event, item)\" title=\"{{title}}\"><i class=\"fa fa-times\"></i></a>\r\n </ng-container>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n<ng-template #normalBitSelectMultiple>\r\n <label *ngIf=\"!hideLabel\"><ng-content></ng-content> <span *ngIf=\"obligatorio\" class=\"fa fa-asterisk\"></span> \r\n <i *ngIf=\"ayuda\" (click)=\"showAyuda()\" class=\"btn-ayuda fa fa-question\"></i>\r\n </label>\r\n <p *ngIf=\"readOnly && !showSeparateSelectedLabels\" class=\"lectura\">{{value_lectura}}</p>\r\n <div [formGroup]=\"myForm\" *ngIf=\"!readOnly\">\r\n <p-multiSelect\r\n id=\"{{id}}\"\r\n [options]=\"listaOpciones\"\r\n [formControl]=\"control\"\r\n \r\n [defaultLabel]=\"emptyTextResolved\"\r\n [maxSelectedLabels]=\"maxSelectedLabels\"\r\n selectedItemsLabel=\"{0} elements seleccionats\"\r\n (onFocus)=\"onFocus()\"\r\n (onBlur)=\"onBlur()\">\r\n </p-multiSelect>\r\n <control-messages *ngIf=\"control!=null\" [control]=\"control\" [field]=\"id\"></control-messages>\r\n </div>\r\n</ng-template>\r\n", components: [{ type: i3$4.MultiSelect, selector: "p-multiSelect", inputs: ["style", "styleClass", "panelStyle", "panelStyleClass", "inputId", "disabled", "readonly", "group", "filter", "filterPlaceHolder", "filterLocale", "overlayVisible", "tabindex", "appendTo", "dataKey", "name", "ariaLabelledBy", "displaySelectedLabel", "maxSelectedLabels", "selectionLimit", "selectedItemsLabel", "showToggleAll", "emptyFilterMessage", "emptyMessage", "resetFilterOnHide", "dropdownIcon", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "showHeader", "autoZIndex", "baseZIndex", "filterBy", "virtualScroll", "itemSize", "showTransitionOptions", "hideTransitionOptions", "ariaFilterLabel", "filterMatchMode", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "autofocusFilter", "display", "autocomplete", "scrollHeight", "defaultLabel", "placeholder", "options", "filterValue"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onPanelShow", "onPanelHide"] }, { type: BitControlMessages, selector: "control-messages", inputs: ["control", "field"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i5$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i5$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i5$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] });
|
|
4247
4296
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: BitDropDownMultipleComponent, decorators: [{
|
|
4248
4297
|
type: Component,
|
|
4249
|
-
args: [{ selector: "bit-dropdown-multiple", template: "<div class=\"row separador\" *ngIf=\"showSeparateSelectedLabels; else normalBitSelectMultiple\">\r\n <div> <!-- class=\"col-sm-4\"-->\r\n <ng-container *ngTemplateOutlet=\"normalBitSelectMultiple\"></ng-container>\r\n </div>\r\n <div><!-- elementos seleccionados -->\r\n <label> </label>\r\n <div class=\"multiselect-labels\">\r\n <div class=\"label label-primary multiselect-labels-lg\" *ngFor=\"let item of control.value\">\r\n <span>{{labelSelectedItem(item)}}</span>\r\n \r\n
|
|
4298
|
+
args: [{ selector: "bit-dropdown-multiple", template: "<div class=\"row separador\" *ngIf=\"showSeparateSelectedLabels; else normalBitSelectMultiple\">\r\n <div> <!-- class=\"col-sm-4\"-->\r\n <ng-container *ngTemplateOutlet=\"normalBitSelectMultiple\"></ng-container>\r\n </div>\r\n <div><!-- elementos seleccionados -->\r\n <label> </label>\r\n <div class=\"multiselect-labels\">\r\n <div class=\"label label-primary multiselect-labels-lg\" *ngFor=\"let item of control.value\">\r\n <span>{{labelSelectedItem(item)}}</span>\r\n <ng-container *ngIf=\"!readOnly\">\r\n \r\n <a (click)=\"deleteSelectedItem($event, item)\" title=\"{{title}}\"><i class=\"fa fa-times\"></i></a>\r\n </ng-container>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n<ng-template #normalBitSelectMultiple>\r\n <label *ngIf=\"!hideLabel\"><ng-content></ng-content> <span *ngIf=\"obligatorio\" class=\"fa fa-asterisk\"></span> \r\n <i *ngIf=\"ayuda\" (click)=\"showAyuda()\" class=\"btn-ayuda fa fa-question\"></i>\r\n </label>\r\n <p *ngIf=\"readOnly && !showSeparateSelectedLabels\" class=\"lectura\">{{value_lectura}}</p>\r\n <div [formGroup]=\"myForm\" *ngIf=\"!readOnly\">\r\n <p-multiSelect\r\n id=\"{{id}}\"\r\n [options]=\"listaOpciones\"\r\n [formControl]=\"control\"\r\n \r\n [defaultLabel]=\"emptyTextResolved\"\r\n [maxSelectedLabels]=\"maxSelectedLabels\"\r\n selectedItemsLabel=\"{0} elements seleccionats\"\r\n (onFocus)=\"onFocus()\"\r\n (onBlur)=\"onBlur()\">\r\n </p-multiSelect>\r\n <control-messages *ngIf=\"control!=null\" [control]=\"control\" [field]=\"id\"></control-messages>\r\n </div>\r\n</ng-template>\r\n" }]
|
|
4250
4299
|
}], ctorParameters: function () { return [{ type: i1.ActivatedRoute }, { type: SessionSharedService }, { type: AyudaService }, { type: TranslateService }]; }, propDecorators: { maxSelectedLabels: [{
|
|
4251
4300
|
type: Input
|
|
4252
4301
|
}], showSeparateSelectedLabels: [{
|