@esfaenza/forms-and-validations 11.2.4 → 11.2.5

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.
@@ -1748,6 +1748,25 @@
1748
1748
  * Associa il componente Form a questo input
1749
1749
  */
1750
1750
  this.Form = null;
1751
+ /**
1752
+ * Nome della proprietà che contiene l'Id degli oggetti bindati nella **Source**
1753
+ */
1754
+ this.IdField = 'id';
1755
+ /**
1756
+ * Espressione simil-Angular per cambiare il testo dei componenti che scelgono il proprio modello da una **Source**
1757
+ *
1758
+ * Il funzionamento è identico al binder di angular, solo con una graffa invece che 2.
1759
+ * È inoltre possibile aggiungere pezzi di descrizione in maniera condizionale con la sintassi **:prop?(Prop vale {prop})**
1760
+ */
1761
+ this.Display = '{description}';
1762
+ /**
1763
+ * Risultato dell'unione fra le informazioni degli oggetti in **Source** e le impostazioni specificate nell'Input **Display**
1764
+ */
1765
+ this.BoundSource = [];
1766
+ /**
1767
+ * Indica se è il primo Bind del componente
1768
+ */
1769
+ this.FirstBind = true;
1751
1770
  /**
1752
1771
  * Evento chiamato alla modifica del valore collegato a questo campo
1753
1772
  */
@@ -1840,6 +1859,48 @@
1840
1859
  configurable: true
1841
1860
  });
1842
1861
  ;
1862
+ /**
1863
+ * Effettua il Bind/Parse delle varie **Source** unendo le informazioni specificate in **Display**
1864
+ *
1865
+ * Eventualmente rieffettua un bind al modello in base al valore della variabile **RebindModelAfterSource**
1866
+ */
1867
+ BaseFormControl.prototype.tryBindSourceDisplay = function () {
1868
+ var _this = this;
1869
+ if (!this.Source)
1870
+ return;
1871
+ if (this.Source.length == 0 && !this.FirstBind)
1872
+ this.BoundSource = [];
1873
+ this.FirstBind = false;
1874
+ if (this.Source.length > 0) {
1875
+ this.BoundSource = [];
1876
+ var baseRegex = ":([a-z]+)\?\(([^\(\)]+)\)";
1877
+ var conditions_1 = new RegExp(baseRegex, "g");
1878
+ var conditionDetails_1 = new RegExp(baseRegex, "i");
1879
+ var bindings_1 = /{[a-z]+}/gi;
1880
+ this.Source.forEach(function (s) {
1881
+ var tmpDescription = _this.Display;
1882
+ var iffedMatches = tmpDescription.match(conditions_1);
1883
+ // Considerando di avere qualcosa del tipo --> :sqi?({sqi})
1884
+ if (iffedMatches) {
1885
+ for (var i = 0; i < iffedMatches.length; i++) {
1886
+ var m = iffedMatches[i];
1887
+ var groups = m.match(conditionDetails_1);
1888
+ // Se è presente la proprietà "sqi" nell'oggetto della source e non è falsy sostituisco con {sqi} per poterlo parsare al ciclo dopo
1889
+ // altrimenti elimino il blocco completamente
1890
+ tmpDescription = tmpDescription.replace(m[0], s[groups[1]] ? groups[2] : "");
1891
+ }
1892
+ }
1893
+ var matches = tmpDescription.match(bindings_1);
1894
+ if (matches) {
1895
+ for (var i = 0; i < matches.length; i++) {
1896
+ var m = matches[i];
1897
+ tmpDescription = tmpDescription.replace(m, s[m.substring(1, m.length - 1)]);
1898
+ }
1899
+ }
1900
+ _this.BoundSource.push({ id: s[_this.IdField], description: tmpDescription });
1901
+ });
1902
+ }
1903
+ };
1843
1904
  /**
1844
1905
  * Indica se il comopnente in questione è in grado di gestire ngControl nulli.
1845
1906
  * Di default è **false**
@@ -2003,6 +2064,9 @@
2003
2064
  InputColWidth: [{ type: core.Input }],
2004
2065
  Last: [{ type: core.Input }],
2005
2066
  Form: [{ type: core.Input }],
2067
+ Source: [{ type: core.Input }],
2068
+ IdField: [{ type: core.Input }],
2069
+ Display: [{ type: core.Input }],
2006
2070
  Readonly: [{ type: core.Input }],
2007
2071
  LabelInputRatio: [{ type: core.Input }],
2008
2072
  _validationControl: [{ type: core.ViewChild, args: ["validationControl", { static: false },] }],
@@ -2213,24 +2277,6 @@
2213
2277
  _this.utiExts = utiExts;
2214
2278
  _this.dateAdapter = dateAdapter;
2215
2279
  _this.lc = lc;
2216
- /**
2217
- * Nome della proprietà che contiene l'Id degli oggetti bindati nella Source
2218
- */
2219
- _this.IdField = 'id';
2220
- /**
2221
- * Espressione simil-Angular per cambiare il testo dei componenti che scelgono il proprio modello da una Source.
2222
- *
2223
- * Il funzionamento è identico al binder di angular, solo con una graffa invece che due
2224
- */
2225
- _this.Display = '{description}';
2226
- /**
2227
- * Risultato dell'unione fra le informazioni degli oggetti in **Source** e le impostazioni specificate nell'Input **Display**
2228
- */
2229
- _this.BoundSource = [];
2230
- /**
2231
- * Indica se è il primo Bind del componente
2232
- */
2233
- _this.FirstBind = true;
2234
2280
  /**
2235
2281
  * Permette di scaricare l'eventuale file presente qualora il **Type** di questo componente fosse **file**
2236
2282
  */
