@esfaenza/forms-and-validations 12.2.8 → 12.2.12
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 +95 -208
- package/bundles/esfaenza-forms-and-validations.umd.js.map +1 -1
- package/esfaenza-forms-and-validations.metadata.json +1 -1
- package/esm2015/lib/forms/base-form-control.js +80 -4
- package/esm2015/lib/forms/form-adaptive/form-adaptive.component.js +2 -43
- package/esm2015/lib/forms/form-autocomplete/form-autocomplete.component.js +2 -49
- package/esm2015/lib/forms/form-multiselect/form-multiselect.component.js +9 -56
- package/esm2015/lib/forms/form-select/form-select.component.js +4 -55
- package/fesm2015/esfaenza-forms-and-validations.js +92 -202
- package/fesm2015/esfaenza-forms-and-validations.js.map +1 -1
- package/lib/forms/base-form-control.d.ts +32 -0
- package/lib/forms/form-adaptive/form-adaptive.component.d.ts +0 -26
- package/lib/forms/form-autocomplete/form-autocomplete.component.d.ts +0 -29
- package/lib/forms/form-multiselect/form-multiselect.component.d.ts +1 -35
- package/lib/forms/form-select/form-select.component.d.ts +0 -28
- package/package.json +1 -1
|
@@ -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,50 @@
|
|
|
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
|
+
// Cache locale per evitare di rifare dei regex.match ogni santa volta
|
|
1875
|
+
if (this.Source.length > 0) {
|
|
1876
|
+
this.BoundSource = [];
|
|
1877
|
+
// Blocco per tirare fuori le condizioni scritte tipo --> :prop?(Roba con {prop})
|
|
1878
|
+
var iffedMatches = this.Display.match(/:([a-z]+)\?\(([^\(\)]+)\)/g);
|
|
1879
|
+
var bindCheckingGroups = [];
|
|
1880
|
+
if (iffedMatches) {
|
|
1881
|
+
iffedMatches.forEach(function (m) {
|
|
1882
|
+
// Stessa regex di sopra ma il tag "i" serve per tirare fuori i singoli capturing group e per qualche motivo
|
|
1883
|
+
// new RegExp(baseRegex, "g") non funziona quindi non ho potuto razionalizzarlo
|
|
1884
|
+
var groups = m.match(/:([a-z]+)\?\(([^\(\)]+)\)/i);
|
|
1885
|
+
bindCheckingGroups.push({ global: m, prop: groups[1], whenexists: groups[2] });
|
|
1886
|
+
});
|
|
1887
|
+
}
|
|
1888
|
+
// Blocco per tirare fuori le proprietà scritte tipo --> {prop}
|
|
1889
|
+
var bindProperties = [];
|
|
1890
|
+
var matches = this.Display.match(/{[a-z]+}/gi);
|
|
1891
|
+
if (matches)
|
|
1892
|
+
matches.forEach(function (m) { bindProperties.push({ global: m, prop: m.substring(1, m.length - 1) }); });
|
|
1893
|
+
// Blocco per generare la descrizione finale di un elemento
|
|
1894
|
+
this.Source.forEach(function (s) {
|
|
1895
|
+
// Parto sempre dalla variabile di Display, poi sostituisco pezzo per pezzo
|
|
1896
|
+
var desc = _this.Display;
|
|
1897
|
+
// Taglio o mantengo le condizioni in base alla proprietà su cui fare check
|
|
1898
|
+
// Dopodiché scrivo tutte le proprietà
|
|
1899
|
+
bindCheckingGroups.forEach(function (t) { desc = desc.replace(t.global, (s[t.prop] != null && s[t.prop] != undefined) ? t.whenexists : ""); });
|
|
1900
|
+
bindProperties.forEach(function (t) { desc = desc.replace(t.global, s[t.prop]); });
|
|
1901
|
+
// Aggiungo alla BoundSource in formato standard KeyValue
|
|
1902
|
+
_this.BoundSource.push({ id: s[_this.IdField], description: desc });
|
|
1903
|
+
});
|
|
1904
|
+
}
|
|
1905
|
+
};
|
|
1843
1906
|
/**
|
|
1844
1907
|
* Indica se il comopnente in questione è in grado di gestire ngControl nulli.
|
|
1845
1908
|
* Di default è **false**
|
|
@@ -1853,6 +1916,7 @@
|
|
|
1853
1916
|
* @ignore
|
|
1854
1917
|
*/
|
|
1855
1918
|
BaseFormControl.prototype.ngOnInit = function () {
|
|
1919
|
+
var _this = this;
|
|
1856
1920
|
// A volte nell'ngOnInit non ci passa quindi lo metto sia qui sia nell'afterviewinit, penso che valga per i componenti di terze parti
|
|
1857
1921
|
// che si collegano per i cazzi loro al form ecc, quindi la parte sopra non serve... BOH
|
|
1858
1922
|
this.checkRequiredValidator();
|
|
@@ -1862,9 +1926,20 @@
|
|
|
1862
1926
|
if (this.ngControl.name)
|
|
1863
1927
|
this.GeneratedName = this.ngControl.name.toString() + "_internal";
|
|
1864
1928
|
// ATTENZIONE: QUALSIASI SIA IL MOTIVO, SE STO COSO VIENE SPOSTATO DALL ngOnInit NON FUNZIONA PIU NULLA
|
|
1865
|
-
if (this.Form
|
|
1866
|
-
this.
|
|
1867
|
-
|
|
1929
|
+
if (this.Form) {
|
|
1930
|
+
if (!this.formHasBennBound && this.validationControl) {
|
|
1931
|
+
this.Form.addControl(this.validationControl);
|
|
1932
|
+
this.formHasBennBound = true;
|
|
1933
|
+
}
|
|
1934
|
+
// Quando un form viene submittato la variabile Form.submitted viene assegnata all'input [submitted] del val-control
|
|
1935
|
+
// Essendo che però la CD è OnPush per dire ad Angular che l'Input è cambiato e permettere i sideffects di assegnare [submitted]
|
|
1936
|
+
// devo attaccarmi al submit attuale del form e prima di eseguirlo devo marcare il componente per il check
|
|
1937
|
+
var origFunc_1 = this.Form.onSubmit;
|
|
1938
|
+
var formOutsideRef = this.Form;
|
|
1939
|
+
this.Form.onSubmit = function (ev) {
|
|
1940
|
+
_this.cdr.markForCheck();
|
|
1941
|
+
return origFunc_1.apply(formOutsideRef);
|
|
1942
|
+
};
|
|
1868
1943
|
}
|
|
1869
1944
|
};
|
|
1870
1945
|
/**
|
|
@@ -1991,6 +2066,9 @@
|
|
|
1991
2066
|
InputColWidth: [{ type: core.Input }],
|
|
1992
2067
|
Last: [{ type: core.Input }],
|
|
1993
2068
|
Form: [{ type: core.Input }],
|
|
2069
|
+
Source: [{ type: core.Input }],
|
|
2070
|
+
IdField: [{ type: core.Input }],
|
|
2071
|
+
Display: [{ type: core.Input }],
|
|
1994
2072
|
Readonly: [{ type: core.Input }],
|
|
1995
2073
|
LabelInputRatio: [{ type: core.Input }],
|
|
1996
2074
|
_validationControl: [{ type: core.ViewChild, args: ["validationControl", { static: false },] }],
|
|
@@ -2201,24 +2279,6 @@
|
|
|
2201
2279
|
_this.utiExts = utiExts;
|
|
2202
2280
|
_this.dateAdapter = dateAdapter;
|
|
2203
2281
|
_this.lc = lc;
|
|
2204
|
-
/**
|
|
2205
|
-
* Nome della proprietà che contiene l'Id degli oggetti bindati nella Source
|
|
2206
|
-
*/
|
|
2207
|
-
_this.IdField = 'id';
|
|
2208
|
-
/**
|
|
2209
|
-
* Espressione simil-Angular per cambiare il testo dei componenti che scelgono il proprio modello da una Source.
|
|
2210
|
-
*
|
|
2211
|
-
* Il funzionamento è identico al binder di angular, solo con una graffa invece che due
|
|
2212
|
-
*/
|
|
2213
|
-
_this.Display = '{description}';
|
|
2214
|
-
/**
|
|
2215
|
-
* Risultato dell'unione fra le informazioni degli oggetti in **Source** e le impostazioni specificate nell'Input **Display**
|
|
2216
|
-
*/
|
|
2217
|
-
_this.BoundSource = [];
|
|
2218
|
-
/**
|
|
2219
|
-
* Indica se è il primo Bind del componente
|
|
2220
|
-
*/
|
|
2221
|
-
_this.FirstBind = true;
|
|
2222
2282
|
/**
|
|
2223
2283
|
* Permette di scaricare l'eventuale file presente qualora il **Type** di questo componente fosse **file**
|
|
2224
2284
|
*/
|
|
@@ -2251,27 +2311,6 @@
|
|
|
2251
2311
|
});
|
|
2252
2312
|
});
|
|
2253
2313
|
};
|
|
2254
|
-
/**
|
|
2255
|
-
* Effettua il Bind/Parse delle varie **Source** unendo le informazioni specificate in **Display**
|
|
2256
|
-
*/
|
|
2257
|
-
FormAdaptiveComponent.prototype.tryBindSourceDisplay = function () {
|
|
2258
|
-
var _this = this;
|
|
2259
|
-
if (!this.Source)
|
|
2260
|
-
return;
|
|
2261
|
-
this.FirstBind = false;
|
|
2262
|
-
if (this.Source.length > 0) {
|
|
2263
|
-
this.BoundSource = [];
|
|
2264
|
-
this.Source.forEach(function (s) {
|
|
2265
|
-
var matches = _this.Display.match(/{[a-z]+}/gi);
|
|
2266
|
-
var tmpDescription = _this.Display;
|
|
2267
|
-
matches.forEach(function (m) {
|
|
2268
|
-
tmpDescription = tmpDescription.replace(m, s[m.substring(1, m.length - 1)]);
|
|
2269
|
-
});
|
|
2270
|
-
s.finaldescription = tmpDescription;
|
|
2271
|
-
_this.BoundSource.push(s);
|
|
2272
|
-
});
|
|
2273
|
-
}
|
|
2274
|
-
};
|
|
2275
2314
|
/**
|
|
2276
2315
|
* @ignore
|
|
2277
2316
|
*/
|
|
@@ -2356,7 +2395,7 @@
|
|
|
2356
2395
|
{ type: core.Component, args: [{
|
|
2357
2396
|
selector: "form-adaptive",
|
|
2358
2397
|
providers: [{ provide: localizations.LocalizationService, useClass: FormAdaptiveComponentLoc }],
|
|
2359
|
-
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
|
|
2398
|
+
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>",
|
|
2360
2399
|
changeDetection: core.ChangeDetectionStrategy.OnPush,
|
|
2361
2400
|
styles: [".frm-padding-left-22{padding-left:22px}"]
|
|
2362
2401
|
},] }
|
|
@@ -2376,9 +2415,6 @@
|
|
|
2376
2415
|
Type: [{ type: core.Input }],
|
|
2377
2416
|
TypeMissingMessage: [{ type: core.Input }],
|
|
2378
2417
|
Pattern: [{ type: core.Input }],
|
|
2379
|
-
Source: [{ type: core.Input }],
|
|
2380
|
-
IdField: [{ type: core.Input }],
|
|
2381
|
-
Display: [{ type: core.Input }],
|
|
2382
2418
|
inputEl: [{ type: core.ViewChild, args: ["fileInput", { static: false },] }],
|
|
2383
2419
|
AllowDownload: [{ type: core.Input }],
|
|
2384
2420
|
Precision: [{ type: core.Input }]
|
|
@@ -2789,24 +2825,6 @@
|
|
|
2789
2825
|
* Si consiglia di mantenere il default
|
|
2790
2826
|
*/
|
|
2791
2827
|
_this.EmptyFieldValue = '-2';
|
|
2792
|
-
/**
|
|
2793
|
-
* Nome della proprietà che contiene l'Id degli oggetti bindati nella Source
|
|
2794
|
-
*/
|
|
2795
|
-
_this.IdField = 'id';
|
|
2796
|
-
/**
|
|
2797
|
-
* Espressione simil-Angular per cambiare il testo dei componenti che scelgono il proprio modello da una Source
|
|
2798
|
-
*
|
|
2799
|
-
* Il funzionamento è identico al binder di angular, solo con una graffa invece che 2
|
|
2800
|
-
*/
|
|
2801
|
-
_this.Display = '{description}';
|
|
2802
|
-
/**
|
|
2803
|
-
* Risultato dell'unione fra le informazioni degli oggetti in **Source** e le impostazioni specificate nell'Input **Display**
|
|
2804
|
-
*/
|
|
2805
|
-
_this.BoundSource = [];
|
|
2806
|
-
/**
|
|
2807
|
-
* Indica se è il primo Bind del componente
|
|
2808
|
-
*/
|
|
2809
|
-
_this.FirstBind = true;
|
|
2810
2828
|
return _this;
|
|
2811
2829
|
}
|
|
2812
2830
|
/**
|
|
@@ -2833,7 +2851,7 @@
|
|
|
2833
2851
|
*/
|
|
2834
2852
|
if (!this.FirstBind && this.SelectLabel) {
|
|
2835
2853
|
this.BoundSource = null;
|
|
2836
|
-
setTimeout(function () { _this.tryBindSourceDisplay(
|
|
2854
|
+
setTimeout(function () { _this.tryBindSourceDisplay(); _this.cdr.detectChanges(); });
|
|
2837
2855
|
}
|
|
2838
2856
|
else
|
|
2839
2857
|
this.tryBindSourceDisplay();
|
|
@@ -2843,37 +2861,6 @@
|
|
|
2843
2861
|
});
|
|
2844
2862
|
});
|
|
2845
2863
|
};
|
|
2846
|
-
/**
|
|
2847
|
-
* Effettua il Bind/Parse delle varie **Source** unendo le informazioni specificate in **Display**
|
|
2848
|
-
*
|
|
2849
|
-
* Eventualmente effettua un detectChanges qualora il componente fosse stato ricreato dalla funzione **ngOnChanges**
|
|
2850
|
-
*/
|
|
2851
|
-
FormSelectComponent.prototype.tryBindSourceDisplay = function (detectChanges) {
|
|
2852
|
-
if (detectChanges === void 0) { detectChanges = false; }
|
|
2853
|
-
if (!this.Source)
|
|
2854
|
-
return;
|
|
2855
|
-
if (this.Source.length == 0 && !this.FirstBind)
|
|
2856
|
-
this.BoundSource = [];
|
|
2857
|
-
this.FirstBind = false;
|
|
2858
|
-
if (this.Source.length > 0) {
|
|
2859
|
-
this.BoundSource = [];
|
|
2860
|
-
for (var i = 0; i < this.Source.length; i++) {
|
|
2861
|
-
var s = this.Source[i];
|
|
2862
|
-
var matches = this.Display.match(/{[a-z]+}/gi);
|
|
2863
|
-
var tmpDescription = this.Display;
|
|
2864
|
-
if (matches) {
|
|
2865
|
-
for (var mi = 0; mi < matches.length; mi++) {
|
|
2866
|
-
var m = matches[mi];
|
|
2867
|
-
tmpDescription = tmpDescription.replace(m, s[m.substring(1, m.length - 1)]);
|
|
2868
|
-
}
|
|
2869
|
-
}
|
|
2870
|
-
s.finaldescription = tmpDescription;
|
|
2871
|
-
this.BoundSource.push(s);
|
|
2872
|
-
}
|
|
2873
|
-
}
|
|
2874
|
-
if (detectChanges)
|
|
2875
|
-
this.cdr.detectChanges();
|
|
2876
|
-
};
|
|
2877
2864
|
/**
|
|
2878
2865
|
* @ignore
|
|
2879
2866
|
*/
|
|
@@ -2884,7 +2871,7 @@
|
|
|
2884
2871
|
{ type: core.Component, args: [{
|
|
2885
2872
|
selector: "form-select",
|
|
2886
2873
|
providers: [{ provide: localizations.LocalizationService, useClass: FormSelectComponentLoc }],
|
|
2887
|
-
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
|
|
2874
|
+
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>",
|
|
2888
2875
|
changeDetection: core.ChangeDetectionStrategy.OnPush
|
|
2889
2876
|
},] }
|
|
2890
2877
|
];
|
|
@@ -2898,12 +2885,9 @@
|
|
|
2898
2885
|
{ type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [ACO_CUSTOMKEY,] }] }
|
|
2899
2886
|
]; };
|
|
2900
2887
|
FormSelectComponent.propDecorators = {
|
|
2901
|
-
Source: [{ type: core.Input }],
|
|
2902
2888
|
SelectLabel: [{ type: core.Input }],
|
|
2903
2889
|
PlaceholderValue: [{ type: core.Input }],
|
|
2904
|
-
EmptyFieldValue: [{ type: core.Input }]
|
|
2905
|
-
IdField: [{ type: core.Input }],
|
|
2906
|
-
Display: [{ type: core.Input }]
|
|
2890
|
+
EmptyFieldValue: [{ type: core.Input }]
|
|
2907
2891
|
};
|
|
2908
2892
|
|
|
2909
2893
|
/**
|
|
@@ -2964,28 +2948,6 @@
|
|
|
2964
2948
|
* Permette al componente di gestire come modello non una lista di chiavi, ma una lista di KeyValue
|
|
2965
2949
|
*/
|
|
2966
2950
|
_this.UseKeyValues = false;
|
|
2967
|
-
/**
|
|
2968
|
-
* Nome della proprietà che contiene l'Id degli oggetti bindati nella Source
|
|
2969
|
-
*/
|
|
2970
|
-
_this.IdField = 'id';
|
|
2971
|
-
/**
|
|
2972
|
-
* Indica il campo degli oggetti dentro all'array 'Source' dentro a cui c'è la descrizione
|
|
2973
|
-
*/
|
|
2974
|
-
_this.DescriptionField = 'description';
|
|
2975
|
-
/**
|
|
2976
|
-
* Espressione simil-Angular per cambiare il testo dei componenti che scelgono il proprio modello da una Source
|
|
2977
|
-
*
|
|
2978
|
-
* Il funzionamento è identico al binder di angular, solo con una graffa invece che 2
|
|
2979
|
-
*/
|
|
2980
|
-
_this.Display = '{description}';
|
|
2981
|
-
/**
|
|
2982
|
-
* Risultato dell'unione fra le informazioni degli oggetti in **Source** e le impostazioni specificate nell'Input **Display**
|
|
2983
|
-
*/
|
|
2984
|
-
_this.BoundSource = [];
|
|
2985
|
-
/**
|
|
2986
|
-
* Indica se è il primo Bind del componente
|
|
2987
|
-
*/
|
|
2988
|
-
_this.FirstBind = true;
|
|
2989
2951
|
/**
|
|
2990
2952
|
* Impostazioni del componente interno **angular2-multiselect**
|
|
2991
2953
|
*/
|
|
@@ -3001,8 +2963,13 @@
|
|
|
3001
2963
|
var newSource, readonly;
|
|
3002
2964
|
return __generator(this, function (_c) {
|
|
3003
2965
|
newSource = changes["Source"];
|
|
3004
|
-
if (newSource)
|
|
2966
|
+
if (newSource) {
|
|
3005
2967
|
this.tryBindSourceDisplay();
|
|
2968
|
+
if (this.RebindModelAfterSource) {
|
|
2969
|
+
this.writeValue(this.TmpModel);
|
|
2970
|
+
this.RebindModelAfterSource = false;
|
|
2971
|
+
}
|
|
2972
|
+
}
|
|
3006
2973
|
readonly = changes["Readonly"];
|
|
3007
2974
|
this.Settings = {
|
|
3008
2975
|
selectAllText: this.lc.loc("Select everything"),
|
|
@@ -3010,39 +2977,12 @@
|
|
|
3010
2977
|
text: this.SelectLabel || this.lc.loc("Select one or more values..."),
|
|
3011
2978
|
enableCheckAll: true,
|
|
3012
2979
|
disabled: readonly ? (_a = readonly.currentValue) !== null && _a !== void 0 ? _a : false : (_b = this.Readonly) !== null && _b !== void 0 ? _b : false,
|
|
2980
|
+
labelKey: "description"
|
|
3013
2981
|
};
|
|
3014
2982
|
return [2 /*return*/];
|
|
3015
2983
|
});
|
|
3016
2984
|
});
|
|
3017
2985
|
};
|
|
3018
|
-
/**
|
|
3019
|
-
* Effettua il Bind/Parse delle varie **Source** unendo le informazioni specificate in **Display**
|
|
3020
|
-
*
|
|
3021
|
-
* Eventualmente rieffettua un bind al modello in base al valore della variabile **RebindModelAfterSource**
|
|
3022
|
-
*/
|
|
3023
|
-
FormMultiSelectComponent.prototype.tryBindSourceDisplay = function () {
|
|
3024
|
-
var _this = this;
|
|
3025
|
-
if (!this.Source)
|
|
3026
|
-
return;
|
|
3027
|
-
this.FirstBind = false;
|
|
3028
|
-
if (this.Source.length > 0) {
|
|
3029
|
-
this.BoundSource = [];
|
|
3030
|
-
this.Source.forEach(function (s) {
|
|
3031
|
-
var matches = _this.Display.match(/{[a-z]+}/gi);
|
|
3032
|
-
var tmpDescription = _this.Display;
|
|
3033
|
-
if (matches) {
|
|
3034
|
-
matches.forEach(function (m) {
|
|
3035
|
-
tmpDescription = tmpDescription.replace(m, s[m.substring(1, m.length - 1)]);
|
|
3036
|
-
});
|
|
3037
|
-
}
|
|
3038
|
-
_this.BoundSource.push({ id: s[_this.IdField], itemName: tmpDescription });
|
|
3039
|
-
});
|
|
3040
|
-
if (this.RebindModelAfterSource) {
|
|
3041
|
-
this.writeValue(this.TmpModel);
|
|
3042
|
-
this.RebindModelAfterSource = false;
|
|
3043
|
-
}
|
|
3044
|
-
}
|
|
3045
|
-
};
|
|
3046
2986
|
/**
|
|
3047
2987
|
* @ignore
|
|
3048
2988
|
*/
|
|
@@ -3109,12 +3049,8 @@
|
|
|
3109
3049
|
{ type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [ACO_CUSTOMKEY,] }] }
|
|
3110
3050
|
]; };
|
|
3111
3051
|
FormMultiSelectComponent.propDecorators = {
|
|
3112
|
-
Source: [{ type: core.Input }],
|
|
3113
3052
|
SelectLabel: [{ type: core.Input }],
|
|
3114
|
-
UseKeyValues: [{ type: core.Input }]
|
|
3115
|
-
IdField: [{ type: core.Input }],
|
|
3116
|
-
DescriptionField: [{ type: core.Input }],
|
|
3117
|
-
Display: [{ type: core.Input }]
|
|
3053
|
+
UseKeyValues: [{ type: core.Input }]
|
|
3118
3054
|
};
|
|
3119
3055
|
|
|
3120
3056
|
/**
|
|
@@ -3166,26 +3102,7 @@
|
|
|
3166
3102
|
* @ignore
|
|
3167
3103
|
*/
|
|
3168
3104
|
function FormAutocompleteComponent(cdr, ngControl, _validators, ac, AppContext, ACO_CUSTOMKEY) {
|
|
3169
|
-
|
|
3170
|
-
/**
|
|
3171
|
-
* Nome della proprietà che contiene l'Id degli oggetti bindati nella Source
|
|
3172
|
-
*/
|
|
3173
|
-
_this.IdField = 'id';
|
|
3174
|
-
/**
|
|
3175
|
-
* Espressione simil-Angular per cambiare il testo dei componenti che scelgono il proprio modello da una Source
|
|
3176
|
-
*
|
|
3177
|
-
* Il funzionamento è identico al binder di angular, solo con una graffa invece che 2
|
|
3178
|
-
*/
|
|
3179
|
-
_this.Display = '{description}';
|
|
3180
|
-
/**
|
|
3181
|
-
* Risultato dell'unione fra le informazioni degli oggetti in **Source** e le impostazioni specificate nell'Input **Display**
|
|
3182
|
-
*/
|
|
3183
|
-
_this.BoundSource = [];
|
|
3184
|
-
/**
|
|
3185
|
-
* Indica se è il primo Bind del componente
|
|
3186
|
-
*/
|
|
3187
|
-
_this.FirstBind = true;
|
|
3188
|
-
return _this;
|
|
3105
|
+
return _super.call(this, cdr, ngControl, _validators, ac, AppContext, ACO_CUSTOMKEY) || this;
|
|
3189
3106
|
}
|
|
3190
3107
|
/**
|
|
3191
3108
|
* @ignore
|
|
@@ -3201,31 +3118,6 @@
|
|
|
3201
3118
|
});
|
|
3202
3119
|
});
|
|
3203
3120
|
};
|
|
3204
|
-
/**
|
|
3205
|
-
* Effettua il Bind/Parse delle varie **Source** unendo le informazioni specificate in **Display**
|
|
3206
|
-
*/
|
|
3207
|
-
FormAutocompleteComponent.prototype.tryBindSourceDisplay = function () {
|
|
3208
|
-
var _this = this;
|
|
3209
|
-
if (!this.Source)
|
|
3210
|
-
return;
|
|
3211
|
-
if (this.Source.length == 0 && !this.FirstBind)
|
|
3212
|
-
this.BoundSource = [];
|
|
3213
|
-
this.FirstBind = false;
|
|
3214
|
-
if (this.Source.length > 0) {
|
|
3215
|
-
this.BoundSource = [];
|
|
3216
|
-
this.Source.forEach(function (s) {
|
|
3217
|
-
var matches = _this.Display.match(/{[a-z]+}/gi);
|
|
3218
|
-
var tmpDescription = _this.Display;
|
|
3219
|
-
if (matches) {
|
|
3220
|
-
matches.forEach(function (m) {
|
|
3221
|
-
tmpDescription = tmpDescription.replace(m, s[m.substring(1, m.length - 1)]);
|
|
3222
|
-
});
|
|
3223
|
-
}
|
|
3224
|
-
s.finaldescription = tmpDescription;
|
|
3225
|
-
_this.BoundSource.push({ id: s[_this.IdField], description: s.finaldescription });
|
|
3226
|
-
});
|
|
3227
|
-
}
|
|
3228
|
-
};
|
|
3229
3121
|
/**
|
|
3230
3122
|
* @ignore
|
|
3231
3123
|
*/
|
|
@@ -3246,12 +3138,7 @@
|
|
|
3246
3138
|
{ type: accessControl.AccessControlService, decorators: [{ type: core.Optional }] },
|
|
3247
3139
|
{ type: accessControl.ComponentContext, decorators: [{ type: core.Optional }] },
|
|
3248
3140
|
{ type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [ACO_CUSTOMKEY,] }] }
|
|
3249
|
-
]; };
|
|
3250
|
-
FormAutocompleteComponent.propDecorators = {
|
|
3251
|
-
Source: [{ type: core.Input }],
|
|
3252
|
-
IdField: [{ type: core.Input }],
|
|
3253
|
-
Display: [{ type: core.Input }]
|
|
3254
|
-
};
|
|
3141
|
+
]; };
|
|
3255
3142
|
|
|
3256
3143
|
/**
|
|
3257
3144
|
* Componente che identifica la selezione di un orario
|