@esfaenza/forms-and-validations 11.2.77 → 11.2.80

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.
@@ -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 = 10;
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 () {
@@ -3053,7 +3208,9 @@
3053
3208
  this.detatchPreviousAndRetatchNext(function (afterStuff) {
3054
3209
  _this.BoundSource = null;
3055
3210
  setTimeout(function () {
3211
+ var _a;
3056
3212
  _this.tryBindSourceDisplay();
3213
+ _this.EvaluatedModel = _this.BoundSource && _this.BoundSource.length > 0 ? (_a = _this.BoundSource.find(function (t) { return t.id == _this.Model; })) === null || _a === void 0 ? void 0 : _a.description : "";
3057
3214
  _this.cdr.detectChanges();
3058
3215
  setTimeout(function () { afterStuff(); });
3059
3216
  });
@@ -3061,7 +3218,9 @@
3061
3218
  }
3062
3219
  else
3063
3220
  this.detatchPreviousAndRetatchNext(function (afterStuff) {
3221
+ var _a;
3064
3222
  _this.tryBindSourceDisplay();
3223
+ _this.EvaluatedModel = _this.BoundSource && _this.BoundSource.length > 0 ? (_a = _this.BoundSource.find(function (t) { return t.id == _this.Model; })) === null || _a === void 0 ? void 0 : _a.description : "";
3065
3224
  _this.cdr.detectChanges();
3066
3225
  setTimeout(function () { afterStuff(); });
3067
3226
  });
@@ -3089,9 +3248,9 @@
3089
3248
  };
3090
3249
  /** @ignore */
3091
3250
  FormSelectComponent.prototype.writeValue = function (obj) {
3251
+ var _this = this;
3092
3252
  var _a;
3093
- if (this.BoundSource && this.BoundSource.length > 0)
3094
- this.EvaluatedModel = (_a = this.BoundSource.find(function (t) { return t.id == obj; })) === null || _a === void 0 ? void 0 : _a.description;
3253
+ this.EvaluatedModel = this.BoundSource && this.BoundSource.length > 0 ? (_a = this.BoundSource.find(function (t) { return t.id == _this.Model; })) === null || _a === void 0 ? void 0 : _a.description : "";
3095
3254
  _super.prototype.writeValue.call(this, obj);
3096
3255
  };
3097
3256
  /** @ignore */
@@ -3172,6 +3331,8 @@
3172
3331
  _this.SelectLabel = "";
3173
3332
  /** Permette al componente di gestire come modello non una lista di chiavi, ma una lista di KeyValue */
3174
3333
  _this.UseKeyValues = false;
3334
+ /** Indica al componente di emettere una lista di chiavi separate da virgola piuttosto che una lista vera e propria di chiavi/KeyValue */
3335
+ _this.UseCommaSeparatedList = false;
3175
3336
  /** Impostazioni del componente interno **angular2-multiselect** */
3176
3337
  _this.Settings = null;
3177
3338
  // Default dei settings per evitare che siano mai nulli, altrimenti il cazzo di CuppaLab salta in araia che è veramente una bellezza
@@ -3230,6 +3391,8 @@
3230
3391
  var _this = this;
3231
3392
  this.TmpModel = obj;
3232
3393
  var toPass = [];
3394
+ if (this.UseCommaSeparatedList && obj && !obj.length)
3395
+ obj = obj.split(',');
3233
3396
  //Qui arrivano solo gli id, o {id: x, description: y} in caso sono in UseKeyValues,
3234
3397
  //devo tirare fuori gli oggetti relativi e piazzarli come lista per il Model
3235
3398
  if (obj && obj.length > 0) {
@@ -3247,10 +3410,12 @@
3247
3410
  /** @ignore Override per gestire input in uscita */
3248
3411
  FormMultiSelectComponent.prototype.changed = function () {
3249
3412
  var toEmit = null;
3250
- if (!this.UseKeyValues)
3413
+ if (!this.UseKeyValues && !this.UseCommaSeparatedList)
3251
3414
  toEmit = this.Model.map(function (m) { return m.id; });
3252
- else
3415
+ else if (this.UseKeyValues)
3253
3416
  toEmit = this.Model.map(function (m) { return ({ id: m.id, description: m.itemName }); });
3417
+ else if (this.UseCommaSeparatedList)
3418
+ toEmit = this.Model.map(function (m) { return m.id; }).join(',');
3254
3419
  _super.prototype.changed.call(this, toEmit);
3255
3420
  _super.prototype.finalized.call(this);
3256
3421
  };
@@ -3278,7 +3443,8 @@
3278
3443
  ]; };
3279
3444
  FormMultiSelectComponent.propDecorators = {
3280
3445
  SelectLabel: [{ type: core.Input }],
3281
- UseKeyValues: [{ type: core.Input }]
3446
+ UseKeyValues: [{ type: core.Input }],
3447
+ UseCommaSeparatedList: [{ type: core.Input }]
3282
3448
  };
3283
3449
 
3284
3450
  /** Componente che presenta una casella di testo tipicamente utilizzata per scrivere delle note o del log breve */
@@ -3354,6 +3520,10 @@
3354
3520
  _this.RequiredPlaceholder = null;
3355
3521
  /** Indica se i controlli devono essere effettuati tenendo conto del Case o meno. Vale solo qualora la **Source** fosse fornita */