@@ -2263,27 +2309,6 @@
2263
2309
  });
2264
2310
  });
2265
2311
  };
2266
- /**
2267
- * Effettua il Bind/Parse delle varie **Source** unendo le informazioni specificate in **Display**
2268
- */
2269
- FormAdaptiveComponent.prototype.tryBindSourceDisplay = function () {
2270
- var _this = this;
2271
- if (!this.Source)
2272
- return;
2273
- this.FirstBind = false;
2274
- if (this.Source.length > 0) {
2275
- this.BoundSource = [];
2276
- this.Source.forEach(function (s) {
2277
- var matches = _this.Display.match(/{[a-z]+}/gi);
2278
- var tmpDescription = _this.Display;
2279
- matches.forEach(function (m) {
2280
- tmpDescription = tmpDescription.replace(m, s[m.substring(1, m.length - 1)]);
2281
- });
2282
- s.finaldescription = tmpDescription;
2283
- _this.BoundSource.push(s);
2284
- });
2285
- }
2286
- };
2287
2312
  /**
2288
2313
  * @ignore
2289
2314
  */
@@ -2368,7 +2393,7 @@
2368
2393
  { type: core.Component, args: [{
2369
2394
  selector: "form-adaptive",
2370
2395
  providers: [{ provide: localizations.LocalizationService, useClass: FormAdaptiveComponentLoc }],
2371
- template: "<ng-container *ngIf=\"!FormLayout\">\r\n <ng-container *ngTemplateOutlet=\"controlTemplate\"></ng-container>\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}} m-t-5\">{{Label}}{{Required ? '*' : ''}}:</label>\r\n <div class=\"col-md-{{InputColWidth}}\">\r\n <ng-container *ngTemplateOutlet=\"controlTemplate\"></ng-container>\r\n </div>\r\n <div class=\"clearfix\"></div>\r\n</div>\r\n\r\n<ng-template #controlTemplate>\r\n <div *ngIf=\"!Type\" class=\"app-margin-top-5\">\r\n <em>{{TypeMissingMessage}}</em>\r\n </div>\r\n \r\n <!--Se currency-->\r\n <div *ngIf=\"Type == 'currency'\">\r\n <val-currency [forceInvalid]=\"ForcedError\"\r\n [CurrencyOptions]=\"{ prefix: '', thousands: '.', decimal: ',', precision: Precision, align: 'left' }\" [noValidate]=\"!Validation\"\r\n #validationControl=\"ngModel\" type=\"text\" [readonly]=\"Readonly\" [submitted]=\"Form?.submitted\" [required]=\"Required\" [(ngModel)]=\"Model\" name=\"{{GeneratedName}}\" autocomplete=\"off\" (inputChange)=\"changed();\"></val-currency>\r\n </div>\r\n <!--Se data-->\r\n <div *ngIf=\"Type == 'date'\">\r\n <val-date #validationControl=\"ngModel\" [forceInvalid]=\"ForcedError\" [noValidate]=\"!Validation\" [readonly]=\"Readonly\" [submitted]=\"Form?.submitted\" [required]=\"Required\" [(ngModel)]=\"Model\" name=\"{{GeneratedName}}\" autocomplete=\"off\" (inputChange)=\"changed();\"></val-date>\r\n </div>\r\n <!--Se stringa-->\r\n <div *ngIf=\"Type == 'string'\">\r\n <val-input #validationControl=\"ngModel\" [forceInvalid]=\"ForcedError\" [noValidate]=\"!Validation\" [readonly]=\"Readonly\" [submitted]=\"Form?.submitted\" type=\"text\" pattern=\"{{Pattern || ''}}\" [required]=\"Required\" [(ngModel)]=\"Model\" name=\"{{GeneratedName}}\" autocomplete=\"off\" (inputChange)=\"changed();\"></val-input>\r\n </div>\r\n <!--Se numero-->\r\n <div *ngIf=\"Type == 'float' || Type == 'number'\">\r\n <val-input #validationControl=\"ngModel\" [forceInvalid]=\"ForcedError\" [noValidate]=\"!Validation\" [readonly]=\"Readonly\" [submitted]=\"Form?.submitted\" type=\"text\" pattern=\"{{Pattern || '^([0-9]*[,])?[0-9]+$'}}\" [required]=\"Required\" [(ngModel)]=\"Model\" name=\"{{GeneratedName}}\" autocomplete=\"off\" (inputChange)=\"changed();\"></val-input>\r\n </div>\r\n <!--Se numero intero-->\r\n <div *ngIf=\"Type == 'int'\">\r\n <val-input #validationControl=\"ngModel\" [forceInvalid]=\"ForcedError\" [noValidate]=\"!Validation\" [readonly]=\"Readonly\" [submitted]=\"Form?.submitted\" type=\"text\" pattern=\"{{Pattern || '^[0-9]\\\\d*$'}}\" [required]=\"Required\" [(ngModel)]=\"Model\" name=\"{{GeneratedName}}\" autocomplete=\"off\" (inputChange)=\"changed();\"></val-input>\r\n </div>\r\n <!--Se boolean-->\r\n <div class=\"m-t-5\" *ngIf=\"Type == 'boolean'\">\r\n <input #validationControl=\"ngModel\" [readonly]=\"Readonly\" type=\"checkbox\" class=\"app-pointer\" [(ngModel)]=\"Model\" name=\"{{GeneratedName}}\" (ngModelChange)=\"changed();\" />\r\n </div>\r\n <!--Se enum-->\r\n <div *ngIf=\"Type == 'enum'\">\r\n <val-select #validationControl=\"ngModel\" [forceInvalid]=\"ForcedError\" [noValidate]=\"!Validation\" [readonly]=\"Readonly\" [submitted]=\"Form?.submitted\" [placeHolderValue]=\"''\" [placeholder]=\"('Select' | localize : lc) + '...'\" [required]=\"Required\" [(ngModel)]=\"Model\" (inputChange)=\"changed();\" name=\"{{GeneratedName}}\">\r\n <option *ngFor=\"let val of Source\" [value]=\"val.id\">{{val.description}}</option>\r\n </val-select>\r\n </div>\r\n <!--Se autocomplete-->\r\n <div *ngIf=\"Type == 'autocomplete'\">\r\n <val-autocomplete #validationControl=\"ngModel\" [forceInvalid]=\"ForcedError\" [noValidate]=\"!Validation\" [readonly]=\"Readonly\" [submitted]=\"Form?.submitted\" [required]=\"Required\" [(ngModel)]=\"Model\" name=\"{{GeneratedName}}\" [Source]=\"Source\" (inputChange)=\"changed();\"></val-autocomplete>\r\n </div>\r\n <!--Se date time-->\r\n <div *ngIf=\"Type == 'datetime'\">\r\n <val-datetime #validationControl=\"ngModel\" [forceInvalid]=\"ForcedError\" [noValidate]=\"!Validation\" [readonly]=\"Readonly\" [submitted]=\"Form?.submitted\" [required]=\"Required\" [(ngModel)]=\"Model\" name=\"{{GeneratedName}}\" autocomplete=\"off\" (inputChange)=\"changed();\"></val-datetime>\r\n </div>\r\n <!--Se time-->\r\n <div *ngIf=\"Type == 'time'\">\r\n <ngx-mat-timepicker name=\"val-time\" #elementRef #baseInput=\"ngModel\" [(ngModel)]=\"Model\" [disabled]=\"Readonly\"\r\n [showSpinners]=\"false\" [stepHour]=\"2\" [stepMinute]=\"5\" [stepSecond]=\"30\"\r\n [showSeconds]=\"true\" (ngModelChange)=\"changed()\" #validationControl=\"ngModel\">\r\n </ngx-mat-timepicker>\r\n </div>\r\n <!--Se file-->\r\n <div *ngIf=\"Type == 'file'\">\r\n <div class=\"input-group file-upload\">\r\n <input type=\"file\" (change)=\"fileChange()\" #fileInput class=\"file-upload-btn app-pointer\" [multiple]=\"null\"/>\r\n <input type=\"text\" [class.frm-padding-left-22]=\"AllowDownload && ModelFile.filename && ModelFile.fileb64\" class=\"form-control checking-field\" placeholder=\"{{'Select a file' | localize : lc}}...\" [(ngModel)]=\"ModelFile.filename\" name=\"dsfile\" #validationControl=\"ngModel\" [required]=\"Required\"/>\r\n \r\n <a class=\"fa fa-download app-pointer app-input-icon\" *ngIf=\"AllowDownload && ModelFile.filename && ModelFile.fileb64\" (click)=\"downloadAttachment()\"></a>\r\n <i class=\"fa fa-times delete-file\" (click)=\"fileChange(true)\" *ngIf=\"ModelFile.filename\"></i>\r\n <span class=\"input-group-btn\">\r\n <button class=\"btn btn-primary btn-file-upload\" type=\"button\"><i class=\"fa fa-upload\"></i></button>\r\n </span>\r\n </div>\r\n </div>\r\n</ng-template>",
2396
+ template: "<ng-container *ngIf=\"!FormLayout\">\r\n <ng-container *ngTemplateOutlet=\"controlTemplate\"></ng-container>\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}} m-t-5\">{{Label}}{{Required ? '*' : ''}}:</label>\r\n <div class=\"col-md-{{InputColWidth}}\">\r\n <ng-container *ngTemplateOutlet=\"controlTemplate\"></ng-container>\r\n </div>\r\n <div class=\"clearfix\"></div>\r\n</div>\r\n\r\n<ng-template #controlTemplate>\r\n <div *ngIf=\"!Type\" class=\"app-margin-top-5\">\r\n <em>{{TypeMissingMessage}}</em>\r\n </div>\r\n \r\n <!--Se currency-->\r\n <div *ngIf=\"Type == 'currency'\">\r\n <val-currency [forceInvalid]=\"ForcedError\"\r\n [CurrencyOptions]=\"{ prefix: '', thousands: '.', decimal: ',', precision: Precision, align: 'left' }\" [noValidate]=\"!Validation\"\r\n #validationControl=\"ngModel\" type=\"text\" [readonly]=\"Readonly\" [submitted]=\"Form?.submitted\" [required]=\"Required\" [(ngModel)]=\"Model\" name=\"{{GeneratedName}}\" autocomplete=\"off\" (inputChange)=\"changed();\"></val-currency>\r\n </div>\r\n <!--Se data-->\r\n <div *ngIf=\"Type == 'date'\">\r\n <val-date #validationControl=\"ngModel\" [forceInvalid]=\"ForcedError\" [noValidate]=\"!Validation\" [readonly]=\"Readonly\" [submitted]=\"Form?.submitted\" [required]=\"Required\" [(ngModel)]=\"Model\" name=\"{{GeneratedName}}\" autocomplete=\"off\" (inputChange)=\"changed();\"></val-date>\r\n </div>\r\n <!--Se stringa-->\r\n <div *ngIf=\"Type == 'string'\">\r\n <val-input #validationControl=\"ngModel\" [forceInvalid]=\"ForcedError\" [noValidate]=\"!Validation\" [readonly]=\"Readonly\" [submitted]=\"Form?.submitted\" type=\"text\" pattern=\"{{Pattern || ''}}\" [required]=\"Required\" [(ngModel)]=\"Model\" name=\"{{GeneratedName}}\" autocomplete=\"off\" (inputChange)=\"changed();\"></val-input>\r\n </div>\r\n <!--Se numero-->\r\n <div *ngIf=\"Type == 'float' || Type == 'number'\">\r\n <val-input #validationControl=\"ngModel\" [forceInvalid]=\"ForcedError\" [noValidate]=\"!Validation\" [readonly]=\"Readonly\" [submitted]=\"Form?.submitted\" type=\"text\" pattern=\"{{Pattern || '^([0-9]*[,])?[0-9]+$'}}\" [required]=\"Required\" [(ngModel)]=\"Model\" name=\"{{GeneratedName}}\" autocomplete=\"off\" (inputChange)=\"changed();\"></val-input>\r\n </div>\r\n <!--Se numero intero-->\r\n <div *ngIf=\"Type == 'int'\">\r\n <val-input #validationControl=\"ngModel\" [forceInvalid]=\"ForcedError\" [noValidate]=\"!Validation\" [readonly]=\"Readonly\" [submitted]=\"Form?.submitted\" type=\"text\" pattern=\"{{Pattern || '^[0-9]\\\\d*$'}}\" [required]=\"Required\" [(ngModel)]=\"Model\" name=\"{{GeneratedName}}\" autocomplete=\"off\" (inputChange)=\"changed();\"></val-input>\r\n </div>\r\n <!--Se boolean-->\r\n <div class=\"m-t-5\" *ngIf=\"Type == 'boolean'\">\r\n <input #validationControl=\"ngModel\" [readonly]=\"Readonly\" type=\"checkbox\" class=\"app-pointer\" [(ngModel)]=\"Model\" name=\"{{GeneratedName}}\" (ngModelChange)=\"changed();\" />\r\n </div>\r\n <!--Se enum-->\r\n <div *ngIf=\"Type == 'enum'\">\r\n <val-select #validationControl=\"ngModel\" [forceInvalid]=\"ForcedError\" [noValidate]=\"!Validation\" [readonly]=\"Readonly\" [submitted]=\"Form?.submitted\" [placeHolderValue]=\"''\" [placeholder]=\"('Select' | localize : lc) + '...'\" [required]=\"Required\" [(ngModel)]=\"Model\" (inputChange)=\"changed();\" name=\"{{GeneratedName}}\">\r\n <option *ngFor=\"let val of BoundSource\" [value]=\"val.id\">{{val.description}}</option>\r\n </val-select>\r\n </div>\r\n <!--Se autocomplete-->\r\n <div *ngIf=\"Type == 'autocomplete'\">\r\n <val-autocomplete #validationControl=\"ngModel\" [forceInvalid]=\"ForcedError\" [noValidate]=\"!Validation\" [readonly]=\"Readonly\" [submitted]=\"Form?.submitted\" [required]=\"Required\" [(ngModel)]=\"Model\" name=\"{{GeneratedName}}\" [Source]=\"BoundSource\" (inputChange)=\"changed();\"></val-autocomplete>\r\n </div>\r\n <!--Se date time-->\r\n <div *ngIf=\"Type == 'datetime'\">\r\n <val-datetime #validationControl=\"ngModel\" [forceInvalid]=\"ForcedError\" [noValidate]=\"!Validation\" [readonly]=\"Readonly\" [submitted]=\"Form?.submitted\" [required]=\"Required\" [(ngModel)]=\"Model\" name=\"{{GeneratedName}}\" autocomplete=\"off\" (inputChange)=\"changed();\"></val-datetime>\r\n </div>\r\n <!--Se time-->\r\n <div *ngIf=\"Type == 'time'\">\r\n <ngx-mat-timepicker name=\"val-time\" #elementRef #baseInput=\"ngModel\" [(ngModel)]=\"Model\" [disabled]=\"Readonly\"\r\n [showSpinners]=\"false\" [stepHour]=\"2\" [stepMinute]=\"5\" [stepSecond]=\"30\"\r\n [showSeconds]=\"true\" (ngModelChange)=\"changed()\" #validationControl=\"ngModel\">\r\n </ngx-mat-timepicker>\r\n </div>\r\n <!--Se file-->\r\n <div *ngIf=\"Type == 'file'\">\r\n <div class=\"input-group file-upload\">\r\n <input type=\"file\" (change)=\"fileChange()\" #fileInput class=\"file-upload-btn app-pointer\" [multiple]=\"null\"/>\r\n <input type=\"text\" [class.frm-padding-left-22]=\"AllowDownload && ModelFile.filename && ModelFile.fileb64\" class=\"form-control checking-field\" placeholder=\"{{'Select a file' | localize : lc}}...\" [(ngModel)]=\"ModelFile.filename\" name=\"dsfile\" #validationControl=\"ngModel\" [required]=\"Required\"/>\r\n \r\n <a class=\"fa fa-download app-pointer app-input-icon\" *ngIf=\"AllowDownload && ModelFile.filename && ModelFile.fileb64\" (click)=\"downloadAttachment()\"></a>\r\n <i class=\"fa fa-times delete-file\" (click)=\"fileChange(true)\" *ngIf=\"ModelFile.filename\"></i>\r\n <span class=\"input-group-btn\">\r\n <button class=\"btn btn-primary btn-file-upload\" type=\"button\"><i class=\"fa fa-upload\"></i></button>\r\n </span>\r\n </div>\r\n </div>\r\n</ng-template>",
2372
2397
  changeDetection: core.ChangeDetectionStrategy.OnPush,
2373
2398
  styles: [".frm-padding-left-22{padding-left:22px}"]
2374
2399
  },] }
