@esfaenza/forms-and-validations 11.2.1 → 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.
- package/bundles/esfaenza-forms-and-validations.umd.js +130 -214
- 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 +78 -4
- package/esm2015/lib/forms/form-adaptive/form-adaptive.component.js +2 -43
- package/esm2015/lib/forms/form-autocomplete/form-autocomplete.component.js +3 -50
- package/esm2015/lib/forms/form-date/form-date.component.js +2 -2
- package/esm2015/lib/forms/form-datetime/form-datetime.component.js +2 -2
- package/esm2015/lib/forms/form-input/form-input.component.js +2 -2
- 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/esm2015/lib/forms/form-textarea/form-textarea.component.js +2 -2
- package/esm2015/lib/validations/base-validation.js +20 -2
- package/esm2015/lib/validations/validation-input/validation-input.component.js +9 -1
- package/fesm2015/esfaenza-forms-and-validations.js +122 -208
- 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/lib/validations/base-validation.d.ts +8 -0
- package/lib/validations/validation-input/validation-input.component.d.ts +5 -1
- package/package.json +1 -1
|
@@ -469,6 +469,10 @@
|
|
|
469
469
|
*/
|
|
470
470
|
var BaseValidation = /** @class */ (function () {
|
|
471
471
|
function BaseValidation() {
|
|
472
|
+
/**
|
|
473
|
+
* Variabile per tenere in memoria il fatto che il componente è forzato a invalido o no
|
|
474
|
+
*/
|
|
475
|
+
this._forceInvalid = false;
|
|
472
476
|
/**
|
|
473
477
|
* Indica se il valore è obbligatorio o opzionale
|
|
474
478
|
*/
|
|
@@ -581,6 +585,24 @@
|
|
|
581
585
|
enumerable: false,
|
|
582
586
|
configurable: true
|
|
583
587
|
});
|
|
588
|
+
Object.defineProperty(BaseValidation.prototype, "forceInvalid", {
|
|
589
|
+
/**
|
|
590
|
+
* Imposta il componente come "invalid" a prescindere dai validatori
|
|
591
|
+
*/
|
|
592
|
+
set: function (val) {
|
|
593
|
+
var _this = this;
|
|
594
|
+
this._forceInvalid = val;
|
|
595
|
+
if (val)
|
|
596
|
+
setTimeout(function () { return _this.baseInput.control.setErrors({ forcedtoinvalid: true }); });
|
|
597
|
+
else
|
|
598
|
+
setTimeout(function () {
|
|
599
|
+
_this.baseInput.control.setErrors({ forcedtoinvalid: null });
|
|
600
|
+
_this.baseInput.control.updateValueAndValidity();
|
|
601
|
+
});
|
|
602
|
+
},
|
|
603
|
+
enumerable: false,
|
|
604
|
+
configurable: true
|
|
605
|
+
});
|
|
584
606
|
/**
|
|
585
607
|
* Helper che controlla se il tooltip deve essere mostrato o meno,
|
|
586
608
|
* richiamato direttamente dall'HTML dei componenti
|
|
@@ -659,7 +681,8 @@
|
|
|
659
681
|
noValidate: [{ type: core.Input }],
|
|
660
682
|
autocomplete: [{ type: core.Input }],
|
|
661
683
|
inputChange: [{ type: core.Output }],
|
|
662
|
-
submitted: [{ type: core.Input, args: ["submitted",] }]
|
|
684
|
+
submitted: [{ type: core.Input, args: ["submitted",] }],
|
|
685
|
+
forceInvalid: [{ type: core.Input }]
|
|
663
686
|
};
|
|
664
687
|
|
|
665
688
|
/**
|
|
@@ -1085,6 +1108,14 @@
|
|
|
1085
1108
|
this.HasPrefix = !!this.prefix_internal;
|
|
1086
1109
|
this.postBinding();
|
|
1087
1110
|
};
|
|
1111
|
+
/**
|
|
1112
|
+
* @ignore
|
|
1113
|
+
*/
|
|
1114
|
+
ValidationInputComponent.prototype.ngOnChanges = function (changes) {
|
|
1115
|
+
var newShowWarnings = changes["showWarning"];
|
|
1116
|
+
if (newShowWarnings)
|
|
1117
|
+
this.HasSuffix = !!this.suffix_internal || this.showWarning;
|
|
1118
|
+
};
|
|
1088
1119
|
/**
|
|
1089
1120
|
* Metodo che si occupa di collegare i validatori e la funzione di reset dal **ControlValueAccessor** rappresentato
|
|
1090
1121
|
* da questo componente al **ControlValueAccessor** rappresentato dall'effettivo elemento di Input presente lato HTML
|
|
@@ -1717,6 +1748,25 @@
|
|
|
1717
1748
|
* Associa il componente Form a questo input
|
|
1718
1749
|
*/
|
|
1719
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;
|
|
1720
1770
|
/**
|
|
1721
1771
|
* Evento chiamato alla modifica del valore collegato a questo campo
|
|
1722
1772
|
*/
|
|
@@ -1809,6 +1859,48 @@
|
|
|
1809
1859
|
configurable: true
|
|
1810
1860
|
});
|
|
1811
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
|
+
};
|
|
1812
1904
|
/**
|
|
1813
1905
|
* Indica se il comopnente in questione è in grado di gestire ngControl nulli.
|
|
1814
1906
|
* Di default è **false**
|
|
@@ -1822,6 +1914,7 @@
|
|
|
1822
1914
|
* @ignore
|
|
1823
1915
|
*/
|
|
1824
1916
|
BaseFormControl.prototype.ngOnInit = function () {
|
|
1917
|
+
var _this = this;
|
|
1825
1918
|
// A volte nell'ngOnInit non ci passa quindi lo metto sia qui sia nell'afterviewinit, penso che valga per i componenti di terze parti
|
|
1826
1919
|
// che si collegano per i cazzi loro al form ecc, quindi la parte sopra non serve... BOH
|
|
1827
1920
|
this.checkRequiredValidator();
|
|
@@ -1831,9 +1924,20 @@
|
|
|
1831
1924
|
if (this.ngControl.name)
|
|
1832
1925
|
this.GeneratedName = this.ngControl.name.toString() + "_internal";
|
|
1833
1926
|
// ATTENZIONE: QUALSIASI SIA IL MOTIVO, SE STO COSO VIENE SPOSTATO DALL ngOnInit NON FUNZIONA PIU NULLA
|
|
1834
|
-
if (this.Form
|
|
1835
|
-
this.
|
|
1836
|
-
|
|
1927
|
+
if (this.Form) {
|
|
1928
|
+
if (!this.formHasBennBound && this.validationControl) {
|
|
1929
|
+
this.Form.addControl(this.validationControl);
|
|
1930
|
+
this.formHasBennBound = true;
|
|
1931
|
+
}
|
|
1932
|
+
// Quando un form viene submittato la variabile Form.submitted viene assegnata all'input [submitted] del val-control
|
|
1933
|
+
// Essendo che però la CD è OnPush per dire ad Angular che l'Input è cambiato e permettere i sideffects di assegnare [submitted]
|
|
1934
|
+
// devo attaccarmi al submit attuale del form e prima di eseguirlo devo marcare il componente per il check
|
|
1935
|
+
var origFunc_1 = this.Form.onSubmit;
|
|
1936
|
+
var formOutsideRef = this.Form;
|
|
1937
|
+
this.Form.onSubmit = function (ev) {
|
|
1938
|
+
_this.cdr.markForCheck();
|
|
1939
|
+
return origFunc_1.apply(formOutsideRef);
|
|
1940
|
+
};
|
|
1837
1941
|
}
|
|
1838
1942
|
};
|
|
1839
1943
|
/**
|
|
@@ -1960,6 +2064,9 @@
|
|
|
1960
2064
|
InputColWidth: [{ type: core.Input }],
|
|
1961
2065
|
Last: [{ type: core.Input }],
|
|
1962
2066
|
Form: [{ type: core.Input }],
|
|
2067
|
+
Source: [{ type: core.Input }],
|
|
2068
|
+
IdField: [{ type: core.Input }],
|
|
2069
|
+
Display: [{ type: core.Input }],
|
|
1963
2070
|
Readonly: [{ type: core.Input }],
|
|
1964
2071
|
LabelInputRatio: [{ type: core.Input }],
|
|
1965
2072
|
_validationControl: [{ type: core.ViewChild, args: ["validationControl", { static: false },] }],
|
|
@@ -2116,7 +2223,7 @@
|
|
|
2116
2223
|
FormDateTimeComponent.decorators = [
|
|
2117
2224
|
{ type: core.Component, args: [{
|
|
2118
2225
|
selector: "form-datetime",
|
|
2119
|
-
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 <val-datetime [noValidate]=\"!Validation\"\r\n [submitted]=\"Form?.submitted\"\r\n [readonly]=\"Readonly\"\r\n [class]=\"Readonly ? 'app-bg-lightgrey' : ''\"\r\n [useJsDates]=\"JsDates\"\r\n [(ngModel)]=\"Model\"\r\n name=\"{{GeneratedName}}\"\r\n #validationControl=\"ngModel\"\r\n (inputChange)=\"changed();\"\r\n [placeholder]=\"Placeholder\"\r\n [validationFailed]=\"FailedValidationMessage\">\r\n </val-datetime>\r\n</ng-template>",
|
|
2226
|
+
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 <val-datetime [noValidate]=\"!Validation\"\r\n [submitted]=\"Form?.submitted\"\r\n [forceInvalid]=\"ForcedError\"\r\n [readonly]=\"Readonly\"\r\n [class]=\"Readonly ? 'app-bg-lightgrey' : ''\"\r\n [useJsDates]=\"JsDates\"\r\n [(ngModel)]=\"Model\"\r\n name=\"{{GeneratedName}}\"\r\n #validationControl=\"ngModel\"\r\n (inputChange)=\"changed();\"\r\n [placeholder]=\"Placeholder\"\r\n [validationFailed]=\"FailedValidationMessage\">\r\n </val-datetime>\r\n</ng-template>",
|
|
2120
2227
|
changeDetection: core.ChangeDetectionStrategy.OnPush
|
|
2121
2228
|
},] }
|
|
2122
2229
|
];
|
|
@@ -2170,24 +2277,6 @@
|
|
|
2170
2277
|
_this.utiExts = utiExts;
|
|
2171
2278
|
_this.dateAdapter = dateAdapter;
|
|
2172
2279
|
_this.lc = lc;
|
|
2173
|
-
/**
|
|
2174
|
-
* Nome della proprietà che contiene l'Id degli oggetti bindati nella Source
|
|
2175
|
-
*/
|
|
2176
|
-
_this.IdField = 'id';
|
|
2177
|
-
/**
|
|
2178
|
-
* Espressione simil-Angular per cambiare il testo dei componenti che scelgono il proprio modello da una Source.
|
|
2179
|
-
*
|
|
2180
|
-
* Il funzionamento è identico al binder di angular, solo con una graffa invece che due
|
|
2181
|
-
*/
|
|
2182
|
-
_this.Display = '{description}';
|
|
2183
|
-
/**
|
|
2184
|
-
* Risultato dell'unione fra le informazioni degli oggetti in **Source** e le impostazioni specificate nell'Input **Display**
|
|
2185
|
-
*/
|
|
2186
|
-
_this.BoundSource = [];
|
|
2187
|
-
/**
|
|
2188
|
-
* Indica se è il primo Bind del componente
|
|
2189
|
-
*/
|
|
2190
|
-
_this.FirstBind = true;
|
|
2191
2280
|
/**
|
|
2192
2281
|
* Permette di scaricare l'eventuale file presente qualora il **Type** di questo componente fosse **file**
|
|
2193
2282
|
*/
|
|
@@ -2220,27 +2309,6 @@
|
|
|
2220
2309
|
});
|
|
2221
2310
|
});
|
|
2222
2311
|
};
|
|
2223
|
-
/**
|
|
2224
|
-
* Effettua il Bind/Parse delle varie **Source** unendo le informazioni specificate in **Display**
|
|
2225
|
-
*/
|
|
2226
|
-
FormAdaptiveComponent.prototype.tryBindSourceDisplay = function () {
|
|
2227
|
-
var _this = this;
|
|
2228
|
-
if (!this.Source)
|
|
2229
|
-
return;
|
|
2230
|
-
this.FirstBind = false;
|
|
2231
|
-
if (this.Source.length > 0) {
|
|
2232
|
-
this.BoundSource = [];
|
|
2233
|
-
this.Source.forEach(function (s) {
|
|
2234
|
-
var matches = _this.Display.match(/{[a-z]+}/gi);
|
|
2235
|
-
var tmpDescription = _this.Display;
|
|
2236
|
-
matches.forEach(function (m) {
|
|
2237
|
-
tmpDescription = tmpDescription.replace(m, s[m.substring(1, m.length - 1)]);
|
|
2238
|
-
});
|
|
2239
|
-
s.finaldescription = tmpDescription;
|
|
2240
|
-
_this.BoundSource.push(s);
|
|
2241
|
-
});
|
|
2242
|
-
}
|
|
2243
|
-
};
|
|
2244
2312
|
/**
|
|
2245
2313
|
* @ignore
|
|
2246
2314
|
*/
|
|
@@ -2325,7 +2393,7 @@
|
|
|
2325
2393
|
{ type: core.Component, args: [{
|
|
2326
2394
|
selector: "form-adaptive",
|
|
2327
2395
|
providers: [{ provide: localizations.LocalizationService, useClass: FormAdaptiveComponentLoc }],
|
|
2328
|
-
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 \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\" [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\" [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\" [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\" [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\" [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
|
|
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>",
|
|
2329
2397
|
changeDetection: core.ChangeDetectionStrategy.OnPush,
|
|
2330
2398
|
styles: [".frm-padding-left-22{padding-left:22px}"]
|
|
2331
2399
|
},] }
|
|
@@ -2345,9 +2413,6 @@
|
|
|
2345
2413
|
Type: [{ type: core.Input }],
|
|
2346
2414
|
TypeMissingMessage: [{ type: core.Input }],
|
|
2347
2415
|
Pattern: [{ type: core.Input }],
|
|
2348
|
-
Source: [{ type: core.Input }],
|
|
2349
|
-
IdField: [{ type: core.Input }],
|
|
2350
|
-
Display: [{ type: core.Input }],
|
|
2351
2416
|
inputEl: [{ type: core.ViewChild, args: ["fileInput", { static: false },] }],
|
|
2352
2417
|
AllowDownload: [{ type: core.Input }],
|
|
2353
2418
|
Precision: [{ type: core.Input }]
|
|
@@ -2623,7 +2688,7 @@
|
|
|
2623
2688
|
FormDateComponent.decorators = [
|
|
2624
2689
|
{ type: core.Component, args: [{
|
|
2625
2690
|
selector: "form-date",
|
|
2626
|
-
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 <val-date [noValidate]=\"!Validation\"\r\n [submitted]=\"Form?.submitted\"\r\n [readonly]=\"Readonly\"\r\n [class]=\"Readonly ? 'app-bg-lightgrey' : ''\"\r\n [useJsDates]=\"JsDates\"\r\n [(ngModel)]=\"Model\"\r\n name=\"{{GeneratedName}}\"\r\n #validationControl=\"ngModel\"\r\n (inputChange)=\"changed();\"\r\n [placeholder]=\"Placeholder\"\r\n [validationFailed]=\"FailedValidationMessage\">\r\n </val-date>\r\n</ng-template>",
|
|
2691
|
+
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 <val-date [noValidate]=\"!Validation\"\r\n [submitted]=\"Form?.submitted\"\r\n [forceInvalid]=\"ForcedError\"\r\n [readonly]=\"Readonly\"\r\n [class]=\"Readonly ? 'app-bg-lightgrey' : ''\"\r\n [useJsDates]=\"JsDates\"\r\n [(ngModel)]=\"Model\"\r\n name=\"{{GeneratedName}}\"\r\n #validationControl=\"ngModel\"\r\n (inputChange)=\"changed();\"\r\n [placeholder]=\"Placeholder\"\r\n [validationFailed]=\"FailedValidationMessage\">\r\n </val-date>\r\n</ng-template>",
|
|
2627
2692
|
changeDetection: core.ChangeDetectionStrategy.OnPush
|
|
2628
2693
|
},] }
|
|
2629
2694
|
];
|
|
@@ -2689,7 +2754,7 @@
|
|
|
2689
2754
|
FormInputComponent.decorators = [
|
|
2690
2755
|
{ type: core.Component, args: [{
|
|
2691
2756
|
selector: "form-input",
|
|
2692
|
-
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 <val-input [noValidate]=\"!Validation\"\r\n [submitted]=\"Form?.submitted\"\r\n [readonly]=\"Readonly\"\r\n type=\"text\"\r\n [(ngModel)]=\"Model\"\r\n name=\"{{GeneratedName}}\"\r\n autocomplete=\"off\"\r\n #validationControl=\"ngModel\"\r\n (inputChange)=\"changed();\"\r\n [placeholder]=\"Placeholder\"\r\n [validationFailed]=\"FailedValidationMessage\"\r\n [Password]=\"Password\">\r\n <ng-container *ngIf=\"HasSuffix\">\r\n <ng-template #suffix_internal>\r\n <button type=\"button\" class=\"mat-button mat-icon-button mat-button-base mat-icon-button-override mat-icon-button-override-suffix\"\r\n matSuffix (click)=\"onSuffixAction.emit(); $event.stopPropagation(); $event.preventDefault();\">\r\n <ng-container *ngTemplateOutlet=\"suffix\"></ng-container>\r\n </button>\r\n </ng-template>\r\n </ng-container>\r\n <ng-container *ngIf=\"HasPrefix\">\r\n <ng-template #prefix_internal>\r\n <button type=\"button\" class=\"mat-button mat-icon-button mat-button-base mat-icon-button-override mat-icon-button-override-prefix\"\r\n matPrefix (click)=\"onPrefixAction.emit(); $event.stopPropagation(); $event.preventDefault();\">\r\n <ng-container *ngTemplateOutlet=\"prefix\"></ng-container>\r\n </button>\r\n </ng-template>\r\n </ng-container>\r\n </val-input>\r\n</ng-template>",
|
|
2757
|
+
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 <val-input [noValidate]=\"!Validation\"\r\n [submitted]=\"Form?.submitted\"\r\n [readonly]=\"Readonly\"\r\n [forceInvalid]=\"ForcedError\"\r\n type=\"text\"\r\n [(ngModel)]=\"Model\"\r\n name=\"{{GeneratedName}}\"\r\n autocomplete=\"off\"\r\n #validationControl=\"ngModel\"\r\n (inputChange)=\"changed();\"\r\n [placeholder]=\"Placeholder\"\r\n [validationFailed]=\"FailedValidationMessage\"\r\n [Password]=\"Password\">\r\n <ng-container *ngIf=\"HasSuffix\">\r\n <ng-template #suffix_internal>\r\n <button type=\"button\" class=\"mat-button mat-icon-button mat-button-base mat-icon-button-override mat-icon-button-override-suffix\"\r\n matSuffix (click)=\"onSuffixAction.emit(); $event.stopPropagation(); $event.preventDefault();\">\r\n <ng-container *ngTemplateOutlet=\"suffix\"></ng-container>\r\n </button>\r\n </ng-template>\r\n </ng-container>\r\n <ng-container *ngIf=\"HasPrefix\">\r\n <ng-template #prefix_internal>\r\n <button type=\"button\" class=\"mat-button mat-icon-button mat-button-base mat-icon-button-override mat-icon-button-override-prefix\"\r\n matPrefix (click)=\"onPrefixAction.emit(); $event.stopPropagation(); $event.preventDefault();\">\r\n <ng-container *ngTemplateOutlet=\"prefix\"></ng-container>\r\n </button>\r\n </ng-template>\r\n </ng-container>\r\n </val-input>\r\n</ng-template>",
|
|
2693
2758
|
changeDetection: core.ChangeDetectionStrategy.OnPush
|
|
2694
2759
|
},] }
|
|
2695
2760
|
];
|
|
@@ -2758,24 +2823,6 @@
|
|
|
2758
2823
|
* Si consiglia di mantenere il default
|
|
2759
2824
|
*/
|
|
2760
2825
|
_this.EmptyFieldValue = '-2';
|
|
2761
|
-
/**
|
|
2762
|
-
* Nome della proprietà che contiene l'Id degli oggetti bindati nella Source
|
|
2763
|
-
*/
|
|
2764
|
-
_this.IdField = 'id';
|
|
2765
|
-
/**
|
|
2766
|
-
* Espressione simil-Angular per cambiare il testo dei componenti che scelgono il proprio modello da una Source
|
|
2767
|
-
*
|
|
2768
|
-
* Il funzionamento è identico al binder di angular, solo con una graffa invece che 2
|
|
2769
|
-
*/
|
|
2770
|
-
_this.Display = '{description}';
|
|
2771
|
-
/**
|
|
2772
|
-
* Risultato dell'unione fra le informazioni degli oggetti in **Source** e le impostazioni specificate nell'Input **Display**
|
|
2773
|
-
*/
|
|
2774
|
-
_this.BoundSource = [];
|
|
2775
|
-
/**
|
|
2776
|
-
* Indica se è il primo Bind del componente
|
|
2777
|
-
*/
|
|
2778
|
-
_this.FirstBind = true;
|
|
2779
2826
|
return _this;
|
|
2780
2827
|
}
|
|
2781
2828
|
/**
|
|
@@ -2802,7 +2849,7 @@
|
|
|
2802
2849
|
*/
|
|
2803
2850
|
if (!this.FirstBind && this.SelectLabel) {
|
|
2804
2851
|
this.BoundSource = null;
|
|
2805
|
-
setTimeout(function () { _this.tryBindSourceDisplay(
|
|
2852
|
+
setTimeout(function () { _this.tryBindSourceDisplay(); _this.cdr.detectChanges(); });
|
|
2806
2853
|
}
|
|
2807
2854
|
else
|
|
2808
2855
|
this.tryBindSourceDisplay();
|
|
@@ -2812,37 +2859,6 @@
|
|
|
2812
2859
|
});
|
|
2813
2860
|
});
|
|
2814
2861
|
};
|
|
2815
|
-
/**
|
|
2816
|
-
* Effettua il Bind/Parse delle varie **Source** unendo le informazioni specificate in **Display**
|
|
2817
|
-
*
|
|
2818
|
-
* Eventualmente effettua un detectChanges qualora il componente fosse stato ricreato dalla funzione **ngOnChanges**
|
|
2819
|
-
*/
|
|
2820
|
-
FormSelectComponent.prototype.tryBindSourceDisplay = function (detectChanges) {
|
|
2821
|
-
if (detectChanges === void 0) { detectChanges = false; }
|
|
2822
|
-
if (!this.Source)
|
|
2823
|
-
return;
|
|
2824
|
-
if (this.Source.length == 0 && !this.FirstBind)
|
|
2825
|
-
this.BoundSource = [];
|
|
2826
|
-
this.FirstBind = false;
|
|
2827
|
-
if (this.Source.length > 0) {
|
|
2828
|
-
this.BoundSource = [];
|
|
2829
|
-
for (var i = 0; i < this.Source.length; i++) {
|
|
2830
|
-
var s = this.Source[i];
|
|
2831
|
-
var matches = this.Display.match(/{[a-z]+}/gi);
|
|
2832
|
-
var tmpDescription = this.Display;
|
|
2833
|
-
if (matches) {
|
|
2834
|
-
for (var mi = 0; mi < matches.length; mi++) {
|
|
2835
|
-
var m = matches[mi];
|
|
2836
|
-
tmpDescription = tmpDescription.replace(m, s[m.substring(1, m.length - 1)]);
|
|
2837
|
-
}
|
|
2838
|
-
}
|
|
2839
|
-
s.finaldescription = tmpDescription;
|
|
2840
|
-
this.BoundSource.push(s);
|
|
2841
|
-
}
|
|
2842
|
-
}
|
|
2843
|
-
if (detectChanges)
|
|
2844
|
-
this.cdr.detectChanges();
|
|
2845
|
-
};
|
|
2846
2862
|
/**
|
|
2847
2863
|
* @ignore
|
|
2848
2864
|
*/
|
|
@@ -2853,7 +2869,7 @@
|
|
|
2853
2869
|
{ type: core.Component, args: [{
|
|
2854
2870
|
selector: "form-select",
|
|
2855
2871
|
providers: [{ provide: localizations.LocalizationService, useClass: FormSelectComponentLoc }],
|
|
2856
|
-
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 [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 [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
|
|
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>",
|
|
2857
2873
|
changeDetection: core.ChangeDetectionStrategy.OnPush
|
|
2858
2874
|
},] }
|
|
2859
2875
|
];
|
|
@@ -2867,12 +2883,9 @@
|
|
|
2867
2883
|
{ type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [ACO_CUSTOMKEY,] }] }
|
|
2868
2884
|
]; };
|
|
2869
2885
|
FormSelectComponent.propDecorators = {
|
|
2870
|
-
Source: [{ type: core.Input }],
|
|
2871
2886
|
SelectLabel: [{ type: core.Input }],
|
|
2872
2887
|
PlaceholderValue: [{ type: core.Input }],
|
|
2873
|
-
EmptyFieldValue: [{ type: core.Input }]
|
|
2874
|
-
IdField: [{ type: core.Input }],
|
|
2875
|
-
Display: [{ type: core.Input }]
|
|
2888
|
+
EmptyFieldValue: [{ type: core.Input }]
|
|
2876
2889
|
};
|
|
2877
2890
|
|
|
2878
2891
|
/**
|
|
@@ -2933,28 +2946,6 @@
|
|
|
2933
2946
|
* Permette al componente di gestire come modello non una lista di chiavi, ma una lista di KeyValue
|
|
2934
2947
|
*/
|
|
2935
2948
|
_this.UseKeyValues = false;
|
|
2936
|
-
/**
|
|
2937
|
-
* Nome della proprietà che contiene l'Id degli oggetti bindati nella Source
|
|
2938
|
-
*/
|
|
2939
|
-
_this.IdField = 'id';
|
|
2940
|
-
/**
|
|
2941
|
-
* Indica il campo degli oggetti dentro all'array 'Source' dentro a cui c'è la descrizione
|
|
2942
|
-
*/
|
|
2943
|
-
_this.DescriptionField = 'description';
|
|
2944
|
-
/**
|
|
2945
|
-
* Espressione simil-Angular per cambiare il testo dei componenti che scelgono il proprio modello da una Source
|
|
2946
|
-
*
|
|
2947
|
-
* Il funzionamento è identico al binder di angular, solo con una graffa invece che 2
|
|
2948
|
-
*/
|
|
2949
|
-
_this.Display = '{description}';
|
|
2950
|
-
/**
|
|
2951
|
-
* Risultato dell'unione fra le informazioni degli oggetti in **Source** e le impostazioni specificate nell'Input **Display**
|
|
2952
|
-
*/
|
|
2953
|
-
_this.BoundSource = [];
|
|
2954
|
-
/**
|
|
2955
|
-
* Indica se è il primo Bind del componente
|
|
2956
|
-
*/
|
|
2957
|
-
_this.FirstBind = true;
|
|
2958
2949
|
/**
|
|
2959
2950
|
* Impostazioni del componente interno **angular2-multiselect**
|
|
2960
2951
|
*/
|
|
@@ -2970,8 +2961,13 @@
|
|
|
2970
2961
|
var newSource, readonly;
|
|
2971
2962
|
return __generator(this, function (_c) {
|
|
2972
2963
|
newSource = changes["Source"];
|
|
2973
|
-
if (newSource)
|
|
2964
|
+
if (newSource) {
|
|
2974
2965
|
this.tryBindSourceDisplay();
|
|
2966
|
+
if (this.RebindModelAfterSource) {
|
|
2967
|
+
this.writeValue(this.TmpModel);
|
|
2968
|
+
this.RebindModelAfterSource = false;
|
|
2969
|
+
}
|
|
2970
|
+
}
|
|
2975
2971
|
readonly = changes["Readonly"];
|
|
2976
2972
|
this.Settings = {
|
|
2977
2973
|
selectAllText: this.lc.loc("Select everything"),
|
|
@@ -2979,39 +2975,12 @@
|
|
|
2979
2975
|
text: this.SelectLabel || this.lc.loc("Select one or more values..."),
|
|
2980
2976
|
enableCheckAll: true,
|
|
2981
2977
|
disabled: readonly ? (_a = readonly.currentValue) !== null && _a !== void 0 ? _a : false : (_b = this.Readonly) !== null && _b !== void 0 ? _b : false,
|
|
2978
|
+
labelKey: "description"
|
|
2982
2979
|
};
|
|
2983
2980
|
return [2 /*return*/];
|
|
2984
2981
|
});
|
|
2985
2982
|
});
|
|
2986
2983
|
};
|
|
2987
|
-
/**
|
|
2988
|
-
* Effettua il Bind/Parse delle varie **Source** unendo le informazioni specificate in **Display**
|
|
2989
|
-
*
|
|
2990
|
-
* Eventualmente rieffettua un bind al modello in base al valore della variabile **RebindModelAfterSource**
|
|
2991
|
-
*/
|
|
2992
|
-
FormMultiSelectComponent.prototype.tryBindSourceDisplay = function () {
|
|
2993
|
-
var _this = this;
|
|
2994
|
-
if (!this.Source)
|
|
2995
|
-
return;
|
|
2996
|
-
this.FirstBind = false;
|
|
2997
|
-
if (this.Source.length > 0) {
|
|
2998
|
-
this.BoundSource = [];
|
|
2999
|
-
this.Source.forEach(function (s) {
|
|
3000
|
-
var matches = _this.Display.match(/{[a-z]+}/gi);
|
|
3001
|
-
var tmpDescription = _this.Display;
|
|
3002
|
-
if (matches) {
|
|
3003
|
-
matches.forEach(function (m) {
|
|
3004
|
-
tmpDescription = tmpDescription.replace(m, s[m.substring(1, m.length - 1)]);
|
|
3005
|
-
});
|
|
3006
|
-
}
|
|
3007
|
-
_this.BoundSource.push({ id: s[_this.IdField], itemName: tmpDescription });
|
|
3008
|
-
});
|
|
3009
|
-
if (this.RebindModelAfterSource) {
|
|
3010
|
-
this.writeValue(this.TmpModel);
|
|
3011
|
-
this.RebindModelAfterSource = false;
|
|
3012
|
-
}
|
|
3013
|
-
}
|
|
3014
|
-
};
|
|
3015
2984
|
/**
|
|
3016
2985
|
* @ignore
|
|
3017
2986
|
*/
|
|
@@ -3078,12 +3047,8 @@
|
|
|
3078
3047
|
{ type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [ACO_CUSTOMKEY,] }] }
|
|
3079
3048
|
]; };
|
|
3080
3049
|
FormMultiSelectComponent.propDecorators = {
|
|
3081
|
-
Source: [{ type: core.Input }],
|
|
3082
3050
|
SelectLabel: [{ type: core.Input }],
|
|
3083
|
-
UseKeyValues: [{ type: core.Input }]
|
|
3084
|
-
IdField: [{ type: core.Input }],
|
|
3085
|
-
DescriptionField: [{ type: core.Input }],
|
|
3086
|
-
Display: [{ type: core.Input }]
|
|
3051
|
+
UseKeyValues: [{ type: core.Input }]
|
|
3087
3052
|
};
|
|
3088
3053
|
|
|
3089
3054
|
/**
|
|
@@ -3108,7 +3073,7 @@
|
|
|
3108
3073
|
FormTextareaComponent.decorators = [
|
|
3109
3074
|
{ type: core.Component, args: [{
|
|
3110
3075
|
selector: "form-textarea",
|
|
3111
|
-
template: "<div 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 <val-textarea [noValidate]=\"!Validation\"\r\n [submitted]=\"Form?.submitted\"\r\n [rows]=\"Rows\"\r\n [readonly]=\"Readonly\"\r\n [class]=\"Readonly ? 'app-bg-lightgrey app-no-resize' : 'app-no-resize'\"\r\n [(ngModel)]=\"Model\"\r\n name=\"{{GeneratedName}}\"\r\n autocomplete=\"off\"\r\n [placeholder]=\"Placeholder\"\r\n [validationFailed]=\"FailedValidationMessage\"\r\n #validationControl=\"ngModel\"\r\n (inputChange)=\"changed();\">\r\n </val-textarea>\r\n </div>\r\n <div class=\"clearfix\"></div>\r\n</div>",
|
|
3076
|
+
template: "<div 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 <val-textarea [noValidate]=\"!Validation\"\r\n [submitted]=\"Form?.submitted\"\r\n [forceInvalid]=\"ForcedError\"\r\n [rows]=\"Rows\"\r\n [readonly]=\"Readonly\"\r\n [class]=\"Readonly ? 'app-bg-lightgrey app-no-resize' : 'app-no-resize'\"\r\n [(ngModel)]=\"Model\"\r\n name=\"{{GeneratedName}}\"\r\n autocomplete=\"off\"\r\n [placeholder]=\"Placeholder\"\r\n [validationFailed]=\"FailedValidationMessage\"\r\n #validationControl=\"ngModel\"\r\n (inputChange)=\"changed();\">\r\n </val-textarea>\r\n </div>\r\n <div class=\"clearfix\"></div>\r\n</div>",
|
|
3112
3077
|
changeDetection: core.ChangeDetectionStrategy.OnPush
|
|
3113
3078
|
},] }
|
|
3114
3079
|
];
|
|
@@ -3135,26 +3100,7 @@
|
|
|
3135
3100
|
* @ignore
|
|
3136
3101
|
*/
|
|
3137
3102
|
function FormAutocompleteComponent(cdr, ngControl, _validators, ac, AppContext, ACO_CUSTOMKEY) {
|
|
3138
|
-
|
|
3139
|
-
/**
|
|
3140
|
-
* Nome della proprietà che contiene l'Id degli oggetti bindati nella Source
|
|
3141
|
-
*/
|
|
3142
|
-
_this.IdField = 'id';
|
|
3143
|
-
/**
|
|
3144
|
-
* Espressione simil-Angular per cambiare il testo dei componenti che scelgono il proprio modello da una Source
|
|
3145
|
-
*
|
|
3146
|
-
* Il funzionamento è identico al binder di angular, solo con una graffa invece che 2
|
|
3147
|
-
*/
|
|
3148
|
-
_this.Display = '{description}';
|
|
3149
|
-
/**
|
|
3150
|
-
* Risultato dell'unione fra le informazioni degli oggetti in **Source** e le impostazioni specificate nell'Input **Display**
|
|
3151
|
-
*/
|
|
3152
|
-
_this.BoundSource = [];
|
|
3153
|
-
/**
|
|
3154
|
-
* Indica se è il primo Bind del componente
|
|
3155
|
-
*/
|
|
3156
|
-
_this.FirstBind = true;
|
|
3157
|
-
return _this;
|
|
3103
|
+
return _super.call(this, cdr, ngControl, _validators, ac, AppContext, ACO_CUSTOMKEY) || this;
|
|
3158
3104
|
}
|
|
3159
3105
|
/**
|
|
3160
3106
|
* @ignore
|
|
@@ -3170,31 +3116,6 @@
|
|
|
3170
3116
|
});
|
|
3171
3117
|
});
|
|
3172
3118
|
};
|
|
3173
|
-
/**
|
|
3174
|
-
* Effettua il Bind/Parse delle varie **Source** unendo le informazioni specificate in **Display**
|
|
3175
|
-
*/
|
|
3176
|
-
FormAutocompleteComponent.prototype.tryBindSourceDisplay = function () {
|
|
3177
|
-
var _this = this;
|
|
3178
|
-
if (!this.Source)
|
|
3179
|
-
return;
|
|
3180
|
-
if (this.Source.length == 0 && !this.FirstBind)
|
|
3181
|
-
this.BoundSource = [];
|
|
3182
|
-
this.FirstBind = false;
|
|
3183
|
-
if (this.Source.length > 0) {
|
|
3184
|
-
this.BoundSource = [];
|
|
3185
|
-
this.Source.forEach(function (s) {
|
|
3186
|
-
var matches = _this.Display.match(/{[a-z]+}/gi);
|
|
3187
|
-
var tmpDescription = _this.Display;
|
|
3188
|
-
if (matches) {
|
|
3189
|
-
matches.forEach(function (m) {
|
|
3190
|
-
tmpDescription = tmpDescription.replace(m, s[m.substring(1, m.length - 1)]);
|
|
3191
|
-
});
|
|
3192
|
-
}
|
|
3193
|
-
s.finaldescription = tmpDescription;
|
|
3194
|
-
_this.BoundSource.push({ id: s[_this.IdField], description: s.finaldescription });
|
|
3195
|
-
});
|
|
3196
|
-
}
|
|
3197
|
-
};
|
|
3198
3119
|
/**
|
|
3199
3120
|
* @ignore
|
|
3200
3121
|
*/
|
|
@@ -3204,7 +3125,7 @@
|
|
|
3204
3125
|
FormAutocompleteComponent.decorators = [
|
|
3205
3126
|
{ type: core.Component, args: [{
|
|
3206
3127
|
selector: "form-autocomplete",
|
|
3207
|
-
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 <val-autocomplete [noValidate]=\"!Validation\"\r\n [submitted]=\"Form?.submitted\"\r\n [readonly]=\"Readonly\"\r\n type=\"text\"\r\n [(ngModel)]=\"Model\"\r\n name=\"{{GeneratedName}}\"\r\n #validationControl=\"ngModel\"\r\n (inputChange)=\"changed();\"\r\n [placeholder]=\"Placeholder\"\r\n [validationFailed]=\"FailedValidationMessage\"\r\n [Source]=\"BoundSource\">\r\n </val-autocomplete>\r\n</ng-template>",
|
|
3128
|
+
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 <val-autocomplete [noValidate]=\"!Validation\"\r\n [submitted]=\"Form?.submitted\"\r\n [forceInvalid]=\"ForcedError\"\r\n [readonly]=\"Readonly\"\r\n type=\"text\"\r\n [(ngModel)]=\"Model\"\r\n name=\"{{GeneratedName}}\"\r\n #validationControl=\"ngModel\"\r\n (inputChange)=\"changed();\"\r\n [placeholder]=\"Placeholder\"\r\n [validationFailed]=\"FailedValidationMessage\"\r\n [Source]=\"BoundSource\">\r\n </val-autocomplete>\r\n</ng-template>",
|
|
3208
3129
|
changeDetection: core.ChangeDetectionStrategy.OnPush
|
|
3209
3130
|
},] }
|
|
3210
3131
|
];
|
|
@@ -3215,12 +3136,7 @@
|
|
|
3215
3136
|
{ type: accessControl.AccessControlService, decorators: [{ type: core.Optional }] },
|
|
3216
3137
|
{ type: accessControl.ComponentContext, decorators: [{ type: core.Optional }] },
|
|
3217
3138
|
{ type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [ACO_CUSTOMKEY,] }] }
|
|
3218
|
-
]; };
|
|
3219
|
-
FormAutocompleteComponent.propDecorators = {
|
|
3220
|
-
Source: [{ type: core.Input }],
|
|
3221
|
-
IdField: [{ type: core.Input }],
|
|
3222
|
-
Display: [{ type: core.Input }]
|
|
3223
|
-
};
|
|
3139
|
+
]; };
|
|
3224
3140
|
|
|
3225
3141
|
/**
|
|
3226
3142
|
* Componente che identifica la selezione di un orario
|