ng-inail-common 2.0.24 → 2.0.25
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/bundles/ng-inail-common.umd.js +133 -2
- package/bundles/ng-inail-common.umd.js.map +1 -1
- package/bundles/ng-inail-common.umd.min.js +2 -2
- package/bundles/ng-inail-common.umd.min.js.map +1 -1
- package/esm2015/lib/components/core/form/form-element.component.js +2 -1
- package/esm2015/lib/components/core/form/input-file/input-file.component.js +3 -1
- package/esm2015/lib/components/core/form/multi-select/multi-select.component.js +121 -0
- package/esm2015/lib/ng-inail-common.module.js +6 -3
- package/esm2015/public-api.js +2 -1
- package/fesm2015/ng-inail-common.js +125 -3
- package/fesm2015/ng-inail-common.js.map +1 -1
- package/lib/components/core/form/multi-select/multi-select.component.d.ts +40 -0
- package/ng-inail-common.metadata.json +1 -1
- package/package.json +1 -1
- package/public-api.d.ts +1 -0
|
@@ -2975,6 +2975,7 @@
|
|
|
2975
2975
|
_this.error = undefined;
|
|
2976
2976
|
_this.errorChange.emit(undefined);
|
|
2977
2977
|
}
|
|
2978
|
+
_this.formElementCdr.detectChanges();
|
|
2978
2979
|
});
|
|
2979
2980
|
};
|
|
2980
2981
|
FormElementComponent.prototype.registerOnChange = function (fn) {
|
|
@@ -5790,11 +5791,13 @@
|
|
|
5790
5791
|
if (!this.addButton) {
|
|
5791
5792
|
this.fileChange.emit(this.fileModel);
|
|
5792
5793
|
}
|
|
5794
|
+
this.cleanError();
|
|
5793
5795
|
this.cdr.detectChanges();
|
|
5794
5796
|
};
|
|
5795
5797
|
InputFileComponent.prototype.reset = function () {
|
|
5796
5798
|
this.fileModel = undefined;
|
|
5797
5799
|
this.fileChange.emit(undefined);
|
|
5800
|
+
this.cleanError();
|
|
5798
5801
|
this.cdr.detectChanges();
|
|
5799
5802
|
};
|
|
5800
5803
|
return InputFileComponent;
|
|
@@ -6349,6 +6352,131 @@
|
|
|
6349
6352
|
valuenow: [{ type: core.Input }]
|
|
6350
6353
|
};
|
|
6351
6354
|
|
|
6355
|
+
var MultiSelectComponent = /** @class */ (function (_super) {
|
|
6356
|
+
__extends(MultiSelectComponent, _super);
|
|
6357
|
+
function MultiSelectComponent(cdr) {
|
|
6358
|
+
var _this = _super.call(this, cdr) || this;
|
|
6359
|
+
_this.cdr = cdr;
|
|
6360
|
+
_this.options = [];
|
|
6361
|
+
_this.values = [];
|
|
6362
|
+
_this.valuesChange = new core.EventEmitter();
|
|
6363
|
+
_this.placeholder = '- seleziona opzioni -';
|
|
6364
|
+
_this.toggle = function () { return window['$'](_this.formControlElement.nativeElement).dropdown('toggle'); };
|
|
6365
|
+
_this.isExpanded = function () { return _this.formControlElement.nativeElement.getAttribute('aria-expanded') === 'true'; };
|
|
6366
|
+
_this.hasFormControlFocus = function () { return _this.formControlElement.nativeElement.matches(':focus'); };
|
|
6367
|
+
_this.hasDropdownMenuFocus = function () { return _this.dropdownMenu.nativeElement.matches(':focus-within'); };
|
|
6368
|
+
_this.isChecked = function (value) { return _this.values.some(function (v) { return v === value; }); };
|
|
6369
|
+
_this.getInputTextValue = function () { return _this.options.filter(function (opt) { return _this.isChecked(opt.value); }).map(function (opt) { return opt.label; }).join(', '); };
|
|
6370
|
+
_this.pushValue = function (value) { return _this.values = _this.options.filter(function (opt) { return opt.value === value || _this.isChecked(opt.value); }).map(function (opt) { return opt.value; }); };
|
|
6371
|
+
_this.isFocusOut = function () { return window['$'](_this.multiSelect.nativeElement).find(document.activeElement).length == 0; };
|
|
6372
|
+
_this.logPrefix = "[inail-multi-select]";
|
|
6373
|
+
_this.detach();
|
|
6374
|
+
return _this;
|
|
6375
|
+
}
|
|
6376
|
+
MultiSelectComponent.prototype.ngOnChanges = function (changes) {
|
|
6377
|
+
var _a, _b, _c;
|
|
6378
|
+
_super.prototype.ngOnChanges.call(this, changes);
|
|
6379
|
+
if ((((_a = changes === null || changes === void 0 ? void 0 : changes.options) === null || _a === void 0 ? void 0 : _a.currentValue) || ((_b = changes === null || changes === void 0 ? void 0 : changes.sort) === null || _b === void 0 ? void 0 : _b.currentValue)) && this.sort) {
|
|
6380
|
+
var direction_1 = "ASC" == this.sort.toUpperCase() ? 1 : "DESC" == this.sort.toUpperCase() ? -1 : 0;
|
|
6381
|
+
if (direction_1 != 0 && this.options != undefined) {
|
|
6382
|
+
this.options.sort(function (a, b) { return a.label < b.label ? -direction_1 : a.label > b.label ? direction_1 : 0; });
|
|
6383
|
+
}
|
|
6384
|
+
}
|
|
6385
|
+
if ((_c = changes === null || changes === void 0 ? void 0 : changes.options) === null || _c === void 0 ? void 0 : _c.currentValue) {
|
|
6386
|
+
this.inputTextValue = this.getInputTextValue();
|
|
6387
|
+
}
|
|
6388
|
+
this.cdr.detectChanges();
|
|
6389
|
+
};
|
|
6390
|
+
MultiSelectComponent.prototype.ngOnInit = function () {
|
|
6391
|
+
var _this = this;
|
|
6392
|
+
_super.prototype.ngOnInit.call(this);
|
|
6393
|
+
this.emitDebug("@ViewChild('formControl')");
|
|
6394
|
+
this.emitDebug(this.formControlElement);
|
|
6395
|
+
if (this.focus) {
|
|
6396
|
+
this.push(this.focus.subscribe(function (scroll) {
|
|
6397
|
+
_this.emitDebug("Catch focus!");
|
|
6398
|
+
setFocus(_this.formControlElement.nativeElement, scroll);
|
|
6399
|
+
}));
|
|
6400
|
+
}
|
|
6401
|
+
};
|
|
6402
|
+
MultiSelectComponent.prototype.ngAfterViewInit = function () {
|
|
6403
|
+
};
|
|
6404
|
+
MultiSelectComponent.prototype.ngOnDestroy = function () {
|
|
6405
|
+
_super.prototype.ngOnDestroy.call(this);
|
|
6406
|
+
};
|
|
6407
|
+
MultiSelectComponent.prototype.onKeypress = function ($event) {
|
|
6408
|
+
$event.preventDefault();
|
|
6409
|
+
};
|
|
6410
|
+
MultiSelectComponent.prototype.onFocusIn = function () {
|
|
6411
|
+
var _this = this;
|
|
6412
|
+
setTimeout(function () {
|
|
6413
|
+
_this.showDropdownMenu();
|
|
6414
|
+
}, 250);
|
|
6415
|
+
};
|
|
6416
|
+
MultiSelectComponent.prototype.onFocusOut = function () {
|
|
6417
|
+
var _this = this;
|
|
6418
|
+
setTimeout(function () {
|
|
6419
|
+
if (_this.isFocusOut()) {
|
|
6420
|
+
_this.closeDropdownMenu();
|
|
6421
|
+
}
|
|
6422
|
+
}, 150);
|
|
6423
|
+
};
|
|
6424
|
+
MultiSelectComponent.prototype.showDropdownMenu = function () {
|
|
6425
|
+
var _this = this;
|
|
6426
|
+
setTimeout(function () {
|
|
6427
|
+
if (!_this.isExpanded()) {
|
|
6428
|
+
_this.toggle();
|
|
6429
|
+
}
|
|
6430
|
+
});
|
|
6431
|
+
};
|
|
6432
|
+
MultiSelectComponent.prototype.closeDropdownMenu = function () {
|
|
6433
|
+
var _this = this;
|
|
6434
|
+
setTimeout(function () {
|
|
6435
|
+
if (_this.isExpanded()) {
|
|
6436
|
+
_this.toggle();
|
|
6437
|
+
}
|
|
6438
|
+
});
|
|
6439
|
+
};
|
|
6440
|
+
MultiSelectComponent.prototype.onCheck = function (cb) {
|
|
6441
|
+
if (!cb.firstChange) {
|
|
6442
|
+
if (cb.checked && !this.isChecked(cb.value)) {
|
|
6443
|
+
this.pushValue(cb.value);
|
|
6444
|
+
this.cleanError();
|
|
6445
|
+
}
|
|
6446
|
+
else if (!cb.checked && this.isChecked(cb.value)) {
|
|
6447
|
+
this.values = this.values.filter(function (value) { return value != cb.value; });
|
|
6448
|
+
this.cleanError();
|
|
6449
|
+
}
|
|
6450
|
+
this.valuesChange.emit(this.values);
|
|
6451
|
+
this.inputTextValue = this.getInputTextValue();
|
|
6452
|
+
this.cdr.detectChanges();
|
|
6453
|
+
}
|
|
6454
|
+
};
|
|
6455
|
+
return MultiSelectComponent;
|
|
6456
|
+
}(FormElementComponent));
|
|
6457
|
+
MultiSelectComponent.decorators = [
|
|
6458
|
+
{ type: core.Component, args: [{
|
|
6459
|
+
selector: 'inail-multi-select',
|
|
6460
|
+
template: "<div #multiSelect\n class=\"form-group {{getResponsiveClass()}} noPaddingLeft {{class}} inail-multi-select\"\n [ngClass]=\"{'has-error': isThereError()}\">\n <label *ngIf=\"label\"\n class=\"control-label {{labelClass}}\"\n [ngClass]=\"{'sr-only': hiddenLabel}\"\n [attr.title]=\"labelTitle\"\n [for]=\"id\"\n [innerHTML]=\"getLabel()\"></label>\n <span *ngIf=\"showPopover()\"\n [style.padding-left.px]=\"5\">\n <inail-popover [iconClass]=\"popoverButtonIcon\"\n [buttonTitle]=\"popoverButtonTitle\"\n [header]=\"popoverHeader\"\n [content]=\"popoverContent\">\n </inail-popover>\n </span>\n <div class=\"form-control-wrapper\"\n [ngClass]=\"{'no-label' : hiddenLabel || !label}\">\n <input #formControl\n type=\"text\"\n [id]=\"id\"\n class=\"form-control dropdown-toggle {{inputClass}}\"\n data-toggle=\"dropdown\"\n aria-haspopup=\"true\"\n aria-expanded=\"false\"\n [ngClass]=\"{'disabled': disabled}\"\n [attr.name]=\"name\"\n [attr.title]=\"title\"\n [disabled]=\"disabled\"\n [readonly]=\"true\"\n [attr.placeholder]=\"placeholder\"\n [attr.aria-required]=\"required === true ? true : undefined\"\n [attr.aria-invalid]=\"isThereError() === true ? true : undefined\"\n [attr.aria-describedBy]=\"getAriaDescribedBy()\"\n (blur)=\"onBlur()\"\n (focusin)=\"onFocusIn()\"\n (focusout)=\"onFocusOut()\"\n (keypress)=\"onKeypress($event)\"\n (keyup.enter)=\"enterUp.emit()\"\n [ngModel]=\"inputTextValue\">\n <div #dropdownMenu\n class=\"dropdown-menu\"\n (focusout)=\"onFocusOut()\"\n [attr.aria-labelledby]=\"id\">\n <ng-container *ngFor=\"let opt of options\">\n <div *ngIf=\"opt.beforeDivider\" class=\"divider\"></div>\n <div class=\"row\" [attr.tabIndex]=\"opt.disabled ? 0 : undefined\">\n <inail-checkbox [label]=\"opt.label\"\n [value]=\"opt.value\"\n [title]=\"opt.title\"\n [checked]=\"isChecked(opt.value)\"\n [disabled]=\"opt.disabled\"\n (stateChange)=\"onCheck($event)\">\n </inail-checkbox>\n </div>\n <div *ngIf=\"opt.afterDivider\" class=\"divider\"></div>\n </ng-container>\n </div>\n </div>\n <div *ngIf=\"showError()\" [id]=\"id+'-description'\">\n <div class=\"msg msg-errore\">\n <strong [innerHTML]=\"'ERRORE: '+this.error\"></strong>\n </div>\n <div *ngIf=\"description\" [innerHTML]=\"this.description\"></div>\n </div>\n <div *ngIf=\"description && !showError()\"\n [id]=\"id+'-description'\"\n [innerHTML]=\"this.description\">\n </div>\n</div>\n",
|
|
6461
|
+
changeDetection: CHANGE_DETECTION_STRATEGY,
|
|
6462
|
+
encapsulation: core.ViewEncapsulation.None,
|
|
6463
|
+
styles: [".inail-multi-select .form-control-wrapper:after{font-family:FontAwesome;content:\"\\f078\";right:31px;position:absolute;top:35px;font-size:10px;color:#0083f5}.inail-multi-select .form-control-wrapper.no-label:after{top:11px}.inail-multi-select .form-control[readonly]:not([disabled]){background-color:#fff}.inail-multi-select .form-control:not([disabled]){cursor:pointer}.inail-multi-select .dropdown-menu .form-group{margin:0!important;padding-left:20px!important}.inail-multi-select .dropdown-menu .form-group:hover{background-color:#eaedf2}.inail-multi-select .dropdown-menu .form-group .checkbox{margin:0!important}.inail-multi-select .dropdown-menu .form-group .checkbox label{margin-top:5px!important;margin-bottom:5px!important;display:block!important}"]
|
|
6464
|
+
},] }
|
|
6465
|
+
];
|
|
6466
|
+
MultiSelectComponent.ctorParameters = function () { return [
|
|
6467
|
+
{ type: core.ChangeDetectorRef }
|
|
6468
|
+
]; };
|
|
6469
|
+
MultiSelectComponent.propDecorators = {
|
|
6470
|
+
multiSelect: [{ type: core.ViewChild, args: ['multiSelect', { static: true },] }],
|
|
6471
|
+
formControlElement: [{ type: core.ViewChild, args: ['formControl', { static: true },] }],
|
|
6472
|
+
dropdownMenu: [{ type: core.ViewChild, args: ['dropdownMenu', { static: true },] }],
|
|
6473
|
+
options: [{ type: core.Input }],
|
|
6474
|
+
values: [{ type: core.Input }],
|
|
6475
|
+
valuesChange: [{ type: core.Output }],
|
|
6476
|
+
placeholder: [{ type: core.Input }],
|
|
6477
|
+
sort: [{ type: core.Input }]
|
|
6478
|
+
};
|
|
6479
|
+
|
|
6352
6480
|
var NgInailCommonModule = /** @class */ (function () {
|
|
6353
6481
|
function NgInailCommonModule() {
|
|
6354
6482
|
}
|
|
@@ -6403,7 +6531,8 @@
|
|
|
6403
6531
|
WizardComponent,
|
|
6404
6532
|
ContainerComponent,
|
|
6405
6533
|
TrCheckboxComponent,
|
|
6406
|
-
ProgressBarComponent
|
|
6534
|
+
ProgressBarComponent,
|
|
6535
|
+
MultiSelectComponent
|
|
6407
6536
|
],
|
|
6408
6537
|
imports: [
|
|
6409
6538
|
common.CommonModule,
|
|
@@ -6452,7 +6581,8 @@
|
|
|
6452
6581
|
WizardComponent,
|
|
6453
6582
|
ContainerComponent,
|
|
6454
6583
|
TrCheckboxComponent,
|
|
6455
|
-
ProgressBarComponent
|
|
6584
|
+
ProgressBarComponent,
|
|
6585
|
+
MultiSelectComponent
|
|
6456
6586
|
],
|
|
6457
6587
|
providers: [common.DatePipe]
|
|
6458
6588
|
},] }
|
|
@@ -6494,6 +6624,7 @@
|
|
|
6494
6624
|
exports.MenuIntranetComponent = MenuIntranetComponent;
|
|
6495
6625
|
exports.MenuItem = MenuItem;
|
|
6496
6626
|
exports.ModalComponent = ModalComponent;
|
|
6627
|
+
exports.MultiSelectComponent = MultiSelectComponent;
|
|
6497
6628
|
exports.NavigazioneInternaComponent = NavigazioneInternaComponent;
|
|
6498
6629
|
exports.NavigazionePrincipaleComponent = NavigazionePrincipaleComponent;
|
|
6499
6630
|
exports.NavigazioneSecondariaComponent = NavigazioneSecondariaComponent;
|