@@ -2388,9 +2413,6 @@
2388
2413
  Type: [{ type: core.Input }],
2389
2414
  TypeMissingMessage: [{ type: core.Input }],
2390
2415
  Pattern: [{ type: core.Input }],
2391
- Source: [{ type: core.Input }],
2392
- IdField: [{ type: core.Input }],
2393
- Display: [{ type: core.Input }],
2394
2416
  inputEl: [{ type: core.ViewChild, args: ["fileInput", { static: false },] }],
2395
2417
  AllowDownload: [{ type: core.Input }],
2396
2418
  Precision: [{ type: core.Input }]
@@ -2801,24 +2823,6 @@
2801
2823
  * Si consiglia di mantenere il default
2802
2824
  */
2803
2825
  _this.EmptyFieldValue = '-2';
2804
- /**
2805
- * Nome della proprietà che contiene l'Id degli oggetti bindati nella Source
2806
- */
2807
- _this.IdField = 'id';
2808
- /**
2809
- * Espressione simil-Angular per cambiare il testo dei componenti che scelgono il proprio modello da una Source
2810
- *
2811
- * Il funzionamento è identico al binder di angular, solo con una graffa invece che 2
2812
- */
2813
- _this.Display = '{description}';
2814
- /**
2815
- * Risultato dell'unione fra le informazioni degli oggetti in **Source** e le impostazioni specificate nell'Input **Display**
2816
- */
2817
- _this.BoundSource = [];
2818
- /**
2819
- * Indica se è il primo Bind del componente
2820
- */
2821
- _this.FirstBind = true;
2822
2826
  return _this;