3356
3522
  _this.CaseSensitive = false;
3523
+ /** Indica se usare la modalità multiselezione o no */
3524
+ _this.Multi = false;
3525
+ /** Indica se usare la modalità multiselezione o no */
3526
+ _this.MultiElementsThreshold = 10;
3357
3527
  /**
3358
3528
  * Indica se ignorare il prossimo evento writeValue che normalmente dovrebbe richiedere la nuova source. Serve per quando l'utente seleziona un elemento:
3359
3529
  * Subito dopo partirebbe un altro evento modelChange che ricaricherebbe nuovamente la source
@@ -3380,7 +3550,8 @@
3380
3550
  });
3381
3551
  return;
3382
3552
  }
3383
- this.finalizeValue(value);
3553
+ if (!this.Multi)
3554
+ this.finalizeValue(value);
3384
3555
  };
3385
3556
  /**
3386
3557
  * 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 +3576,10 @@
3405
3576
  if (t && t.length > 0) {
3406
3577
  _this.Source = t;
3407
3578
  _this.tryBindSourceDisplay();
3408
- setTimeout(function () { _this.finalizeValue(_this.Model); });
3579
+ if (!_this.Multi)
3580
+ setTimeout(function () { _this.finalizeValue(_this.Model); });
3581
+ else
3582
+ _this.cdr.markForCheck();
3409
3583
  }
3410
3584
  });
3411
3585
  };
@@ -3421,7 +3595,8 @@
3421
3595
  return;
3422
3596
  }
3423
3597
  // Quando filtro la source, se non devo ignorare l'evento devo comunque assicurarmi di impostare il valore selezionato a null
3424
- _super.prototype.changed.call(this, null);
3598
+ if (!this.Multi)
3599
+ _super.prototype.changed.call(this, null);
3425
3600
  if (!event && this.MinChars == 0 && !this.SearchFunction) {
3426
3601
  this.FilteredBoundSource = this.BoundSource;
3427
3602
  return;
@@ -3479,7 +3654,10 @@
3479
3654
  FormAutocompleteComponent.prototype.changed = function (forcedValue, markForCheck) {
3480
3655
  if (forcedValue === void 0) { forcedValue = null; }
3481
3656
  if (markForCheck === void 0) { markForCheck = false; }
3482
- this.ignoreNextWriteValue = true;
3657
+ if (!this.Multi)
3658
+ this.ignoreNextWriteValue = true;
3659
+ if (forcedValue == "" && this.Multi)
3660
+ this.Model = "";
3483
3661
  _super.prototype.changed.call(this, forcedValue, markForCheck);
3484
3662
  };
3485
3663
  /** @ignore */
@@ -3498,7 +3676,7 @@
3498
3676
  FormAutocompleteComponent.decorators = [
3499
3677
  { type: core.Component, args: [{
3500
3678
  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>",
3679
+ 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 [ChipThreshold]=\"MultiElementsThreshold\"\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
3680
  providers: [{ provide: localizations.LocalizationService, useClass: FormAutocompleteComponentLoc }],
3503
3681
  changeDetection: core.ChangeDetectionStrategy.OnPush
3504
3682
  },] }
@@ -3518,7 +3696,9 @@
3518
3696
  SearchFunction: [{ type: core.Input }],
3519
3697
  MinChars: [{ type: core.Input }],
3520
3698
  RequiredPlaceholder: [{ type: core.Input }],
3521
- CaseSensitive: [{ type: core.Input }]
3699
+ CaseSensitive: [{ type: core.Input }],
3700
+ Multi: [{ type: core.Input }],
3701
+ MultiElementsThreshold: [{ type: core.Input }]
3522
3702
  };
3523
3703
 
3524
3704
  /** Componente che identifica la selezione di un orario */
@@ -3652,6 +3832,7 @@
3652
3832
  FormMultiSelectComponent,
3653
3833
  FormFileComponent,
3654
3834
  ValidationAutocompleteComponent,
3835
+ ValidationAutocompleteMultiComponent,
3655
3836
  FormAutocompleteComponent,
3656
3837
  FormDateTimeComponent,
3657
3838
  ValidationDateTimeComponent,
@@ -3665,6 +3846,9 @@
3665
3846
  forms.FormsModule,
3666
3847
  localizations.LocalizationModule,
3667
3848
  input.MatInputModule,
3849
+ chips.MatChipsModule,
3850
+ icon.MatIconModule,
3851
+ checkbox.MatCheckboxModule,
3668
3852
  datepicker.MatDatepickerModule,
3669
3853
  materialDayjsAdapter.MatDayjsDateModule,
3670
3854
  tooltip.TooltipModule,
@@ -3749,7 +3933,8 @@
3749
3933
  exports.ɵj = FormMultiSelectComponent;
3750
3934
  exports.ɵk = FormMultiSelectComponentLoc;
3751
3935
  exports.ɵl = FormFileComponentLoc;
3752
- exports.ɵm = FormAutocompleteComponentLoc;
3936
+ exports.ɵm = ValidationAutocompleteMultiComponent;
3937
+ exports.ɵn = FormAutocompleteComponentLoc;
3753
3938
 
3754
3939
  Object.defineProperty(exports, '__esModule', { value: true });
3755
3940