@esfaenza/forms-and-validations 11.2.75 → 11.2.78
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/esfaenza-forms-and-validations.umd.js +226 -48
- package/bundles/esfaenza-forms-and-validations.umd.js.map +1 -1
- package/esfaenza-forms-and-validations.d.ts +2 -1
- package/esfaenza-forms-and-validations.metadata.json +1 -1
- package/esm2015/esfaenza-forms-and-validations.js +3 -2
- package/esm2015/lib/forms/base-form-control.js +2 -2
- package/esm2015/lib/forms/form-autocomplete/form-autocomplete.component.js +18 -7
- package/esm2015/lib/forms/form-multiselect/form-multiselect.component.js +11 -4
- package/esm2015/lib/forms-and-validations.module.js +9 -1
- package/esm2015/lib/validations/base-validation.loc.js +2 -1
- package/esm2015/lib/validations/validation-autocomplete/validation-autocomplete.component.js +12 -34
- package/esm2015/lib/validations/validation-autocomplete-multi/validation-autocomplete-multi.component.js +175 -0
- package/fesm2015/esfaenza-forms-and-validations.js +216 -45
- package/fesm2015/esfaenza-forms-and-validations.js.map +1 -1
- package/lib/forms/form-autocomplete/form-autocomplete.component.d.ts +2 -0
- package/lib/forms/form-multiselect/form-multiselect.component.d.ts +3 -1
- package/lib/validations/validation-autocomplete/validation-autocomplete.component.d.ts +14 -42
- package/lib/validations/validation-autocomplete-multi/validation-autocomplete-multi.component.d.ts +78 -0
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/material/core'), require('@esfaenza/material-dayjs-adapter'), require('@angular/common'), require('@angular/forms'), require('@angular/material/datepicker'), require('@angular/material/autocomplete'), require('@angular/material/input'), require('@esfaenza/localizations'), require('@esfaenza/ngx-currency-mask'), require('angular2-multiselect-dropdown'), require('@angular-material-components/datetime-picker'), require('ngx-bootstrap/tooltip'), require('@esfaenza/extensions'), require('@esfaenza/access-control')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@esfaenza/forms-and-validations', ['exports', '@angular/core', '@angular/material/core', '@esfaenza/material-dayjs-adapter', '@angular/common', '@angular/forms', '@angular/material/datepicker', '@angular/material/autocomplete', '@angular/material/input', '@esfaenza/localizations', '@esfaenza/ngx-currency-mask', 'angular2-multiselect-dropdown', '@angular-material-components/datetime-picker', 'ngx-bootstrap/tooltip', '@esfaenza/extensions', '@esfaenza/access-control'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.esfaenza = global.esfaenza || {}, global.esfaenza['forms-and-validations'] = {}), global.ng.core, global.ng.material.core, global.materialDayjsAdapter, global.ng.common, global.ng.forms, global.ng.material.datepicker, global.ng.material.autocomplete, global.ng.material.input, global.localizations, global.ngxCurrencyMask, global.angular2MultiselectDropdown, global.datetimePicker, global.tooltip, global.extensions, global.accessControl));
|
|
5
|
-
}(this, (function (exports, core, core$1, materialDayjsAdapter, common, forms, datepicker, autocomplete, input, localizations, ngxCurrencyMask, angular2MultiselectDropdown, datetimePicker, tooltip, extensions, accessControl) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/material/core'), require('@esfaenza/material-dayjs-adapter'), require('@angular/common'), require('@angular/forms'), require('@angular/material/datepicker'), require('@angular/material/autocomplete'), require('@angular/material/input'), require('@angular/material/chips'), require('@angular/material/icon'), require('@angular/material/checkbox'), require('@esfaenza/localizations'), require('@esfaenza/ngx-currency-mask'), require('angular2-multiselect-dropdown'), require('@angular-material-components/datetime-picker'), require('ngx-bootstrap/tooltip'), require('@esfaenza/extensions'), require('@esfaenza/access-control')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@esfaenza/forms-and-validations', ['exports', '@angular/core', '@angular/material/core', '@esfaenza/material-dayjs-adapter', '@angular/common', '@angular/forms', '@angular/material/datepicker', '@angular/material/autocomplete', '@angular/material/input', '@angular/material/chips', '@angular/material/icon', '@angular/material/checkbox', '@esfaenza/localizations', '@esfaenza/ngx-currency-mask', 'angular2-multiselect-dropdown', '@angular-material-components/datetime-picker', 'ngx-bootstrap/tooltip', '@esfaenza/extensions', '@esfaenza/access-control'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.esfaenza = global.esfaenza || {}, global.esfaenza['forms-and-validations'] = {}), global.ng.core, global.ng.material.core, global.materialDayjsAdapter, global.ng.common, global.ng.forms, global.ng.material.datepicker, global.ng.material.autocomplete, global.ng.material.input, global.ng.material.chips, global.ng.material.icon, global.ng.material.checkbox, global.localizations, global.ngxCurrencyMask, global.angular2MultiselectDropdown, global.datetimePicker, global.tooltip, global.extensions, global.accessControl));
|
|
5
|
+
}(this, (function (exports, core, core$1, materialDayjsAdapter, common, forms, datepicker, autocomplete, input, chips, icon, checkbox, localizations, ngxCurrencyMask, angular2MultiselectDropdown, datetimePicker, tooltip, extensions, accessControl) { 'use strict';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Classe che identifica un file
|
|
@@ -749,6 +749,7 @@
|
|
|
749
749
|
var _this = _super.call(this, LOC_LOCALE !== null && LOC_LOCALE !== void 0 ? LOC_LOCALE : 'it-IT') || this;
|
|
750
750
|
_super.prototype.set.call(_this, "en->it", "Required Input", ["Input Richiesto"]);
|
|
751
751
|
_super.prototype.set.call(_this, "en->it", "Invalid Input Format", ["Formato Input Invalido"]);
|
|
752
|
+
_super.prototype.set.call(_this, "en->it", "Elements selected", ["Elementi selezionati"]);
|
|
752
753
|
return _this;
|
|
753
754
|
}
|
|
754
755
|
return BaseValidationLoc;
|
|
@@ -1589,53 +1590,37 @@
|
|
|
1589
1590
|
*/
|
|
1590
1591
|
var ValidationAutocompleteComponent = /** @class */ (function (_super) {
|
|
1591
1592
|
__extends(ValidationAutocompleteComponent, _super);
|
|
1592
|
-
/**
|
|
1593
|
-
* @ignore
|
|
1594
|
-
*/
|
|
1593
|
+
/** @ignore */
|
|
1595
1594
|
function ValidationAutocompleteComponent(_validators, _asyncValidators, injector, lc) {
|
|
1596
1595
|
var _this = _super.call(this) || this;
|
|
1597
1596
|
_this._validators = _validators;
|
|
1598
1597
|
_this._asyncValidators = _asyncValidators;
|
|
1599
1598
|
_this.injector = injector;
|
|
1600
1599
|
_this.lc = lc;
|
|
1601
|
-
/**
|
|
1602
|
-
* Sorgente da cui scegliere valori filtrata in base a quello che ha scritto l'utente
|
|
1603
|
-
*/
|
|
1600
|
+
/** Sorgente da cui scegliere valori filtrata in base a quello che ha scritto l'utente */
|
|
1604
1601
|
_this.FilteredSource = [];
|
|
1605
|
-
/**
|
|
1606
|
-
* Contenuto della label Floattante Material-Style
|
|
1607
|
-
*/
|
|
1602
|
+
/** Contenuto della label Floattante Material-Style */
|
|
1608
1603
|
_this.label = "";
|
|
1609
|
-
/**
|
|
1610
|
-
* Evento che indica l'opzione selezionata dal componente. Il valore finale della selezione dovrà essere questo
|
|
1611
|
-
*/
|
|
1604
|
+
/** Evento che indica l'opzione selezionata dal componente. Il valore finale della selezione dovrà essere questo */
|
|
1612
1605
|
_this.optionChange = new core.EventEmitter();
|
|
1613
|
-
/**
|
|
1614
|
-
* @ignore
|
|
1615
|
-
*/
|
|
1606
|
+
/** @ignore */
|
|
1616
1607
|
_this.onTouched = function () { }; //placeholder on touched function
|
|
1617
1608
|
return _this;
|
|
1618
1609
|
}
|
|
1619
|
-
/**
|
|
1620
|
-
* @ignore
|
|
1621
|
-
*/
|
|
1610
|
+
/** @ignore */
|
|
1622
1611
|
ValidationAutocompleteComponent.prototype.ngOnInit = function () {
|
|
1623
1612
|
this.registerFocusRequest();
|
|
1624
1613
|
//controllo se è settato un required per decidere in maniera condizionale se utilizzare il validatore required nel componente interno
|
|
1625
1614
|
if (this._validators && !this.noValidate && this._validators.some(function (elem) { return elem instanceof forms.RequiredValidator; }))
|
|
1626
1615
|
this.required = true;
|
|
1627
1616
|
};
|
|
1628
|
-
/**
|
|
1629
|
-
* @ignore
|
|
1630
|
-
*/
|
|
1617
|
+
/** @ignore */
|
|
1631
1618
|
ValidationAutocompleteComponent.prototype.ngOnDestroy = function () {
|
|
1632
1619
|
this.deregisterFocusRequest();
|
|
1633
1620
|
if (this.tooltipSubscription)
|
|
1634
1621
|
this.tooltipSubscription.unsubscribe();
|
|
1635
1622
|
};
|
|
1636
|
-
/**
|
|
1637
|
-
* @ignore
|
|
1638
|
-
*/
|
|
1623
|
+
/** @ignore */
|
|
1639
1624
|
ValidationAutocompleteComponent.prototype.ngAfterViewInit = function () {
|
|
1640
1625
|
this.postBinding();
|
|
1641
1626
|
};
|
|
@@ -1667,9 +1652,7 @@
|
|
|
1667
1652
|
};
|
|
1668
1653
|
}
|
|
1669
1654
|
};
|
|
1670
|
-
/**
|
|
1671
|
-
* @ignore
|
|
1672
|
-
*/
|
|
1655
|
+
/** @ignore */
|
|
1673
1656
|
ValidationAutocompleteComponent.prototype.writeValue = function (value) {
|
|
1674
1657
|
var val = value && this.FilteredSource ? this.FilteredSource.find(function (t) { return t.id == value; }) : null;
|
|
1675
1658
|
if (val)
|
|
@@ -1687,15 +1670,11 @@
|
|
|
1687
1670
|
this.inputChange.emit(toEmit);
|
|
1688
1671
|
this.onTouched();
|
|
1689
1672
|
};
|
|
1690
|
-
/**
|
|
1691
|
-
* @ignore
|
|
1692
|
-
*/
|
|
1673
|
+
/** @ignore */
|
|
1693
1674
|
ValidationAutocompleteComponent.prototype.registerOnChange = function (fn) {
|
|
1694
1675
|
this.propagateChange = fn;
|
|
1695
1676
|
};
|
|
1696
|
-
/**
|
|
1697
|
-
* @ignore
|
|
1698
|
-
*/
|
|
1677
|
+
/** @ignore */
|
|
1699
1678
|
ValidationAutocompleteComponent.prototype.registerOnTouched = function (fn) {
|
|
1700
1679
|
this.onTouched = fn;
|
|
1701
1680
|
};
|
|
@@ -1731,6 +1710,182 @@
|
|
|
1731
1710
|
optionChange: [{ type: core.Output }]
|
|
1732
1711
|
};
|
|
1733
1712
|
|
|
1713
|
+
/**
|
|
1714
|
+
* Componente di validaizone per gli input di Autocompletamento
|
|
1715
|
+
*/
|
|
1716
|
+
var ValidationAutocompleteMultiComponent = /** @class */ (function (_super) {
|
|
1717
|
+
__extends(ValidationAutocompleteMultiComponent, _super);
|
|
1718
|
+
/** @ignore */
|
|
1719
|
+
function ValidationAutocompleteMultiComponent(_validators, _asyncValidators, injector, lc) {
|
|
1720
|
+
var _this = _super.call(this) || this;
|
|
1721
|
+
_this._validators = _validators;
|
|
1722
|
+
_this._asyncValidators = _asyncValidators;
|
|
1723
|
+
_this.injector = injector;
|
|
1724
|
+
_this.lc = lc;
|
|
1725
|
+
_this.displayFn = function () { return ''; };
|
|
1726
|
+
/** Numero massimo di chip visualizzate */
|
|
1727
|
+
_this.ChipThreshold = 3;
|
|
1728
|
+
/** Sorgente da cui scegliere valori filtrata in base a quello che ha scritto l'utente */
|
|
1729
|
+
_this.FilteredSource = [];
|
|
1730
|
+
/** Contenuto della label Floattante Material-Style */
|
|
1731
|
+
_this.label = "";
|
|
1732
|
+
/** Evento che indica l'opzione selezionata dal componente. Il valore finale della selezione dovrà essere questo */
|
|
1733
|
+
_this.optionChange = new core.EventEmitter();
|
|
1734
|
+
/** Elementi selezionati */
|
|
1735
|
+
_this.selectData = [];
|
|
1736
|
+
/** @ignore */
|
|
1737
|
+
_this.onTouched = function () { }; //placeholder on touched function
|
|
1738
|
+
return _this;
|
|
1739
|
+
}
|
|
1740
|
+
/** @ignore */
|
|
1741
|
+
ValidationAutocompleteMultiComponent.prototype.ngOnInit = function () {
|
|
1742
|
+
this.registerFocusRequest();
|
|
1743
|
+
//controllo se è settato un required per decidere in maniera condizionale se utilizzare il validatore required nel componente interno
|
|
1744
|
+
if (this._validators && !this.noValidate && this._validators.some(function (elem) { return elem instanceof forms.RequiredValidator; }))
|
|
1745
|
+
this.required = true;
|
|
1746
|
+
};
|
|
1747
|
+
/** @ignore */
|
|
1748
|
+
ValidationAutocompleteMultiComponent.prototype.ngOnDestroy = function () {
|
|
1749
|
+
this.deregisterFocusRequest();
|
|
1750
|
+
if (this.tooltipSubscription)
|
|
1751
|
+
this.tooltipSubscription.unsubscribe();
|
|
1752
|
+
};
|
|
1753
|
+
/** @ignore */
|
|
1754
|
+
ValidationAutocompleteMultiComponent.prototype.ngAfterViewInit = function () {
|
|
1755
|
+
this.postBinding();
|
|
1756
|
+
};
|
|
1757
|
+
/** In caso arrivi una nuova sorgente devo reimpostare lo stato di selezione con quello attuale */
|
|
1758
|
+
ValidationAutocompleteMultiComponent.prototype.ngOnChanges = function (changes) {
|
|
1759
|
+
var newSource = changes["FilteredSource"];
|
|
1760
|
+
if (!newSource || newSource.firstChange)
|
|
1761
|
+
return;
|
|
1762
|
+
var _loop_1 = function (i) {
|
|
1763
|
+
var item = this_1.FilteredSource[i];
|
|
1764
|
+
item.selected = this_1.selectData.find(function (t) { return t.id == item.id; });
|
|
1765
|
+
};
|
|
1766
|
+
var this_1 = this;
|
|
1767
|
+
for (var i = 0; i < this.FilteredSource.length; i++) {
|
|
1768
|
+
_loop_1(i);
|
|
1769
|
+
}
|
|
1770
|
+
};
|
|
1771
|
+
/**
|
|
1772
|
+
* Metodo che si occupa di collegare i validatori e la funzione di reset dal **ControlValueAccessor** rappresentato
|
|
1773
|
+
* da questo componente al **ControlValueAccessor** rappresentato dall'effettivo elemento di Input presente lato HTML
|
|
1774
|
+
*/
|
|
1775
|
+
ValidationAutocompleteMultiComponent.prototype.postBinding = function () {
|
|
1776
|
+
var _this = this;
|
|
1777
|
+
this.CheckValidity();
|
|
1778
|
+
var ngControl = this.injector.get(forms.NgControl, null);
|
|
1779
|
+
if (ngControl) {
|
|
1780
|
+
this.parentControl = ngControl.control;
|
|
1781
|
+
//se la variabile novalidate è true, elimino tutti i validatori eventualmente inseriti
|
|
1782
|
+
if (this.noValidate) {
|
|
1783
|
+
this.parentControl.clearValidators();
|
|
1784
|
+
this.parentControl.clearAsyncValidators();
|
|
1785
|
+
}
|
|
1786
|
+
else {
|
|
1787
|
+
this.baseInput.control.setAsyncValidators(this._asyncValidators);
|
|
1788
|
+
this.baseInput.control.setValidators(this._validators);
|
|
1789
|
+
}
|
|
1790
|
+
//faccio in modo che se chiamo il reset del controllo (o della form) dall'esterno si resetti anche il controllo nativo
|
|
1791
|
+
var origFunc_1 = this.parentControl.reset;
|
|
1792
|
+
this.parentControl.reset = function () {
|
|
1793
|
+
origFunc_1.apply(_this.parentControl);
|
|
1794
|
+
_this.baseInput.control.reset();
|
|
1795
|
+
_this.tooltip.hide();
|
|
1796
|
+
};
|
|
1797
|
+
}
|
|
1798
|
+
};
|
|
1799
|
+
/** @ignore */
|
|
1800
|
+
ValidationAutocompleteMultiComponent.prototype.writeValue = function (value, finalValue) {
|
|
1801
|
+
if (finalValue === void 0) { finalValue = false; }
|
|
1802
|
+
var val = value && this.FilteredSource ? this.FilteredSource.find(function (t) { return t.id == value; }) : null;
|
|
1803
|
+
if (finalValue)
|
|
1804
|
+
this.optionChange.emit(value);
|
|
1805
|
+
this.propagateChange(val ? val.id : value);
|
|
1806
|
+
this.value = val ? val.description : value;
|
|
1807
|
+
};
|
|
1808
|
+
/**
|
|
1809
|
+
* L'emit della modifica al valore viene gestito su un evento custom (**inputChange**) come workaround al malfunzionamento dell'**ngModelChange** nativo
|
|
1810
|
+
*
|
|
1811
|
+
* @param {any} toEmit valore da propagare all'esterno
|
|
1812
|
+
*/
|
|
1813
|
+
ValidationAutocompleteMultiComponent.prototype.onModelChange = function (toEmit, finalValue) {
|
|
1814
|
+
if (finalValue === void 0) { finalValue = false; }
|
|
1815
|
+
this.writeValue(toEmit, finalValue);
|
|
1816
|
+
if (!finalValue)
|
|
1817
|
+
this.inputChange.emit(toEmit);
|
|
1818
|
+
this.onTouched();
|
|
1819
|
+
};
|
|
1820
|
+
/** @ignore */
|
|
1821
|
+
ValidationAutocompleteMultiComponent.prototype.registerOnChange = function (fn) {
|
|
1822
|
+
this.propagateChange = fn;
|
|
1823
|
+
};
|
|
1824
|
+
/** @ignore */
|
|
1825
|
+
ValidationAutocompleteMultiComponent.prototype.registerOnTouched = function (fn) {
|
|
1826
|
+
this.onTouched = fn;
|
|
1827
|
+
};
|
|
1828
|
+
/** Rimuove un elemento selezionato */
|
|
1829
|
+
ValidationAutocompleteMultiComponent.prototype.removeChip = function (data) {
|
|
1830
|
+
if (!data) {
|
|
1831
|
+
this.selectData = [];
|
|
1832
|
+
this.FilteredSource.forEach(function (data) { return data.selected = false; });
|
|
1833
|
+
this.onModelChange(this.selectData.map(function (t) { return t.id; }).join(','), true);
|
|
1834
|
+
this.onFinalize();
|
|
1835
|
+
}
|
|
1836
|
+
else
|
|
1837
|
+
this.toggleSelection(data);
|
|
1838
|
+
};
|
|
1839
|
+
;
|
|
1840
|
+
/** Seleziona o deseleziona un oggetto */
|
|
1841
|
+
ValidationAutocompleteMultiComponent.prototype.toggleSelection = function (data) {
|
|
1842
|
+
data.selected = !data.selected;
|
|
1843
|
+
if (data.selected === true) {
|
|
1844
|
+
this.selectData.push(data);
|
|
1845
|
+
}
|
|
1846
|
+
else {
|
|
1847
|
+
var i = this.selectData.findIndex(function (value) { return value.id === data.id; });
|
|
1848
|
+
this.selectData.splice(i, 1);
|
|
1849
|
+
}
|
|
1850
|
+
this.value = null;
|
|
1851
|
+
this.onModelChange(this.selectData.map(function (t) { return t.id; }).join(','), true);
|
|
1852
|
+
this.onFinalize();
|
|
1853
|
+
};
|
|
1854
|
+
;
|
|
1855
|
+
return ValidationAutocompleteMultiComponent;
|
|
1856
|
+
}(BaseValidation));
|
|
1857
|
+
ValidationAutocompleteMultiComponent.decorators = [
|
|
1858
|
+
{ type: core.Component, args: [{
|
|
1859
|
+
selector: "val-autocomplete-multi",
|
|
1860
|
+
template: "<mat-form-field appearance=\"{{FieldAppearence}}\" class=\"mat-full-width mat-no-border-top\" [style.width.px]=\"widthPx\">\r\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\r\n <mat-chip-list #chipList>\r\n <ng-container *ngIf=\"selectData.length < ChipThreshold\" >\r\n <mat-chip *ngFor=\"let select of selectData\" class=\"cardinal-colors\" (click)=\"!(readonly || disabled) && removeChip(select)\">\r\n {{ select.description }}\r\n <mat-icon class=\"mat-chip-remove\">cancel</mat-icon>\r\n </mat-chip>\r\n </ng-container>\r\n\r\n <mat-chip *ngIf=\"selectData.length >= ChipThreshold\" class=\"cardinal-colors\" (click)=\"!(readonly || disabled) && removeChip(null)\">\r\n {{ selectData.length }} {{ 'Elements selected' | localize: lc }}\r\n <mat-icon class=\"mat-chip-remove\">cancel</mat-icon>\r\n </mat-chip>\r\n \r\n <input matInput\r\n [matChipInputFor]=\"chipList\"\r\n #htmlInput\r\n #baseInput='ngModel'\r\n type=\"text\"\r\n triggers=\"\"\r\n placement=\"top\"\r\n [placeholder]=\"placeholder\"\r\n [matAutocomplete]=\"auto\"\r\n name=\"val-input\"\r\n id=\"{{id}}\"\r\n [(ngModel)]=\"value\"\r\n [tooltip]=\"tolTemplate\"\r\n [disabled]=\"readonly || disabled\"\r\n (ngModelChange)=\"onModelChange($event)\"\r\n (click)=\"onFocus($event)\"\r\n (focus)=\"checkTooltip();\"\r\n (blur)=\"closeTooltip();\">\r\n </mat-chip-list>\r\n\r\n <mat-autocomplete #auto=\"matAutocomplete\" [displayWith]=\"displayFn\">\r\n <mat-option *ngFor=\"let data of FilteredSource\">\r\n <div (click)=\"toggleSelection(data); $event.stopPropagation()\">\r\n <mat-checkbox [checked]=\"data.selected\" (change)=\"toggleSelection(data);\" (click)=\"$event.stopPropagation()\">\r\n {{ data.description }}\r\n </mat-checkbox>\r\n </div>\r\n </mat-option>\r\n </mat-autocomplete>\r\n</mat-form-field>\r\n\r\n<ng-template #tolTemplate>\r\n <div (click)=\"closeTooltip()\">\r\n <span>{{validationFailed}}</span>\r\n </div>\r\n</ng-template>",
|
|
1861
|
+
changeDetection: core.ChangeDetectionStrategy.OnPush,
|
|
1862
|
+
providers: [
|
|
1863
|
+
{ provide: localizations.LocalizationService, useClass: BaseValidationLoc },
|
|
1864
|
+
{
|
|
1865
|
+
provide: forms.NG_VALUE_ACCESSOR,
|
|
1866
|
+
useExisting: core.forwardRef(function () { return ValidationAutocompleteMultiComponent; }),
|
|
1867
|
+
multi: true
|
|
1868
|
+
}
|
|
1869
|
+
],
|
|
1870
|
+
encapsulation: core.ViewEncapsulation.None,
|
|
1871
|
+
styles: [".tooltip-inner{background-color:#842a30;font-size:12px;width:-webkit-max-content;width:-moz-max-content;width:max-content}.tooltip{margin:auto auto auto 20%!important}.tooltip-inner{background-color:#842a30!important;color:#fff}.tooltip.top .tooltip-arrow,.tooltip.top .tooltip-arrow:before{border-top-color:#842a30}.close-button{position:absolute;right:0;top:-.2em;float:right;font-size:16px;font-weight:700;color:inherit;text-shadow:0 1px 0 #fff;opacity:.5}.close-button:focus,.close-button:hover{text-decoration:none;cursor:pointer;opacity:.75}"]
|
|
1872
|
+
},] }
|
|
1873
|
+
];
|
|
1874
|
+
ValidationAutocompleteMultiComponent.ctorParameters = function () { return [
|
|
1875
|
+
{ type: Array, decorators: [{ type: core.Optional }, { type: core.Inject, args: [forms.NG_VALIDATORS,] }] },
|
|
1876
|
+
{ type: Array, decorators: [{ type: core.Optional }, { type: core.Inject, args: [forms.NG_ASYNC_VALIDATORS,] }] },
|
|
1877
|
+
{ type: core.Injector },
|
|
1878
|
+
{ type: localizations.LocalizationService }
|
|
1879
|
+
]; };
|
|
1880
|
+
ValidationAutocompleteMultiComponent.propDecorators = {
|
|
1881
|
+
ChipThreshold: [{ type: core.Input }],
|
|
1882
|
+
FilteredSource: [{ type: core.Input }],
|
|
1883
|
+
value: [{ type: core.Input }],
|
|
1884
|
+
label: [{ type: core.Input }],
|
|
1885
|
+
optionChange: [{ type: core.Output }],
|
|
1886
|
+
autoTrigger: [{ type: core.ViewChild, args: [autocomplete.MatAutocompleteTrigger,] }]
|
|
1887
|
+
};
|
|
1888
|
+
|
|
1734
1889
|
// Angular
|
|
1735
1890
|
/** Componente base da cui tutti i componenti Form implementano */
|
|
1736
1891
|
var BaseFormControl = /** @class */ (function () {
|
|
@@ -2030,7 +2185,7 @@
|
|
|
2030
2185
|
* un altro con lo stesso "name" ma magari resettato, Angular lo re-idraterebbe con i valori precedenti nonostante il modello fosse vuoto
|
|
2031
2186
|
*/
|
|
2032
2187
|
BaseFormControl.prototype.ngOnDestroy = function () {
|
|
2033
|
-
if (this.
|
|
2188
|
+
if (this.Form && this.validationControl && !!this.Form.getControl(this.validationControl))
|
|
2034
2189
|
this.Form.removeControl(this.validationControl);
|
|
2035
2190
|
};
|
|
2036
2191
|
/** Elabora i validatori iniettati e capisce se il valore è obbligatorio o meno */
|
|
@@ -3172,6 +3327,8 @@
|
|
|
3172
3327
|
_this.SelectLabel = "";
|
|
3173
3328
|
/** Permette al componente di gestire come modello non una lista di chiavi, ma una lista di KeyValue */
|
|
3174
3329
|
_this.UseKeyValues = false;
|
|
3330
|
+
/** Indica al componente di emettere una lista di chiavi separate da virgola piuttosto che una lista vera e propria di chiavi/KeyValue */
|
|
3331
|
+
_this.UseCommaSeparatedList = false;
|
|
3175
3332
|
/** Impostazioni del componente interno **angular2-multiselect** */
|
|
3176
3333
|
_this.Settings = null;
|
|
3177
3334
|
// Default dei settings per evitare che siano mai nulli, altrimenti il cazzo di CuppaLab salta in araia che è veramente una bellezza
|
|
@@ -3230,6 +3387,8 @@
|
|
|
3230
3387
|
var _this = this;
|
|
3231
3388
|
this.TmpModel = obj;
|
|
3232
3389
|
var toPass = [];
|
|
3390
|
+
if (this.UseCommaSeparatedList && obj && !obj.length)
|
|
3391
|
+
obj = obj.split(',');
|
|
3233
3392
|
//Qui arrivano solo gli id, o {id: x, description: y} in caso sono in UseKeyValues,
|
|
3234
3393
|
//devo tirare fuori gli oggetti relativi e piazzarli come lista per il Model
|
|
3235
3394
|
if (obj && obj.length > 0) {
|
|
@@ -3247,10 +3406,12 @@
|
|
|
3247
3406
|
/** @ignore Override per gestire input in uscita */
|
|
3248
3407
|
FormMultiSelectComponent.prototype.changed = function () {
|
|
3249
3408
|
var toEmit = null;
|
|
3250
|
-
if (!this.UseKeyValues)
|
|
3409
|
+
if (!this.UseKeyValues && !this.UseCommaSeparatedList)
|
|
3251
3410
|
toEmit = this.Model.map(function (m) { return m.id; });
|
|
3252
|
-
else
|
|
3411
|
+
else if (this.UseKeyValues)
|
|
3253
3412
|
toEmit = this.Model.map(function (m) { return ({ id: m.id, description: m.itemName }); });
|
|
3413
|
+
else if (this.UseCommaSeparatedList)
|
|
3414
|
+
toEmit = this.Model.map(function (m) { return m.id; }).join(',');
|
|
3254
3415
|
_super.prototype.changed.call(this, toEmit);
|
|
3255
3416
|
_super.prototype.finalized.call(this);
|
|
3256
3417
|
};
|
|
@@ -3278,7 +3439,8 @@
|
|
|
3278
3439
|
]; };
|
|
3279
3440
|
FormMultiSelectComponent.propDecorators = {
|
|
3280
3441
|
SelectLabel: [{ type: core.Input }],
|
|
3281
|
-
UseKeyValues: [{ type: core.Input }]
|
|
3442
|
+
UseKeyValues: [{ type: core.Input }],
|
|
3443
|
+
UseCommaSeparatedList: [{ type: core.Input }]
|
|
3282
3444
|
};
|
|
3283
3445
|
|
|
3284
3446
|
/** Componente che presenta una casella di testo tipicamente utilizzata per scrivere delle note o del log breve */
|
|
@@ -3354,6 +3516,8 @@
|
|
|
3354
3516
|
_this.RequiredPlaceholder = null;
|
|
3355
3517
|
/** Indica se i controlli devono essere effettuati tenendo conto del Case o meno. Vale solo qualora la **Source** fosse fornita */
|
|
3356
3518
|
_this.CaseSensitive = false;
|
|
3519
|
+
/** Indica se usare la modalità multiselezione o no */
|
|
3520
|
+
_this.Multi = false;
|
|
3357
3521
|
/**
|
|
3358
3522
|
* Indica se ignorare il prossimo evento writeValue che normalmente dovrebbe richiedere la nuova source. Serve per quando l'utente seleziona un elemento:
|
|
3359
3523
|
* Subito dopo partirebbe un altro evento modelChange che ricaricherebbe nuovamente la source
|
|
@@ -3380,7 +3544,8 @@
|
|
|
3380
3544
|
});
|
|
3381
3545
|
return;
|
|
3382
3546
|
}
|
|
3383
|
-
this.
|
|
3547
|
+
if (!this.Multi)
|
|
3548
|
+
this.finalizeValue(value);
|
|
3384
3549
|
};
|
|
3385
3550
|
/**
|
|
3386
3551
|
* Dato un valore verifica se può restituire le informazioni trovate in **Source** con id uguale a **value** o se deve restituire il valore in se
|
|
@@ -3405,7 +3570,10 @@
|
|
|
3405
3570
|
if (t && t.length > 0) {
|
|
3406
3571
|
_this.Source = t;
|
|
3407
3572
|
_this.tryBindSourceDisplay();
|
|
3408
|
-
|
|
3573
|
+
if (!_this.Multi)
|
|
3574
|
+
setTimeout(function () { _this.finalizeValue(_this.Model); });
|
|
3575
|
+
else
|
|
3576
|
+
_this.cdr.markForCheck();
|
|
3409
3577
|
}
|
|
3410
3578
|
});
|
|
3411
3579
|
};
|
|
@@ -3421,7 +3589,8 @@
|
|
|
3421
3589
|
return;
|
|
3422
3590
|
}
|
|
3423
3591
|
// Quando filtro la source, se non devo ignorare l'evento devo comunque assicurarmi di impostare il valore selezionato a null
|
|
3424
|
-
|
|
3592
|
+
if (!this.Multi)
|
|
3593
|
+
_super.prototype.changed.call(this, null);
|
|
3425
3594
|
if (!event && this.MinChars == 0 && !this.SearchFunction) {
|
|
3426
3595
|
this.FilteredBoundSource = this.BoundSource;
|
|
3427
3596
|
return;
|
|
@@ -3479,7 +3648,10 @@
|
|
|
3479
3648
|
FormAutocompleteComponent.prototype.changed = function (forcedValue, markForCheck) {
|
|
3480
3649
|
if (forcedValue === void 0) { forcedValue = null; }
|
|
3481
3650
|
if (markForCheck === void 0) { markForCheck = false; }
|
|
3482
|
-
this.
|
|
3651
|
+
if (!this.Multi)
|
|
3652
|
+
this.ignoreNextWriteValue = true;
|
|
3653
|
+
if (forcedValue == "" && this.Multi)
|
|
3654
|
+
this.Model = "";
|
|
3483
3655
|
_super.prototype.changed.call(this, forcedValue, markForCheck);
|
|
3484
3656
|
};
|
|
3485
3657
|
/** @ignore */
|
|
@@ -3498,7 +3670,7 @@
|
|
|
3498
3670
|
FormAutocompleteComponent.decorators = [
|
|
3499
3671
|
{ type: core.Component, args: [{
|
|
3500
3672
|
selector: "form-autocomplete",
|
|
3501
|
-
template: "<ng-container *ngIf=\"!FormLayout\">\r\n <ng-container *ngIf=\"DisplayMode && !DisplayModeTemplate\">{{ EvaluatedModel }}</ng-container>\r\n <ng-container *ngIf=\"DisplayMode && DisplayModeTemplate\"><ng-container *ngTemplateOutlet=\"DisplayModeTemplate, context: { $implicit: EvaluatedModel }\"></ng-container></ng-container>\r\n <div [hidden]=\"DisplayMode\"><ng-container *ngTemplateOutlet=\"controlTemplate\"></ng-container></div>\r\n</ng-container>\r\n\r\n<div *ngIf=\"FormLayout\" class=\"form-group row {{FormGroupClass}}\" [class.app-margin-bottom-0]=\"Last\">\r\n <label class=\"col-md-{{LabelColWidth}}\" [class.app-bold]=\"DisplayMode\" [class.m-t-5]=\"!DisplayMode\">{{Label}}{{Required && !DisplayMode ? '*' : ''}}:</label>\r\n <div class=\"col-md-{{InputColWidth}}\">\r\n <ng-container *ngIf=\"DisplayMode && !DisplayModeTemplate\">{{ EvaluatedModel }}</ng-container>\r\n <ng-container *ngIf=\"DisplayMode && DisplayModeTemplate\"><ng-container *ngTemplateOutlet=\"DisplayModeTemplate, context: { $implicit: EvaluatedModel }\"></ng-container></ng-container>\r\n <div [hidden]=\"DisplayMode\"><ng-container *ngTemplateOutlet=\"controlTemplate\"></ng-container></div>\r\n </div>\r\n <div class=\"clearfix\"></div>\r\n</div>\r\n\r\n<ng-template #controlTemplate>\r\n <val-autocomplete [FocusSubject]=\"FocusSubject\" [FieldAppearence]=\"FieldAppearence\" [noValidate]=\"!Validation\"\r\n [submitted]=\"Form?.submitted\"\r\n [forceInvalid]=\"ForcedError\"\r\n [readonly]=\"Readonly\"\r\n [label]=\"SelectLabel\"\r\n type=\"text\"\r\n [ngModel]=\"Model\"\r\n (ngModelChange)=\"Model = $event; evaluateIdResearch()\"\r\n [id]=\"GeneratedName\"\r\n name=\"{{GeneratedName}}\"\r\n #validationControl=\"ngModel\"\r\n (inputChange)=\"filterSource($event);\"\r\n (inputFocus)=\"focused($event);\"\r\n (inputFinalized)=\"finalized()\"\r\n (optionChange)=\"changed($event);\"\r\n [placeholder]=\"Required ? ((RequiredPlaceholder != null ? RequiredPlaceholder : ('Select' | localize : lc) + '...')) : Placeholder\"\r\n [validationFailed]=\"FailedValidationMessage\"\r\n [FilteredSource]=\"FilteredBoundSource\"\r\n >\r\n </val-autocomplete>\r\n</ng-template>",
|
|
3673
|
+
template: "<ng-container *ngIf=\"!FormLayout\">\r\n <ng-container *ngIf=\"DisplayMode && !DisplayModeTemplate\">{{ EvaluatedModel }}</ng-container>\r\n <ng-container *ngIf=\"DisplayMode && DisplayModeTemplate\"><ng-container *ngTemplateOutlet=\"DisplayModeTemplate, context: { $implicit: EvaluatedModel }\"></ng-container></ng-container>\r\n <div [hidden]=\"DisplayMode\"><ng-container *ngTemplateOutlet=\"controlTemplate\"></ng-container></div>\r\n</ng-container>\r\n\r\n<div *ngIf=\"FormLayout\" class=\"form-group row {{FormGroupClass}}\" [class.app-margin-bottom-0]=\"Last\">\r\n <label class=\"col-md-{{LabelColWidth}}\" [class.app-bold]=\"DisplayMode\" [class.m-t-5]=\"!DisplayMode\">{{Label}}{{Required && !DisplayMode ? '*' : ''}}:</label>\r\n <div class=\"col-md-{{InputColWidth}}\">\r\n <ng-container *ngIf=\"DisplayMode && !DisplayModeTemplate\">{{ EvaluatedModel }}</ng-container>\r\n <ng-container *ngIf=\"DisplayMode && DisplayModeTemplate\"><ng-container *ngTemplateOutlet=\"DisplayModeTemplate, context: { $implicit: EvaluatedModel }\"></ng-container></ng-container>\r\n <div [hidden]=\"DisplayMode\"><ng-container *ngTemplateOutlet=\"controlTemplate\"></ng-container></div>\r\n </div>\r\n <div class=\"clearfix\"></div>\r\n</div>\r\n\r\n<ng-template #controlTemplate>\r\n <val-autocomplete *ngIf=\"!Multi\" [FocusSubject]=\"FocusSubject\" [FieldAppearence]=\"FieldAppearence\" [noValidate]=\"!Validation\"\r\n [submitted]=\"Form?.submitted\"\r\n [forceInvalid]=\"ForcedError\"\r\n [readonly]=\"Readonly\"\r\n [label]=\"SelectLabel\"\r\n type=\"text\"\r\n [ngModel]=\"Model\"\r\n (ngModelChange)=\"Model = $event; evaluateIdResearch()\"\r\n [id]=\"GeneratedName\"\r\n name=\"{{GeneratedName}}\"\r\n #validationControl=\"ngModel\"\r\n (inputChange)=\"filterSource($event);\"\r\n (inputFocus)=\"focused($event);\"\r\n (inputFinalized)=\"finalized()\"\r\n (optionChange)=\"changed($event);\"\r\n [placeholder]=\"Required ? ((RequiredPlaceholder != null ? RequiredPlaceholder : ('Select' | localize : lc) + '...')) : Placeholder\"\r\n [validationFailed]=\"FailedValidationMessage\"\r\n [FilteredSource]=\"FilteredBoundSource\">\r\n </val-autocomplete>\r\n\r\n <val-autocomplete-multi *ngIf=\"Multi\" [FocusSubject]=\"FocusSubject\" [FieldAppearence]=\"FieldAppearence\" [noValidate]=\"!Validation\"\r\n [submitted]=\"Form?.submitted\"\r\n [forceInvalid]=\"ForcedError\"\r\n [readonly]=\"Readonly\"\r\n [label]=\"SelectLabel\"\r\n type=\"text\"\r\n [ngModel]=\"Model\"\r\n (ngModelChange)=\"Model = $event; evaluateIdResearch()\"\r\n [id]=\"GeneratedName\"\r\n name=\"{{GeneratedName}}\"\r\n #validationControl=\"ngModel\"\r\n (inputChange)=\"filterSource($event);\"\r\n (inputFocus)=\"focused($event);\"\r\n (inputFinalized)=\"finalized()\"\r\n (optionChange)=\"changed($event);\"\r\n [placeholder]=\"Required ? ((RequiredPlaceholder != null ? RequiredPlaceholder : ('Select' | localize : lc) + '...')) : Placeholder\"\r\n [validationFailed]=\"FailedValidationMessage\"\r\n [FilteredSource]=\"FilteredBoundSource\">\r\n\r\n </val-autocomplete-multi>\r\n</ng-template>",
|
|
3502
3674
|
providers: [{ provide: localizations.LocalizationService, useClass: FormAutocompleteComponentLoc }],
|
|
3503
3675
|
changeDetection: core.ChangeDetectionStrategy.OnPush
|
|
3504
3676
|
},] }
|
|
@@ -3518,7 +3690,8 @@
|
|
|
3518
3690
|
SearchFunction: [{ type: core.Input }],
|
|
3519
3691
|
MinChars: [{ type: core.Input }],
|
|
3520
3692
|
RequiredPlaceholder: [{ type: core.Input }],
|
|
3521
|
-
CaseSensitive: [{ type: core.Input }]
|
|
3693
|
+
CaseSensitive: [{ type: core.Input }],
|
|
3694
|
+
Multi: [{ type: core.Input }]
|
|
3522
3695
|
};
|
|
3523
3696
|
|
|
3524
3697
|
/** Componente che identifica la selezione di un orario */
|
|
@@ -3652,6 +3825,7 @@
|
|
|
3652
3825
|
FormMultiSelectComponent,
|
|
3653
3826
|
FormFileComponent,
|
|
3654
3827
|
ValidationAutocompleteComponent,
|
|
3828
|
+
ValidationAutocompleteMultiComponent,
|
|
3655
3829
|
FormAutocompleteComponent,
|
|
3656
3830
|
FormDateTimeComponent,
|
|
3657
3831
|
ValidationDateTimeComponent,
|
|
@@ -3665,6 +3839,9 @@
|
|
|
3665
3839
|
forms.FormsModule,
|
|
3666
3840
|
localizations.LocalizationModule,
|
|
3667
3841
|
input.MatInputModule,
|
|
3842
|
+
chips.MatChipsModule,
|
|
3843
|
+
icon.MatIconModule,
|
|
3844
|
+
checkbox.MatCheckboxModule,
|
|
3668
3845
|
datepicker.MatDatepickerModule,
|
|
3669
3846
|
materialDayjsAdapter.MatDayjsDateModule,
|
|
3670
3847
|
tooltip.TooltipModule,
|
|
@@ -3749,7 +3926,8 @@
|
|
|
3749
3926
|
exports.ɵj = FormMultiSelectComponent;
|
|
3750
3927
|
exports.ɵk = FormMultiSelectComponentLoc;
|
|
3751
3928
|
exports.ɵl = FormFileComponentLoc;
|
|
3752
|
-
exports.ɵm =
|
|
3929
|
+
exports.ɵm = ValidationAutocompleteMultiComponent;
|
|
3930
|
+
exports.ɵn = FormAutocompleteComponentLoc;
|
|
3753
3931
|
|
|
3754
3932
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3755
3933
|
|