2823
2827
  }
2824
2828
  /**
@@ -2845,7 +2849,7 @@
2845
2849
  */
2846
2850
  if (!this.FirstBind && this.SelectLabel) {
2847
2851
  this.BoundSource = null;
2848
- setTimeout(function () { _this.tryBindSourceDisplay(true); });
2852
+ setTimeout(function () { _this.tryBindSourceDisplay(); _this.cdr.detectChanges(); });
2849
2853
  }
2850
2854
  else
2851
2855
  this.tryBindSourceDisplay();
@@ -2855,37 +2859,6 @@
2855
2859
  });
2856
2860
  });
2857
2861
  };
2858
- /**
2859
- * Effettua il Bind/Parse delle varie **Source** unendo le informazioni specificate in **Display**
2860
- *
2861
- * Eventualmente effettua un detectChanges qualora il componente fosse stato ricreato dalla funzione **ngOnChanges**
2862
- */
2863
- FormSelectComponent.prototype.tryBindSourceDisplay = function (detectChanges) {
2864
- if (detectChanges === void 0) { detectChanges = false; }
2865
- if (!this.Source)
2866
- return;
2867
- if (this.Source.length == 0 && !this.FirstBind)
2868
- this.BoundSource = [];
2869
- this.FirstBind = false;
2870
- if (this.Source.length > 0) {
2871
- this.BoundSource = [];
2872
- for (var i = 0; i < this.Source.length; i++) {
2873
- var s = this.Source[i];
2874
- var matches = this.Display.match(/{[a-z]+}/gi);
2875
- var tmpDescription = this.Display;
2876
- if (matches) {
2877
- for (var mi = 0; mi < matches.length; mi++) {
2878
- var m = matches[mi];
2879
- tmpDescription = tmpDescription.replace(m, s[m.substring(1, m.length - 1)]);
2880
- }
2881
- }
2882
- s.finaldescription = tmpDescription;
2883
- this.BoundSource.push(s);
2884
- }
2885
- }
2886
- if (detectChanges)
2887
- this.cdr.detectChanges();
2888
- };
2889
2862
  /**
2890
2863
  * @ignore
2891
2864
  */
@@ -2896,7 +2869,7 @@
2896
2869
  { type: core.Component, args: [{
2897
2870
  selector: "form-select",
2898
2871
  providers: [{ provide: localizations.LocalizationService, useClass: FormSelectComponentLoc }],
2899
- template: "<ng-container *ngIf=\"!FormLayout\">\r\n <ng-container *ngTemplateOutlet=\"controlTemplate\"></ng-container>\r\n</ng-container>\r\n\r\n<div *ngIf=\"FormLayout && BoundSource\" class=\"form-group row {{FormGroupClass}}\" [class.app-margin-bottom-0]=\"Last\">\r\n <label class=\"col-md-{{LabelColWidth}} m-t-5\">{{Label}}{{Required ? '*' : ''}}:</label>\r\n <div class=\"col-md-{{InputColWidth}}\">\r\n <ng-container *ngTemplateOutlet=\"controlTemplate\"></ng-container>\r\n </div>\r\n <div class=\"clearfix\"></div>\r\n</div>\r\n\r\n<ng-template #controlTemplate>\r\n\r\n <!-- Select vuota per quando non ho Sorgenti dati da cui selezionare. Uguale identica alla piena ma senza option\r\n Purtroppo devono essere due componenti distinti perch\u00E9 una select una volta creata non riesce pi\u00F9 ad adattarsi ai cambi di options -->\r\n <val-select *ngIf=\"!BoundSource || BoundSource.length == 0\"\r\n [required]=\"Required ? 'required' : null\"\r\n [noValidate]=\"!Validation\"\r\n [readonly]=\"Readonly\"\r\n [forceInvalid]=\"ForcedError\"\r\n [label]=\"SelectLabel\"\r\n [validationFailed]=\"FailedValidationMessage\"\r\n [placeholder]=\"Required ? ('Select' | localize : lc) + '...' : Placeholder\"\r\n [placeHolderValue]=\"PlaceholderValue\"\r\n [submitted]=\"Form?.submitted\"\r\n [emptyFieldValue]=\"Required || Placeholder || SelectLabel ? EmptyFieldValue : ''\"\r\n [(ngModel)]=\"Model\"\r\n name=\"{{GeneratedName}}\"\r\n (inputChange)=\"Model = $event == EmptyFieldValue ? (Required? PlaceholderValue : '') : $event; changed();\"\r\n #validationControl=\"ngModel\">\r\n </val-select>\r\n\r\n <!-- Select vera e propria per quando arrivano i dati -->\r\n <val-select *ngIf=\"BoundSource && BoundSource.length > 0\"\r\n [required]=\"Required ? 'required' : null\"\r\n [noValidate]=\"!Validation\"\r\n [readonly]=\"Readonly\"\r\n [forceInvalid]=\"ForcedError\"\r\n [label]=\"SelectLabel\"\r\n [validationFailed]=\"FailedValidationMessage\"\r\n [placeholder]=\"Required ? ('Select' | localize : lc) + '...' : Placeholder\"\r\n [placeHolderValue]=\"PlaceholderValue\"\r\n [submitted]=\"Form?.submitted\"\r\n [emptyFieldValue]=\"Required || Placeholder || SelectLabel ? EmptyFieldValue : ''\"\r\n [(ngModel)]=\"Model\"\r\n name=\"{{GeneratedName}}\"\r\n (inputChange)=\"Model = $event == EmptyFieldValue ? (Required? PlaceholderValue : '') : $event; changed();\"\r\n #validationControl=\"ngModel\">\r\n <option *ngFor=\"let obj of BoundSource\" [value]=\"obj[IdField]\">{{obj.finaldescription}}</option>\r\n </val-select>\r\n</ng-template>",
2872
+ template: "<ng-container *ngIf=\"!FormLayout\">\r\n <ng-container *ngTemplateOutlet=\"controlTemplate\"></ng-container>\r\n</ng-container>\r\n\r\n<div *ngIf=\"FormLayout && BoundSource\" class=\"form-group row {{FormGroupClass}}\" [class.app-margin-bottom-0]=\"Last\">\r\n <label class=\"col-md-{{LabelColWidth}} m-t-5\">{{Label}}{{Required ? '*' : ''}}:</label>\r\n <div class=\"col-md-{{InputColWidth}}\">\r\n <ng-container *ngTemplateOutlet=\"controlTemplate\"></ng-container>\r\n </div>\r\n <div class=\"clearfix\"></div>\r\n</div>\r\n\r\n<ng-template #controlTemplate>\r\n\r\n <!-- Select vuota per quando non ho Sorgenti dati da cui selezionare. Uguale identica alla piena ma senza option\r\n Purtroppo devono essere due componenti distinti perch\u00E9 una select una volta creata non riesce pi\u00F9 ad adattarsi ai cambi di options -->\r\n <val-select *ngIf=\"!BoundSource || BoundSource.length == 0\"\r\n [required]=\"Required ? 'required' : null\"\r\n [noValidate]=\"!Validation\"\r\n [readonly]=\"Readonly\"\r\n [forceInvalid]=\"ForcedError\"\r\n [label]=\"SelectLabel\"\r\n [validationFailed]=\"FailedValidationMessage\"\r\n [placeholder]=\"Required ? ('Select' | localize : lc) + '...' : Placeholder\"\r\n [placeHolderValue]=\"PlaceholderValue\"\r\n [submitted]=\"Form?.submitted\"\r\n [emptyFieldValue]=\"Required || Placeholder || SelectLabel ? EmptyFieldValue : ''\"\r\n [(ngModel)]=\"Model\"\r\n name=\"{{GeneratedName}}\"\r\n (inputChange)=\"Model = $event == EmptyFieldValue ? (Required? PlaceholderValue : '') : $event; changed();\"\r\n #validationControl=\"ngModel\">\r\n </val-select>\r\n\r\n <!-- Select vera e propria per quando arrivano i dati -->\r\n <val-select *ngIf=\"BoundSource && BoundSource.length > 0\"\r\n [required]=\"Required ? 'required' : null\"\r\n [noValidate]=\"!Validation\"\r\n [readonly]=\"Readonly\"\r\n [forceInvalid]=\"ForcedError\"\r\n [label]=\"SelectLabel\"\r\n [validationFailed]=\"FailedValidationMessage\"\r\n [placeholder]=\"Required ? ('Select' | localize : lc) + '...' : Placeholder\"\r\n [placeHolderValue]=\"PlaceholderValue\"\r\n [submitted]=\"Form?.submitted\"\r\n [emptyFieldValue]=\"Required || Placeholder || SelectLabel ? EmptyFieldValue : ''\"\r\n [(ngModel)]=\"Model\"\r\n name=\"{{GeneratedName}}\"\r\n (inputChange)=\"Model = $event == EmptyFieldValue ? (Required? PlaceholderValue : '') : $event; changed();\"\r\n #validationControl=\"ngModel\">\r\n <option *ngFor=\"let obj of BoundSource\" [value]=\"obj.id\">{{obj.description}}</option>\r\n </val-select>\r\n</ng-template>",
2900
2873
  changeDetection: core.ChangeDetectionStrategy.OnPush
2901
2874
  },] }
2902
2875
  ];
@@ -2910,12 +2883,9 @@
2910
2883
  { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [ACO_CUSTOMKEY,] }] }
2911
2884
  ]; };
2912
2885
  FormSelectComponent.propDecorators = {
2913
- Source: [{ type: core.Input }],
2914
2886
  SelectLabel: [{ type: core.Input }],
2915
2887
  PlaceholderValue: [{ type: core.Input }],
2916
- EmptyFieldValue: [{ type: core.Input }],
2917
- IdField: [{ type: core.Input }],
2918
- Display: [{ type: core.Input }]
2888
+ EmptyFieldValue: [{ type: core.Input }]
2919
2889
  };
2920
2890
 
2921
2891
  /**
@@ -2976,28 +2946,6 @@
2976
2946
  * Permette al componente di gestire come modello non una lista di chiavi, ma una lista di KeyValue
2977
2947
  */
2978
2948
  _this.UseKeyValues = false;
2979
- /**
2980
- * Nome della proprietà che contiene l'Id degli oggetti bindati nella Source
2981
- */
2982
- _this.IdField = 'id';
2983
- /**
2984
- * Indica il campo degli oggetti dentro all'array 'Source' dentro a cui c'è la descrizione
2985
- */
2986
- _this.DescriptionField = 'description';
2987
- /**
2988
- * Espressione simil-Angular per cambiare il testo dei componenti che scelgono il proprio modello da una Source
2989
- *
2990
- * Il funzionamento è identico al binder di angular, solo con una graffa invece che 2
2991
- */
2992
- _this.Display = '{description}';
2993
- /**
2994
- * Risultato dell'unione fra le informazioni degli oggetti in **Source** e le impostazioni specificate nell'Input **Display**
2995
- */
2996
- _this.BoundSource = [];
2997
- /**
2998
- * Indica se è il primo Bind del componente
2999
- */
3000
- _this.FirstBind = true;
3001
2949
  /**
3002
2950
  * Impostazioni del componente interno **angular2-multiselect**
3003
2951
  */
@@ -3013,8 +2961,13 @@
3013
2961
  var newSource, readonly;
3014
2962
  return __generator(this, function (_c) {
3015
2963
  newSource = changes["Source"];
3016
- if (newSource)
2964
+ if (newSource) {
3017
2965
  this.tryBindSourceDisplay();
2966
+ if (this.RebindModelAfterSource) {
2967
+ this.writeValue(this.TmpModel);
2968
+ this.RebindModelAfterSource = false;
2969
+ }
2970
+ }
3018
2971
  readonly = changes["Readonly"];
3019
2972
  this.Settings = {
3020
2973
  selectAllText: this.lc.loc("Select everything"),
@@ -3022,39 +2975,12 @@
3022
2975
  text: this.SelectLabel || this.lc.loc("Select one or more values..."),
3023
2976
  enableCheckAll: true,
3024
2977
  disabled: readonly ? (_a = readonly.currentValue) !== null && _a !== void 0 ? _a : false : (_b = this.Readonly) !== null && _b !== void 0 ? _b : false,
2978
+ labelKey: "description"
3025
2979
  };
3026
2980
  return [2 /*return*/];
3027
2981
  });
3028
2982
  });
3029
2983
  };
3030
- /**
3031
- * Effettua il Bind/Parse delle varie **Source** unendo le informazioni specificate in **Display**
3032
- *
3033
- * Eventualmente rieffettua un bind al modello in base al valore della variabile **RebindModelAfterSource**
3034
- */
3035
- FormMultiSelectComponent.prototype.tryBindSourceDisplay = function () {
3036
- var _this = this;
3037
- if (!this.Source)
3038
- return;
3039
- this.FirstBind = false;
3040
- if (this.Source.length > 0) {
3041
- this.BoundSource = [];
3042
- this.Source.forEach(function (s) {
3043
- var matches = _this.Display.match(/{[a-z]+}/gi);
3044
- var tmpDescription = _this.Display;
3045
- if (matches) {
3046
- matches.forEach(function (m) {
3047
- tmpDescription = tmpDescription.replace(m, s[m.substring(1, m.length - 1)]);
3048
- });
3049
- }
3050
- _this.BoundSource.push({ id: s[_this.IdField], itemName: tmpDescription });
3051
- });
3052
- if (this.RebindModelAfterSource) {
3053
- this.writeValue(this.TmpModel);
3054
- this.RebindModelAfterSource = false;
3055
- }
3056
- }
3057
- };
3058
2984
  /**
3059
2985
  * @ignore
3060
2986
  */
@@ -3121,12 +3047,8 @@
3121
3047
  { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [ACO_CUSTOMKEY,] }] }
3122
3048
  ]; };
3123
3049
  FormMultiSelectComponent.propDecorators = {
3124
- Source: [{ type: core.Input }],
3125
3050
  SelectLabel: [{ type: core.Input }],
3126
- UseKeyValues: [{ type: core.Input }],
3127
- IdField: [{ type: core.Input }],
3128
- DescriptionField: [{ type: core.Input }],
3129
- Display: [{ type: core.Input }]
3051
+ UseKeyValues: [{ type: core.Input }]
3130
3052
  };
3131
3053
 
3132
3054
  /**
@@ -3178,26 +3100,7 @@
3178
3100
  * @ignore
3179
3101
  */
3180
3102
  function FormAutocompleteComponent(cdr, ngControl, _validators, ac, AppContext, ACO_CUSTOMKEY) {
3181
- var _this = _super.call(this, cdr, ngControl, _validators, ac, AppContext, ACO_CUSTOMKEY) || this;
3182
- /**
3183
- * Nome della proprietà che contiene l'Id degli oggetti bindati nella Source
3184
- */
3185
- _this.IdField = 'id';
3186
- /**
3187
- * Espressione simil-Angular per cambiare il testo dei componenti che scelgono il proprio modello da una Source
3188
- *
3189
- * Il funzionamento è identico al binder di angular, solo con una graffa invece che 2
3190
- */
3191
- _this.Display = '{description}';
3192
- /**
3193
- * Risultato dell'unione fra le informazioni degli oggetti in **Source** e le impostazioni specificate nell'Input **Display**
3194
- */
3195
- _this.BoundSource = [];
3196
- /**
3197
- * Indica se è il primo Bind del componente
3198
- */
3199
- _this.FirstBind = true;
3200
- return _this;
3103
+ return _super.call(this, cdr, ngControl, _validators, ac, AppContext, ACO_CUSTOMKEY) || this;
3201
3104
  }
3202
3105
  /**
3203
3106
  * @ignore
@@ -3213,31 +3116,6 @@
3213
3116
  });
3214
3117
  });
3215
3118
  };
3216
- /**
3217
- * Effettua il Bind/Parse delle varie **Source** unendo le informazioni specificate in **Display**
3218
- */
3219
- FormAutocompleteComponent.prototype.tryBindSourceDisplay = function () {
3220
- var _this = this;
3221
- if (!this.Source)
3222
- return;
3223
- if (this.Source.length == 0 && !this.FirstBind)
3224
- this.BoundSource = [];
3225
- this.FirstBind = false;
3226
- if (this.Source.length > 0) {
3227
- this.BoundSource = [];
3228
- this.Source.forEach(function (s) {
3229
- var matches = _this.Display.match(/{[a-z]+}/gi);
3230
- var tmpDescription = _this.Display;
3231
- if (matches) {
3232
- matches.forEach(function (m) {
3233
- tmpDescription = tmpDescription.replace(m, s[m.substring(1, m.length - 1)]);
3234
- });
3235
- }
3236
- s.finaldescription = tmpDescription;
3237
- _this.BoundSource.push({ id: s[_this.IdField], description: s.finaldescription });
3238
- });
3239
- }
3240
- };
3241
3119
  /**
3242
3120
  * @ignore
3243
3121
  */
@@ -3258,12 +3136,7 @@
3258
3136
  { type: accessControl.AccessControlService, decorators: [{ type: core.Optional }] },
3259
3137
  { type: accessControl.ComponentContext, decorators: [{ type: core.Optional }] },
3260
3138
  { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [ACO_CUSTOMKEY,] }] }
3261
- ]; };
3262
- FormAutocompleteComponent.propDecorators = {
3263
- Source: [{ type: core.Input }],
3264
- IdField: [{ type: core.Input }],
3265
- Display: [{ type: core.Input }]
3266
- };
3139
+ ]; };
3267
3140
 
3268
3141
  /**
3269
3142
  * Componente che identifica la selezione di un orario