@esfaenza/forms-and-validations 12.2.31 → 13.1.2

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.
Files changed (118) hide show
  1. package/esfaenza-forms-and-validations.d.ts +1 -12
  2. package/esm2020/esfaenza-forms-and-validations.mjs +5 -0
  3. package/esm2020/lib/forms/base-form-control.mjs +482 -0
  4. package/esm2020/lib/forms/form-adaptive/form-adaptive.component.loc.mjs +28 -0
  5. package/esm2020/lib/forms/form-adaptive/form-adaptive.component.mjs +294 -0
  6. package/esm2020/lib/forms/form-autocomplete/form-autocomplete.component.loc.mjs +26 -0
  7. package/esm2020/lib/forms/form-autocomplete/form-autocomplete.component.mjs +200 -0
  8. package/esm2020/lib/forms/form-checkbox/form-checkbox.component.mjs +52 -0
  9. package/esm2020/lib/forms/form-date/form-date.component.mjs +59 -0
  10. package/esm2020/lib/forms/form-datetime/form-datetime.component.mjs +59 -0
  11. package/esm2020/lib/forms/form-empty/form-empty.component.mjs +36 -0
  12. package/esm2020/lib/forms/form-error/form-error.component.mjs +52 -0
  13. package/esm2020/lib/forms/form-file/form-file.component.loc.mjs +28 -0
  14. package/esm2020/lib/forms/form-file/form-file.component.mjs +119 -0
  15. package/esm2020/lib/forms/form-info/form-info.component.mjs +52 -0
  16. package/esm2020/lib/forms/form-input/form-input.component.mjs +93 -0
  17. package/esm2020/lib/forms/form-multiselect/form-multiselect.component.loc.mjs +29 -0
  18. package/esm2020/lib/forms/form-multiselect/form-multiselect.component.mjs +159 -0
  19. package/esm2020/lib/forms/form-select/form-select.component.loc.mjs +26 -0
  20. package/esm2020/lib/forms/form-select/form-select.component.mjs +129 -0
  21. package/esm2020/lib/forms/form-template/form-template.component.mjs +71 -0
  22. package/esm2020/lib/forms/form-textarea/form-textarea.component.mjs +54 -0
  23. package/esm2020/lib/forms/form-time/form-time.component.mjs +131 -0
  24. package/esm2020/lib/forms-and-validations.module.mjs +203 -0
  25. package/{esm2015/lib/models/AppFile.js → esm2020/lib/models/AppFile.mjs} +0 -0
  26. package/{esm2015/lib/models/FormsAndValidationsModuleConfig.js → esm2020/lib/models/FormsAndValidationsModuleConfig.mjs} +0 -0
  27. package/esm2020/lib/models/dayjs-adapter/dayjs-date-adapter.mjs +89 -0
  28. package/{esm2015/lib/tokens.js → esm2020/lib/tokens.mjs} +0 -0
  29. package/esm2020/lib/validations/base-validation.loc.mjs +28 -0
  30. package/esm2020/lib/validations/base-validation.mjs +232 -0
  31. package/esm2020/lib/validations/customValidators/CustomRequiredDirective.mjs +41 -0
  32. package/esm2020/lib/validations/validation-autocomplete/validation-autocomplete.component.mjs +168 -0
  33. package/esm2020/lib/validations/validation-currency/validation-currency.component.mjs +61 -0
  34. package/esm2020/lib/validations/validation-date/validation-date.component.mjs +177 -0
  35. package/esm2020/lib/validations/validation-datetime/validation-datetime.component.mjs +206 -0
  36. package/esm2020/lib/validations/validation-input/validation-input.component.mjs +207 -0
  37. package/esm2020/lib/validations/validation-select/validation-select.component.mjs +184 -0
  38. package/esm2020/lib/validations/validation-text-area/validation-text-area.component.mjs +64 -0
  39. package/esm2020/public-api.mjs +35 -0
  40. package/fesm2015/esfaenza-forms-and-validations.mjs +3620 -0
  41. package/fesm2015/esfaenza-forms-and-validations.mjs.map +1 -0
  42. package/fesm2020/esfaenza-forms-and-validations.mjs +3562 -0
  43. package/fesm2020/esfaenza-forms-and-validations.mjs.map +1 -0
  44. package/lib/forms/base-form-control.d.ts +3 -0
  45. package/lib/forms/form-adaptive/form-adaptive.component.d.ts +3 -0
  46. package/lib/forms/form-adaptive/form-adaptive.component.loc.d.ts +3 -0
  47. package/lib/forms/form-autocomplete/form-autocomplete.component.d.ts +3 -0
  48. package/lib/forms/form-autocomplete/form-autocomplete.component.loc.d.ts +3 -0
  49. package/lib/forms/form-checkbox/form-checkbox.component.d.ts +3 -0
  50. package/lib/forms/form-date/form-date.component.d.ts +3 -0
  51. package/lib/forms/form-datetime/form-datetime.component.d.ts +3 -0
  52. package/lib/forms/form-empty/form-empty.component.d.ts +3 -0
  53. package/lib/forms/form-error/form-error.component.d.ts +3 -0
  54. package/lib/forms/form-file/form-file.component.d.ts +3 -0
  55. package/lib/forms/form-file/form-file.component.loc.d.ts +3 -0
  56. package/lib/forms/form-info/form-info.component.d.ts +3 -0
  57. package/lib/forms/form-input/form-input.component.d.ts +3 -0
  58. package/lib/forms/form-multiselect/form-multiselect.component.d.ts +3 -0
  59. package/lib/forms/form-multiselect/form-multiselect.component.loc.d.ts +3 -0
  60. package/lib/forms/form-select/form-select.component.d.ts +3 -0
  61. package/lib/forms/form-select/form-select.component.loc.d.ts +3 -0
  62. package/lib/forms/form-template/form-template.component.d.ts +3 -0
  63. package/lib/forms/form-textarea/form-textarea.component.d.ts +3 -0
  64. package/lib/forms/form-time/form-time.component.d.ts +3 -0
  65. package/lib/forms-and-validations.module.d.ts +38 -0
  66. package/lib/models/dayjs-adapter/dayjs-date-adapter.d.ts +3 -0
  67. package/lib/validations/base-validation.d.ts +3 -0
  68. package/lib/validations/base-validation.loc.d.ts +3 -0
  69. package/lib/validations/customValidators/CustomRequiredDirective.d.ts +3 -0
  70. package/lib/validations/validation-autocomplete/validation-autocomplete.component.d.ts +3 -0
  71. package/lib/validations/validation-currency/validation-currency.component.d.ts +3 -0
  72. package/lib/validations/validation-date/validation-date.component.d.ts +3 -0
  73. package/lib/validations/validation-datetime/validation-datetime.component.d.ts +3 -0
  74. package/lib/validations/validation-input/validation-input.component.d.ts +3 -0
  75. package/lib/validations/validation-select/validation-select.component.d.ts +3 -0
  76. package/lib/validations/validation-text-area/validation-text-area.component.d.ts +3 -0
  77. package/package.json +30 -18
  78. package/public-api.d.ts +2 -0
  79. package/bundles/esfaenza-forms-and-validations.umd.js +0 -3754
  80. package/bundles/esfaenza-forms-and-validations.umd.js.map +0 -1
  81. package/esfaenza-forms-and-validations.metadata.json +0 -1
  82. package/esm2015/esfaenza-forms-and-validations.js +0 -17
  83. package/esm2015/lib/forms/base-form-control.js +0 -460
  84. package/esm2015/lib/forms/form-adaptive/form-adaptive.component.js +0 -277
  85. package/esm2015/lib/forms/form-adaptive/form-adaptive.component.loc.js +0 -23
  86. package/esm2015/lib/forms/form-autocomplete/form-autocomplete.component.js +0 -187
  87. package/esm2015/lib/forms/form-autocomplete/form-autocomplete.component.loc.js +0 -21
  88. package/esm2015/lib/forms/form-checkbox/form-checkbox.component.js +0 -41
  89. package/esm2015/lib/forms/form-date/form-date.component.js +0 -49
  90. package/esm2015/lib/forms/form-datetime/form-datetime.component.js +0 -49
  91. package/esm2015/lib/forms/form-empty/form-empty.component.js +0 -34
  92. package/esm2015/lib/forms/form-error/form-error.component.js +0 -49
  93. package/esm2015/lib/forms/form-file/form-file.component.js +0 -109
  94. package/esm2015/lib/forms/form-file/form-file.component.loc.js +0 -23
  95. package/esm2015/lib/forms/form-info/form-info.component.js +0 -49
  96. package/esm2015/lib/forms/form-input/form-input.component.js +0 -76
  97. package/esm2015/lib/forms/form-multiselect/form-multiselect.component.js +0 -154
  98. package/esm2015/lib/forms/form-multiselect/form-multiselect.component.loc.js +0 -24
  99. package/esm2015/lib/forms/form-select/form-select.component.js +0 -114
  100. package/esm2015/lib/forms/form-select/form-select.component.loc.js +0 -21
  101. package/esm2015/lib/forms/form-template/form-template.component.js +0 -64
  102. package/esm2015/lib/forms/form-textarea/form-textarea.component.js +0 -44
  103. package/esm2015/lib/forms/form-time/form-time.component.js +0 -117
  104. package/esm2015/lib/forms-and-validations.module.js +0 -144
  105. package/esm2015/lib/models/dayjs-adapter/dayjs-date-adapter.js +0 -86
  106. package/esm2015/lib/validations/base-validation.js +0 -208
  107. package/esm2015/lib/validations/base-validation.loc.js +0 -23
  108. package/esm2015/lib/validations/customValidators/CustomRequiredDirective.js +0 -35
  109. package/esm2015/lib/validations/validation-autocomplete/validation-autocomplete.component.js +0 -151
  110. package/esm2015/lib/validations/validation-currency/validation-currency.component.js +0 -48
  111. package/esm2015/lib/validations/validation-date/validation-date.component.js +0 -165
  112. package/esm2015/lib/validations/validation-datetime/validation-datetime.component.js +0 -193
  113. package/esm2015/lib/validations/validation-input/validation-input.component.js +0 -186
  114. package/esm2015/lib/validations/validation-select/validation-select.component.js +0 -166
  115. package/esm2015/lib/validations/validation-text-area/validation-text-area.component.js +0 -52
  116. package/esm2015/public-api.js +0 -32
  117. package/fesm2015/esfaenza-forms-and-validations.js +0 -3262
  118. package/fesm2015/esfaenza-forms-and-validations.js.map +0 -1
@@ -0,0 +1,3562 @@
1
+ import * as i0 from '@angular/core';
2
+ import { InjectionToken, Directive, Input, Injectable, Inject, EventEmitter, ViewChild, Output, Optional, forwardRef, Component, ViewEncapsulation, ChangeDetectionStrategy, ContentChild, Self, Host, NgModule } from '@angular/core';
3
+ import * as i5 from '@angular/common';
4
+ import { CommonModule } from '@angular/common';
5
+ import * as i2$1 from '@angular/forms';
6
+ import { NG_VALIDATORS, RequiredValidator, NgControl, NG_ASYNC_VALIDATORS, NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
7
+ import * as i4$1 from '@angular/material/datepicker';
8
+ import { MatDatepickerModule } from '@angular/material/datepicker';
9
+ import * as i3 from '@angular/material/autocomplete';
10
+ import { MatAutocompleteModule } from '@angular/material/autocomplete';
11
+ import * as i4 from '@angular/material/input';
12
+ import { MatInputModule } from '@angular/material/input';
13
+ import * as i4$2 from '@angular/material/core';
14
+ import { MAT_DATE_LOCALE, MAT_DATE_FORMATS } from '@angular/material/core';
15
+ import * as i1 from '@esfaenza/localizations';
16
+ import { LocalizationService, LocalizationModule } from '@esfaenza/localizations';
17
+ import { DayJsDateAdapter, MatDayjsDateModule } from '@esfaenza/material-dayjs-adapter';
18
+ import * as i6 from '@esfaenza/ngx-currency-mask';
19
+ import { CurrencyMaskModule } from '@esfaenza/ngx-currency-mask';
20
+ import * as i4$3 from 'angular2-multiselect-dropdown';
21
+ import { AngularMultiSelectModule } from 'angular2-multiselect-dropdown';
22
+ import * as i2$3 from '@angular-material-components/datetime-picker';
23
+ import { NgxMatDatetimePickerModule, NgxMatTimepickerModule, NGX_MAT_DATE_FORMATS, NgxMatDateAdapter } from '@angular-material-components/datetime-picker';
24
+ import * as i7 from 'ngx-bootstrap/tooltip';
25
+ import { TooltipDirective, TooltipModule } from 'ngx-bootstrap/tooltip';
26
+ import * as i2 from '@angular/material/form-field';
27
+ import * as i2$2 from '@esfaenza/extensions';
28
+ import * as i2$4 from '@esfaenza/access-control';
29
+
30
+ /**
31
+ * Classe che identifica un file
32
+ */
33
+ class AppFile {
34
+ /**
35
+ * @ignore
36
+ */
37
+ constructor() {
38
+ this.filename = "";
39
+ this.fileb64 = "";
40
+ this.nativefiles = [];
41
+ }
42
+ }
43
+
44
+ /**
45
+ * Classe di configurazione del modulo
46
+ */
47
+ class FormsAndValidationsModuleConfig {
48
+ }
49
+
50
+ /**
51
+ * Token che indica la lingua da utilizzare, sono supportate "it-IT" ed "en-US"
52
+ */
53
+ const FAV_LOCALE = new InjectionToken('FAV_LOCALE');
54
+ /**
55
+ * Chiave che indica il prefisso dei Contesti Applicativi per permettere l'abilitazione/disabilitazione di input in maniera contestuale
56
+ */
57
+ const ACO_CUSTOMKEY = new InjectionToken('ACO_CUSTOMKEY');
58
+
59
+ // Angular
60
+ /**
61
+ * Direttiva utilizzata per validazioni "required" custom, in modo da poter dire che anche se c'è un valore selezionato, ma quel valore lo considero null
62
+ * allora la validazione fallisce. Attualmente usato nell'unico punto sensato: validation-select
63
+ */
64
+ class CustomRequiredDirective {
65
+ constructor() {
66
+ /**
67
+ * Lista di valori che vengono considerati "vuoti" seppur presenti
68
+ */
69
+ this.NullValues = [];
70
+ }
71
+ /**
72
+ * @ignore
73
+ */
74
+ validate(c) {
75
+ // Controllo solo per custom required a true, altrimenti qualsiasi valore mi va bene
76
+ if (this.customRequired != "true")
77
+ return null;
78
+ return !c.value || this.NullValues.includes(c.value) ? { required: true } : null;
79
+ }
80
+ }
81
+ CustomRequiredDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: CustomRequiredDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
82
+ CustomRequiredDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.1", type: CustomRequiredDirective, selector: "[customRequired]", inputs: { NullValues: ["CustomNullValues", "NullValues"], customRequired: "customRequired" }, providers: [{ provide: NG_VALIDATORS, useExisting: CustomRequiredDirective, multi: true }], ngImport: i0 });
83
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: CustomRequiredDirective, decorators: [{
84
+ type: Directive,
85
+ args: [{
86
+ selector: '[customRequired]',
87
+ providers: [{ provide: NG_VALIDATORS, useExisting: CustomRequiredDirective, multi: true }]
88
+ }]
89
+ }], propDecorators: { NullValues: [{
90
+ type: Input,
91
+ args: ["CustomNullValues"]
92
+ }], customRequired: [{
93
+ type: Input,
94
+ args: ['customRequired']
95
+ }] } });
96
+
97
+ //Angular
98
+ /**
99
+ * Espansione dell'adapter di default di DayJs già utilizzato per i bind base su Material.
100
+ *
101
+ * Questa versione serve unicamente per i controlli **datetime-picker**, ma dato che io l'adapter già lo avevo lato **esfaenza/material-dayjs-adapter**
102
+ * qui devo semplicemente aggiungere le funzioni non presenti nella mia implementazione che servono al **datetime-picker**
103
+ */
104
+ class NgxExpandedDayJsDateAdapter extends DayJsDateAdapter {
105
+ /**
106
+ * @ignore
107
+ */
108
+ constructor(dateLocale) {
109
+ super(dateLocale);
110
+ }
111
+ // Espando il mio DayJsDateAdapter con i metodi extra del NgxMatDateAdapter che servono per il material timepicker
112
+ // Non potendo fare "extends" da due classi mi tocca tenerlo così senza type safety....
113
+ /**
114
+ * Identifica se due date hanno lo stesso orario
115
+ *
116
+ * @param {DayJs} a Primo elemento del controllo
117
+ * @param {DayJs} b Secondo elemento del controllo
118
+ * @returns **true** se hanno lo stess orario, **false** altrimenti
119
+ */
120
+ isSameTime(a, b) {
121
+ if (a == null || b == null)
122
+ return true;
123
+ return this.getHour(a) === this.getHour(b)
124
+ && this.getMinute(a) === this.getMinute(b)
125
+ && this.getSecond(a) === this.getSecond(b);
126
+ }
127
+ /**
128
+ * Copia dell'orario da una data all'altra, Modifica direttamente l'oggetto **toDate**
129
+ *
130
+ * @param {DayJs} toDate Data in cui copiare l'orario
131
+ * @param {DayJs} fromDate Data da cui copiare l'orario
132
+ */
133
+ copyTime(toDate, fromDate) {
134
+ this.setHour(toDate, this.getHour(fromDate));
135
+ this.setMinute(toDate, this.getMinute(fromDate));
136
+ this.setSecond(toDate, this.getSecond(fromDate));
137
+ }
138
+ /**
139
+ * Mette a confronto due date
140
+ * @param {Dayjs} first Prima data da confrontare
141
+ * @param {Dayjs} second Seconda data da confrontare
142
+ * @param {boolean} showSeconds Indica se considerare anche i secondi, di default no
143
+ * @returns {number} 0 se le due date sono uguali, un numero minore di 0 se la prima data è precedente alla seconda e un numero maggiore di 0 altrimenti
144
+ */
145
+ compareDateWithTime(first, second, showSeconds) {
146
+ let res = super.compareDate(first, second) ||
147
+ this.getHour(first) - this.getHour(second) ||
148
+ this.getMinute(first) - this.getMinute(second);
149
+ if (showSeconds)
150
+ res = res || this.getSecond(first) - this.getSecond(second);
151
+ return res;
152
+ }
153
+ /**
154
+ * Assegna a una data i valori di ore, minuti e secondi di default.
155
+ *
156
+ * Se non specificati vengono assegnati degli '0'
157
+ *
158
+ * @param {DayJs} date Data a cui assegnare i valori di default
159
+ * @param {number[]} defaultTime Valori di default per ore, minuti e secondi, considerati 0 se non presenti
160
+ */
161
+ setTimeByDefaultValues(date, defaultTime) {
162
+ if (!Array.isArray(defaultTime)) {
163
+ throw Error('@Input DefaultTime should be an array');
164
+ }
165
+ this.setHour(date, defaultTime[0] || 0);
166
+ this.setMinute(date, defaultTime[1] || 0);
167
+ this.setSecond(date, defaultTime[2] || 0);
168
+ }
169
+ }
170
+ NgxExpandedDayJsDateAdapter.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: NgxExpandedDayJsDateAdapter, deps: [{ token: MAT_DATE_LOCALE }], target: i0.ɵɵFactoryTarget.Injectable });
171
+ NgxExpandedDayJsDateAdapter.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: NgxExpandedDayJsDateAdapter });
172
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: NgxExpandedDayJsDateAdapter, decorators: [{
173
+ type: Injectable
174
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
175
+ type: Inject,
176
+ args: [MAT_DATE_LOCALE]
177
+ }] }]; } });
178
+
179
+ // Angular
180
+ /**
181
+ * Classe astratta base che contiene le logiche / proprietà in comune a tutti i validatori
182
+ *
183
+ * Nota bene: I tooltip rallentano tantissimo la pagina perché il tizio che ha fatto ngx bootstrap non è capace
184
+ */
185
+ class BaseValidation {
186
+ constructor() {
187
+ /**
188
+ * Variabile per tenere in memoria il fatto che il componente è forzato a invalido o no
189
+ */
190
+ this._forceInvalid = false;
191
+ /**
192
+ * Indica se il valore è obbligatorio o opzionale
193
+ */
194
+ this.required = false;
195
+ /**
196
+ * Indica se di default deve valutare il messaggio di errore in base al validatore che fallisce.
197
+ *
198
+ * Se fallisce il required validator scriverà che l'input è obbligatorio, se invece fallisce
199
+ * un eventuale pattern validator scriverà che il formato dell'input è invalido
200
+ */
201
+ this.InferErrorMessages = true;
202
+ /**
203
+ * Messaggio da mostrare se la validazione fallisce.
204
+ *
205
+ * Se questo è valorizzato, il messaggio non viene valutato in automatico nonstante **InferErrorMessages** sia **true**
206
+ */
207
+ this.validationFailed = "";
208
+ /**
209
+ * Indica se il componente è in sola lettura
210
+ */
211
+ this.readonly = false;
212
+ /**
213
+ * Indica le dimensioni del componente
214
+ */
215
+ this.widthPx = null;
216
+ /**
217
+ * Indica se il componente è disabilitato o no (più o meno stesso concetto del readonly)
218
+ */
219
+ this.disabled = false;
220
+ /**
221
+ * Eventuale placeholder da mostrare al posto del valore quando il valore è nullo / vuoto
222
+ */
223
+ this.placeholder = "";
224
+ /**
225
+ * Classi da applicare al componente
226
+ */
227
+ this.class = "";
228
+ /**
229
+ * Stili da applicare al componente
230
+ */
231
+ this.style = "";
232
+ /**
233
+ * Pattern di validazione dell'input
234
+ */
235
+ this.pattern = "";
236
+ /**
237
+ * Indica di non validare il componente
238
+ */
239
+ this.noValidate = false;
240
+ /**
241
+ * Indica se abilitare o meno l'autocompletamento di default del browser
242
+ */
243
+ this.autocomplete = "off";
244
+ /**
245
+ * Evento che sostituisce l'ngModelChange facendolo funzionare in maniera un po' più consistente
246
+ */
247
+ this.inputChange = new EventEmitter();
248
+ /**
249
+ * @ignore
250
+ */
251
+ this.propagateChange = (_) => { };
252
+ }
253
+ /**
254
+ * Query che raccoglie il tooltip in maniera dinamica (ad ogni change detection)
255
+ *
256
+ * @param {TooltipDirective} comp Elemento HTML a cui è applicata la direttiva del tooltip
257
+ */
258
+ set tooltip_static(comp) {
259
+ if (comp) {
260
+ this.tooltip = comp;
261
+ }
262
+ }
263
+ ;
264
+ /**
265
+ * Query che raccoglie l'input o direttiva che contiene il valore in maniera dinamica (ad ogni change detection)
266
+ *
267
+ * @param {NgModel} comp Elemento HTML associato al ngModel del componente
268
+ */
269
+ set baseInput_static(comp) {
270
+ if (comp) {
271
+ this.baseInput = comp;
272
+ }
273
+ }
274
+ ;
275
+ /**
276
+ * Imposta il componente come "submitted" scatenandone le validazioni ed eventualmente la visualizzazione del tooltip di errore
277
+ *
278
+ * @param {boolean} val **true** se si vuole impostare questo controllo come submitted, **false** altrimenti
279
+ */
280
+ set submitted(val) {
281
+ this._submitted = val;
282
+ if (!this.baseInput)
283
+ return;
284
+ if (val)
285
+ this.baseInput.control.markAsTouched();
286
+ if (this.baseInput.control.status === "INVALID" && val)
287
+ this.showTooltipWithMessage();
288
+ else
289
+ this.tooltip.hide();
290
+ }
291
+ /**
292
+ * Imposta il componente come "invalid" a prescindere dai validatori
293
+ */
294
+ set forceInvalid(val) {
295
+ this._forceInvalid = val;
296
+ if (val)
297
+ setTimeout(() => this.baseInput.control.setErrors({ forcedtoinvalid: true }));
298
+ else
299
+ setTimeout(() => {
300
+ this.baseInput.control.setErrors({ forcedtoinvalid: null });
301
+ this.baseInput.control.updateValueAndValidity();
302
+ });
303
+ }
304
+ /**
305
+ * Helper che controlla se il tooltip deve essere mostrato o meno,
306
+ * richiamato direttamente dall'HTML dei componenti
307
+ */
308
+ checkTooltip() {
309
+ if ((this.baseInput.invalid && this.baseInput.touched))
310
+ this.showTooltipWithMessage();
311
+ }
312
+ /**
313
+ * Helper che calcola il messaggio da mostrare nel tooltip che andrà ad aprire
314
+ */
315
+ showTooltipWithMessage() {
316
+ this.validationFailed = this.validationFailed ? this.validationFailed : this.InferErrorMessages ? this.inferMessage() : "";
317
+ if (this.validationFailed)
318
+ this.tooltip.show();
319
+ }
320
+ /**
321
+ * Calcola il messaggio da mostrare in base al valore.
322
+ *
323
+ * Entrare in questa funzione significa che lo stato di validazione è fallito, per questo si comporta semplicemente in maniera esclusiva, e cioè:
324
+ *
325
+ * 1) Se ero required e sono senza valore --> Input richiesto
326
+ *
327
+ * 2) Altrimenti se ho un valore --> Di sicuro il formato è errato
328
+ */
329
+ inferMessage() {
330
+ if (this.required && !this.baseInput.value)
331
+ return this.lc.loc("Required Input");
332
+ if (this.baseInput.value)
333
+ return this.lc.loc("Invalid Input Format");
334
+ }
335
+ /**
336
+ * Forza la chiusura del tooltip
337
+ */
338
+ closeTooltip() {
339
+ this.tooltip.hide();
340
+ }
341
+ /**
342
+ * Controlla se il controllo è valido e in caso lo sia chiude il tooltip
343
+ */
344
+ CheckValidity() {
345
+ if (!this.baseInput.statusChanges)
346
+ return;
347
+ this.baseInput.statusChanges.subscribe(event => {
348
+ if (event === "VALID")
349
+ this.tooltip.hide();
350
+ });
351
+ }
352
+ /**
353
+ * @ignore
354
+ */
355
+ setDisabledState(isDisabled) {
356
+ isDisabled ? this.baseInput.control.disable() : this.baseInput.control.enable();
357
+ this.readonly = isDisabled;
358
+ }
359
+ }
360
+ BaseValidation.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: BaseValidation, deps: [], target: i0.ɵɵFactoryTarget.Directive });
361
+ BaseValidation.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.1", type: BaseValidation, inputs: { InferErrorMessages: "InferErrorMessages", validationFailed: "validationFailed", readonly: "readonly", widthPx: "widthPx", disabled: "disabled", placeholder: "placeholder", class: "class", style: "style", pattern: "pattern", noValidate: "noValidate", autocomplete: "autocomplete", submitted: "submitted", forceInvalid: "forceInvalid" }, outputs: { inputChange: "inputChange" }, viewQueries: [{ propertyName: "tooltip", first: true, predicate: TooltipDirective, descendants: true }, { propertyName: "tooltip_static", first: true, predicate: TooltipDirective, descendants: true, static: true }, { propertyName: "baseInput", first: true, predicate: ["baseInput"], descendants: true }, { propertyName: "baseInput_static", first: true, predicate: ["baseInput"], descendants: true, static: true }], ngImport: i0 });
362
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: BaseValidation, decorators: [{
363
+ type: Directive
364
+ }], propDecorators: { tooltip: [{
365
+ type: ViewChild,
366
+ args: [TooltipDirective, { static: false }]
367
+ }], tooltip_static: [{
368
+ type: ViewChild,
369
+ args: [TooltipDirective, { static: true }]
370
+ }], baseInput: [{
371
+ type: ViewChild,
372
+ args: ["baseInput", { static: false }]
373
+ }], baseInput_static: [{
374
+ type: ViewChild,
375
+ args: ["baseInput", { static: true }]
376
+ }], InferErrorMessages: [{
377
+ type: Input
378
+ }], validationFailed: [{
379
+ type: Input
380
+ }], readonly: [{
381
+ type: Input
382
+ }], widthPx: [{
383
+ type: Input
384
+ }], disabled: [{
385
+ type: Input
386
+ }], placeholder: [{
387
+ type: Input
388
+ }], class: [{
389
+ type: Input
390
+ }], style: [{
391
+ type: Input
392
+ }], pattern: [{
393
+ type: Input
394
+ }], noValidate: [{
395
+ type: Input
396
+ }], autocomplete: [{
397
+ type: Input
398
+ }], inputChange: [{
399
+ type: Output
400
+ }], submitted: [{
401
+ type: Input,
402
+ args: ["submitted"]
403
+ }], forceInvalid: [{
404
+ type: Input
405
+ }] } });
406
+
407
+ /**
408
+ * Classe di localizzazione in comune con tutti i Componenti di validazione
409
+ */
410
+ class BaseValidationLoc extends LocalizationService {
411
+ /**
412
+ * @ignore
413
+ */
414
+ constructor(LOC_LOCALE) {
415
+ super(LOC_LOCALE ?? 'it-IT');
416
+ super.set("en->it", "Required Input", ["Input Richiesto"]);
417
+ super.set("en->it", "Invalid Input Format", ["Formato Input Invalido"]);
418
+ }
419
+ }
420
+ BaseValidationLoc.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: BaseValidationLoc, deps: [{ token: FAV_LOCALE, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
421
+ BaseValidationLoc.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: BaseValidationLoc });
422
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: BaseValidationLoc, decorators: [{
423
+ type: Injectable
424
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
425
+ type: Optional
426
+ }, {
427
+ type: Inject,
428
+ args: [FAV_LOCALE]
429
+ }] }]; } });
430
+
431
+ // Angular
432
+ /**
433
+ * Componente di validaizone per gli input a selezione singola
434
+ */
435
+ class ValidationSelectComponent extends BaseValidation {
436
+ /**
437
+ * @ignore
438
+ */
439
+ constructor(_validators, _asyncValidators, injector, cdr, lc) {
440
+ super();
441
+ this._validators = _validators;
442
+ this._asyncValidators = _asyncValidators;
443
+ this.injector = injector;
444
+ this.cdr = cdr;
445
+ this.lc = lc;
446
+ /**
447
+ * valore del campo vuoto della select
448
+ */
449
+ this.emptyFieldValue = "-2";
450
+ /**
451
+ * Valore del placeholder
452
+ */
453
+ this.placeHolderValue = "-1";
454
+ /**
455
+ * Per i componenti non obbligatori indica se fornire un "valore vuoto"
456
+ */
457
+ this.emptyValue = true;
458
+ /**
459
+ * Indica se mostrare o nascondere il simboletto di validazione (Tic verde o Croce rossa)
460
+ */
461
+ this.showValidationSymbol = true;
462
+ /**
463
+ * Contenuto della label Floattante Material-Style
464
+ */
465
+ this.label = "";
466
+ /**
467
+ * Evento richiamato quando si perde il focus sull'input di inserimento
468
+ */
469
+ this.onBlur = new EventEmitter();
470
+ /**
471
+ * @ignore
472
+ */
473
+ this.onTouched = () => { }; //placeholder on touched function
474
+ }
475
+ /**
476
+ * @ignore
477
+ */
478
+ ngOnInit() {
479
+ //controllo se è settato un required per decidere in maniera condizionale se utilizzare il validatore required nel componente interno
480
+ //Lo imposto ANCHE se sono in situazione di noValidate perché comporta eventuali modifiche grafiche che potrebbero servirmi, ma comunque non va a d aggiungere
481
+ //validatori o cose strane, quindi GG
482
+ if (this._validators && this._validators.some(elem => elem instanceof RequiredValidator && elem.required))
483
+ this.required = true;
484
+ }
485
+ /**
486
+ * @ignore
487
+ */
488
+ ngOnDestroy() {
489
+ if (this.tooltipSubscription)
490
+ this.tooltipSubscription.unsubscribe();
491
+ }
492
+ /**
493
+ * @ignore
494
+ */
495
+ ngAfterViewInit() {
496
+ this.postBinding();
497
+ }
498
+ /**
499
+ * Metodo che si occupa di collegare i validatori e la funzione di reset dal **ControlValueAccessor** rappresentato
500
+ * da questo componente al **ControlValueAccessor** rappresentato dall'effettivo elemento di Input presente lato HTML
501
+ */
502
+ postBinding() {
503
+ // Eredito i validatori
504
+ if (!this.noValidate) {
505
+ this.baseInput.control.setAsyncValidators(this._asyncValidators);
506
+ this.baseInput.control.setValidators(this._validators);
507
+ }
508
+ this.CheckValidity();
509
+ const ngControl = this.injector.get(NgControl, null);
510
+ if (ngControl) {
511
+ this.parentControl = ngControl.control;
512
+ // se la variabile novalidate è true, elimino tutti i validatori eventualmente inseriti
513
+ if (this.noValidate) {
514
+ this.parentControl.clearValidators();
515
+ this.parentControl.clearAsyncValidators();
516
+ }
517
+ // faccio in modo che se chiamo il reset del controllo (o della form) dall'esterno si resetti anche il controllo nativo
518
+ const origFunc = this.parentControl.reset;
519
+ this.parentControl.reset = () => {
520
+ origFunc.apply(this.parentControl);
521
+ this.baseInput.control.reset();
522
+ this.tooltip.hide();
523
+ };
524
+ }
525
+ }
526
+ /**
527
+ * @ignore
528
+ */
529
+ writeValue(value) {
530
+ this.value = value;
531
+ this.propagateChange(value);
532
+ this.cdr.markForCheck();
533
+ }
534
+ /**
535
+ * L'emit della modifica al valore viene gestito su un evento custom (**inputChange**) come workaround al malfunzionamento dell'**ngModelChange** nativo
536
+ *
537
+ * @param {any} toEmit valore da propagare all'esterno
538
+ */
539
+ onModelChange(toEmit) {
540
+ this.writeValue(toEmit);
541
+ this.inputChange.emit(toEmit);
542
+ this.onTouched();
543
+ }
544
+ /**
545
+ * @ignore
546
+ */
547
+ registerOnChange(fn) {
548
+ this.propagateChange = fn;
549
+ }
550
+ /**
551
+ * @ignore
552
+ */
553
+ registerOnTouched(fn) {
554
+ this.onTouched = fn;
555
+ }
556
+ }
557
+ ValidationSelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ValidationSelectComponent, deps: [{ token: NG_VALIDATORS, optional: true }, { token: NG_ASYNC_VALIDATORS, optional: true }, { token: i0.Injector }, { token: i0.ChangeDetectorRef }, { token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
558
+ ValidationSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: ValidationSelectComponent, selector: "val-select", inputs: { emptyFieldValue: "emptyFieldValue", placeHolderValue: "placeHolderValue", emptyValue: "emptyValue", showValidationSymbol: "showValidationSymbol", label: "label" }, outputs: { onBlur: "onBlur" }, providers: [
559
+ { provide: LocalizationService, useClass: BaseValidationLoc },
560
+ {
561
+ provide: NG_VALUE_ACCESSOR,
562
+ useExisting: forwardRef(() => ValidationSelectComponent),
563
+ multi: true
564
+ }
565
+ ], usesInheritance: true, ngImport: i0, template: "<mat-form-field appearance=\"outline\" class=\"mat-full-width mat-no-border-top mat-height-fixed\" [style.width.px]=\"widthPx\">\r\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\r\n <select matNativeControl\r\n #baseInput=\"ngModel\"\r\n name=\"val-select\"\r\n class=\"form-control\"\r\n triggers=\"\"\r\n placement=\"top\"\r\n [customRequired]=\"required ? 'true' : 'false'\"\r\n [CustomNullValues]=\"[placeHolderValue,emptyFieldValue]\"\r\n [(ngModel)]=\"value\"\r\n [tooltip]=\"tolTemplate\"\r\n [class.checking-combo]=\"!noValidate\"\r\n [class.app-option-placeholder]=\"baseInput.value === placeHolderValue\"\r\n [class.no-bg-img]=\"!showValidationSymbol\"\r\n [disabled]=\"readonly\"\r\n (focus)=\"checkTooltip()\"\r\n (blur)=\"closeTooltip(); onBlur.emit(true);\"\r\n (ngModelChange)=\"onModelChange($event)\">\r\n\r\n <option *ngIf=\"placeholder\" [value]=\"placeHolderValue\" disabled selected hidden>{{placeholder}}</option>\r\n <option *ngIf=\"required == false && emptyValue\" [value]=\"emptyFieldValue\"></option>\r\n <ng-content></ng-content>\r\n </select>\r\n</mat-form-field>\r\n\r\n<ng-template #tolTemplate>\r\n <div (click)=\"closeTooltip()\">\r\n <span>{{validationFailed}}</span>\r\n </div>\r\n</ng-template>", styles: [".tooltip-inner{background-color:#842a30;color:#fff;font-size:12px;width:max-content}.tooltip{margin:auto auto auto 20%!important}.tooltip-inner{background-color:#842a30!important;color:#fff}.tooltip.top .tooltip-arrow:before,.tooltip.top .tooltip-arrow{border-top-color:#842a30}.close-button{position:absolute;right:0em;top:-.2em;float:right;font-size:16px;font-weight:700;color:inherit;text-shadow:0 1px 0 #fff;opacity:.5}.close-button:hover,.close-button:focus{text-decoration:none;cursor:pointer;opacity:.75}\n"], components: [{ type: i2.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }], directives: [{ type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.MatLabel, selector: "mat-label" }, { type: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i2$1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { type: CustomRequiredDirective, selector: "[customRequired]", inputs: ["CustomNullValues", "customRequired"] }, { type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i7.TooltipDirective, selector: "[tooltip], [tooltipHtml]", inputs: ["adaptivePosition", "placement", "triggers", "containerClass", "isDisabled", "delay", "tooltipAnimation", "tooltipFadeDuration", "isOpen", "tooltipHtml", "tooltip", "tooltipPlacement", "tooltipIsOpen", "tooltipEnable", "tooltipAppendToBody", "container", "tooltipClass", "tooltipContext", "tooltipPopupDelay", "tooltipTrigger", "boundariesElement"], outputs: ["tooltipChange", "tooltipStateChanged", "onShown", "onHidden"], exportAs: ["bs-tooltip"] }, { type: i2$1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i2$1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
566
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ValidationSelectComponent, decorators: [{
567
+ type: Component,
568
+ args: [{ selector: "val-select", encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, providers: [
569
+ { provide: LocalizationService, useClass: BaseValidationLoc },
570
+ {
571
+ provide: NG_VALUE_ACCESSOR,
572
+ useExisting: forwardRef(() => ValidationSelectComponent),
573
+ multi: true
574
+ }
575
+ ], template: "<mat-form-field appearance=\"outline\" class=\"mat-full-width mat-no-border-top mat-height-fixed\" [style.width.px]=\"widthPx\">\r\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\r\n <select matNativeControl\r\n #baseInput=\"ngModel\"\r\n name=\"val-select\"\r\n class=\"form-control\"\r\n triggers=\"\"\r\n placement=\"top\"\r\n [customRequired]=\"required ? 'true' : 'false'\"\r\n [CustomNullValues]=\"[placeHolderValue,emptyFieldValue]\"\r\n [(ngModel)]=\"value\"\r\n [tooltip]=\"tolTemplate\"\r\n [class.checking-combo]=\"!noValidate\"\r\n [class.app-option-placeholder]=\"baseInput.value === placeHolderValue\"\r\n [class.no-bg-img]=\"!showValidationSymbol\"\r\n [disabled]=\"readonly\"\r\n (focus)=\"checkTooltip()\"\r\n (blur)=\"closeTooltip(); onBlur.emit(true);\"\r\n (ngModelChange)=\"onModelChange($event)\">\r\n\r\n <option *ngIf=\"placeholder\" [value]=\"placeHolderValue\" disabled selected hidden>{{placeholder}}</option>\r\n <option *ngIf=\"required == false && emptyValue\" [value]=\"emptyFieldValue\"></option>\r\n <ng-content></ng-content>\r\n </select>\r\n</mat-form-field>\r\n\r\n<ng-template #tolTemplate>\r\n <div (click)=\"closeTooltip()\">\r\n <span>{{validationFailed}}</span>\r\n </div>\r\n</ng-template>", styles: [".tooltip-inner{background-color:#842a30;color:#fff;font-size:12px;width:max-content}.tooltip{margin:auto auto auto 20%!important}.tooltip-inner{background-color:#842a30!important;color:#fff}.tooltip.top .tooltip-arrow:before,.tooltip.top .tooltip-arrow{border-top-color:#842a30}.close-button{position:absolute;right:0em;top:-.2em;float:right;font-size:16px;font-weight:700;color:inherit;text-shadow:0 1px 0 #fff;opacity:.5}.close-button:hover,.close-button:focus{text-decoration:none;cursor:pointer;opacity:.75}\n"] }]
576
+ }], ctorParameters: function () { return [{ type: Array, decorators: [{
577
+ type: Optional
578
+ }, {
579
+ type: Inject,
580
+ args: [NG_VALIDATORS]
581
+ }] }, { type: Array, decorators: [{
582
+ type: Optional
583
+ }, {
584
+ type: Inject,
585
+ args: [NG_ASYNC_VALIDATORS]
586
+ }] }, { type: i0.Injector }, { type: i0.ChangeDetectorRef }, { type: i1.LocalizationService }]; }, propDecorators: { emptyFieldValue: [{
587
+ type: Input
588
+ }], placeHolderValue: [{
589
+ type: Input
590
+ }], emptyValue: [{
591
+ type: Input
592
+ }], showValidationSymbol: [{
593
+ type: Input
594
+ }], label: [{
595
+ type: Input
596
+ }], onBlur: [{
597
+ type: Output
598
+ }] } });
599
+
600
+ // Angular
601
+ /**
602
+ * Componente di validaizone per gli input di tipo data
603
+ */
604
+ class ValidationDateComponent extends BaseValidation {
605
+ /**
606
+ * @ignore
607
+ */
608
+ constructor(cdr, _validators, _asyncValidators, injector, lc, dateExts) {
609
+ super();
610
+ this.cdr = cdr;
611
+ this._validators = _validators;
612
+ this._asyncValidators = _asyncValidators;
613
+ this.injector = injector;
614
+ this.lc = lc;
615
+ this.dateExts = dateExts;
616
+ /**
617
+ * Utilizza il Date di Javascript come modello in uscita. Il modello in entrata verrà comunque ricondotto a un DayJs
618
+ */
619
+ this.useJsDates = false;
620
+ /**
621
+ * @ignore
622
+ */
623
+ this.onTouched = () => { };
624
+ }
625
+ /**
626
+ * @ignore
627
+ */
628
+ ngOnInit() {
629
+ //controllo se è settato un required per decidere in maniera condizionale se utilizzare il validatore required nel componente interno
630
+ if (this._validators && !this.noValidate && this._validators.some(elem => elem instanceof RequiredValidator))
631
+ this.required = true;
632
+ this._format = this.lc.token("getSmallDateDisplayFormat");
633
+ }
634
+ /**
635
+ * @ignore
636
+ */
637
+ ngAfterViewInit() {
638
+ this.postBinding();
639
+ }
640
+ /**
641
+ * Metodo che si occupa di collegare i validatori e la funzione di reset dal **ControlValueAccessor** rappresentato
642
+ * da questo componente al **ControlValueAccessor** rappresentato dall'effettivo elemento di Input presente lato HTML
643
+ */
644
+ postBinding() {
645
+ this.CheckValidity();
646
+ const ngControl = this.injector.get(NgControl, null);
647
+ if (ngControl) {
648
+ this.parentControl = ngControl.control;
649
+ if (this.noValidate) {
650
+ this.parentControl.clearValidators();
651
+ this.parentControl.clearAsyncValidators();
652
+ }
653
+ else {
654
+ this.baseInput.control.setAsyncValidators(this._asyncValidators);
655
+ this.baseInput.control.setValidators(this._validators);
656
+ }
657
+ // //faccio in modo che se chiamo il reset del controllo (o della form) dall'esterno si resetti anche il controllo nativo
658
+ //faccio in modo che se chiamo il reset del controllo (o della form) dall'esterno si resetti anche il controllo nativo
659
+ const origFunc = this.parentControl.reset;
660
+ this.parentControl.reset = () => {
661
+ origFunc.apply(this.parentControl);
662
+ this.baseInput.control.reset();
663
+ this.tooltip.hide();
664
+ };
665
+ }
666
+ }
667
+ /**
668
+ * @ignore
669
+ */
670
+ writeValue(value) {
671
+ if (!value) {
672
+ this.value = null;
673
+ if (this.baseInput)
674
+ this.baseInput.reset();
675
+ }
676
+ else {
677
+ var date = null;
678
+ if (this.useJsDates) {
679
+ date = this.dateExts.getDateConvertion(value);
680
+ if (date) {
681
+ this.propagateChange(date.toDate());
682
+ this.inputChange.emit(date.toDate());
683
+ }
684
+ }
685
+ else
686
+ date = dayjs(value, this.lc.token("getSmallDateFormat"));
687
+ this.value = date;
688
+ }
689
+ this.cdr.markForCheck();
690
+ }
691
+ /**
692
+ * Metodo che si occupa di, eventualmente, aggiustare il valore da propagare ed emetterlo
693
+ *
694
+ * L'emit della modifica al valore viene gestito su un evento custom (**inputChange**) come workaround al malfunzionamento dell'**ngModelChange** nativo
695
+ *
696
+ * @param {any} toEmit valore da propagare all'esterno
697
+ */
698
+ outputValue(toEmit) {
699
+ let value = toEmit.value;
700
+ let propagateValue;
701
+ if (!value)
702
+ propagateValue = null;
703
+ else if (!this.useJsDates)
704
+ propagateValue = value.format(this.lc.token("getSmallDateFormat"));
705
+ else {
706
+ if (value && value.isValid())
707
+ propagateValue = value.hour(0).minute(0).second(0).toDate();
708
+ else
709
+ propagateValue = null;
710
+ }
711
+ this.propagateChange(propagateValue);
712
+ this.inputChange.emit(propagateValue);
713
+ this.onTouched();
714
+ }
715
+ /**
716
+ * @ignore
717
+ */
718
+ registerOnChange(fn) {
719
+ this.propagateChange = fn;
720
+ }
721
+ /**
722
+ * @ignore
723
+ */
724
+ registerOnTouched(fn) {
725
+ this.onTouched = fn;
726
+ }
727
+ }
728
+ ValidationDateComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ValidationDateComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: NG_VALIDATORS, optional: true }, { token: NG_ASYNC_VALIDATORS, optional: true }, { token: i0.Injector }, { token: i1.LocalizationService }, { token: i2$2.DateService }], target: i0.ɵɵFactoryTarget.Component });
729
+ ValidationDateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: ValidationDateComponent, selector: "val-date", inputs: { useJsDates: "useJsDates" }, providers: [
730
+ { provide: LocalizationService, useClass: BaseValidationLoc },
731
+ {
732
+ provide: NG_VALUE_ACCESSOR,
733
+ useExisting: forwardRef(() => ValidationDateComponent),
734
+ multi: true
735
+ }
736
+ ], usesInheritance: true, ngImport: i0, template: "<mat-form-field appearance=\"outline\" class=\"mat-full-width mat-no-border-top mat-height-fixed\" [style.width.px]=\"widthPx\">\r\n <mat-label *ngIf=\"placeholder\">{{placeholder}}</mat-label>\r\n <input matInput\r\n [matDatepicker]=\"datepicker\"\r\n #baseInput=\"ngModel\"\r\n type=\"text\"\r\n triggers=\"\"\r\n placement=\"top\"\r\n name=\"val-date\"\r\n class=\"form-control {{class}}\"\r\n autocomplete=\"{{autocomplete}}\"\r\n [(ngModel)]=\"value\"\r\n [class.checking-field]=\"!noValidate\"\r\n [tooltip]=\"tolTemplate\"\r\n [placeholder]=\"placeholder ? '' : _format\"\r\n [disabled]=\"readonly || disabled\"\r\n [isDisabled]=\"readonly || disabled\"\r\n (dateChange)=\"outputValue($event)\" />\r\n <mat-datepicker-toggle matSuffix [for]=\"datepicker\"></mat-datepicker-toggle>\r\n <mat-datepicker #datepicker></mat-datepicker>\r\n</mat-form-field>\r\n\r\n<ng-template #tolTemplate>\r\n <div (click)=\"closeTooltip()\">\r\n <span>{{validationFailed}}</span>\r\n </div>\r\n</ng-template>", styles: [".tooltip-inner{background-color:#842a30;color:#fff;font-size:12px;width:max-content}.tooltip{margin:auto auto auto 20%!important}.tooltip-inner{background-color:#842a30!important;color:#fff}.tooltip.top .tooltip-arrow:before,.tooltip.top .tooltip-arrow{border-top-color:#842a30}.close-button{position:absolute;right:0em;top:-.2em;float:right;font-size:16px;font-weight:700;color:inherit;text-shadow:0 1px 0 #fff;opacity:.5}.close-button:hover,.close-button:focus{text-decoration:none;cursor:pointer;opacity:.75}\n"], components: [{ type: i2.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i4$1.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { type: i4$1.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }], directives: [{ type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.MatLabel, selector: "mat-label" }, { type: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i4$1.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { type: i2$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i7.TooltipDirective, selector: "[tooltip], [tooltipHtml]", inputs: ["adaptivePosition", "placement", "triggers", "containerClass", "isDisabled", "delay", "tooltipAnimation", "tooltipFadeDuration", "isOpen", "tooltipHtml", "tooltip", "tooltipPlacement", "tooltipIsOpen", "tooltipEnable", "tooltipAppendToBody", "container", "tooltipClass", "tooltipContext", "tooltipPopupDelay", "tooltipTrigger", "boundariesElement"], outputs: ["tooltipChange", "tooltipStateChanged", "onShown", "onHidden"], exportAs: ["bs-tooltip"] }, { type: i2.MatSuffix, selector: "[matSuffix]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
737
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ValidationDateComponent, decorators: [{
738
+ type: Component,
739
+ args: [{ selector: "val-date", encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, providers: [
740
+ { provide: LocalizationService, useClass: BaseValidationLoc },
741
+ {
742
+ provide: NG_VALUE_ACCESSOR,
743
+ useExisting: forwardRef(() => ValidationDateComponent),
744
+ multi: true
745
+ }
746
+ ], template: "<mat-form-field appearance=\"outline\" class=\"mat-full-width mat-no-border-top mat-height-fixed\" [style.width.px]=\"widthPx\">\r\n <mat-label *ngIf=\"placeholder\">{{placeholder}}</mat-label>\r\n <input matInput\r\n [matDatepicker]=\"datepicker\"\r\n #baseInput=\"ngModel\"\r\n type=\"text\"\r\n triggers=\"\"\r\n placement=\"top\"\r\n name=\"val-date\"\r\n class=\"form-control {{class}}\"\r\n autocomplete=\"{{autocomplete}}\"\r\n [(ngModel)]=\"value\"\r\n [class.checking-field]=\"!noValidate\"\r\n [tooltip]=\"tolTemplate\"\r\n [placeholder]=\"placeholder ? '' : _format\"\r\n [disabled]=\"readonly || disabled\"\r\n [isDisabled]=\"readonly || disabled\"\r\n (dateChange)=\"outputValue($event)\" />\r\n <mat-datepicker-toggle matSuffix [for]=\"datepicker\"></mat-datepicker-toggle>\r\n <mat-datepicker #datepicker></mat-datepicker>\r\n</mat-form-field>\r\n\r\n<ng-template #tolTemplate>\r\n <div (click)=\"closeTooltip()\">\r\n <span>{{validationFailed}}</span>\r\n </div>\r\n</ng-template>", styles: [".tooltip-inner{background-color:#842a30;color:#fff;font-size:12px;width:max-content}.tooltip{margin:auto auto auto 20%!important}.tooltip-inner{background-color:#842a30!important;color:#fff}.tooltip.top .tooltip-arrow:before,.tooltip.top .tooltip-arrow{border-top-color:#842a30}.close-button{position:absolute;right:0em;top:-.2em;float:right;font-size:16px;font-weight:700;color:inherit;text-shadow:0 1px 0 #fff;opacity:.5}.close-button:hover,.close-button:focus{text-decoration:none;cursor:pointer;opacity:.75}\n"] }]
747
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: Array, decorators: [{
748
+ type: Optional
749
+ }, {
750
+ type: Inject,
751
+ args: [NG_VALIDATORS]
752
+ }] }, { type: Array, decorators: [{
753
+ type: Optional
754
+ }, {
755
+ type: Inject,
756
+ args: [NG_ASYNC_VALIDATORS]
757
+ }] }, { type: i0.Injector }, { type: i1.LocalizationService }, { type: i2$2.DateService }]; }, propDecorators: { useJsDates: [{
758
+ type: Input
759
+ }] } });
760
+
761
+ // Angular
762
+ /**
763
+ * Componente di validaizone per gli input a semplice casella di testo
764
+ */
765
+ class ValidationInputComponent extends BaseValidation {
766
+ /**
767
+ * @ignore
768
+ */
769
+ constructor(cdr, _validators, _asyncValidators, injector, lc) {
770
+ super();
771
+ this.cdr = cdr;
772
+ this._validators = _validators;
773
+ this._asyncValidators = _asyncValidators;
774
+ this.injector = injector;
775
+ this.lc = lc;
776
+ /**
777
+ * Indica se questo Comopnente deve rappresentare un oggetto di Input di tipo "Password"
778
+ */
779
+ this.Password = false;
780
+ /**
781
+ * Indica se deve mostrare un indicazione di warning nel suffisso
782
+ */
783
+ this.showWarning = false;
784
+ /**
785
+ * Classe del warning eventualmente modificabile.
786
+ *
787
+ * Default: "fa fa-warning"
788
+ */
789
+ this.warningClass = "fa fa-warning";
790
+ /**
791
+ * Identifica se il testo di un componente di tipo "password" dev'essere visualizzato o meno
792
+ */
793
+ this.passShown = false;
794
+ /**
795
+ * Tipo del componente, può essere "text" o "password" e viene impostato automaticamente dall'Input **Password**
796
+ */
797
+ this.type = "text";
798
+ /**
799
+ * Indicazione se il componente ha o meno un suffisso.
800
+ *
801
+ * Valorizzato a **true** solo se viene trovata una proiezione su **suffix_internal** o se l'Input **showWarning** viene impostato a **true**
802
+ */
803
+ this.HasSuffix = false;
804
+ /**
805
+ * Indicazione se il componente ha o meno un prefisso.
806
+ *
807
+ * Valorizzato a **true** solo se viene trovata una proiezione su **prefix_internal**
808
+ */
809
+ this.HasPrefix = false;
810
+ /**
811
+ * @ignore
812
+ */
813
+ this.onTouched = () => { };
814
+ }
815
+ /**
816
+ * @ignore
817
+ */
818
+ ngOnInit() {
819
+ //controllo se è settato un required per decidere in maniera condizionale se utilizzare il validatore required nel componente interno
820
+ if (this._validators && !this.noValidate && this._validators.some(elem => elem instanceof RequiredValidator))
821
+ this.required = true;
822
+ if (this.Password)
823
+ this.type = "password";
824
+ }
825
+ /**
826
+ * @ignore
827
+ */
828
+ ngOnDestroy() {
829
+ if (this.tooltipSubscription)
830
+ this.tooltipSubscription.unsubscribe();
831
+ }
832
+ /**
833
+ * @ignore
834
+ */
835
+ ngAfterViewInit() {
836
+ this.HasSuffix = !!this.suffix_internal || this.showWarning;
837
+ this.HasPrefix = !!this.prefix_internal;
838
+ this.postBinding();
839
+ }
840
+ /**
841
+ * @ignore
842
+ */
843
+ ngOnChanges(changes) {
844
+ const newShowWarnings = changes["showWarning"];
845
+ if (newShowWarnings)
846
+ this.HasSuffix = !!this.suffix_internal || this.showWarning;
847
+ }
848
+ /**
849
+ * Metodo che si occupa di collegare i validatori e la funzione di reset dal **ControlValueAccessor** rappresentato
850
+ * da questo componente al **ControlValueAccessor** rappresentato dall'effettivo elemento di Input presente lato HTML
851
+ */
852
+ postBinding() {
853
+ this.CheckValidity();
854
+ const ngControl = this.injector.get(NgControl, null);
855
+ if (ngControl) {
856
+ this.parentControl = ngControl.control;
857
+ // Se la variabile novalidate è true, elimino tutti i validatori eventualmente inseriti
858
+ if (this.noValidate) {
859
+ this.parentControl.clearValidators();
860
+ this.parentControl.clearAsyncValidators();
861
+ }
862
+ else {
863
+ this.baseInput.control.setAsyncValidators(this._asyncValidators);
864
+ this.baseInput.control.setValidators(this._validators);
865
+ }
866
+ // Faccio in modo che se chiamo il reset del controllo (o della form) dall'esterno si resetti anche il controllo nativo
867
+ const origFunc = this.parentControl.reset;
868
+ this.parentControl.reset = () => {
869
+ origFunc.apply(this.parentControl);
870
+ this.baseInput.control.reset();
871
+ this.tooltip.hide();
872
+ };
873
+ }
874
+ }
875
+ /**
876
+ * @ignore
877
+ */
878
+ writeValue(value) {
879
+ this.value = value;
880
+ this.propagateChange(value);
881
+ this.cdr.markForCheck();
882
+ }
883
+ /**
884
+ * L'emit della modifica al valore viene gestito su un evento custom (**inputChange**) come workaround al malfunzionamento dell'**ngModelChange** nativo
885
+ *
886
+ * @param {any} toEmit valore da propagare all'esterno
887
+ */
888
+ onModelChange(toEmit) {
889
+ this.writeValue(toEmit);
890
+ this.inputChange.emit(toEmit);
891
+ this.onTouched();
892
+ }
893
+ /**
894
+ * @ignore
895
+ */
896
+ registerOnChange(fn) {
897
+ this.propagateChange = fn;
898
+ }
899
+ /**
900
+ * @ignore
901
+ */
902
+ registerOnTouched(fn) {
903
+ this.onTouched = fn;
904
+ }
905
+ }
906
+ ValidationInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ValidationInputComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: NG_VALIDATORS, optional: true }, { token: NG_ASYNC_VALIDATORS, optional: true }, { token: i0.Injector }, { token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
907
+ ValidationInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: ValidationInputComponent, selector: "val-input", inputs: { Password: "Password", showWarning: "showWarning", warningTitle: "warningTitle", warningClass: "warningClass", value: "value" }, providers: [
908
+ { provide: LocalizationService, useClass: BaseValidationLoc },
909
+ {
910
+ provide: NG_VALUE_ACCESSOR,
911
+ useExisting: forwardRef(() => ValidationInputComponent),
912
+ multi: true
913
+ }
914
+ ], queries: [{ propertyName: "suffix_internal", first: true, predicate: ["suffix_internal"], descendants: true }, { propertyName: "prefix_internal", first: true, predicate: ["prefix_internal"], descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<mat-form-field appearance=\"outline\" class=\"mat-full-width mat-no-border-top mat-height-fixed\" [style.width.px]=\"widthPx\">\r\n <mat-label [class.app-margin-left-25]=\"HasPrefix\" *ngIf=\"placeholder\">{{placeholder}}</mat-label>\r\n <ng-container *ngIf=\"HasPrefix\">\r\n <ng-container *ngTemplateOutlet=\"prefix_internal\"></ng-container>\r\n </ng-container>\r\n\r\n <input matInput\r\n #baseInput='ngModel'\r\n type=\"{{type}}\"\r\n triggers=\"\"\r\n placement=\"top\"\r\n autocomplete=\"{{autocomplete}}\"\r\n name=\"val-input\"\r\n class=\"form-control {{class}}\"\r\n [class.app-margin-left-25]=\"HasPrefix\"\r\n [class.mat-input-with-suffix]=\"HasSuffix || Password || showWarning\"\r\n [(ngModel)]=\"value\"\r\n [class.checking-field]=\"!noValidate && !showWarning\"\r\n [tooltip]=\"tolTemplate\"\r\n [disabled]=\"readonly || disabled\"\r\n (ngModelChange)=\"onModelChange($event)\"\r\n (focus)=\"checkTooltip();\"\r\n (blur)=\"closeTooltip();\">\r\n <ng-container *ngIf=\"HasSuffix || Password || showWarning\">\r\n <ng-container *ngIf=\"!Password && !showWarning\">\r\n <ng-container *ngTemplateOutlet=\"suffix_internal\"></ng-container>\r\n </ng-container>\r\n\r\n <span class=\"form-input-suffix\" *ngIf=\"Password || showWarning\">\r\n <ng-container *ngIf=\"Password\" matSuffix>\r\n <a *ngIf=\"passShown\" class=\"fa fa-eye-slash app-fs-16 app-pointer\" (click)=\"type = 'password'; passShown = !passShown; $event.preventDefault()\"></a>\r\n <a *ngIf=\"!passShown\" class=\"fa fa-eye app-fs-16 app-pointer\" (click)=\"type = 'text'; passShown = !passShown; $event.preventDefault()\"></a>\r\n </ng-container>\r\n <ng-container *ngIf=\"showWarning\" matSuffix>\r\n <span title=\"{{warningTitle}}\" class=\"{{warningClass}} text-warning app-fs-16\"></span>\r\n </ng-container>\r\n </span>\r\n </ng-container>\r\n</mat-form-field>\r\n\r\n<ng-template #tolTemplate>\r\n <div (click)=\"closeTooltip()\">\r\n <span>{{validationFailed}}</span>\r\n </div>\r\n</ng-template>", styles: [".tooltip-inner{background-color:#842a30;color:#fff;font-size:12px;width:max-content}.tooltip{margin:auto auto auto 20%!important}.tooltip-inner{background-color:#842a30!important;color:#fff}.tooltip.top .tooltip-arrow:before,.tooltip.top .tooltip-arrow{border-top-color:#842a30}.close-button{position:absolute;right:0em;top:-.2em;float:right;font-size:16px;font-weight:700;color:inherit;text-shadow:0 1px 0 #fff;opacity:.5}.close-button:hover,.close-button:focus{text-decoration:none;cursor:pointer;opacity:.75}\n"], components: [{ type: i2.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }], directives: [{ type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.MatLabel, selector: "mat-label" }, { type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i2$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i7.TooltipDirective, selector: "[tooltip], [tooltipHtml]", inputs: ["adaptivePosition", "placement", "triggers", "containerClass", "isDisabled", "delay", "tooltipAnimation", "tooltipFadeDuration", "isOpen", "tooltipHtml", "tooltip", "tooltipPlacement", "tooltipIsOpen", "tooltipEnable", "tooltipAppendToBody", "container", "tooltipClass", "tooltipContext", "tooltipPopupDelay", "tooltipTrigger", "boundariesElement"], outputs: ["tooltipChange", "tooltipStateChanged", "onShown", "onHidden"], exportAs: ["bs-tooltip"] }, { type: i2.MatSuffix, selector: "[matSuffix]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
915
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ValidationInputComponent, decorators: [{
916
+ type: Component,
917
+ args: [{ selector: "val-input", changeDetection: ChangeDetectionStrategy.OnPush, providers: [
918
+ { provide: LocalizationService, useClass: BaseValidationLoc },
919
+ {
920
+ provide: NG_VALUE_ACCESSOR,
921
+ useExisting: forwardRef(() => ValidationInputComponent),
922
+ multi: true
923
+ }
924
+ ], encapsulation: ViewEncapsulation.None, template: "<mat-form-field appearance=\"outline\" class=\"mat-full-width mat-no-border-top mat-height-fixed\" [style.width.px]=\"widthPx\">\r\n <mat-label [class.app-margin-left-25]=\"HasPrefix\" *ngIf=\"placeholder\">{{placeholder}}</mat-label>\r\n <ng-container *ngIf=\"HasPrefix\">\r\n <ng-container *ngTemplateOutlet=\"prefix_internal\"></ng-container>\r\n </ng-container>\r\n\r\n <input matInput\r\n #baseInput='ngModel'\r\n type=\"{{type}}\"\r\n triggers=\"\"\r\n placement=\"top\"\r\n autocomplete=\"{{autocomplete}}\"\r\n name=\"val-input\"\r\n class=\"form-control {{class}}\"\r\n [class.app-margin-left-25]=\"HasPrefix\"\r\n [class.mat-input-with-suffix]=\"HasSuffix || Password || showWarning\"\r\n [(ngModel)]=\"value\"\r\n [class.checking-field]=\"!noValidate && !showWarning\"\r\n [tooltip]=\"tolTemplate\"\r\n [disabled]=\"readonly || disabled\"\r\n (ngModelChange)=\"onModelChange($event)\"\r\n (focus)=\"checkTooltip();\"\r\n (blur)=\"closeTooltip();\">\r\n <ng-container *ngIf=\"HasSuffix || Password || showWarning\">\r\n <ng-container *ngIf=\"!Password && !showWarning\">\r\n <ng-container *ngTemplateOutlet=\"suffix_internal\"></ng-container>\r\n </ng-container>\r\n\r\n <span class=\"form-input-suffix\" *ngIf=\"Password || showWarning\">\r\n <ng-container *ngIf=\"Password\" matSuffix>\r\n <a *ngIf=\"passShown\" class=\"fa fa-eye-slash app-fs-16 app-pointer\" (click)=\"type = 'password'; passShown = !passShown; $event.preventDefault()\"></a>\r\n <a *ngIf=\"!passShown\" class=\"fa fa-eye app-fs-16 app-pointer\" (click)=\"type = 'text'; passShown = !passShown; $event.preventDefault()\"></a>\r\n </ng-container>\r\n <ng-container *ngIf=\"showWarning\" matSuffix>\r\n <span title=\"{{warningTitle}}\" class=\"{{warningClass}} text-warning app-fs-16\"></span>\r\n </ng-container>\r\n </span>\r\n </ng-container>\r\n</mat-form-field>\r\n\r\n<ng-template #tolTemplate>\r\n <div (click)=\"closeTooltip()\">\r\n <span>{{validationFailed}}</span>\r\n </div>\r\n</ng-template>", styles: [".tooltip-inner{background-color:#842a30;color:#fff;font-size:12px;width:max-content}.tooltip{margin:auto auto auto 20%!important}.tooltip-inner{background-color:#842a30!important;color:#fff}.tooltip.top .tooltip-arrow:before,.tooltip.top .tooltip-arrow{border-top-color:#842a30}.close-button{position:absolute;right:0em;top:-.2em;float:right;font-size:16px;font-weight:700;color:inherit;text-shadow:0 1px 0 #fff;opacity:.5}.close-button:hover,.close-button:focus{text-decoration:none;cursor:pointer;opacity:.75}\n"] }]
925
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: Array, decorators: [{
926
+ type: Optional
927
+ }, {
928
+ type: Inject,
929
+ args: [NG_VALIDATORS]
930
+ }] }, { type: Array, decorators: [{
931
+ type: Optional
932
+ }, {
933
+ type: Inject,
934
+ args: [NG_ASYNC_VALIDATORS]
935
+ }] }, { type: i0.Injector }, { type: i1.LocalizationService }]; }, propDecorators: { Password: [{
936
+ type: Input
937
+ }], showWarning: [{
938
+ type: Input
939
+ }], warningTitle: [{
940
+ type: Input
941
+ }], warningClass: [{
942
+ type: Input
943
+ }], value: [{
944
+ type: Input,
945
+ args: ["value"]
946
+ }], suffix_internal: [{
947
+ type: ContentChild,
948
+ args: ["suffix_internal", { static: false }]
949
+ }], prefix_internal: [{
950
+ type: ContentChild,
951
+ args: ["prefix_internal", { static: false }]
952
+ }] } });
953
+
954
+ // Angular
955
+ /**
956
+ * Componente di validaizone per gli input con maschera di inserimento numerica
957
+ */
958
+ class ValidationCurrencyComponent extends ValidationInputComponent {
959
+ /**
960
+ * @ignore
961
+ */
962
+ constructor(cdr, validators, asyncValidators, injector, lc) {
963
+ super(cdr, validators, asyncValidators, injector, lc);
964
+ this.lc = lc;
965
+ }
966
+ }
967
+ ValidationCurrencyComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ValidationCurrencyComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: NG_VALIDATORS, optional: true }, { token: NG_ASYNC_VALIDATORS, optional: true }, { token: i0.Injector }, { token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
968
+ ValidationCurrencyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: ValidationCurrencyComponent, selector: "val-currency", inputs: { CurrencyOptions: "CurrencyOptions" }, providers: [
969
+ { provide: LocalizationService, useClass: BaseValidationLoc },
970
+ {
971
+ provide: NG_VALUE_ACCESSOR,
972
+ useExisting: forwardRef(() => ValidationCurrencyComponent),
973
+ multi: true
974
+ }
975
+ ], usesInheritance: true, ngImport: i0, template: "<mat-form-field appearance=\"outline\" class=\"mat-full-width mat-no-border-top mat-height-fixed\" [style.width.px]=\"widthPx\">\r\n <mat-label *ngIf=\"placeholder\">{{placeholder}}</mat-label>\r\n <input #baseInput='ngModel'\r\n currencyMask\r\n matInput\r\n [readonly]=\"readonly\"\r\n [options]='CurrencyOptions'\r\n [(ngModel)]=\"value\"\r\n name=\"val-input\"\r\n (focus)=\"checkTooltip()\"\r\n (blur)=\"closeTooltip()\"\r\n class=\"form-control {{class}}\"\r\n [class.checking-field]=\"!noValidate\"\r\n (ngModelChange)=\"onModelChange($event)\"\r\n type=\"{{type}}\"\r\n [tooltip]=\"tolTemplate\"\r\n triggers=\"\"\r\n placement=\"top\"\r\n autocomplete=\"{{autocomplete}}\" />\r\n</mat-form-field>\r\n\r\n<ng-template #tolTemplate>\r\n <div>\r\n <span class=\"close-button pull-right\" (click)=\"closeTooltip()\" aria-label=\"Close\">\r\n <span aria-hidden=\"true\">&times;</span>\r\n </span>\r\n <span>{{validationFailed}}</span>\r\n </div>\r\n</ng-template>", styles: [".tooltip-inner{background-color:#842a30;color:#fff;font-size:12px;width:max-content}.tooltip{margin:auto auto auto 20%!important}.tooltip-inner{background-color:#842a30!important;color:#fff}.tooltip.top .tooltip-arrow:before,.tooltip.top .tooltip-arrow{border-top-color:#842a30}.close-button{position:absolute;right:0em;top:-.2em;float:right;font-size:16px;font-weight:700;color:inherit;text-shadow:0 1px 0 #fff;opacity:.5}.close-button:hover,.close-button:focus{text-decoration:none;cursor:pointer;opacity:.75}\n", "val-currency .mat-form-field-wrapper .form-control.checking-field.ng-touched{padding-right:25px;margin-left:-25px}\n"], components: [{ type: i2.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }], directives: [{ type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.MatLabel, selector: "mat-label" }, { type: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i2$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i6.CurrencyMaskDirective, selector: "[currencyMask]", inputs: ["max", "min", "options"] }, { type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i7.TooltipDirective, selector: "[tooltip], [tooltipHtml]", inputs: ["adaptivePosition", "placement", "triggers", "containerClass", "isDisabled", "delay", "tooltipAnimation", "tooltipFadeDuration", "isOpen", "tooltipHtml", "tooltip", "tooltipPlacement", "tooltipIsOpen", "tooltipEnable", "tooltipAppendToBody", "container", "tooltipClass", "tooltipContext", "tooltipPopupDelay", "tooltipTrigger", "boundariesElement"], outputs: ["tooltipChange", "tooltipStateChanged", "onShown", "onHidden"], exportAs: ["bs-tooltip"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
976
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ValidationCurrencyComponent, decorators: [{
977
+ type: Component,
978
+ args: [{ selector: "val-currency", changeDetection: ChangeDetectionStrategy.OnPush, providers: [
979
+ { provide: LocalizationService, useClass: BaseValidationLoc },
980
+ {
981
+ provide: NG_VALUE_ACCESSOR,
982
+ useExisting: forwardRef(() => ValidationCurrencyComponent),
983
+ multi: true
984
+ }
985
+ ], encapsulation: ViewEncapsulation.None, template: "<mat-form-field appearance=\"outline\" class=\"mat-full-width mat-no-border-top mat-height-fixed\" [style.width.px]=\"widthPx\">\r\n <mat-label *ngIf=\"placeholder\">{{placeholder}}</mat-label>\r\n <input #baseInput='ngModel'\r\n currencyMask\r\n matInput\r\n [readonly]=\"readonly\"\r\n [options]='CurrencyOptions'\r\n [(ngModel)]=\"value\"\r\n name=\"val-input\"\r\n (focus)=\"checkTooltip()\"\r\n (blur)=\"closeTooltip()\"\r\n class=\"form-control {{class}}\"\r\n [class.checking-field]=\"!noValidate\"\r\n (ngModelChange)=\"onModelChange($event)\"\r\n type=\"{{type}}\"\r\n [tooltip]=\"tolTemplate\"\r\n triggers=\"\"\r\n placement=\"top\"\r\n autocomplete=\"{{autocomplete}}\" />\r\n</mat-form-field>\r\n\r\n<ng-template #tolTemplate>\r\n <div>\r\n <span class=\"close-button pull-right\" (click)=\"closeTooltip()\" aria-label=\"Close\">\r\n <span aria-hidden=\"true\">&times;</span>\r\n </span>\r\n <span>{{validationFailed}}</span>\r\n </div>\r\n</ng-template>", styles: [".tooltip-inner{background-color:#842a30;color:#fff;font-size:12px;width:max-content}.tooltip{margin:auto auto auto 20%!important}.tooltip-inner{background-color:#842a30!important;color:#fff}.tooltip.top .tooltip-arrow:before,.tooltip.top .tooltip-arrow{border-top-color:#842a30}.close-button{position:absolute;right:0em;top:-.2em;float:right;font-size:16px;font-weight:700;color:inherit;text-shadow:0 1px 0 #fff;opacity:.5}.close-button:hover,.close-button:focus{text-decoration:none;cursor:pointer;opacity:.75}\n", "val-currency .mat-form-field-wrapper .form-control.checking-field.ng-touched{padding-right:25px;margin-left:-25px}\n"] }]
986
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: Array, decorators: [{
987
+ type: Optional
988
+ }, {
989
+ type: Inject,
990
+ args: [NG_VALIDATORS]
991
+ }] }, { type: Array, decorators: [{
992
+ type: Optional
993
+ }, {
994
+ type: Inject,
995
+ args: [NG_ASYNC_VALIDATORS]
996
+ }] }, { type: i0.Injector }, { type: i1.LocalizationService }]; }, propDecorators: { CurrencyOptions: [{
997
+ type: Input
998
+ }] } });
999
+
1000
+ // Angular
1001
+ /**
1002
+ * Componente di validaizone per gli input ad area di testo
1003
+ */
1004
+ class ValidationTextAreaComponent extends ValidationInputComponent {
1005
+ /**
1006
+ * @ignore
1007
+ */
1008
+ constructor(cdr, validators, asyncValidators, injector, lc) {
1009
+ super(cdr, validators, asyncValidators, injector, lc);
1010
+ this.lc = lc;
1011
+ /**
1012
+ * Righe da mostrare di default per l'area di inserimento
1013
+ */
1014
+ this.rows = 2;
1015
+ }
1016
+ }
1017
+ ValidationTextAreaComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ValidationTextAreaComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: NG_VALIDATORS, optional: true }, { token: NG_ASYNC_VALIDATORS, optional: true }, { token: i0.Injector }, { token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
1018
+ ValidationTextAreaComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: ValidationTextAreaComponent, selector: "val-textarea", inputs: { rows: "rows" }, providers: [
1019
+ { provide: LocalizationService, useClass: BaseValidationLoc },
1020
+ {
1021
+ provide: NG_VALUE_ACCESSOR,
1022
+ useExisting: forwardRef(() => ValidationTextAreaComponent),
1023
+ multi: true
1024
+ }
1025
+ ], usesInheritance: true, ngImport: i0, template: "<mat-form-field appearance=\"outline\" class=\"mat-full-width mat-full-height mat-no-border-top mat-height-auto\">\r\n <mat-label *ngIf=\"placeholder\">{{placeholder}}</mat-label>\r\n <textarea #baseInput=\"ngModel\"\r\n matInput\r\n [(ngModel)]=\"value\"\r\n name=\"val-textarea\"\r\n triggers=\"\"\r\n class=\"app-no-resize form-control {{class}}\"\r\n [class.checking-field]=\"!noValidate\"\r\n rows=\"{{rows}}\"\r\n [tooltip]=\"tolTemplate\"\r\n placement=\"top\"\r\n (focus)=\"checkTooltip()\"\r\n (blur)=\"closeTooltip()\"\r\n (ngModelChange)=\"onModelChange($event)\">\r\n </textarea>\r\n</mat-form-field>\r\n\r\n<ng-template #tolTemplate>\r\n <div (click)=\"closeTooltip()\">\r\n <span>{{validationFailed}}</span>\r\n </div>\r\n</ng-template>", styles: [".tooltip-inner{background-color:#842a30;color:#fff;font-size:12px;width:max-content}.tooltip{margin:auto auto auto 20%!important}.tooltip-inner{background-color:#842a30!important;color:#fff}.tooltip.top .tooltip-arrow:before,.tooltip.top .tooltip-arrow{border-top-color:#842a30}.close-button{position:absolute;right:0em;top:-.2em;float:right;font-size:16px;font-weight:700;color:inherit;text-shadow:0 1px 0 #fff;opacity:.5}.close-button:hover,.close-button:focus{text-decoration:none;cursor:pointer;opacity:.75}\n"], components: [{ type: i2.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }], directives: [{ type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.MatLabel, selector: "mat-label" }, { type: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i2$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i7.TooltipDirective, selector: "[tooltip], [tooltipHtml]", inputs: ["adaptivePosition", "placement", "triggers", "containerClass", "isDisabled", "delay", "tooltipAnimation", "tooltipFadeDuration", "isOpen", "tooltipHtml", "tooltip", "tooltipPlacement", "tooltipIsOpen", "tooltipEnable", "tooltipAppendToBody", "container", "tooltipClass", "tooltipContext", "tooltipPopupDelay", "tooltipTrigger", "boundariesElement"], outputs: ["tooltipChange", "tooltipStateChanged", "onShown", "onHidden"], exportAs: ["bs-tooltip"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1026
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ValidationTextAreaComponent, decorators: [{
1027
+ type: Component,
1028
+ args: [{ selector: "val-textarea", providers: [
1029
+ { provide: LocalizationService, useClass: BaseValidationLoc },
1030
+ {
1031
+ provide: NG_VALUE_ACCESSOR,
1032
+ useExisting: forwardRef(() => ValidationTextAreaComponent),
1033
+ multi: true
1034
+ }
1035
+ ], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<mat-form-field appearance=\"outline\" class=\"mat-full-width mat-full-height mat-no-border-top mat-height-auto\">\r\n <mat-label *ngIf=\"placeholder\">{{placeholder}}</mat-label>\r\n <textarea #baseInput=\"ngModel\"\r\n matInput\r\n [(ngModel)]=\"value\"\r\n name=\"val-textarea\"\r\n triggers=\"\"\r\n class=\"app-no-resize form-control {{class}}\"\r\n [class.checking-field]=\"!noValidate\"\r\n rows=\"{{rows}}\"\r\n [tooltip]=\"tolTemplate\"\r\n placement=\"top\"\r\n (focus)=\"checkTooltip()\"\r\n (blur)=\"closeTooltip()\"\r\n (ngModelChange)=\"onModelChange($event)\">\r\n </textarea>\r\n</mat-form-field>\r\n\r\n<ng-template #tolTemplate>\r\n <div (click)=\"closeTooltip()\">\r\n <span>{{validationFailed}}</span>\r\n </div>\r\n</ng-template>", styles: [".tooltip-inner{background-color:#842a30;color:#fff;font-size:12px;width:max-content}.tooltip{margin:auto auto auto 20%!important}.tooltip-inner{background-color:#842a30!important;color:#fff}.tooltip.top .tooltip-arrow:before,.tooltip.top .tooltip-arrow{border-top-color:#842a30}.close-button{position:absolute;right:0em;top:-.2em;float:right;font-size:16px;font-weight:700;color:inherit;text-shadow:0 1px 0 #fff;opacity:.5}.close-button:hover,.close-button:focus{text-decoration:none;cursor:pointer;opacity:.75}\n"] }]
1036
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: Array, decorators: [{
1037
+ type: Optional
1038
+ }, {
1039
+ type: Inject,
1040
+ args: [NG_VALIDATORS]
1041
+ }] }, { type: Array, decorators: [{
1042
+ type: Optional
1043
+ }, {
1044
+ type: Inject,
1045
+ args: [NG_ASYNC_VALIDATORS]
1046
+ }] }, { type: i0.Injector }, { type: i1.LocalizationService }]; }, propDecorators: { rows: [{
1047
+ type: Input
1048
+ }] } });
1049
+
1050
+ // Angular
1051
+ /**
1052
+ * Componente di validaizone per gli input di tipo data-ora
1053
+ */
1054
+ class ValidationDateTimeComponent extends BaseValidation {
1055
+ /**
1056
+ * @ignore
1057
+ */
1058
+ constructor(cdr, _validators, _asyncValidators, injector, lc, dateExts) {
1059
+ super();
1060
+ this.cdr = cdr;
1061
+ this._validators = _validators;
1062
+ this._asyncValidators = _asyncValidators;
1063
+ this.injector = injector;
1064
+ this.lc = lc;
1065
+ this.dateExts = dateExts;
1066
+ /**
1067
+ * Proprietà dell'elemento di selezione dell'orario. Mostra o nasconde gli spinner
1068
+ *
1069
+ * Attualemnte non bindata ed utilizzata solo a livello di default ma non si sa mai
1070
+ */
1071
+ this.showSpinners = true;
1072
+ /**
1073
+ * Proprietà dell'elemento di selezione dell'orario. Mostra o nasconde i secondi
1074
+ *
1075
+ * Attualemnte non bindata ed utilizzata solo a livello di default ma non si sa mai
1076
+ */
1077
+ this.showSeconds = true;
1078
+ /**
1079
+ * Proprietà dell'elemento di selezione dell'orario. Imposta l'incremento/decremento minimo per le ore
1080
+ *
1081
+ * Attualemnte non bindata ed utilizzata solo a livello di default ma non si sa mai
1082
+ */
1083
+ this.stepHour = 1;
1084
+ /**
1085
+ * Proprietà dell'elemento di selezione dell'orario. Imposta l'incremento/decremento minimo per i minuti
1086
+ *
1087
+ * Attualemnte non bindata ed utilizzata solo a livello di default ma non si sa mai
1088
+ */
1089
+ this.stepMinute = 1;
1090
+ /**
1091
+ * Proprietà dell'elemento di selezione dell'orario. Imposta l'incremento/decremento minimo per i secondi
1092
+ *
1093
+ * Attualemnte non bindata ed utilizzata solo a livello di default ma non si sa mai
1094
+ */
1095
+ this.stepSecond = 1;
1096
+ /**
1097
+ * Utilizza il Date di Javascript come modello in uscita. Il modello in entrata verrà comunque ricondotto a un DayJs
1098
+ */
1099
+ this.useJsDates = false;
1100
+ /**
1101
+ * @ignore
1102
+ */
1103
+ this.onTouched = () => { };
1104
+ }
1105
+ /**
1106
+ * @ignore
1107
+ */
1108
+ ngOnInit() {
1109
+ // Controllo se è settato un required per decidere in maniera condizionale se utilizzare il validatore required nel componente interno
1110
+ if (this._validators && !this.noValidate && this._validators.some(elem => elem instanceof RequiredValidator))
1111
+ this.required = true;
1112
+ this._format = this.lc.token("getSmallDateDisplayFormat");
1113
+ }
1114
+ /**
1115
+ * @ignore
1116
+ */
1117
+ ngAfterViewInit() {
1118
+ this.postBinding();
1119
+ }
1120
+ /**
1121
+ * Metodo che si occupa di collegare i validatori e la funzione di reset dal **ControlValueAccessor** rappresentato
1122
+ * da questo componente al **ControlValueAccessor** rappresentato dall'effettivo elemento di Input presente lato HTML
1123
+ */
1124
+ postBinding() {
1125
+ this.CheckValidity();
1126
+ const ngControl = this.injector.get(NgControl, null);
1127
+ if (ngControl) {
1128
+ this.parentControl = ngControl.control;
1129
+ // Se la variabile novalidate è true, elimino tutti i validatori eventualmente inseriti
1130
+ if (this.noValidate) {
1131
+ this.parentControl.clearValidators();
1132
+ this.parentControl.clearAsyncValidators();
1133
+ }
1134
+ else {
1135
+ this.baseInput.control.setAsyncValidators(this._asyncValidators);
1136
+ this.baseInput.control.setValidators(this._validators);
1137
+ }
1138
+ // Faccio in modo che se chiamo il reset del controllo (o della form) dall'esterno si resetti anche il controllo nativo
1139
+ const origFunc = this.parentControl.reset;
1140
+ this.parentControl.reset = () => {
1141
+ origFunc.apply(this.parentControl);
1142
+ this.baseInput.control.reset();
1143
+ this.tooltip.hide();
1144
+ };
1145
+ }
1146
+ }
1147
+ /**
1148
+ * @ignore
1149
+ */
1150
+ writeValue(value) {
1151
+ if (!value) {
1152
+ this.value = null;
1153
+ if (this.baseInput)
1154
+ this.baseInput.reset();
1155
+ }
1156
+ else {
1157
+ var date = null;
1158
+ if (this.useJsDates) {
1159
+ date = this.dateExts.getDateConvertion(value);
1160
+ this.propagateChange(date);
1161
+ this.inputChange.emit(date);
1162
+ }
1163
+ else
1164
+ date = dayjs(value, this.lc.token("getSmallDateFormat") + " HH:mm:ss");
1165
+ this.value = date;
1166
+ }
1167
+ this.cdr.markForCheck();
1168
+ }
1169
+ /**
1170
+ * Metodo che si occupa di, eventualmente, aggiustare il valore da propagare ed emetterlo
1171
+ *
1172
+ * L'emit della modifica al valore viene gestito su un evento custom (**inputChange**) come workaround al malfunzionamento dell'**ngModelChange** nativo
1173
+ *
1174
+ * @param {any} toEmit valore da propagare all'esterno
1175
+ */
1176
+ outputValue(toEmit) {
1177
+ let value = toEmit.value;
1178
+ let propagateValue;
1179
+ if (!value)
1180
+ propagateValue = null;
1181
+ else if (!this.useJsDates)
1182
+ propagateValue = value.format(this.lc.token("getSmallDateFormat") + " HH:mm:ss");
1183
+ else {
1184
+ if (value && value.isValid())
1185
+ propagateValue = value.toDate();
1186
+ else
1187
+ propagateValue = null;
1188
+ }
1189
+ this.propagateChange(propagateValue);
1190
+ this.inputChange.emit(propagateValue);
1191
+ this.onTouched();
1192
+ }
1193
+ /**
1194
+ * @ignore
1195
+ */
1196
+ registerOnChange(fn) {
1197
+ this.propagateChange = fn;
1198
+ }
1199
+ /**
1200
+ * @ignore
1201
+ */
1202
+ registerOnTouched(fn) {
1203
+ this.onTouched = fn;
1204
+ }
1205
+ }
1206
+ ValidationDateTimeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ValidationDateTimeComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: NG_VALIDATORS, optional: true }, { token: NG_ASYNC_VALIDATORS, optional: true }, { token: i0.Injector }, { token: i1.LocalizationService }, { token: i2$2.DateService }], target: i0.ɵɵFactoryTarget.Component });
1207
+ ValidationDateTimeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: ValidationDateTimeComponent, selector: "val-datetime", inputs: { useJsDates: "useJsDates" }, providers: [
1208
+ { provide: LocalizationService, useClass: BaseValidationLoc },
1209
+ {
1210
+ provide: NG_VALUE_ACCESSOR,
1211
+ useExisting: forwardRef(() => ValidationDateTimeComponent),
1212
+ multi: true
1213
+ }
1214
+ ], usesInheritance: true, ngImport: i0, template: "<mat-form-field appearance=\"outline\" class=\"mat-full-width mat-no-border-top mat-height-fixed\" [style.width.px]=\"widthPx\">\r\n <mat-label *ngIf=\"placeholder\">{{placeholder}}</mat-label>\r\n\r\n <input matInput \r\n [ngxMatDatetimePicker]=\"datepicker\" \r\n #baseInput=\"ngModel\"\r\n type=\"text\"\r\n triggers=\"\"\r\n placement=\"top\"\r\n name=\"val-date\"\r\n class=\"form-control {{class}}\"\r\n autocomplete=\"{{autocomplete}}\"\r\n [(ngModel)]=\"value\"\r\n [class.checking-field]=\"!noValidate\"\r\n [tooltip]=\"tolTemplate\"\r\n [placeholder]=\"placeholder ? '' : _format\"\r\n [disabled]=\"readonly || disabled\"\r\n [isDisabled]=\"readonly || disabled\"\r\n (dateChange)=\"outputValue($event)\"/>\r\n\r\n <mat-datepicker-toggle matSuffix [for]=\"datepicker\"></mat-datepicker-toggle>\r\n\r\n <ngx-mat-datetime-picker #datepicker \r\n [showSpinners]=\"showSpinners\" \r\n [showSeconds]=\"showSeconds\" \r\n [stepHour]=\"stepHour\" \r\n [stepMinute]=\"stepMinute\" \r\n [stepSecond]=\"stepSecond\" \r\n [touchUi]=\"false\" \r\n [color]=\"'primary'\">\r\n </ngx-mat-datetime-picker>\r\n</mat-form-field>\r\n\r\n<ng-template #tolTemplate>\r\n <div (click)=\"closeTooltip()\">\r\n <span>{{validationFailed}}</span>\r\n </div>\r\n</ng-template>", styles: [".tooltip-inner{background-color:#842a30;color:#fff;font-size:12px;width:max-content}.tooltip{margin:auto auto auto 20%!important}.tooltip-inner{background-color:#842a30!important;color:#fff}.tooltip.top .tooltip-arrow:before,.tooltip.top .tooltip-arrow{border-top-color:#842a30}.close-button{position:absolute;right:0em;top:-.2em;float:right;font-size:16px;font-weight:700;color:inherit;text-shadow:0 1px 0 #fff;opacity:.5}.close-button:hover,.close-button:focus{text-decoration:none;cursor:pointer;opacity:.75}\n"], components: [{ type: i2.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i4$1.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { type: i2$3.NgxMatDatetimePicker, selector: "ngx-mat-datetime-picker", inputs: ["calendarHeaderComponent", "startAt", "startView", "defaultColor", "color", "touchUi", "hideTime", "disabled", "panelClass", "dateClass", "opened", "showSpinners", "showSeconds", "stepHour", "stepMinute", "stepSecond", "enableMeridian", "disableMinute", "defaultTime"], outputs: ["yearSelected", "monthSelected", "opened", "closed"], exportAs: ["ngxMatDatetimePicker"] }], directives: [{ type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.MatLabel, selector: "mat-label" }, { type: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i2$3.NgxMatDatetimeInput, selector: "input[ngxMatDatetimePicker]", inputs: ["ngxMatDatetimePicker", "ngxMatDatetimePickerFilter", "value", "min", "max", "disabled"], outputs: ["dateChange", "dateInput"], exportAs: ["ngxMatDatetimePickerInput"] }, { type: i2$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i7.TooltipDirective, selector: "[tooltip], [tooltipHtml]", inputs: ["adaptivePosition", "placement", "triggers", "containerClass", "isDisabled", "delay", "tooltipAnimation", "tooltipFadeDuration", "isOpen", "tooltipHtml", "tooltip", "tooltipPlacement", "tooltipIsOpen", "tooltipEnable", "tooltipAppendToBody", "container", "tooltipClass", "tooltipContext", "tooltipPopupDelay", "tooltipTrigger", "boundariesElement"], outputs: ["tooltipChange", "tooltipStateChanged", "onShown", "onHidden"], exportAs: ["bs-tooltip"] }, { type: i2.MatSuffix, selector: "[matSuffix]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1215
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ValidationDateTimeComponent, decorators: [{
1216
+ type: Component,
1217
+ args: [{ selector: "val-datetime", encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, providers: [
1218
+ { provide: LocalizationService, useClass: BaseValidationLoc },
1219
+ {
1220
+ provide: NG_VALUE_ACCESSOR,
1221
+ useExisting: forwardRef(() => ValidationDateTimeComponent),
1222
+ multi: true
1223
+ }
1224
+ ], template: "<mat-form-field appearance=\"outline\" class=\"mat-full-width mat-no-border-top mat-height-fixed\" [style.width.px]=\"widthPx\">\r\n <mat-label *ngIf=\"placeholder\">{{placeholder}}</mat-label>\r\n\r\n <input matInput \r\n [ngxMatDatetimePicker]=\"datepicker\" \r\n #baseInput=\"ngModel\"\r\n type=\"text\"\r\n triggers=\"\"\r\n placement=\"top\"\r\n name=\"val-date\"\r\n class=\"form-control {{class}}\"\r\n autocomplete=\"{{autocomplete}}\"\r\n [(ngModel)]=\"value\"\r\n [class.checking-field]=\"!noValidate\"\r\n [tooltip]=\"tolTemplate\"\r\n [placeholder]=\"placeholder ? '' : _format\"\r\n [disabled]=\"readonly || disabled\"\r\n [isDisabled]=\"readonly || disabled\"\r\n (dateChange)=\"outputValue($event)\"/>\r\n\r\n <mat-datepicker-toggle matSuffix [for]=\"datepicker\"></mat-datepicker-toggle>\r\n\r\n <ngx-mat-datetime-picker #datepicker \r\n [showSpinners]=\"showSpinners\" \r\n [showSeconds]=\"showSeconds\" \r\n [stepHour]=\"stepHour\" \r\n [stepMinute]=\"stepMinute\" \r\n [stepSecond]=\"stepSecond\" \r\n [touchUi]=\"false\" \r\n [color]=\"'primary'\">\r\n </ngx-mat-datetime-picker>\r\n</mat-form-field>\r\n\r\n<ng-template #tolTemplate>\r\n <div (click)=\"closeTooltip()\">\r\n <span>{{validationFailed}}</span>\r\n </div>\r\n</ng-template>", styles: [".tooltip-inner{background-color:#842a30;color:#fff;font-size:12px;width:max-content}.tooltip{margin:auto auto auto 20%!important}.tooltip-inner{background-color:#842a30!important;color:#fff}.tooltip.top .tooltip-arrow:before,.tooltip.top .tooltip-arrow{border-top-color:#842a30}.close-button{position:absolute;right:0em;top:-.2em;float:right;font-size:16px;font-weight:700;color:inherit;text-shadow:0 1px 0 #fff;opacity:.5}.close-button:hover,.close-button:focus{text-decoration:none;cursor:pointer;opacity:.75}\n"] }]
1225
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: Array, decorators: [{
1226
+ type: Optional
1227
+ }, {
1228
+ type: Inject,
1229
+ args: [NG_VALIDATORS]
1230
+ }] }, { type: Array, decorators: [{
1231
+ type: Optional
1232
+ }, {
1233
+ type: Inject,
1234
+ args: [NG_ASYNC_VALIDATORS]
1235
+ }] }, { type: i0.Injector }, { type: i1.LocalizationService }, { type: i2$2.DateService }]; }, propDecorators: { useJsDates: [{
1236
+ type: Input
1237
+ }] } });
1238
+
1239
+ // Angular
1240
+ /**
1241
+ * Componente di validaizone per gli input di Autocompletamento
1242
+ */
1243
+ class ValidationAutocompleteComponent extends BaseValidation {
1244
+ /**
1245
+ * @ignore
1246
+ */
1247
+ constructor(_validators, _asyncValidators, injector, lc, cdr) {
1248
+ super();
1249
+ this._validators = _validators;
1250
+ this._asyncValidators = _asyncValidators;
1251
+ this.injector = injector;
1252
+ this.lc = lc;
1253
+ this.cdr = cdr;
1254
+ /**
1255
+ * Sorgente da cui scegliere valori filtrata in base a quello che ha scritto l'utente
1256
+ */
1257
+ this.FilteredSource = [];
1258
+ /**
1259
+ * Contenuto della label Floattante Material-Style
1260
+ */
1261
+ this.label = "";
1262
+ /**
1263
+ * Evento che indica l'opzione selezionata dal componente. Il valore finale della selezione dovrà essere questo
1264
+ */
1265
+ this.optionChange = new EventEmitter();
1266
+ /**
1267
+ * @ignore
1268
+ */
1269
+ this.onTouched = () => { }; //placeholder on touched function
1270
+ }
1271
+ /**
1272
+ * @ignore
1273
+ */
1274
+ ngOnInit() {
1275
+ //controllo se è settato un required per decidere in maniera condizionale se utilizzare il validatore required nel componente interno
1276
+ if (this._validators && !this.noValidate && this._validators.some(elem => elem instanceof RequiredValidator))
1277
+ this.required = true;
1278
+ }
1279
+ /**
1280
+ * @ignore
1281
+ */
1282
+ ngOnDestroy() {
1283
+ if (this.tooltipSubscription)
1284
+ this.tooltipSubscription.unsubscribe();
1285
+ }
1286
+ /**
1287
+ * @ignore
1288
+ */
1289
+ ngAfterViewInit() {
1290
+ this.postBinding();
1291
+ }
1292
+ /**
1293
+ * Metodo che si occupa di collegare i validatori e la funzione di reset dal **ControlValueAccessor** rappresentato
1294
+ * da questo componente al **ControlValueAccessor** rappresentato dall'effettivo elemento di Input presente lato HTML
1295
+ */
1296
+ postBinding() {
1297
+ this.CheckValidity();
1298
+ const ngControl = this.injector.get(NgControl, null);
1299
+ if (ngControl) {
1300
+ this.parentControl = ngControl.control;
1301
+ //se la variabile novalidate è true, elimino tutti i validatori eventualmente inseriti
1302
+ if (this.noValidate) {
1303
+ this.parentControl.clearValidators();
1304
+ this.parentControl.clearAsyncValidators();
1305
+ }
1306
+ else {
1307
+ this.baseInput.control.setAsyncValidators(this._asyncValidators);
1308
+ this.baseInput.control.setValidators(this._validators);
1309
+ }
1310
+ //faccio in modo che se chiamo il reset del controllo (o della form) dall'esterno si resetti anche il controllo nativo
1311
+ const origFunc = this.parentControl.reset;
1312
+ this.parentControl.reset = () => {
1313
+ origFunc.apply(this.parentControl);
1314
+ this.baseInput.control.reset();
1315
+ this.tooltip.hide();
1316
+ };
1317
+ }
1318
+ }
1319
+ /**
1320
+ * @ignore
1321
+ */
1322
+ writeValue(value) {
1323
+ var val = value && this.FilteredSource ? this.FilteredSource.find(t => t.id == value) : null;
1324
+ if (val)
1325
+ this.optionChange.emit(val.id);
1326
+ this.propagateChange(val ? val.id : value);
1327
+ this.value = val ? val.description : value;
1328
+ }
1329
+ /**
1330
+ * L'emit della modifica al valore viene gestito su un evento custom (**inputChange**) come workaround al malfunzionamento dell'**ngModelChange** nativo
1331
+ *
1332
+ * @param {any} toEmit valore da propagare all'esterno
1333
+ */
1334
+ onModelChange(toEmit) {
1335
+ this.writeValue(toEmit);
1336
+ this.inputChange.emit(toEmit);
1337
+ this.onTouched();
1338
+ }
1339
+ /**
1340
+ * @ignore
1341
+ */
1342
+ registerOnChange(fn) {
1343
+ this.propagateChange = fn;
1344
+ }
1345
+ /**
1346
+ * @ignore
1347
+ */
1348
+ registerOnTouched(fn) {
1349
+ this.onTouched = fn;
1350
+ }
1351
+ }
1352
+ ValidationAutocompleteComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ValidationAutocompleteComponent, deps: [{ token: NG_VALIDATORS, optional: true }, { token: NG_ASYNC_VALIDATORS, optional: true }, { token: i0.Injector }, { token: i1.LocalizationService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
1353
+ ValidationAutocompleteComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: ValidationAutocompleteComponent, selector: "val-autocomplete", inputs: { FilteredSource: "FilteredSource", value: "value", label: "label" }, outputs: { optionChange: "optionChange" }, providers: [
1354
+ { provide: LocalizationService, useClass: BaseValidationLoc },
1355
+ {
1356
+ provide: NG_VALUE_ACCESSOR,
1357
+ useExisting: forwardRef(() => ValidationAutocompleteComponent),
1358
+ multi: true
1359
+ }
1360
+ ], usesInheritance: true, ngImport: i0, template: "<mat-form-field appearance=\"outline\" class=\"mat-full-width mat-no-border-top mat-height-fixed\" [style.width.px]=\"widthPx\">\r\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\r\n <input matInput\r\n #baseInput='ngModel'\r\n type=\"text\"\r\n triggers=\"\"\r\n placement=\"top\"\r\n placeholder=\"{{placeholder}}\"\r\n [matAutocomplete]=\"auto\"\r\n name=\"val-input\"\r\n class=\"form-control {{class}}\"\r\n [(ngModel)]=\"value\"\r\n [class.checking-field]=\"!noValidate\"\r\n [tooltip]=\"tolTemplate\"\r\n [disabled]=\"readonly || disabled\"\r\n (ngModelChange)=\"onModelChange($event)\"\r\n (focus)=\"checkTooltip();\"\r\n (blur)=\"closeTooltip();\">\r\n <mat-autocomplete autoActiveFirstOption #auto=\"matAutocomplete\">\r\n <mat-option *ngFor=\"let option of FilteredSource\" [value]=\"option.id\">\r\n {{option.description}}\r\n </mat-option>\r\n </mat-autocomplete>\r\n</mat-form-field>\r\n\r\n<ng-template #tolTemplate>\r\n <div (click)=\"closeTooltip()\">\r\n <span>{{validationFailed}}</span>\r\n </div>\r\n</ng-template>", styles: [".tooltip-inner{background-color:#842a30;color:#fff;font-size:12px;width:max-content}.tooltip{margin:auto auto auto 20%!important}.tooltip-inner{background-color:#842a30!important;color:#fff}.tooltip.top .tooltip-arrow:before,.tooltip.top .tooltip-arrow{border-top-color:#842a30}.close-button{position:absolute;right:0em;top:-.2em;float:right;font-size:16px;font-weight:700;color:inherit;text-shadow:0 1px 0 #fff;opacity:.5}.close-button:hover,.close-button:focus{text-decoration:none;cursor:pointer;opacity:.75}\n"], components: [{ type: i2.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i3.MatAutocomplete, selector: "mat-autocomplete", inputs: ["disableRipple"], exportAs: ["matAutocomplete"] }, { type: i4$2.MatOption, selector: "mat-option", exportAs: ["matOption"] }], directives: [{ type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.MatLabel, selector: "mat-label" }, { type: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i3.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }, { type: i2$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i7.TooltipDirective, selector: "[tooltip], [tooltipHtml]", inputs: ["adaptivePosition", "placement", "triggers", "containerClass", "isDisabled", "delay", "tooltipAnimation", "tooltipFadeDuration", "isOpen", "tooltipHtml", "tooltip", "tooltipPlacement", "tooltipIsOpen", "tooltipEnable", "tooltipAppendToBody", "container", "tooltipClass", "tooltipContext", "tooltipPopupDelay", "tooltipTrigger", "boundariesElement"], outputs: ["tooltipChange", "tooltipStateChanged", "onShown", "onHidden"], exportAs: ["bs-tooltip"] }, { type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1361
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ValidationAutocompleteComponent, decorators: [{
1362
+ type: Component,
1363
+ args: [{ selector: "val-autocomplete", changeDetection: ChangeDetectionStrategy.OnPush, providers: [
1364
+ { provide: LocalizationService, useClass: BaseValidationLoc },
1365
+ {
1366
+ provide: NG_VALUE_ACCESSOR,
1367
+ useExisting: forwardRef(() => ValidationAutocompleteComponent),
1368
+ multi: true
1369
+ }
1370
+ ], encapsulation: ViewEncapsulation.None, template: "<mat-form-field appearance=\"outline\" class=\"mat-full-width mat-no-border-top mat-height-fixed\" [style.width.px]=\"widthPx\">\r\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\r\n <input matInput\r\n #baseInput='ngModel'\r\n type=\"text\"\r\n triggers=\"\"\r\n placement=\"top\"\r\n placeholder=\"{{placeholder}}\"\r\n [matAutocomplete]=\"auto\"\r\n name=\"val-input\"\r\n class=\"form-control {{class}}\"\r\n [(ngModel)]=\"value\"\r\n [class.checking-field]=\"!noValidate\"\r\n [tooltip]=\"tolTemplate\"\r\n [disabled]=\"readonly || disabled\"\r\n (ngModelChange)=\"onModelChange($event)\"\r\n (focus)=\"checkTooltip();\"\r\n (blur)=\"closeTooltip();\">\r\n <mat-autocomplete autoActiveFirstOption #auto=\"matAutocomplete\">\r\n <mat-option *ngFor=\"let option of FilteredSource\" [value]=\"option.id\">\r\n {{option.description}}\r\n </mat-option>\r\n </mat-autocomplete>\r\n</mat-form-field>\r\n\r\n<ng-template #tolTemplate>\r\n <div (click)=\"closeTooltip()\">\r\n <span>{{validationFailed}}</span>\r\n </div>\r\n</ng-template>", styles: [".tooltip-inner{background-color:#842a30;color:#fff;font-size:12px;width:max-content}.tooltip{margin:auto auto auto 20%!important}.tooltip-inner{background-color:#842a30!important;color:#fff}.tooltip.top .tooltip-arrow:before,.tooltip.top .tooltip-arrow{border-top-color:#842a30}.close-button{position:absolute;right:0em;top:-.2em;float:right;font-size:16px;font-weight:700;color:inherit;text-shadow:0 1px 0 #fff;opacity:.5}.close-button:hover,.close-button:focus{text-decoration:none;cursor:pointer;opacity:.75}\n"] }]
1371
+ }], ctorParameters: function () { return [{ type: Array, decorators: [{
1372
+ type: Optional
1373
+ }, {
1374
+ type: Inject,
1375
+ args: [NG_VALIDATORS]
1376
+ }] }, { type: Array, decorators: [{
1377
+ type: Optional
1378
+ }, {
1379
+ type: Inject,
1380
+ args: [NG_ASYNC_VALIDATORS]
1381
+ }] }, { type: i0.Injector }, { type: i1.LocalizationService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { FilteredSource: [{
1382
+ type: Input
1383
+ }], value: [{
1384
+ type: Input
1385
+ }], label: [{
1386
+ type: Input
1387
+ }], optionChange: [{
1388
+ type: Output
1389
+ }] } });
1390
+
1391
+ // Angular
1392
+ /**
1393
+ * Componente base da cui tutti i componenti Form implementano
1394
+ */
1395
+ class BaseFormControl {
1396
+ /**
1397
+ * Costruttore
1398
+ *
1399
+ * @ignore
1400
+ */
1401
+ constructor(cdr, ngControl, _validators, ac, AppContext, ACO_CUSTOMKEY, nativeInput = false) {
1402
+ this.cdr = cdr;
1403
+ this.ngControl = ngControl;
1404
+ this._validators = _validators;
1405
+ this.ac = ac;
1406
+ this.AppContext = AppContext;
1407
+ this.ACO_CUSTOMKEY = ACO_CUSTOMKEY;
1408
+ this.nativeInput = nativeInput;
1409
+ /**
1410
+ * https://github.com/angular/angular/issues/14988
1411
+ * TL:DR; Il primo valore passato al writeValue è nullo perché quando i cagnacci fanno new FormControl()
1412
+ * scrivono un writeValue nullo... quindi al primo binding salto l'inizializzazione se ho la coppia null-firstBind
1413
+ * poi mettendo firstBind a false di lì in poi funziono come devo. Vista la casistica evito essenzialmente metà detectChanges
1414
+ */
1415
+ this.firstBind = true;
1416
+ /**
1417
+ * Indica se il campo è obbligatorio i opzionale
1418
+ */
1419
+ this.Required = false;
1420
+ /**
1421
+ * Indica se il Form che contiene questo campo è già stato registrato
1422
+ */
1423
+ this.formHasBennBound = false;
1424
+ /**
1425
+ * Indica se questo campo è staccato dal Form, ad esempio nel caso sia in un ng-template proiettato nel form.
1426
+ *
1427
+ * In quel caso la variabile **Form** del componente dev'essere valorizzata
1428
+ */
1429
+ this.detatchedFromform = false;
1430
+ /**
1431
+ * @ignore
1432
+ */
1433
+ this.propagateChange = (_) => { };
1434
+ /**
1435
+ * @ignore
1436
+ */
1437
+ this.onTouched = () => { };
1438
+ /**
1439
+ * @ignore Vedi getter e setter
1440
+ */
1441
+ this._readonly = false;
1442
+ /**
1443
+ * Qualora ci fosse un contesto collegato questa variabile identifica se Sono l'Owner o meno.
1444
+ *
1445
+ * Se non lo sono, il campo risulterà in sola lettura
1446
+ */
1447
+ this.AppContextOwnership = true;
1448
+ /**
1449
+ * Utilizza o meno il Layout di un form (Label con input di fianco), se false mostra solo l'input
1450
+ */
1451
+ this.FormLayout = true;
1452
+ /**
1453
+ * Attiva o disattiva la validazione per questo componente
1454
+ */
1455
+ this.Validation = true;
1456
+ /**
1457
+ * Placeholder per quando l'input è vuoto
1458
+ */
1459
+ this.Placeholder = "";
1460
+ /**
1461
+ * Classe extra per il form-group in cui viene wrappato l'input
1462
+ */
1463
+ this.FormGroupClass = "";
1464
+ /**
1465
+ * Messaggio da mostrare quando la validazione fallisce per questo componente. Di default viene proposta dalla libreria
1466
+ */
1467
+ this.FailedValidationMessage = "";
1468
+ /**
1469
+ * Input che forza l'invalidità del componente
1470
+ */
1471
+ this.ForcedError = false;
1472
+ /**
1473
+ * Mostra un testo a sinistra dell'input (FormLayout permettendo)
1474
+ */
1475
+ this.Label = "";
1476
+ /**
1477
+ * col-md-X per la label
1478
+ */
1479
+ this.LabelColWidth = 4;
1480
+ /**
1481
+ * col-md-X per l'input
1482
+ */
1483
+ this.InputColWidth = 8;
1484
+ /**
1485
+ * Indica se è l'ultimo componente di un form (serve per rimuovere il margine finale)
1486
+ */
1487
+ this.Last = false;
1488
+ /**
1489
+ * Associa il componente Form a questo input
1490
+ */
1491
+ this.Form = null;
1492
+ /**
1493
+ * Nome della proprietà che contiene l'Id degli oggetti bindati nella **Source**
1494
+ */
1495
+ this.IdField = 'id';
1496
+ /**
1497
+ * Espressione simil-Angular per cambiare il testo dei componenti che scelgono il proprio modello da una **Source**
1498
+ *
1499
+ * Il funzionamento è identico al binder di angular, solo con una graffa invece che 2.
1500
+ * È inoltre possibile aggiungere pezzi di descrizione in maniera condizionale con la sintassi **:prop?(Prop vale {prop})**
1501
+ */
1502
+ this.Display = '{description}';
1503
+ /**
1504
+ * Risultato dell'unione fra le informazioni degli oggetti in **Source** e le impostazioni specificate nell'Input **Display**
1505
+ */
1506
+ this.BoundSource = [];
1507
+ /**
1508
+ * Indica se è il primo Bind della Source
1509
+ */
1510
+ this.SourceFirstBind = true;
1511
+ /**
1512
+ * Evento chiamato alla modifica del valore collegato a questo campo
1513
+ */
1514
+ this.inputChange = new EventEmitter();
1515
+ /**
1516
+ * Cache delle condizioni scritte tipo :prop?(Roba con {prop})
1517
+ */
1518
+ this.BindCheckingGroups = [];
1519
+ /**
1520
+ * Cache delle proprietà scritte tipo --> {prop}
1521
+ */
1522
+ this.BindProperties = [];
1523
+ if (ngControl == null) {
1524
+ if (!this.handleNullNgControl())
1525
+ console.error("ngControl nullo per qualche motivo! Il 90% delle funzionalità di questo input saranno disabilitate");
1526
+ return;
1527
+ }
1528
+ //Se mi arriva l'injectable del contesto posso capire se questo campo deve essere in readonly o no, solo se ho già inizializzato i controller custom dell'access control
1529
+ if (this.AppContext && this.AppContext.name && this.ACO_CUSTOMKEY && this.ac && this.ac.InitializedCustom) {
1530
+ this.AppContextOwnership = !this.ac.has(this.ACO_CUSTOMKEY + ":" + this.AppContext.name);
1531
+ this._readonly = !this.AppContextOwnership;
1532
+ }
1533
+ ngControl.valueAccessor = this;
1534
+ //Se ho già un parent impostato vuol dire che sotto al tag <form> ho direttamente un tag <form-*>..
1535
+ //.. quindi posso impostare direttamente il riferimento del Form da usare in HTML per il submitted
1536
+ //Se non c'è vuol dire che dentro al tag <form> c'è uno splendido <ng-container *ngTemplateOutlet="template; context: ....">..
1537
+ //.. il quale a sua volta contiene il controllo <form-*> quindi avrò il form nell'input "Form"
1538
+ if (ngControl._parent)
1539
+ this.Form = ngControl._parent;
1540
+ else
1541
+ this.detatchedFromform = true;
1542
+ //Questa serve per impostare me stesso come si deve, il validatore invece lo passo al validation-input quando viene settato il validationControl
1543
+ if (this.ngControl) {
1544
+ //Per tutti i validatori: rigenero la funzione di validazione. Per qualche motivo a volte ho validatori senza...
1545
+ //... questo è un workaround per essere sicuro di averla sempre.
1546
+ //Solo i validatori con parametri hanno bisogno della _createValidator (es. "maxlength" che ha 1 parametro), quindi no validatori tipo "required"
1547
+ if (this._validators) {
1548
+ this._validators.forEach(v => {
1549
+ if (v._createValidator)
1550
+ v._createValidator();
1551
+ });
1552
+ }
1553
+ this.ngControl.control.setValidators(this._validators);
1554
+ this.ngControl.control.updateValueAndValidity();
1555
+ }
1556
+ }
1557
+ /**
1558
+ * Ottiene il valore della variabile **_readonly**
1559
+ *
1560
+ * @returns {boolean} **true** se sola lettura, **false** altrimenti
1561
+ */
1562
+ get Readonly() { return this._readonly; }
1563
+ /**
1564
+ * Imposta il valore della variabile **_readonly** gestendo anche il Contesto applicativo
1565
+ *
1566
+ * @param {boolean} value Valore da impostare
1567
+ */
1568
+ set Readonly(value) {
1569
+ if (this.AppContextOwnership)
1570
+ this._readonly = value;
1571
+ }
1572
+ /**
1573
+ * Permette di settare in una volta solo gli input LabelColWidth e InputColWidth, basta scriverlo con la sintassi "X Y"
1574
+ *
1575
+ * @param {string} input Input nel formato "X Y"
1576
+ */
1577
+ set LabelInputRatio(input) {
1578
+ var ratio = input.split(/\s/);
1579
+ this.LabelColWidth = parseInt(ratio[0]);
1580
+ this.InputColWidth = parseInt(ratio[1]);
1581
+ }
1582
+ /**
1583
+ * Query sull'elemento 'validationControl' che funziona in ambiente statico
1584
+ *
1585
+ * @param {NgModel} comp Elemento HTML marcato con "#validationControl"
1586
+ */
1587
+ set _validationControl(comp) { this.registerValComp(comp); }
1588
+ /**
1589
+ * Query sull'elemento 'validationControl' che funziona in ambiente dinamico
1590
+ *
1591
+ * @param {NgModel} comp Elemento HTML marcato con "#validationControl"
1592
+ */
1593
+ set validationControl_static(comp) { this.registerValComp(comp); }
1594
+ ;
1595
+ /**
1596
+ * Effettua il Bind/Parse delle varie **Source** unendo le informazioni specificate in **Display**
1597
+ *
1598
+ * Eventualmente rieffettua un bind al modello in base al valore della variabile **RebindModelAfterSource**
1599
+ */
1600
+ tryBindSourceDisplay() {
1601
+ if (!this.Source)
1602
+ return;
1603
+ if (this.Source.length == 0 && !this.SourceFirstBind)
1604
+ this.BoundSource = [];
1605
+ this.SourceFirstBind = false;
1606
+ // Cache locale per evitare di rifare dei regex.match ogni santa volta
1607
+ if (this.Source.length > 0) {
1608
+ this.BoundSource = [];
1609
+ if (this.BindCheckingGroups.length == 0)
1610
+ this.evaluateBindCheckingGroups();
1611
+ if (this.BindProperties.length == 0)
1612
+ this.evaluateBindProperties();
1613
+ // Blocco per generare la descrizione finale di un elemento
1614
+ this.Source.forEach(s => {
1615
+ // Aggiungo alla BoundSource in formato standard KeyValue
1616
+ this.BoundSource.push(this.transformSourceItem(s));
1617
+ });
1618
+ }
1619
+ }
1620
+ /**
1621
+ * Valuta il contenuto della variabile BindCheckingGroups
1622
+ */
1623
+ evaluateBindCheckingGroups() {
1624
+ // Blocco per tirare fuori le condizioni scritte tipo --> :prop?(Roba con {prop})
1625
+ var iffedMatches = this.Display.match(/:([a-z]+)\?\(([^\(\)]+)\)/g);
1626
+ if (iffedMatches) {
1627
+ iffedMatches.forEach(m => {
1628
+ // Stessa regex di sopra ma il tag "i" serve per tirare fuori i singoli capturing group e per qualche motivo
1629
+ // new RegExp(baseRegex, "g") non funziona quindi non ho potuto razionalizzarlo
1630
+ let groups = m.match(/:([a-z]+)\?\(([^\(\)]+)\)/i);
1631
+ this.BindCheckingGroups.push({ global: m, prop: groups[1], whenexists: groups[2] });
1632
+ });
1633
+ }
1634
+ }
1635
+ /**
1636
+ * Valuta il contenuto della variabile BindProperties
1637
+ */
1638
+ evaluateBindProperties() {
1639
+ // Blocco per tirare fuori le proprietà scritte tipo --> {prop}
1640
+ var matches = this.Display.match(/{[a-z]+}/gi);
1641
+ if (matches)
1642
+ matches.forEach(m => { this.BindProperties.push({ global: m, prop: m.substring(1, m.length - 1) }); });
1643
+ }
1644
+ /**
1645
+ * Trasforma un oggetto della Source alla sua versione "nuova" basandosi sulle informazioni su gruppi e proprietà
1646
+ *
1647
+ * @param {any} item Oggetto da trasformare
1648
+ *
1649
+ * @returns {{id: string, description: string}} Oggetto finale trasformato
1650
+ */
1651
+ transformSourceItem(s) {
1652
+ // Parto sempre dalla variabile di Display, poi sostituisco pezzo per pezzo
1653
+ let desc = this.Display;
1654
+ // Taglio o mantengo le condizioni in base alla proprietà su cui fare check
1655
+ // Dopodiché scrivo tutte le proprietà
1656
+ for (let i = 0; i < this.BindCheckingGroups.length; i++) {
1657
+ let t = this.BindCheckingGroups[i];
1658
+ desc = desc.replace(t.global, (s[t.prop] != null && s[t.prop] != undefined) ? t.whenexists : "");
1659
+ }
1660
+ for (let i = 0; i < this.BindProperties.length; i++) {
1661
+ let t = this.BindProperties[i];
1662
+ desc = desc.replace(t.global, s[t.prop]);
1663
+ }
1664
+ return { id: s[this.IdField], description: desc };
1665
+ }
1666
+ /**
1667
+ * Indica se il comopnente in questione è in grado di gestire ngControl nulli.
1668
+ * Di default è **false**
1669
+ *
1670
+ * @returns {boolean} **true** se gestisco ngControl nulli, **false** altrimenti
1671
+ */
1672
+ handleNullNgControl() {
1673
+ return false;
1674
+ }
1675
+ /**
1676
+ * @ignore
1677
+ */
1678
+ ngOnInit() {
1679
+ // A volte nell'ngOnInit non ci passa quindi lo metto sia qui sia nell'afterviewinit, penso che valga per i componenti di terze parti
1680
+ // che si collegano per i cazzi loro al form ecc, quindi la parte sopra non serve... BOH
1681
+ this.checkRequiredValidator();
1682
+ //Il nome non c'è se metto standalone : true
1683
+ //Dato che anche il controllo esterno viene considerato come componente del form, non posso basarmi solo sul nome ma devo aggiungere un tag. In questo caso "_internal"
1684
+ // ATTENZIONE: QUALSIASI SIA IL MOTIVO, SE STO COSO VIENE SPOSTATO DALL ngOnInit NON FUNZIONA PIU NULLA
1685
+ if (this.ngControl.name)
1686
+ this.GeneratedName = this.ngControl.name.toString() + "_internal";
1687
+ // ATTENZIONE: QUALSIASI SIA IL MOTIVO, SE STO COSO VIENE SPOSTATO DALL ngOnInit NON FUNZIONA PIU NULLA
1688
+ if (this.Form) {
1689
+ if (!this.formHasBennBound && this.validationControl) {
1690
+ this.Form.addControl(this.validationControl);
1691
+ this.formHasBennBound = true;
1692
+ }
1693
+ // Quando un form viene submittato la variabile Form.submitted viene assegnata all'input [submitted] del val-control
1694
+ // Essendo che però la CD è OnPush per dire ad Angular che l'Input è cambiato e permettere i sideffects di assegnare [submitted]
1695
+ // devo attaccarmi al submit attuale del form e prima di eseguirlo devo marcare il componente per il check
1696
+ let origFunc = this.Form.onSubmit;
1697
+ var formOutsideRef = this.Form;
1698
+ this.Form.onSubmit = (ev) => {
1699
+ this.cdr.markForCheck();
1700
+ return origFunc.apply(formOutsideRef);
1701
+ };
1702
+ }
1703
+ }
1704
+ /**
1705
+ * Elabora i validatori iniettati e capisce se il valore è obbligatorio o meno
1706
+ */
1707
+ checkRequiredValidator() {
1708
+ // controllo se è settato un required per decidere in maniera condizionale se utilizzare il validatore required nel componente interno
1709
+ // Lo faccio qui e non in un eventuale ngOnInit o costruttore perché ngOnInit non sempre viene chiamato e da costruttore il validatore non ha ancora il valore giusto
1710
+ if (this._validators && this._validators.some(elem => elem instanceof RequiredValidator && elem.required))
1711
+ this.Required = true;
1712
+ }
1713
+ /**
1714
+ * @ignore
1715
+ */
1716
+ ngAfterViewInit() {
1717
+ if (!this.ngControl)
1718
+ return;
1719
+ this.checkRequiredValidator();
1720
+ }
1721
+ /**
1722
+ * Helper che collega la funzione di reset del controllo form al controllo di validazione sottostante
1723
+ */
1724
+ bindResetFunction() {
1725
+ //faccio in modo che se chiamo il reset del controllo (o della form) dall'esterno si resetti anche il controllo nativo
1726
+ const origFunc = this.ngControl.control.__original_reset__ || this.ngControl.control.reset;
1727
+ var ngControl_outsideReference = this.ngControl.control;
1728
+ var validationControl_outsideReference = this.validationControl.control;
1729
+ this.ngControl.control.reset = () => {
1730
+ origFunc.apply(ngControl_outsideReference);
1731
+ validationControl_outsideReference.reset();
1732
+ };
1733
+ //Per consentire richiami multipli di questa funzione prendendo sempre la fiunzione di reset base
1734
+ this.ngControl.control.__original_reset__ = origFunc;
1735
+ }
1736
+ /**
1737
+ * @ignore
1738
+ */
1739
+ writeValue(obj) {
1740
+ if (obj == null && this.firstBind) {
1741
+ this.firstBind = false;
1742
+ return;
1743
+ }
1744
+ this.Model = obj;
1745
+ //Per svegliare Angular. Il valore che entra potrebbe essere valido/non valido e questo lo binda a tutto, form compreso
1746
+ if (this.ngControl)
1747
+ this.ngControl.control.updateValueAndValidity();
1748
+ if (this.Model)
1749
+ this.onNotNullValueSet();
1750
+ // markForCheck non va bene in quanto arrivano possibilmente 2 update su un solo ciclo di stack
1751
+ // setTime*ut che wrappa tutto non va bene sennò spamma delle change detection a suon di interval che rallentano tantissimo l'app
1752
+ this.cdr.detectChanges();
1753
+ }
1754
+ /**
1755
+ * @ignore
1756
+ */
1757
+ registerOnChange(fn) {
1758
+ this.propagateChange = fn;
1759
+ }
1760
+ /**
1761
+ * @ignore
1762
+ */
1763
+ registerOnTouched(fn) {
1764
+ this.onTouched = fn;
1765
+ }
1766
+ /**
1767
+ * Registra internamente il componente di validazione, ne imposta i validatori e collega il Form, se presente
1768
+ *
1769
+ * @param {NgModel} comp Elemento HTML marcato con "#validationControl"
1770
+ */
1771
+ registerValComp(comp) {
1772
+ if (comp) {
1773
+ // È arrivato un nuovo validationContorl (succede solo nel form-select quando cambia la source da 0 elementi / null ad N elementi, quindi al massimo una volta)
1774
+ if (this.validationControl && this.Form)
1775
+ this.Form.removeControl(this.validationControl);
1776
+ this.validationControl = comp;
1777
+ //Questa serve per passare avanti i validatori
1778
+ this.validationControl.control.setValidators(this._validators);
1779
+ //Se sono staccato dal Form (vuol dire che sono ad esempio dentro un ng-template) aggiungo il controllo al Form passato come input (context del template)
1780
+ if (this.detatchedFromform && this.Form && !this.formHasBennBound) {
1781
+ this.Form.addControl(this.validationControl);
1782
+ this.formHasBennBound = true;
1783
+ }
1784
+ if (this.ngControl)
1785
+ this.bindResetFunction();
1786
+ //I val-roba questo lo fanno automaticamente dentro... gli altri no (es. semplice input checkbox)
1787
+ this.updateValidityForNativeInput();
1788
+ }
1789
+ }
1790
+ /**
1791
+ * Aggiorna il valore e la validità dell'input sottostante. Non viene chiamato per input nativi come le checkbox
1792
+ *
1793
+ * @param {boolean} forcedValue Forza l'aggiornamento anche se non è un input nativo (input nativo = checkbox, ad esempio)
1794
+ */
1795
+ updateValidityForNativeInput(forcedValue = false) {
1796
+ if (forcedValue || this.nativeInput)
1797
+ this.validationControl.control.updateValueAndValidity();
1798
+ }
1799
+ /**
1800
+ * @ignore
1801
+ * Classico "spara fuori". Mantengo lo stesso nome dell'evento dei <val-*> (inputChange) per retrocompatibilità.
1802
+ *
1803
+ * Non posso tenerlo protected altrimenti posso eseguirlo solo dal .ts e non dall' .html
1804
+ */
1805
+ changed(forcedValue = null, markForCheck = false) {
1806
+ this.propagateChange(forcedValue == null ? this.Model : forcedValue);
1807
+ this.inputChange.emit(forcedValue == null ? this.Model : forcedValue);
1808
+ if (markForCheck)
1809
+ this.cdr.markForCheck();
1810
+ }
1811
+ }
1812
+ BaseFormControl.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: BaseFormControl, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive });
1813
+ BaseFormControl.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.1", type: BaseFormControl, inputs: { FormLayout: "FormLayout", Validation: "Validation", Placeholder: "Placeholder", FormGroupClass: "FormGroupClass", FailedValidationMessage: "FailedValidationMessage", ForcedError: "ForcedError", Label: "Label", LabelColWidth: "LabelColWidth", InputColWidth: "InputColWidth", Last: "Last", Form: "Form", Source: "Source", IdField: "IdField", Display: "Display", Readonly: "Readonly", LabelInputRatio: "LabelInputRatio" }, outputs: { inputChange: "inputChange" }, viewQueries: [{ propertyName: "_validationControl", first: true, predicate: ["validationControl"], descendants: true }, { propertyName: "validationControl_static", first: true, predicate: ["validationControl"], descendants: true, static: true }], ngImport: i0 });
1814
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: BaseFormControl, decorators: [{
1815
+ type: Directive
1816
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i2$1.NgControl }, { type: Array }, { type: i2$4.AccessControlService, decorators: [{
1817
+ type: Optional
1818
+ }] }, { type: i2$4.ComponentContext, decorators: [{
1819
+ type: Optional
1820
+ }] }, { type: undefined, decorators: [{
1821
+ type: Optional
1822
+ }, {
1823
+ type: Inject,
1824
+ args: [ACO_CUSTOMKEY]
1825
+ }] }, { type: undefined }]; }, propDecorators: { FormLayout: [{
1826
+ type: Input
1827
+ }], Validation: [{
1828
+ type: Input
1829
+ }], Placeholder: [{
1830
+ type: Input
1831
+ }], FormGroupClass: [{
1832
+ type: Input
1833
+ }], FailedValidationMessage: [{
1834
+ type: Input
1835
+ }], ForcedError: [{
1836
+ type: Input
1837
+ }], Label: [{
1838
+ type: Input
1839
+ }], LabelColWidth: [{
1840
+ type: Input
1841
+ }], InputColWidth: [{
1842
+ type: Input
1843
+ }], Last: [{
1844
+ type: Input
1845
+ }], Form: [{
1846
+ type: Input
1847
+ }], Source: [{
1848
+ type: Input
1849
+ }], IdField: [{
1850
+ type: Input
1851
+ }], Display: [{
1852
+ type: Input
1853
+ }], Readonly: [{
1854
+ type: Input
1855
+ }], LabelInputRatio: [{
1856
+ type: Input
1857
+ }], _validationControl: [{
1858
+ type: ViewChild,
1859
+ args: ["validationControl", { static: false }]
1860
+ }], validationControl_static: [{
1861
+ type: ViewChild,
1862
+ args: ["validationControl", { static: true }]
1863
+ }], inputChange: [{
1864
+ type: Output
1865
+ }] } });
1866
+
1867
+ /**
1868
+ * Classe di localizzazione per il componente **FormFileComponent**
1869
+ */
1870
+ class FormFileComponentLoc extends LocalizationService {
1871
+ /**
1872
+ * @ignore
1873
+ */
1874
+ constructor(LOC_LOCALE) {
1875
+ super(LOC_LOCALE ?? 'it-IT');
1876
+ super.set("en->it", "Select a file", ["Seleziona un file"]);
1877
+ super.set("en->it", "Files Selected", ["File Selezionati"]);
1878
+ }
1879
+ }
1880
+ FormFileComponentLoc.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormFileComponentLoc, deps: [{ token: FAV_LOCALE, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
1881
+ FormFileComponentLoc.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormFileComponentLoc });
1882
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormFileComponentLoc, decorators: [{
1883
+ type: Injectable
1884
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
1885
+ type: Optional
1886
+ }, {
1887
+ type: Inject,
1888
+ args: [FAV_LOCALE]
1889
+ }] }]; } });
1890
+
1891
+ // Angular
1892
+ /**
1893
+ * Componente che permette all'utente di caricare/scaricare un file all'interno di un campo Input
1894
+ */
1895
+ class FormFileComponent extends BaseFormControl {
1896
+ /**
1897
+ * Costruttore
1898
+ *
1899
+ * @ignore
1900
+ */
1901
+ constructor(cdr, utiExts, ngControl, _validators, ac, AppContext, ACO_CUSTOMKEY, lc) {
1902
+ super(cdr, ngControl, _validators, ac, AppContext, ACO_CUSTOMKEY);
1903
+ this.utiExts = utiExts;
1904
+ this.lc = lc;
1905
+ /**
1906
+ * Permette di caricare file multipli
1907
+ */
1908
+ this.Multiple = false;
1909
+ /**
1910
+ * Permette di scaricare l'eventuale file selezionato
1911
+ */
1912
+ this.AllowDownload = true;
1913
+ //Per questo componente non posso permettermi che il modello sia nullo
1914
+ this.Model = new AppFile();
1915
+ }
1916
+ /**
1917
+ * @ignore
1918
+ */
1919
+ writeValue(obj) {
1920
+ var model = obj == null ? new AppFile() : obj;
1921
+ super.writeValue(model);
1922
+ if (obj == null)
1923
+ this.changed();
1924
+ }
1925
+ /**
1926
+ * Helper per gestire la modifica del file attualmente bindato
1927
+ *
1928
+ * @param {boolean} clear Indica se bisogna svuotare l'input o meno
1929
+ */
1930
+ fileChange(clear = false) {
1931
+ let files = [];
1932
+ let model = this.Model;
1933
+ let ne = this.inputEl.nativeElement;
1934
+ if (clear) {
1935
+ model.filename = "";
1936
+ ne.value = "";
1937
+ }
1938
+ else {
1939
+ for (let i = 0; i < ne.files.length; i++)
1940
+ files.push(ne.files.item(i));
1941
+ if (ne.files.length == 1)
1942
+ model.filename = ne.files[0].name;
1943
+ if (ne.files.length > 1)
1944
+ model.filename = ne.files.length + " " + this.lc.loc("Files Selected");
1945
+ model.nativefiles = files;
1946
+ model.fileb64 = null;
1947
+ }
1948
+ this.changed(null, true);
1949
+ }
1950
+ /**
1951
+ * Permette di scaricare l'eventuale file selezionato
1952
+ */
1953
+ downloadAttachment() {
1954
+ let model = this.Model;
1955
+ this.utiExts.saveFile(model.fileb64, model.filename);
1956
+ }
1957
+ /**
1958
+ * @ignore
1959
+ */
1960
+ onNotNullValueSet() { }
1961
+ }
1962
+ FormFileComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormFileComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i2$2.UtilityService }, { token: i2$1.NgControl, optional: true, self: true }, { token: NG_VALIDATORS, optional: true }, { token: i2$4.AccessControlService, optional: true }, { token: i2$4.ComponentContext, optional: true }, { token: ACO_CUSTOMKEY, optional: true }, { token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
1963
+ FormFileComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: FormFileComponent, selector: "form-file", inputs: { Multiple: "Multiple", AllowDownload: "AllowDownload" }, providers: [{ provide: LocalizationService, useClass: FormFileComponentLoc }], viewQueries: [{ propertyName: "inputEl", first: true, predicate: ["fileInput"], descendants: true }], usesInheritance: true, ngImport: i0, 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 class=\"input-group file-upload\">\r\n <input type=\"file\" (change)=\"fileChange()\" #fileInput class=\"file-upload-btn app-pointer\" [multiple]=\"Multiple ? true : null\" />\r\n <input type=\"text\" [class.frm-padding-left-22]=\"AllowDownload && Model.filename && Model.fileb64\" class=\"form-control checking-field\" placeholder=\"{{'Select a file' | localize : lc}}...\" [(ngModel)]=\"Model.filename\" name=\"dsfile\" #validationControl=\"ngModel\" [required]=\"Required ? true : null\" />\r\n\r\n <a class=\"fa fa-download app-pointer app-input-icon\" *ngIf=\"AllowDownload && Model.filename && Model.fileb64\" (click)=\"downloadAttachment()\"></a>\r\n <i class=\"fa fa-times delete-file\" (click)=\"fileChange(true)\" *ngIf=\"Model.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</ng-template>", styles: [".frm-padding-left-22{padding-left:22px}\n"], directives: [{ type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i2$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i2$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }], pipes: { "localize": i1.LocalizePipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
1964
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormFileComponent, decorators: [{
1965
+ type: Component,
1966
+ args: [{ selector: "form-file", providers: [{ provide: LocalizationService, useClass: FormFileComponentLoc }], changeDetection: ChangeDetectionStrategy.OnPush, 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 class=\"input-group file-upload\">\r\n <input type=\"file\" (change)=\"fileChange()\" #fileInput class=\"file-upload-btn app-pointer\" [multiple]=\"Multiple ? true : null\" />\r\n <input type=\"text\" [class.frm-padding-left-22]=\"AllowDownload && Model.filename && Model.fileb64\" class=\"form-control checking-field\" placeholder=\"{{'Select a file' | localize : lc}}...\" [(ngModel)]=\"Model.filename\" name=\"dsfile\" #validationControl=\"ngModel\" [required]=\"Required ? true : null\" />\r\n\r\n <a class=\"fa fa-download app-pointer app-input-icon\" *ngIf=\"AllowDownload && Model.filename && Model.fileb64\" (click)=\"downloadAttachment()\"></a>\r\n <i class=\"fa fa-times delete-file\" (click)=\"fileChange(true)\" *ngIf=\"Model.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</ng-template>", styles: [".frm-padding-left-22{padding-left:22px}\n"] }]
1967
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i2$2.UtilityService }, { type: i2$1.NgControl, decorators: [{
1968
+ type: Optional
1969
+ }, {
1970
+ type: Self
1971
+ }] }, { type: Array, decorators: [{
1972
+ type: Optional
1973
+ }, {
1974
+ type: Inject,
1975
+ args: [NG_VALIDATORS]
1976
+ }] }, { type: i2$4.AccessControlService, decorators: [{
1977
+ type: Optional
1978
+ }] }, { type: i2$4.ComponentContext, decorators: [{
1979
+ type: Optional
1980
+ }] }, { type: undefined, decorators: [{
1981
+ type: Optional
1982
+ }, {
1983
+ type: Inject,
1984
+ args: [ACO_CUSTOMKEY]
1985
+ }] }, { type: i1.LocalizationService }]; }, propDecorators: { Multiple: [{
1986
+ type: Input
1987
+ }], AllowDownload: [{
1988
+ type: Input
1989
+ }], inputEl: [{
1990
+ type: ViewChild,
1991
+ args: ["fileInput", { static: false }]
1992
+ }] } });
1993
+
1994
+ // Angular
1995
+ /**
1996
+ * Componente che dà all'utente la possibilità di selezionare una data insieme ad un orario
1997
+ */
1998
+ class FormDateTimeComponent extends BaseFormControl {
1999
+ /**
2000
+ * Costruttore
2001
+ *
2002
+ * @ignore
2003
+ */
2004
+ constructor(cdr, ngControl, _validators, ac, AppContext, ACO_CUSTOMKEY) {
2005
+ super(cdr, ngControl, _validators, ac, AppContext, ACO_CUSTOMKEY);
2006
+ /**
2007
+ * Utilizza il Date di Javascript come modello in uscita. Il modello in entrata verrà comunque ricondotto a un DayJs
2008
+ */
2009
+ this.JsDates = false;
2010
+ }
2011
+ /**
2012
+ * @ignore
2013
+ */
2014
+ onNotNullValueSet() { }
2015
+ }
2016
+ FormDateTimeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormDateTimeComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i2$1.NgControl, optional: true, self: true }, { token: NG_VALIDATORS, optional: true }, { token: i2$4.AccessControlService, optional: true }, { token: i2$4.ComponentContext, optional: true }, { token: ACO_CUSTOMKEY, optional: true }], target: i0.ɵɵFactoryTarget.Component });
2017
+ FormDateTimeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: FormDateTimeComponent, selector: "form-datetime", inputs: { JsDates: "JsDates" }, usesInheritance: true, ngImport: i0, 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>", components: [{ type: ValidationDateTimeComponent, selector: "val-datetime", inputs: ["useJsDates"] }], directives: [{ type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2018
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormDateTimeComponent, decorators: [{
2019
+ type: Component,
2020
+ args: [{ selector: "form-datetime", changeDetection: ChangeDetectionStrategy.OnPush, 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>" }]
2021
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i2$1.NgControl, decorators: [{
2022
+ type: Optional
2023
+ }, {
2024
+ type: Self
2025
+ }] }, { type: Array, decorators: [{
2026
+ type: Optional
2027
+ }, {
2028
+ type: Inject,
2029
+ args: [NG_VALIDATORS]
2030
+ }] }, { type: i2$4.AccessControlService, decorators: [{
2031
+ type: Optional
2032
+ }] }, { type: i2$4.ComponentContext, decorators: [{
2033
+ type: Optional
2034
+ }] }, { type: undefined, decorators: [{
2035
+ type: Optional
2036
+ }, {
2037
+ type: Inject,
2038
+ args: [ACO_CUSTOMKEY]
2039
+ }] }]; }, propDecorators: { JsDates: [{
2040
+ type: Input
2041
+ }] } });
2042
+
2043
+ /**
2044
+ * Classe di localizzazione per il componente **FormAdaptiveComponent**
2045
+ */
2046
+ class FormAdaptiveComponentLoc extends LocalizationService {
2047
+ /**
2048
+ * @ignore
2049
+ */
2050
+ constructor(LOC_LOCALE) {
2051
+ super(LOC_LOCALE ?? 'it-IT');
2052
+ super.set("en->it", "Select a file", ["Seleziona un file"]);
2053
+ super.set("en->it", "Files Selected", ["File Selezionati"]);
2054
+ }
2055
+ }
2056
+ FormAdaptiveComponentLoc.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormAdaptiveComponentLoc, deps: [{ token: FAV_LOCALE, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
2057
+ FormAdaptiveComponentLoc.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormAdaptiveComponentLoc });
2058
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormAdaptiveComponentLoc, decorators: [{
2059
+ type: Injectable
2060
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
2061
+ type: Optional
2062
+ }, {
2063
+ type: Inject,
2064
+ args: [FAV_LOCALE]
2065
+ }] }]; } });
2066
+
2067
+ // Angular
2068
+ /**
2069
+ * Componente in grado di assumere la forma di un qualsiasi altro componente form in base al tipo specificato. Utile per la creazione di form dinamici
2070
+ */
2071
+ class FormAdaptiveComponent extends BaseFormControl {
2072
+ /**
2073
+ * Costruttore
2074
+ *
2075
+ * @ignore
2076
+ */
2077
+ constructor(cdr, utiExts, dateAdapter, lc, ngControl, _validators, ac, AppContext, ACO_CUSTOMKEY) {
2078
+ super(cdr, ngControl, _validators, ac, AppContext, ACO_CUSTOMKEY);
2079
+ this.utiExts = utiExts;
2080
+ this.dateAdapter = dateAdapter;
2081
+ this.lc = lc;
2082
+ /**
2083
+ * Permette di scaricare l'eventuale file presente qualora il **Type** di questo componente fosse **file**
2084
+ */
2085
+ this.AllowDownload = true;
2086
+ /**
2087
+ * Utilizzata nel form-adapter per specificare la precisione degli input currencymap (Type: currency)
2088
+ */
2089
+ this.Precision = 2;
2090
+ /**
2091
+ * Allineamento della currency mask
2092
+ */
2093
+ this.Alignment = 'right';
2094
+ /**
2095
+ * Funzione di ricerca che verrà chiamata dal componente
2096
+ */
2097
+ this.SearchFunction = null;
2098
+ /**
2099
+ * Numero minimo di caratteri con cui cercare
2100
+ */
2101
+ this.MinChars = 3;
2102
+ /**
2103
+ * Indica se i controlli devono essere effettuati tenendo conto del Case o meno. Vale solo qualora la **Source** fosse fornita
2104
+ */
2105
+ this.CaseSensitive = false;
2106
+ /**
2107
+ * Variabile interna che gestisce se effettuare il riallineamento dei dati o meno
2108
+ */
2109
+ this.alignValues = false;
2110
+ /**
2111
+ * Indica se ignorare il prossimo evento writeValue che normalmente dovrebbe richiedere la nuova source. Serve per quando l'utente seleziona un elemento:
2112
+ * Subito dopo partirebbe un altro evento modelChange che ricaricherebbe nuovamente la source
2113
+ */
2114
+ this.ignoreNextWriteValue = false;
2115
+ /**
2116
+ * Cache della sorgente originale POST binding, in modo da poter fare filtri in locale qualora la **SearchFunction** non fosse definita e la **Source** fosse assegnata
2117
+ */
2118
+ this.FilteredBoundSource = [];
2119
+ //******************** Funzione di throttling per non spammare richieste in caso di animazioni attivate
2120
+ //TODO: spostarla in un metodo di utilità (esfaenza/extensions)
2121
+ /** @ignore */
2122
+ this.executionTimers = {};
2123
+ this.ModelFile = new AppFile();
2124
+ }
2125
+ /**
2126
+ * @ignore
2127
+ */
2128
+ async ngOnChanges(changes) {
2129
+ const newSource = changes["Source"];
2130
+ const newType = changes["Type"];
2131
+ if (newSource) {
2132
+ this.tryBindSourceDisplay();
2133
+ // Prima assegnazione se cambia la source sotto (quindi se viene bindata direttamente da HTML)
2134
+ if (this.Type == "autocomplete" && (this.Model?.length || 0) >= this.MinChars && !this.SearchFunction)
2135
+ this.FilteredBoundSource = this.BoundSource;
2136
+ else
2137
+ this.FilteredBoundSource = [];
2138
+ this.cdr.markForCheck();
2139
+ }
2140
+ if (newType && this.Model)
2141
+ this.writeValue(this.Model);
2142
+ }
2143
+ /**
2144
+ * @ignore
2145
+ */
2146
+ writeValue(obj) {
2147
+ this.alignValues = false;
2148
+ if (!this.Type)
2149
+ this.Type = "string";
2150
+ if ((this.Type == "float" || this.Type == "number") && obj)
2151
+ obj = obj.toString().replace(".", ",");
2152
+ // Per sicurezza riallineo i valori
2153
+ if (this.Type == "boolean") {
2154
+ obj = obj ? (obj === true || obj.toLowerCase() == "true") : false;
2155
+ this.alignValues = true;
2156
+ }
2157
+ if (this.Type == "time") {
2158
+ const [hours, minutes, seconds] = (obj || "0:0:0").split(":");
2159
+ obj = dayjs().hour(hours ?? 0).minute(minutes ?? 0).second(seconds ?? 0);
2160
+ }
2161
+ if (this.Type == "file")
2162
+ obj = this.ModelFile;
2163
+ if (this.Type == "autocomplete") {
2164
+ if (this.SearchFunction) {
2165
+ this.SearchFunction(obj, true).subscribe(t => {
2166
+ this.Source = t;
2167
+ this.tryBindSourceDisplay();
2168
+ setTimeout(() => { this.finalizeValue(obj); });
2169
+ });
2170
+ return;
2171
+ }
2172
+ else
2173
+ this.finalizeValue(obj);
2174
+ }
2175
+ super.writeValue(obj);
2176
+ if (this.alignValues) {
2177
+ this.changed();
2178
+ this.cdr.markForCheck();
2179
+ }
2180
+ }
2181
+ /**
2182
+ * Dato un valore verifica se può restituire le informazioni trovate in **Source** con id uguale a **value** o se deve restituire il valore in se
2183
+ *
2184
+ * @param {any} value Valore scritto nell'input di testo
2185
+ */
2186
+ finalizeValue(value) {
2187
+ var val = this.Source.find(t => t.id == value);
2188
+ this.propagateChange(val ? val.id : value);
2189
+ this.Model = val ? val.description : value;
2190
+ }
2191
+ /**
2192
+ * Evento di filtro della sorgente dati in base all'input utente
2193
+ *
2194
+ * @param {string} event Input utente
2195
+ */
2196
+ filterSource(event) {
2197
+ if (this.ignoreNextWriteValue) {
2198
+ this.ignoreNextWriteValue = false;
2199
+ return;
2200
+ }
2201
+ // Quando filtro la source, se non devo ignorare l'evento devo comunque assicurarmi di impostare il valore selezionato a null
2202
+ super.changed("");
2203
+ if (!event && this.MinChars == 0 && !this.SearchFunction) {
2204
+ this.FilteredBoundSource = this.BoundSource;
2205
+ return;
2206
+ }
2207
+ if (!event || event.length < this.MinChars) {
2208
+ this.FilteredBoundSource = [];
2209
+ return;
2210
+ }
2211
+ if (!this.SearchFunction && (!this.Source || this.Source.length == 0))
2212
+ throw "Impossibile filtrare gli elementi senza una funzione di ricerca che restituisca una lista di { id: string, description: string }";
2213
+ if (this.SearchFunction) {
2214
+ this.throttla("filtersource", () => {
2215
+ this.SearchFunction(event, false).subscribe(t => {
2216
+ this.Source = t;
2217
+ this.tryBindSourceDisplay();
2218
+ // In questo caso è già filtrata dalla SearchFunction
2219
+ this.FilteredBoundSource = this.BoundSource;
2220
+ this.cdr.markForCheck();
2221
+ });
2222
+ }, 400);
2223
+ }
2224
+ else {
2225
+ this.throttla("filtersource", () => {
2226
+ // In questo caso devo filtrare io in memoria
2227
+ this.FilteredBoundSource = this.BoundSource.filter(t => (this.CaseSensitive && t.description.includes(event)) || (!this.CaseSensitive && t.description.toLowerCase().includes(event.toLowerCase())));
2228
+ this.cdr.markForCheck();
2229
+ }, 100);
2230
+ }
2231
+ }
2232
+ /**
2233
+ * Metodo richiamato quando viene modificato il modello del campo di input
2234
+ */
2235
+ changed() {
2236
+ var toEmit = this.Model ? JSON.parse(JSON.stringify(this.Model)) : null;
2237
+ if ((this.Type == "float" || this.Type == "number") && toEmit)
2238
+ toEmit = toEmit.replace(".", "").replace(",", ".");
2239
+ if (this.Type == "boolean")
2240
+ toEmit = toEmit ? true : false;
2241
+ if (this.Type == "time") {
2242
+ var toEmit = this.dateAdapter.clone(this.Model);
2243
+ toEmit = toEmit.format("HH:mm:ss");
2244
+ }
2245
+ if (this.Type == "autocomplete")
2246
+ this.ignoreNextWriteValue = true;
2247
+ super.changed(toEmit);
2248
+ }
2249
+ /**
2250
+ * Helper per gestire la modifica del file attualmente bindato. Ovviamente funziona solo qualora il **Type** fosse **file**
2251
+ *
2252
+ * @param {boolean} clear Indica se bisogna svuotare l'input o meno
2253
+ */
2254
+ fileChange(clear = false) {
2255
+ let files = [];
2256
+ let model = this.Model;
2257
+ let ne = this.inputEl.nativeElement;
2258
+ if (clear) {
2259
+ model.filename = "";
2260
+ ne.value = "";
2261
+ }
2262
+ else {
2263
+ for (let i = 0; i < ne.files.length; i++)
2264
+ files.push(ne.files.item(i));
2265
+ if (ne.files.length == 1)
2266
+ model.filename = ne.files[0].name;
2267
+ if (ne.files.length > 1)
2268
+ model.filename = ne.files.length + " " + this.lc.loc("Files Selected");
2269
+ model.nativefiles = files;
2270
+ model.fileb64 = null;
2271
+ }
2272
+ this.changed();
2273
+ }
2274
+ /**
2275
+ * Permette di scaricare il file collegato all'evetnuale file input rappresentato da questo componente
2276
+ */
2277
+ downloadAttachment() {
2278
+ let model = this.Model;
2279
+ this.utiExts.saveFile(model.fileb64, model.filename);
2280
+ }
2281
+ /**
2282
+ * @ignore
2283
+ */
2284
+ onNotNullValueSet() { }
2285
+ /** @ignore */
2286
+ throttla(id, func, throttleTime) {
2287
+ //Se ho la funzione che vuole eseguire ripulisco quel timeout
2288
+ if (this.executionTimers[id])
2289
+ clearTimeout(this.executionTimers[id]);
2290
+ //Ricreo il timeout per eseguire quella funzione dopo throttleTime millisecondi
2291
+ this.executionTimers[id] = setTimeout(() => { func(); this.executionTimers[id] = null; }, throttleTime);
2292
+ }
2293
+ }
2294
+ FormAdaptiveComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormAdaptiveComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i2$2.UtilityService }, { token: i2$3.NgxMatDateAdapter }, { token: i1.LocalizationService }, { token: i2$1.NgControl, optional: true, self: true }, { token: NG_VALIDATORS, optional: true }, { token: i2$4.AccessControlService }, { token: i2$4.ComponentContext, optional: true }, { token: ACO_CUSTOMKEY, optional: true }], target: i0.ɵɵFactoryTarget.Component });
2295
+ FormAdaptiveComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: FormAdaptiveComponent, selector: "form-adaptive", inputs: { Type: "Type", TypeMissingMessage: "TypeMissingMessage", Pattern: "Pattern", AllowDownload: "AllowDownload", Precision: "Precision", Alignment: "Alignment", SearchFunction: "SearchFunction", MinChars: "MinChars", CaseSensitive: "CaseSensitive" }, providers: [{ provide: LocalizationService, useClass: FormAdaptiveComponentLoc }], viewQueries: [{ propertyName: "inputEl", first: true, predicate: ["fileInput"], descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, 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: Alignment }\" [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]=\"Required ? ('Select' | localize : lc) + '...' : Placeholder\" [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\" [placeholder]=\"Required ? ('Select' | localize : lc) + '...' : Placeholder\" [(ngModel)]=\"Model\" name=\"{{GeneratedName}}\" [FilteredSource]=\"FilteredBoundSource\" (inputChange)=\"filterSource($event); 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>", styles: [".frm-padding-left-22{padding-left:22px}\n"], components: [{ type: ValidationCurrencyComponent, selector: "val-currency", inputs: ["CurrencyOptions"] }, { type: ValidationDateComponent, selector: "val-date", inputs: ["useJsDates"] }, { type: ValidationInputComponent, selector: "val-input", inputs: ["Password", "showWarning", "warningTitle", "warningClass", "value"] }, { type: ValidationSelectComponent, selector: "val-select", inputs: ["emptyFieldValue", "placeHolderValue", "emptyValue", "showValidationSymbol", "label"], outputs: ["onBlur"] }, { type: ValidationAutocompleteComponent, selector: "val-autocomplete", inputs: ["FilteredSource", "value", "label"], outputs: ["optionChange"] }, { type: ValidationDateTimeComponent, selector: "val-datetime", inputs: ["useJsDates"] }, { type: i2$3.NgxMatTimepickerComponent, selector: "ngx-mat-timepicker", inputs: ["disabled", "showSpinners", "stepHour", "stepMinute", "stepSecond", "showSeconds", "disableMinute", "enableMeridian", "defaultTime", "color"], exportAs: ["ngxMatTimepicker"] }], directives: [{ type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i2$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i2$1.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { type: i2$1.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2$1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i2$1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i2$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }], pipes: { "localize": i1.LocalizePipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
2296
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormAdaptiveComponent, decorators: [{
2297
+ type: Component,
2298
+ args: [{ selector: "form-adaptive", providers: [{ provide: LocalizationService, useClass: FormAdaptiveComponentLoc }], changeDetection: ChangeDetectionStrategy.OnPush, 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: Alignment }\" [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]=\"Required ? ('Select' | localize : lc) + '...' : Placeholder\" [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\" [placeholder]=\"Required ? ('Select' | localize : lc) + '...' : Placeholder\" [(ngModel)]=\"Model\" name=\"{{GeneratedName}}\" [FilteredSource]=\"FilteredBoundSource\" (inputChange)=\"filterSource($event); 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>", styles: [".frm-padding-left-22{padding-left:22px}\n"] }]
2299
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i2$2.UtilityService }, { type: i2$3.NgxMatDateAdapter }, { type: i1.LocalizationService }, { type: i2$1.NgControl, decorators: [{
2300
+ type: Optional
2301
+ }, {
2302
+ type: Self
2303
+ }] }, { type: Array, decorators: [{
2304
+ type: Optional
2305
+ }, {
2306
+ type: Inject,
2307
+ args: [NG_VALIDATORS]
2308
+ }] }, { type: i2$4.AccessControlService }, { type: i2$4.ComponentContext, decorators: [{
2309
+ type: Optional
2310
+ }] }, { type: undefined, decorators: [{
2311
+ type: Optional
2312
+ }, {
2313
+ type: Inject,
2314
+ args: [ACO_CUSTOMKEY]
2315
+ }] }]; }, propDecorators: { Type: [{
2316
+ type: Input
2317
+ }], TypeMissingMessage: [{
2318
+ type: Input
2319
+ }], Pattern: [{
2320
+ type: Input
2321
+ }], inputEl: [{
2322
+ type: ViewChild,
2323
+ args: ["fileInput", { static: false }]
2324
+ }], AllowDownload: [{
2325
+ type: Input
2326
+ }], Precision: [{
2327
+ type: Input
2328
+ }], Alignment: [{
2329
+ type: Input
2330
+ }], SearchFunction: [{
2331
+ type: Input
2332
+ }], MinChars: [{
2333
+ type: Input
2334
+ }], CaseSensitive: [{
2335
+ type: Input
2336
+ }] } });
2337
+
2338
+ // Angular
2339
+ /**
2340
+ * Componente placeholder per la creazione dei form che rappresenta un blocchetto vuoto,
2341
+ * al posto del quale possono poi comparire dei componenti form senza incasinare la grafica
2342
+ */
2343
+ class FormEmptyComponent {
2344
+ constructor() {
2345
+ /**
2346
+ * Indica se è l'ultimo componente di un form (serve per rimuovere il margine finale)
2347
+ */
2348
+ this.Last = false;
2349
+ /**
2350
+ * Classe extra per il form-group in cui viene wrappato l'input finto
2351
+ */
2352
+ this.FormGroupClass = "";
2353
+ /**
2354
+ * Valore placeholder da mostrare
2355
+ */
2356
+ this.PlaceholderModel = "Placeholder";
2357
+ }
2358
+ }
2359
+ FormEmptyComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormEmptyComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2360
+ FormEmptyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: FormEmptyComponent, selector: "form-empty", inputs: { Last: "Last", FormGroupClass: "FormGroupClass" }, ngImport: i0, template: "<div class=\"form-group row app-hidden-view {{FormGroupClass}}\" [class.app-margin-bottom-0]=\"Last\">\r\n <label class=\"col-md-4 m-t-5\">Placeholder:</label>\r\n <div class=\"col-md-8\">\r\n <val-input type=\"text\" [(ngModel)]=\"PlaceholderModel\" [ngModelOptions]=\"{standalone: true}\"></val-input>\r\n </div>\r\n <div class=\"clearfix\"></div>\r\n</div>", components: [{ type: ValidationInputComponent, selector: "val-input", inputs: ["Password", "showWarning", "warningTitle", "warningClass", "value"] }], directives: [{ type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2361
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormEmptyComponent, decorators: [{
2362
+ type: Component,
2363
+ args: [{ selector: "form-empty", changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"form-group row app-hidden-view {{FormGroupClass}}\" [class.app-margin-bottom-0]=\"Last\">\r\n <label class=\"col-md-4 m-t-5\">Placeholder:</label>\r\n <div class=\"col-md-8\">\r\n <val-input type=\"text\" [(ngModel)]=\"PlaceholderModel\" [ngModelOptions]=\"{standalone: true}\"></val-input>\r\n </div>\r\n <div class=\"clearfix\"></div>\r\n</div>" }]
2364
+ }], propDecorators: { Last: [{
2365
+ type: Input
2366
+ }], FormGroupClass: [{
2367
+ type: Input
2368
+ }] } });
2369
+
2370
+ // Angular
2371
+ /**
2372
+ * Componente da utilizzare quando l'implementazione dell'input non è disponibile nella libreria,
2373
+ * fornisce la struttura standard di un form-component ma l'input vero e proprio viene proiettato dall'esterno
2374
+ */
2375
+ class FormTemplateComponent {
2376
+ constructor() {
2377
+ /**
2378
+ * Indica se l'input è obbligatorio o no
2379
+ */
2380
+ this.Required = false;
2381
+ /**
2382
+ * Mostra un testo a sinistra dell'input, **FormLayout** permettendo
2383
+ */
2384
+ this.Label = "";
2385
+ /**
2386
+ * Utilizza o meno il Layout di un form (Label con input di fianco), se false mostra solo l'input
2387
+ */
2388
+ this.FormLayout = true;
2389
+ /**
2390
+ * col-md-X per la label
2391
+ */
2392
+ this.LabelColWidth = 4;
2393
+ /**
2394
+ * col-md-X per l'input
2395
+ */
2396
+ this.InputColWidth = 8;
2397
+ /**
2398
+ * Indica se è l'ultimo componente di un form (serve per rimuovere il margine finale)
2399
+ */
2400
+ this.Last = false;
2401
+ /**
2402
+ * Classe extra per il form-group in cui viene wrappato l'input
2403
+ */
2404
+ this.FormGroupClass = "";
2405
+ }
2406
+ /**
2407
+ * Permette di settare in una volta solo gli input LabelColWidth e InputColWidth, basta scriverlo con la sintassi "X Y"
2408
+ */
2409
+ set LabelInputRatio(input) {
2410
+ var ratio = input.split(/\s/);
2411
+ this.LabelColWidth = parseInt(ratio[0]);
2412
+ this.InputColWidth = parseInt(ratio[1]);
2413
+ }
2414
+ }
2415
+ FormTemplateComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormTemplateComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2416
+ FormTemplateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: FormTemplateComponent, selector: "form-template", inputs: { Required: "Required", Label: "Label", FormLayout: "FormLayout", LabelColWidth: "LabelColWidth", InputColWidth: "InputColWidth", Last: "Last", FormGroupClass: "FormGroupClass", LabelInputRatio: "LabelInputRatio" }, ngImport: i0, template: "<ng-container *ngIf=\"!FormLayout\">\r\n <ng-content></ng-content>\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 ? '*' : ''}}<span *ngIf=\"Label\">:</span></label>\r\n <div class=\"col-md-{{InputColWidth}}\">\r\n <ng-content></ng-content>\r\n </div>\r\n <div class=\"clearfix\"></div>\r\n</div>", directives: [{ type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2417
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormTemplateComponent, decorators: [{
2418
+ type: Component,
2419
+ args: [{ selector: "form-template", changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"!FormLayout\">\r\n <ng-content></ng-content>\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 ? '*' : ''}}<span *ngIf=\"Label\">:</span></label>\r\n <div class=\"col-md-{{InputColWidth}}\">\r\n <ng-content></ng-content>\r\n </div>\r\n <div class=\"clearfix\"></div>\r\n</div>" }]
2420
+ }], propDecorators: { Required: [{
2421
+ type: Input
2422
+ }], Label: [{
2423
+ type: Input
2424
+ }], FormLayout: [{
2425
+ type: Input
2426
+ }], LabelColWidth: [{
2427
+ type: Input
2428
+ }], InputColWidth: [{
2429
+ type: Input
2430
+ }], Last: [{
2431
+ type: Input
2432
+ }], FormGroupClass: [{
2433
+ type: Input
2434
+ }], LabelInputRatio: [{
2435
+ type: Input
2436
+ }] } });
2437
+
2438
+ // Angular
2439
+ /**
2440
+ * Componente placeholder per la creazione dei form che rappresenta un blocchetto di erorre,
2441
+ * al posto del quale possono poi comparire dei componenti form senza incasinare la grafica
2442
+ */
2443
+ class FormErrorComponent {
2444
+ constructor() {
2445
+ /**
2446
+ * col-md-X per la label (Che in questoc aso è vuota)
2447
+ */
2448
+ this.LabelColWidth = 4;
2449
+ /**
2450
+ * col-md-X per l'input (che in questo caso contiene il messaggio d'errore proiettato nell'HTML)
2451
+ */
2452
+ this.InputColWidth = 8;
2453
+ /**
2454
+ * Indica se è l'ultimo componente di un form (serve per rimuovere il margine finale)
2455
+ */
2456
+ this.Last = false;
2457
+ /**
2458
+ * Classe extra per il form-group in cui viene wrappato l'input
2459
+ */
2460
+ this.FormGroupClass = "";
2461
+ }
2462
+ /**
2463
+ * Permette di settare in una volta solo gli input LabelColWidth e InputColWidth, basta scriverlo con la sintassi "X Y"
2464
+ */
2465
+ set LabelInputRatio(input) {
2466
+ var ratio = input.split(/\s/);
2467
+ this.LabelColWidth = parseInt(ratio[0]);
2468
+ this.InputColWidth = parseInt(ratio[1]);
2469
+ }
2470
+ }
2471
+ FormErrorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormErrorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2472
+ FormErrorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: FormErrorComponent, selector: "form-error", inputs: { LabelColWidth: "LabelColWidth", InputColWidth: "InputColWidth", Last: "Last", FormGroupClass: "FormGroupClass", LabelInputRatio: "LabelInputRatio" }, ngImport: i0, template: "<div class=\"form-group row {{FormGroupClass}}\" [class.app-margin-bottom-0]=\"Last\">\r\n <label class=\"app-hidden-view col-md-{{LabelColWidth}} m-t-5\"></label>\r\n <span class=\"help-block text-danger col-md-{{InputColWidth}}\">\r\n <ng-content></ng-content>\r\n </span>\r\n <div class=\"clearfix\"></div>\r\n</div>", changeDetection: i0.ChangeDetectionStrategy.OnPush });
2473
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormErrorComponent, decorators: [{
2474
+ type: Component,
2475
+ args: [{ selector: "form-error", changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"form-group row {{FormGroupClass}}\" [class.app-margin-bottom-0]=\"Last\">\r\n <label class=\"app-hidden-view col-md-{{LabelColWidth}} m-t-5\"></label>\r\n <span class=\"help-block text-danger col-md-{{InputColWidth}}\">\r\n <ng-content></ng-content>\r\n </span>\r\n <div class=\"clearfix\"></div>\r\n</div>" }]
2476
+ }], propDecorators: { LabelColWidth: [{
2477
+ type: Input
2478
+ }], InputColWidth: [{
2479
+ type: Input
2480
+ }], Last: [{
2481
+ type: Input
2482
+ }], FormGroupClass: [{
2483
+ type: Input
2484
+ }], LabelInputRatio: [{
2485
+ type: Input
2486
+ }] } });
2487
+
2488
+ // Angular
2489
+ /**
2490
+ * Componente placeholder per la creazione dei form che rappresenta un blocchetto di informazioni,
2491
+ * al posto del quale possono poi comparire dei componenti form senza incasinare la grafica
2492
+ */
2493
+ class FormInfoComponent {
2494
+ constructor() {
2495
+ /**
2496
+ * col-md-X per la label (Che in questoc aso è vuota)
2497
+ */
2498
+ this.LabelColWidth = 4;
2499
+ /**
2500
+ * col-md-X per l'input (che in questo caso contiene il messaggio d'errore proiettato nell'HTML)
2501
+ */
2502
+ this.InputColWidth = 8;
2503
+ /**
2504
+ * Indica se è l'ultimo componente di un form (serve per rimuovere il margine finale)
2505
+ */
2506
+ this.Last = false;
2507
+ /**
2508
+ * Classe extra per il form-group in cui viene wrappato l'input
2509
+ */
2510
+ this.FormGroupClass = "";
2511
+ }
2512
+ /**
2513
+ * Permette di settare in una volta solo gli input LabelColWidth e InputColWidth, basta scriverlo con la sintassi "X Y"
2514
+ */
2515
+ set LabelInputRatio(input) {
2516
+ var ratio = input.split(/\s/);
2517
+ this.LabelColWidth = parseInt(ratio[0]);
2518
+ this.InputColWidth = parseInt(ratio[1]);
2519
+ }
2520
+ }
2521
+ FormInfoComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormInfoComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2522
+ FormInfoComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: FormInfoComponent, selector: "form-info", inputs: { LabelColWidth: "LabelColWidth", InputColWidth: "InputColWidth", Last: "Last", FormGroupClass: "FormGroupClass", LabelInputRatio: "LabelInputRatio" }, ngImport: i0, template: "<div class=\"form-group row {{FormGroupClass}}\" [class.app-margin-bottom-0]=\"Last\">\r\n <label class=\"app-hidden-view col-md-{{LabelColWidth}} m-t-5\"></label>\r\n <span class=\"help-block col-md-{{InputColWidth}}\">\r\n <ng-content></ng-content>\r\n </span>\r\n <div class=\"clearfix\"></div>\r\n</div>", changeDetection: i0.ChangeDetectionStrategy.OnPush });
2523
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormInfoComponent, decorators: [{
2524
+ type: Component,
2525
+ args: [{ selector: "form-info", changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"form-group row {{FormGroupClass}}\" [class.app-margin-bottom-0]=\"Last\">\r\n <label class=\"app-hidden-view col-md-{{LabelColWidth}} m-t-5\"></label>\r\n <span class=\"help-block col-md-{{InputColWidth}}\">\r\n <ng-content></ng-content>\r\n </span>\r\n <div class=\"clearfix\"></div>\r\n</div>" }]
2526
+ }], propDecorators: { LabelColWidth: [{
2527
+ type: Input
2528
+ }], InputColWidth: [{
2529
+ type: Input
2530
+ }], Last: [{
2531
+ type: Input
2532
+ }], FormGroupClass: [{
2533
+ type: Input
2534
+ }], LabelInputRatio: [{
2535
+ type: Input
2536
+ }] } });
2537
+
2538
+ // Angular
2539
+ /**
2540
+ * Componente rappresentante una checkbox
2541
+ */
2542
+ class FormCheckboxComponent extends BaseFormControl {
2543
+ /**
2544
+ * Costruttore
2545
+ *
2546
+ * @ignore
2547
+ */
2548
+ constructor(cdr, ngControl, _validators, ac, AppContext, ACO_CUSTOMKEY) {
2549
+ super(cdr, ngControl, _validators, ac, AppContext, ACO_CUSTOMKEY, true);
2550
+ }
2551
+ /**
2552
+ * @ignore
2553
+ */
2554
+ onNotNullValueSet() { }
2555
+ }
2556
+ FormCheckboxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormCheckboxComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i2$1.NgControl, optional: true, self: true }, { token: NG_VALIDATORS, host: true, optional: true }, { token: i2$4.AccessControlService }, { token: i2$4.ComponentContext, optional: true }, { token: ACO_CUSTOMKEY, optional: true }], target: i0.ɵɵFactoryTarget.Component });
2557
+ FormCheckboxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: FormCheckboxComponent, selector: "form-checkbox", usesInheritance: true, ngImport: i0, 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}} m-t-5\">\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 <input class=\"app-pointer\" [disabled]=\"Readonly ? true : null\" type=\"checkbox\" [(ngModel)]=\"Model\" name=\"{{GeneratedName}}\" #validationControl=\"ngModel\" (ngModelChange)=\"changed();\" />\r\n</ng-template>", directives: [{ type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i2$1.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2558
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormCheckboxComponent, decorators: [{
2559
+ type: Component,
2560
+ args: [{ selector: "form-checkbox", changeDetection: ChangeDetectionStrategy.OnPush, 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}} m-t-5\">\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 <input class=\"app-pointer\" [disabled]=\"Readonly ? true : null\" type=\"checkbox\" [(ngModel)]=\"Model\" name=\"{{GeneratedName}}\" #validationControl=\"ngModel\" (ngModelChange)=\"changed();\" />\r\n</ng-template>" }]
2561
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i2$1.NgControl, decorators: [{
2562
+ type: Optional
2563
+ }, {
2564
+ type: Self
2565
+ }] }, { type: Array, decorators: [{
2566
+ type: Optional
2567
+ }, {
2568
+ type: Host
2569
+ }, {
2570
+ type: Inject,
2571
+ args: [NG_VALIDATORS]
2572
+ }] }, { type: i2$4.AccessControlService }, { type: i2$4.ComponentContext, decorators: [{
2573
+ type: Optional
2574
+ }] }, { type: undefined, decorators: [{
2575
+ type: Optional
2576
+ }, {
2577
+ type: Inject,
2578
+ args: [ACO_CUSTOMKEY]
2579
+ }] }]; } });
2580
+
2581
+ // Angular
2582
+ /**
2583
+ * Componente che dà all'utente la possibilità di selezionare una data
2584
+ */
2585
+ class FormDateComponent extends BaseFormControl {
2586
+ /**
2587
+ * Costruttore
2588
+ *
2589
+ * @ignore
2590
+ */
2591
+ constructor(cdr, ngControl, _validators, ac, AppContext, ACO_CUSTOMKEY) {
2592
+ super(cdr, ngControl, _validators, ac, AppContext, ACO_CUSTOMKEY);
2593
+ /**
2594
+ * Utilizza il Date di Javascript come modello in uscita. Il modello in entrata verrà comunque ricondotto a un DayJs
2595
+ */
2596
+ this.JsDates = false;
2597
+ }
2598
+ /**
2599
+ * @ignore
2600
+ */
2601
+ onNotNullValueSet() { }
2602
+ }
2603
+ FormDateComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormDateComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i2$1.NgControl, optional: true, self: true }, { token: NG_VALIDATORS, optional: true }, { token: i2$4.AccessControlService, optional: true }, { token: i2$4.ComponentContext, optional: true }, { token: ACO_CUSTOMKEY, optional: true }], target: i0.ɵɵFactoryTarget.Component });
2604
+ FormDateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: FormDateComponent, selector: "form-date", inputs: { JsDates: "JsDates" }, usesInheritance: true, ngImport: i0, 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>", components: [{ type: ValidationDateComponent, selector: "val-date", inputs: ["useJsDates"] }], directives: [{ type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2605
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormDateComponent, decorators: [{
2606
+ type: Component,
2607
+ args: [{ selector: "form-date", changeDetection: ChangeDetectionStrategy.OnPush, 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>" }]
2608
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i2$1.NgControl, decorators: [{
2609
+ type: Optional
2610
+ }, {
2611
+ type: Self
2612
+ }] }, { type: Array, decorators: [{
2613
+ type: Optional
2614
+ }, {
2615
+ type: Inject,
2616
+ args: [NG_VALIDATORS]
2617
+ }] }, { type: i2$4.AccessControlService, decorators: [{
2618
+ type: Optional
2619
+ }] }, { type: i2$4.ComponentContext, decorators: [{
2620
+ type: Optional
2621
+ }] }, { type: undefined, decorators: [{
2622
+ type: Optional
2623
+ }, {
2624
+ type: Inject,
2625
+ args: [ACO_CUSTOMKEY]
2626
+ }] }]; }, propDecorators: { JsDates: [{
2627
+ type: Input
2628
+ }] } });
2629
+
2630
+ // Angular
2631
+ /**
2632
+ * Semplice componente di Input testuale, con eventuale prefisso/suffisso
2633
+ */
2634
+ class FormInputComponent extends BaseFormControl {
2635
+ /**
2636
+ * Costruttore
2637
+ *
2638
+ * @ignore
2639
+ */
2640
+ constructor(cdr, ngControl, _validators, ac, AppContext, ACO_CUSTOMKEY) {
2641
+ super(cdr, ngControl, _validators, ac, AppContext, ACO_CUSTOMKEY);
2642
+ /**
2643
+ * Indica se l'input relativo è di tipo Password
2644
+ */
2645
+ this.Password = false;
2646
+ /**
2647
+ * Delegato per l'esecuzione di un'operazione al click del suffisso
2648
+ */
2649
+ this.onSuffixAction = new EventEmitter();
2650
+ /**
2651
+ * Delegato per l'esecuzione di un'operazione al click del prefisso
2652
+ */
2653
+ this.onPrefixAction = new EventEmitter();
2654
+ /**
2655
+ * Indica la presenza o meno di un suffisso, si basa sulla "truthiness" della proiezione **suffix**
2656
+ */
2657
+ this.HasSuffix = false;
2658
+ /**
2659
+ * Indica la presenza o meno di un prefisso, si basa sulla "truthiness" della proiezione **prefix**
2660
+ */
2661
+ this.HasPrefix = false;
2662
+ }
2663
+ /**
2664
+ * @ignore
2665
+ */
2666
+ ngAfterContentInit() {
2667
+ this.HasSuffix = !!this.suffix;
2668
+ this.HasPrefix = !!this.prefix;
2669
+ }
2670
+ /**
2671
+ * @ignore
2672
+ */
2673
+ onNotNullValueSet() { }
2674
+ }
2675
+ FormInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormInputComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i2$1.NgControl, optional: true, self: true }, { token: NG_VALIDATORS, optional: true }, { token: i2$4.AccessControlService, optional: true }, { token: i2$4.ComponentContext, optional: true }, { token: ACO_CUSTOMKEY, optional: true }], target: i0.ɵɵFactoryTarget.Component });
2676
+ FormInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: FormInputComponent, selector: "form-input", inputs: { Password: "Password" }, outputs: { onSuffixAction: "onSuffixAction", onPrefixAction: "onPrefixAction" }, queries: [{ propertyName: "suffix", first: true, predicate: ["suffix"], descendants: true }, { propertyName: "prefix", first: true, predicate: ["prefix"], descendants: true }], usesInheritance: true, ngImport: i0, 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>", components: [{ type: ValidationInputComponent, selector: "val-input", inputs: ["Password", "showWarning", "warningTitle", "warningClass", "value"] }], directives: [{ type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i2.MatSuffix, selector: "[matSuffix]" }, { type: i2.MatPrefix, selector: "[matPrefix]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2677
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormInputComponent, decorators: [{
2678
+ type: Component,
2679
+ args: [{ selector: "form-input", changeDetection: ChangeDetectionStrategy.OnPush, 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>" }]
2680
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i2$1.NgControl, decorators: [{
2681
+ type: Optional
2682
+ }, {
2683
+ type: Self
2684
+ }] }, { type: Array, decorators: [{
2685
+ type: Optional
2686
+ }, {
2687
+ type: Inject,
2688
+ args: [NG_VALIDATORS]
2689
+ }] }, { type: i2$4.AccessControlService, decorators: [{
2690
+ type: Optional
2691
+ }] }, { type: i2$4.ComponentContext, decorators: [{
2692
+ type: Optional
2693
+ }] }, { type: undefined, decorators: [{
2694
+ type: Optional
2695
+ }, {
2696
+ type: Inject,
2697
+ args: [ACO_CUSTOMKEY]
2698
+ }] }]; }, propDecorators: { Password: [{
2699
+ type: Input
2700
+ }], onSuffixAction: [{
2701
+ type: Output
2702
+ }], onPrefixAction: [{
2703
+ type: Output
2704
+ }], suffix: [{
2705
+ type: ContentChild,
2706
+ args: ["suffix", { static: false }]
2707
+ }], prefix: [{
2708
+ type: ContentChild,
2709
+ args: ["prefix", { static: false }]
2710
+ }] } });
2711
+
2712
+ /**
2713
+ * Classe di localizzazione per il componente **FormSelectComponent**
2714
+ */
2715
+ class FormSelectComponentLoc extends LocalizationService {
2716
+ /**
2717
+ * @ignore
2718
+ */
2719
+ constructor(LOC_LOCALE) {
2720
+ super(LOC_LOCALE ?? 'it-IT');
2721
+ }
2722
+ }
2723
+ FormSelectComponentLoc.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormSelectComponentLoc, deps: [{ token: FAV_LOCALE, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
2724
+ FormSelectComponentLoc.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormSelectComponentLoc });
2725
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormSelectComponentLoc, decorators: [{
2726
+ type: Injectable
2727
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
2728
+ type: Optional
2729
+ }, {
2730
+ type: Inject,
2731
+ args: [FAV_LOCALE]
2732
+ }] }]; } });
2733
+
2734
+ // Angular
2735
+ /**
2736
+ * Componente che permette di selezionare un valore da una lista di valori disponibili
2737
+ */
2738
+ class FormSelectComponent extends BaseFormControl {
2739
+ /**
2740
+ * Costruttore
2741
+ *
2742
+ * @ignore
2743
+ */
2744
+ constructor(cdr, lc, ngControl, _validators, ac, AppContext, ACO_CUSTOMKEY) {
2745
+ super(cdr, ngControl, _validators, ac, AppContext, ACO_CUSTOMKEY);
2746
+ this.lc = lc;
2747
+ /**
2748
+ * Permette di specificare il testo della Label flottante material-style
2749
+ */
2750
+ this.SelectLabel = "";
2751
+ /**
2752
+ * Permette al componente di considerare questo valore come "valore placeholder"
2753
+ *
2754
+ * Si consiglia di mantenere il default
2755
+ */
2756
+ this.PlaceholderValue = '';
2757
+ /**
2758
+ * Override del placeholder per select requried
2759
+ */
2760
+ this.RequiredPlaceholder = null;
2761
+ /**
2762
+ * Permette al componente di considerare questo valore come "valore vuoto"
2763
+ *
2764
+ * Si consiglia di mantenere il default
2765
+ */
2766
+ this.EmptyFieldValue = '-2';
2767
+ /**
2768
+ * Se **true** rimuove il simbolino di validazione (croce rossa o tick verde)
2769
+ */
2770
+ this.ShowValidationSymbol = true;
2771
+ }
2772
+ /**
2773
+ * @ignore
2774
+ */
2775
+ ngOnChanges(changes) {
2776
+ let newSource = changes["Source"];
2777
+ if (!newSource)
2778
+ return;
2779
+ let curr = newSource.currentValue;
2780
+ let prev = newSource.previousValue;
2781
+ // Se manca curr vuol dire che non ho un valore e posso ignorare (alla peggio deve arrivarmi un array vuoto)
2782
+ if (!curr)
2783
+ return;
2784
+ // Se manca prev vuol dire che è la prima assegnazione, lo considero un array vuoto e proseguo... ogni tanto viene chiamato una sola volta
2785
+ // ogni tanto viene chiamato due volte... è un pelo arbitrario ma vabbè
2786
+ if (!prev)
2787
+ prev = [];
2788
+ // Considero di aver ricevuto una nuova sorgente se:
2789
+ // 1: La sorgente nuova ha un numero di elementi diverso dalla sorgente vecchia
2790
+ // 2: Sia la sorgente nuova che vecchia hanno almeno un elemento e l'id del primo elemento della sorgente nuova è diverso dall'id del primo elemento della sorgente vecchia
2791
+ if (newSource && (curr.length != prev.length || (curr.length > 0 && curr[0][this.IdField] != prev[0][this.IdField]))) {
2792
+ /*
2793
+ * NGBUG:
2794
+ * Uso questo escamotage per distruggere il val-select e ricrearlo
2795
+ * Purtroppo una volta bindato a una sorgente, cambiargliela sotto significa mandare in palla material
2796
+ * che si mette a far floattare la label anche se il valore e' vuoto
2797
+ * Distruggendo il componente e ricreandolo material riparte da 0 e non da' problemi.
2798
+ * Ovviamente lo faccio solo quando ho una SelectLabel, altrimenti non ho problemi di floattamenti
2799
+ */
2800
+ if (!this.SourceFirstBind && this.SelectLabel) {
2801
+ this.BoundSource = null;
2802
+ setTimeout(() => { this.tryBindSourceDisplay(); this.cdr.detectChanges(); });
2803
+ }
2804
+ else
2805
+ this.tryBindSourceDisplay();
2806
+ this.cdr.markForCheck();
2807
+ }
2808
+ }
2809
+ /**
2810
+ * @ignore
2811
+ */
2812
+ onNotNullValueSet() { }
2813
+ }
2814
+ FormSelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormSelectComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i1.LocalizationService }, { token: i2$1.NgControl, optional: true, self: true }, { token: NG_VALIDATORS, optional: true }, { token: i2$4.AccessControlService, optional: true }, { token: i2$4.ComponentContext, optional: true }, { token: ACO_CUSTOMKEY, optional: true }], target: i0.ɵɵFactoryTarget.Component });
2815
+ FormSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: FormSelectComponent, selector: "form-select", inputs: { SelectLabel: "SelectLabel", PlaceholderValue: "PlaceholderValue", RequiredPlaceholder: "RequiredPlaceholder", EmptyFieldValue: "EmptyFieldValue", ShowValidationSymbol: "ShowValidationSymbol" }, providers: [{ provide: LocalizationService, useClass: FormSelectComponentLoc }], usesInheritance: true, usesOnChanges: true, ngImport: i0, 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 ? ((RequiredPlaceholder != null ? RequiredPlaceholder : ('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 [showValidationSymbol]=\"ShowValidationSymbol\"\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 [showValidationSymbol]=\"ShowValidationSymbol\"\r\n [placeholder]=\"Required ? ((RequiredPlaceholder != null ? RequiredPlaceholder : ('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>", components: [{ type: ValidationSelectComponent, selector: "val-select", inputs: ["emptyFieldValue", "placeHolderValue", "emptyValue", "showValidationSymbol", "label"], outputs: ["onBlur"] }], directives: [{ type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i2$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2$1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i2$1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }], pipes: { "localize": i1.LocalizePipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
2816
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormSelectComponent, decorators: [{
2817
+ type: Component,
2818
+ args: [{ selector: "form-select", providers: [{ provide: LocalizationService, useClass: FormSelectComponentLoc }], changeDetection: ChangeDetectionStrategy.OnPush, 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 ? ((RequiredPlaceholder != null ? RequiredPlaceholder : ('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 [showValidationSymbol]=\"ShowValidationSymbol\"\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 [showValidationSymbol]=\"ShowValidationSymbol\"\r\n [placeholder]=\"Required ? ((RequiredPlaceholder != null ? RequiredPlaceholder : ('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>" }]
2819
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i1.LocalizationService }, { type: i2$1.NgControl, decorators: [{
2820
+ type: Optional
2821
+ }, {
2822
+ type: Self
2823
+ }] }, { type: Array, decorators: [{
2824
+ type: Optional
2825
+ }, {
2826
+ type: Inject,
2827
+ args: [NG_VALIDATORS]
2828
+ }] }, { type: i2$4.AccessControlService, decorators: [{
2829
+ type: Optional
2830
+ }] }, { type: i2$4.ComponentContext, decorators: [{
2831
+ type: Optional
2832
+ }] }, { type: undefined, decorators: [{
2833
+ type: Optional
2834
+ }, {
2835
+ type: Inject,
2836
+ args: [ACO_CUSTOMKEY]
2837
+ }] }]; }, propDecorators: { SelectLabel: [{
2838
+ type: Input
2839
+ }], PlaceholderValue: [{
2840
+ type: Input
2841
+ }], RequiredPlaceholder: [{
2842
+ type: Input
2843
+ }], EmptyFieldValue: [{
2844
+ type: Input
2845
+ }], ShowValidationSymbol: [{
2846
+ type: Input
2847
+ }] } });
2848
+
2849
+ /**
2850
+ * Classe di localizzazione per il componente **FormMultiSelectComponent**
2851
+ */
2852
+ class FormMultiSelectComponentLoc extends LocalizationService {
2853
+ /**
2854
+ * @ignore
2855
+ */
2856
+ constructor(LOC_LOCALE) {
2857
+ super(LOC_LOCALE ?? 'it-IT');
2858
+ super.set("en->it", "Select everything", ["Seleziona tutto"]);
2859
+ super.set("en->it", "Deselect everything", ["Deseleziona tutto"]);
2860
+ super.set("en->it", "Select one or more values...", ["Seleziona uno o più valori..."]);
2861
+ }
2862
+ }
2863
+ FormMultiSelectComponentLoc.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormMultiSelectComponentLoc, deps: [{ token: FAV_LOCALE, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
2864
+ FormMultiSelectComponentLoc.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormMultiSelectComponentLoc });
2865
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormMultiSelectComponentLoc, decorators: [{
2866
+ type: Injectable
2867
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
2868
+ type: Optional
2869
+ }, {
2870
+ type: Inject,
2871
+ args: [FAV_LOCALE]
2872
+ }] }]; } });
2873
+
2874
+ // Angular
2875
+ /**
2876
+ * Componente che permette di effettuare una selezione multipla fra gli oggetti passati nell'Input **Source**
2877
+ *
2878
+ * N.B: Al contrario degli altri componenti form-* questo viene tenuto con **changeDetection: ChangeDetectionStrategy.Default** in quanto il componente
2879
+ * utilizzato internamente (angular2-multiselect) non è stato assolutamente pensato per essere usato con **ChangeDetectionStrategy.OnPush**
2880
+ */
2881
+ class FormMultiSelectComponent extends BaseFormControl {
2882
+ /**
2883
+ * Costruttore
2884
+ *
2885
+ * @ignore
2886
+ */
2887
+ constructor(cdr, lc, ngControl, _validators, ac, AppContext, ACO_CUSTOMKEY) {
2888
+ super(cdr, ngControl, _validators, ac, AppContext, ACO_CUSTOMKEY);
2889
+ this.lc = lc;
2890
+ /**
2891
+ * Modello temporaneo **NON** compatibile in maniera diretta con il componente **angular2-multiselect** usato internamente
2892
+ *
2893
+ * Serve da appoggio per effettuare un re-bind qualora la sorgente cambiasse e qualora **RebindModelAfterSource** fosse true
2894
+ */
2895
+ this.TmpModel = [];
2896
+ /**
2897
+ * Indica se la prossima modifica alla Source deve anche effettuare un re-bind del modello. Serve se la **BoundSource** passa da non avere oggetti ad averne
2898
+ */
2899
+ this.RebindModelAfterSource = false;
2900
+ /**
2901
+ * Permette di specificare il testo della Label flottante material-style
2902
+ */
2903
+ this.SelectLabel = "";
2904
+ /**
2905
+ * Permette al componente di gestire come modello non una lista di chiavi, ma una lista di KeyValue
2906
+ */
2907
+ this.UseKeyValues = false;
2908
+ /**
2909
+ * Impostazioni del componente interno **angular2-multiselect**
2910
+ */
2911
+ this.Settings = null;
2912
+ // Default dei settings per evitare che siano mai nulli, altrimenti il cazzo di CuppaLab salta in araia che è veramente una bellezza
2913
+ this.evaluateSettings(false);
2914
+ }
2915
+ /**
2916
+ * @ignore
2917
+ */
2918
+ async ngOnChanges(changes) {
2919
+ const newSource = changes["Source"];
2920
+ if (newSource) {
2921
+ this.tryBindSourceDisplay();
2922
+ if (this.RebindModelAfterSource) {
2923
+ this.writeValue(this.TmpModel);
2924
+ this.RebindModelAfterSource = false;
2925
+ }
2926
+ }
2927
+ const readonly = changes["Readonly"];
2928
+ this.evaluateSettings(readonly ? readonly.currentValue ?? false : this.Readonly ?? false);
2929
+ }
2930
+ /**
2931
+ * Scrive i nuovi settings per il componente
2932
+ *
2933
+ * @param {boolean} disabled Indica se il componente dev'essere disabilitato o meno
2934
+ */
2935
+ evaluateSettings(disabled) {
2936
+ this.Settings = {
2937
+ selectAllText: this.lc.loc("Select everything"),
2938
+ unSelectAllText: this.lc.loc("Deselect everything"),
2939
+ text: this.SelectLabel || this.lc.loc("Select one or more values..."),
2940
+ enableCheckAll: true,
2941
+ disabled: disabled,
2942
+ labelKey: "description",
2943
+ tagToBody: false
2944
+ };
2945
+ }
2946
+ /**
2947
+ * @ignore
2948
+ */
2949
+ onNotNullValueSet() { }
2950
+ /**
2951
+ * Indica se il comopnente in questione è in grado di gestire ngControl nulli.
2952
+ * In questo componente è normale che sia così quindi restituisce semplicemente **true**
2953
+ *
2954
+ * @returns {boolean} **true** se gestisco ngControl nulli, **false** altrimenti
2955
+ */
2956
+ handleNullNgControl() {
2957
+ return true;
2958
+ }
2959
+ /**
2960
+ * @ignore Override per gestire input in ingresso
2961
+ */
2962
+ writeValue(obj) {
2963
+ this.TmpModel = obj;
2964
+ let toPass = [];
2965
+ //Qui arrivano solo gli id, o {id: x, description: y} in caso sono in UseKeyValues,
2966
+ //devo tirare fuori gli oggetti relativi e piazzarli come lista per il Model
2967
+ if (obj && obj.length > 0) {
2968
+ obj.forEach(t => {
2969
+ let item = this.BoundSource.find(o => o.id == (this.UseKeyValues ? t.id : t));
2970
+ if (item)
2971
+ toPass.push(JSON.parse(JSON.stringify(item)));
2972
+ else if (!this.BoundSource || this.BoundSource.length == 0)
2973
+ this.RebindModelAfterSource = true;
2974
+ });
2975
+ }
2976
+ super.writeValue(toPass);
2977
+ }
2978
+ /**
2979
+ * @ignore Override per gestire input in uscita
2980
+ */
2981
+ changed() {
2982
+ let toEmit = null;
2983
+ if (!this.UseKeyValues)
2984
+ toEmit = this.Model.map(m => m.id);
2985
+ else
2986
+ toEmit = this.Model.map(m => ({ id: m.id, description: m.itemName }));
2987
+ super.changed(toEmit);
2988
+ }
2989
+ }
2990
+ FormMultiSelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormMultiSelectComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i1.LocalizationService }, { token: i2$1.NgControl, optional: true, self: true }, { token: NG_VALIDATORS, optional: true }, { token: i2$4.AccessControlService, optional: true }, { token: i2$4.ComponentContext, optional: true }, { token: ACO_CUSTOMKEY, optional: true }], target: i0.ɵɵFactoryTarget.Component });
2991
+ FormMultiSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: FormMultiSelectComponent, selector: "form-multiselect", inputs: { SelectLabel: "SelectLabel", UseKeyValues: "UseKeyValues" }, usesInheritance: true, usesOnChanges: true, ngImport: i0, 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 <div [class.ms-placeholder]=\"!Model || Model.length == 0\">\r\n <angular2-multiselect #validationControl=\"ngModel\" type=\"text\"\r\n [(ngModel)]=\"Model\" name=\"{{GeneratedName}}\"\r\n [settings]=\"Settings\" [data]=\"BoundSource\"\r\n (onSelect)=\"changed();\" \r\n (onDeSelect)=\"changed();\" \r\n (onSelectAll)=\"changed();\"\r\n (onDeSelectAll)=\"changed();\" \r\n (onDeSelectAll)=\"Model = []; changed();\">\r\n </angular2-multiselect>\r\n </div>\r\n</ng-template>", styles: [".c-btn{background:#fff;border:1px solid #ccc;color:#333}.selected-list .c-list .c-token{background:#415269}.selected-list .c-list .c-token .c-label{color:#fff}.selected-list .c-list .c-token .c-remove svg{fill:#fff}.selected-list .c-angle-down svg,.selected-list .c-angle-up svg{fill:#333}.dropdown-list ul li:hover{background:#f5f5f5}.arrow-up,.arrow-down{border-bottom:15px solid #fff}.arrow-2{border-bottom:15px solid #ccc}.list-area{border:1px solid #ccc;background:#fff;box-shadow:0 1px 5px #959595}.select-all,.list-filter{border-bottom:1px solid #ccc}.list-filter .c-search svg{fill:#888}.list-filter .c-clear svg{fill:#888}.pure-checkbox input[type=checkbox]:focus+label:before,.pure-checkbox input[type=checkbox]:hover+label:before{border-color:#415269;background-color:#f2f2f2}.pure-checkbox input[type=checkbox]+label{color:#000}.pure-checkbox input[type=checkbox]+label:before{color:#415269;border:1px solid #415269}.pure-checkbox input[type=checkbox]+label:after{background-color:#415269}.pure-checkbox input[type=checkbox]:disabled+label:before{border-color:#ccc}.pure-checkbox input[type=checkbox]:disabled:checked+label:before{background-color:#ccc}.pure-checkbox input[type=checkbox]+label:after{border-color:#fff}.pure-checkbox input[type=radio]:checked+label:before{background-color:#fff}.pure-checkbox input[type=checkbox]:checked+label:before{background:#415269}.single-select-mode .pure-checkbox input[type=checkbox]:focus+label:before,.single-select-mode .pure-checkbox input[type=checkbox]:hover+label:before{border-color:#415269;background-color:#f2f2f2}.single-select-mode .pure-checkbox input[type=checkbox]+label{color:#000}.single-select-mode .pure-checkbox input[type=checkbox]+label:before{color:transparent!important;border:0px solid #415269}.single-select-mode .pure-checkbox input[type=checkbox]+label:after{background-color:transparent!important}.single-select-mode .pure-checkbox input[type=checkbox]:disabled+label:before{border-color:#ccc}.single-select-mode .pure-checkbox input[type=checkbox]:disabled:checked+label:before{background-color:#ccc}.single-select-mode .pure-checkbox input[type=checkbox]+label:after{border-color:#415269}.single-select-mode .pure-checkbox input[type=radio]:checked+label:before{background-color:#fff}.single-select-mode .pure-checkbox input[type=checkbox]:checked+label:before{background:none!important}.selected-item{background:#e9f4ff}.btn-iceblue{background:#415269;border:1px solid #ccc;color:#fff}.cuppa-dropdown{margin-top:2px;min-width:200px}.cuppa-dropdown .c-btn{min-height:34px}.cuppa-dropdown .c-angle-down,.cuppa-dropdown .c-angle-up{margin-top:-2px}.selected-list .c-list{width:auto!important;padding-right:35px!important;margin-top:-2px!important}.selected-list .c-list .c-token{padding:3px 22px 3px 8px!important}.ms-placeholder .cuppa-dropdown .selected-list>div>span{color:#aaa}\n"], components: [{ type: i4$3.AngularMultiSelect, selector: "angular2-multiselect", inputs: ["settings", "data", "loading"], outputs: ["onSelect", "onDeSelect", "onSelectAll", "onDeSelectAll", "onOpen", "onClose", "onScrollToEnd", "onFilterSelectAll", "onFilterDeSelectAll", "onAddFilterNewItem", "onGroupSelect", "onGroupDeSelect"] }], directives: [{ type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], viewProviders: [{ provide: LocalizationService, useClass: FormMultiSelectComponentLoc }], changeDetection: i0.ChangeDetectionStrategy.Default, encapsulation: i0.ViewEncapsulation.None });
2992
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormMultiSelectComponent, decorators: [{
2993
+ type: Component,
2994
+ args: [{ selector: "form-multiselect", viewProviders: [{ provide: LocalizationService, useClass: FormMultiSelectComponentLoc }], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.Default, 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 <div [class.ms-placeholder]=\"!Model || Model.length == 0\">\r\n <angular2-multiselect #validationControl=\"ngModel\" type=\"text\"\r\n [(ngModel)]=\"Model\" name=\"{{GeneratedName}}\"\r\n [settings]=\"Settings\" [data]=\"BoundSource\"\r\n (onSelect)=\"changed();\" \r\n (onDeSelect)=\"changed();\" \r\n (onSelectAll)=\"changed();\"\r\n (onDeSelectAll)=\"changed();\" \r\n (onDeSelectAll)=\"Model = []; changed();\">\r\n </angular2-multiselect>\r\n </div>\r\n</ng-template>", styles: [".c-btn{background:#fff;border:1px solid #ccc;color:#333}.selected-list .c-list .c-token{background:#415269}.selected-list .c-list .c-token .c-label{color:#fff}.selected-list .c-list .c-token .c-remove svg{fill:#fff}.selected-list .c-angle-down svg,.selected-list .c-angle-up svg{fill:#333}.dropdown-list ul li:hover{background:#f5f5f5}.arrow-up,.arrow-down{border-bottom:15px solid #fff}.arrow-2{border-bottom:15px solid #ccc}.list-area{border:1px solid #ccc;background:#fff;box-shadow:0 1px 5px #959595}.select-all,.list-filter{border-bottom:1px solid #ccc}.list-filter .c-search svg{fill:#888}.list-filter .c-clear svg{fill:#888}.pure-checkbox input[type=checkbox]:focus+label:before,.pure-checkbox input[type=checkbox]:hover+label:before{border-color:#415269;background-color:#f2f2f2}.pure-checkbox input[type=checkbox]+label{color:#000}.pure-checkbox input[type=checkbox]+label:before{color:#415269;border:1px solid #415269}.pure-checkbox input[type=checkbox]+label:after{background-color:#415269}.pure-checkbox input[type=checkbox]:disabled+label:before{border-color:#ccc}.pure-checkbox input[type=checkbox]:disabled:checked+label:before{background-color:#ccc}.pure-checkbox input[type=checkbox]+label:after{border-color:#fff}.pure-checkbox input[type=radio]:checked+label:before{background-color:#fff}.pure-checkbox input[type=checkbox]:checked+label:before{background:#415269}.single-select-mode .pure-checkbox input[type=checkbox]:focus+label:before,.single-select-mode .pure-checkbox input[type=checkbox]:hover+label:before{border-color:#415269;background-color:#f2f2f2}.single-select-mode .pure-checkbox input[type=checkbox]+label{color:#000}.single-select-mode .pure-checkbox input[type=checkbox]+label:before{color:transparent!important;border:0px solid #415269}.single-select-mode .pure-checkbox input[type=checkbox]+label:after{background-color:transparent!important}.single-select-mode .pure-checkbox input[type=checkbox]:disabled+label:before{border-color:#ccc}.single-select-mode .pure-checkbox input[type=checkbox]:disabled:checked+label:before{background-color:#ccc}.single-select-mode .pure-checkbox input[type=checkbox]+label:after{border-color:#415269}.single-select-mode .pure-checkbox input[type=radio]:checked+label:before{background-color:#fff}.single-select-mode .pure-checkbox input[type=checkbox]:checked+label:before{background:none!important}.selected-item{background:#e9f4ff}.btn-iceblue{background:#415269;border:1px solid #ccc;color:#fff}.cuppa-dropdown{margin-top:2px;min-width:200px}.cuppa-dropdown .c-btn{min-height:34px}.cuppa-dropdown .c-angle-down,.cuppa-dropdown .c-angle-up{margin-top:-2px}.selected-list .c-list{width:auto!important;padding-right:35px!important;margin-top:-2px!important}.selected-list .c-list .c-token{padding:3px 22px 3px 8px!important}.ms-placeholder .cuppa-dropdown .selected-list>div>span{color:#aaa}\n"] }]
2995
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i1.LocalizationService }, { type: i2$1.NgControl, decorators: [{
2996
+ type: Optional
2997
+ }, {
2998
+ type: Self
2999
+ }] }, { type: Array, decorators: [{
3000
+ type: Optional
3001
+ }, {
3002
+ type: Inject,
3003
+ args: [NG_VALIDATORS]
3004
+ }] }, { type: i2$4.AccessControlService, decorators: [{
3005
+ type: Optional
3006
+ }] }, { type: i2$4.ComponentContext, decorators: [{
3007
+ type: Optional
3008
+ }] }, { type: undefined, decorators: [{
3009
+ type: Optional
3010
+ }, {
3011
+ type: Inject,
3012
+ args: [ACO_CUSTOMKEY]
3013
+ }] }]; }, propDecorators: { SelectLabel: [{
3014
+ type: Input
3015
+ }], UseKeyValues: [{
3016
+ type: Input
3017
+ }] } });
3018
+
3019
+ // Angular
3020
+ /**
3021
+ * Componente che presenta una casella di testo tipicamente utilizzata per scrivere delle note o del log breve
3022
+ */
3023
+ class FormTextareaComponent extends BaseFormControl {
3024
+ /**
3025
+ * Costruttore
3026
+ *
3027
+ * @ignore
3028
+ */
3029
+ constructor(cdr, ngControl, _validators, ac, AppContext, ACO_CUSTOMKEY) {
3030
+ super(cdr, ngControl, _validators, ac, AppContext, ACO_CUSTOMKEY);
3031
+ }
3032
+ /**
3033
+ * @ignore
3034
+ */
3035
+ onNotNullValueSet() { }
3036
+ }
3037
+ FormTextareaComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormTextareaComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i2$1.NgControl, optional: true, self: true }, { token: NG_VALIDATORS, optional: true }, { token: i2$4.AccessControlService, optional: true }, { token: i2$4.ComponentContext, optional: true }, { token: ACO_CUSTOMKEY, optional: true }], target: i0.ɵɵFactoryTarget.Component });
3038
+ FormTextareaComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: FormTextareaComponent, selector: "form-textarea", inputs: { Rows: "Rows" }, usesInheritance: true, ngImport: i0, 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>", components: [{ type: ValidationTextAreaComponent, selector: "val-textarea", inputs: ["rows"] }], directives: [{ type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3039
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormTextareaComponent, decorators: [{
3040
+ type: Component,
3041
+ args: [{ selector: "form-textarea", changeDetection: ChangeDetectionStrategy.OnPush, 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>" }]
3042
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i2$1.NgControl, decorators: [{
3043
+ type: Optional
3044
+ }, {
3045
+ type: Self
3046
+ }] }, { type: Array, decorators: [{
3047
+ type: Optional
3048
+ }, {
3049
+ type: Inject,
3050
+ args: [NG_VALIDATORS]
3051
+ }] }, { type: i2$4.AccessControlService, decorators: [{
3052
+ type: Optional
3053
+ }] }, { type: i2$4.ComponentContext, decorators: [{
3054
+ type: Optional
3055
+ }] }, { type: undefined, decorators: [{
3056
+ type: Optional
3057
+ }, {
3058
+ type: Inject,
3059
+ args: [ACO_CUSTOMKEY]
3060
+ }] }]; }, propDecorators: { Rows: [{
3061
+ type: Input
3062
+ }] } });
3063
+
3064
+ /**
3065
+ * Classe di localizzazione per il componente **FormAutocompleteComponent**
3066
+ */
3067
+ class FormAutocompleteComponentLoc extends LocalizationService {
3068
+ /**
3069
+ * @ignore
3070
+ */
3071
+ constructor(LOC_LOCALE) {
3072
+ super(LOC_LOCALE ?? 'it-IT');
3073
+ }
3074
+ }
3075
+ FormAutocompleteComponentLoc.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormAutocompleteComponentLoc, deps: [{ token: FAV_LOCALE, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
3076
+ FormAutocompleteComponentLoc.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormAutocompleteComponentLoc });
3077
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormAutocompleteComponentLoc, decorators: [{
3078
+ type: Injectable
3079
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
3080
+ type: Optional
3081
+ }, {
3082
+ type: Inject,
3083
+ args: [FAV_LOCALE]
3084
+ }] }]; } });
3085
+
3086
+ // Angular
3087
+ /**
3088
+ * Componente di input che si auto-completa in base al valore attuale
3089
+ */
3090
+ class FormAutocompleteComponent extends BaseFormControl {
3091
+ /**
3092
+ * Costruttore
3093
+ *
3094
+ * @ignore
3095
+ */
3096
+ constructor(cdr, lc, ngControl, _validators, ac, AppContext, ACO_CUSTOMKEY) {
3097
+ super(cdr, ngControl, _validators, ac, AppContext, ACO_CUSTOMKEY);
3098
+ this.lc = lc;
3099
+ /**
3100
+ * Permette di specificare il testo della Label flottante material-style
3101
+ */
3102
+ this.SelectLabel = "";
3103
+ /**
3104
+ * Funzione di ricerca che verrà chiamata dal componente
3105
+ */
3106
+ this.SearchFunction = null;
3107
+ /**
3108
+ * Numero minimo di caratteri con cui cercare
3109
+ */
3110
+ this.MinChars = 3;
3111
+ /**
3112
+ * Override del placeholder per select requried
3113
+ */
3114
+ this.RequiredPlaceholder = null;
3115
+ /**
3116
+ * Indica se i controlli devono essere effettuati tenendo conto del Case o meno. Vale solo qualora la **Source** fosse fornita
3117
+ */
3118
+ this.CaseSensitive = false;
3119
+ /**
3120
+ * Indica se ignorare il prossimo evento writeValue che normalmente dovrebbe richiedere la nuova source. Serve per quando l'utente seleziona un elemento:
3121
+ * Subito dopo partirebbe un altro evento modelChange che ricaricherebbe nuovamente la source
3122
+ */
3123
+ this.ignoreNextWriteValue = false;
3124
+ /**
3125
+ * Sorgente Bindata Filtrata in base al contenuto della casella di testo
3126
+ */
3127
+ this.FilteredBoundSource = [];
3128
+ //******************** Funzione di throttling per non spammare richieste in caso di animazioni attivate
3129
+ //TODO: spostarla in un metodo di utilità (esfaenza/extensions)
3130
+ /** @ignore */
3131
+ this.executionTimers = {};
3132
+ }
3133
+ /**
3134
+ * @ignore
3135
+ */
3136
+ writeValue(value) {
3137
+ if (!value)
3138
+ return;
3139
+ if (this.SearchFunction) {
3140
+ this.SearchFunction(value, true).subscribe(t => {
3141
+ this.Source = t;
3142
+ this.tryBindSourceDisplay();
3143
+ setTimeout(() => { this.finalizeValue(value); });
3144
+ });
3145
+ return;
3146
+ }
3147
+ this.finalizeValue(value);
3148
+ }
3149
+ /**
3150
+ * Dato un valore verifica se può restituire le informazioni trovate in **Source** con id uguale a **value** o se deve restituire il valore in se
3151
+ *
3152
+ * @param {any} value Valore scritto nell'input di testo
3153
+ */
3154
+ finalizeValue(value) {
3155
+ var val = this.Source.find(t => t.id == value);
3156
+ this.propagateChange(val ? val.id : value);
3157
+ this.Model = val ? val.description : value;
3158
+ }
3159
+ /**
3160
+ * Evento di filtro della sorgente dati in base all'input utente
3161
+ *
3162
+ * @param {string} event Input utente
3163
+ */
3164
+ filterSource(event) {
3165
+ if (this.ignoreNextWriteValue) {
3166
+ this.ignoreNextWriteValue = false;
3167
+ return;
3168
+ }
3169
+ // Quando filtro la source, se non devo ignorare l'evento devo comunque assicurarmi di impostare il valore selezionato a null
3170
+ super.changed("");
3171
+ if (!event && this.MinChars == 0 && !this.SearchFunction) {
3172
+ this.FilteredBoundSource = this.BoundSource;
3173
+ return;
3174
+ }
3175
+ if (!event || event.length < this.MinChars) {
3176
+ this.FilteredBoundSource = [];
3177
+ return;
3178
+ }
3179
+ if (!this.SearchFunction && (!this.Source || this.Source.length == 0))
3180
+ throw "Impossibile filtrare gli elementi senza una funzione di ricerca che restituisca una lista di { id: string, description: string }";
3181
+ if (this.SearchFunction) {
3182
+ this.throttla("filtersource", () => {
3183
+ this.SearchFunction(event, false).subscribe(t => {
3184
+ this.Source = t;
3185
+ this.tryBindSourceDisplay();
3186
+ // In questo caso è già filtrata dalla SearchFunction
3187
+ this.FilteredBoundSource = this.BoundSource;
3188
+ this.cdr.markForCheck();
3189
+ });
3190
+ }, 400);
3191
+ }
3192
+ else {
3193
+ this.throttla("filtersource", () => {
3194
+ // In questo caso devo filtrare io in memoria
3195
+ this.FilteredBoundSource = this.BoundSource.filter(t => (this.CaseSensitive && t.description.includes(event)) || (!this.CaseSensitive && t.description.toLowerCase().includes(event.toLowerCase())));
3196
+ this.cdr.markForCheck();
3197
+ }, 100);
3198
+ }
3199
+ }
3200
+ /**
3201
+ * @ignore
3202
+ */
3203
+ ngOnChanges(changes) {
3204
+ let newSource = changes["Source"];
3205
+ if (newSource) {
3206
+ this.tryBindSourceDisplay();
3207
+ // Prima assegnazione se cambia la source sotto (quindi se viene bindata direttamente da HTML)
3208
+ if ((this.Model?.length || 0) >= this.MinChars && !this.SearchFunction)
3209
+ this.FilteredBoundSource = this.BoundSource;
3210
+ else
3211
+ this.FilteredBoundSource = [];
3212
+ this.cdr.markForCheck();
3213
+ }
3214
+ }
3215
+ /**
3216
+ * @ignore
3217
+ *
3218
+ * Override che marca anche il prossimo evento di filterSource da ignorare
3219
+ */
3220
+ changed(forcedValue = null, markForCheck = false) {
3221
+ this.ignoreNextWriteValue = true;
3222
+ super.changed(forcedValue, markForCheck);
3223
+ }
3224
+ /**
3225
+ * @ignore
3226
+ */
3227
+ onNotNullValueSet() { }
3228
+ /** @ignore */
3229
+ throttla(id, func, throttleTime) {
3230
+ //Se ho la funzione che vuole eseguire ripulisco quel timeout
3231
+ if (this.executionTimers[id])
3232
+ clearTimeout(this.executionTimers[id]);
3233
+ //Ricreo il timeout per eseguire quella funzione dopo throttleTime millisecondi
3234
+ this.executionTimers[id] = setTimeout(() => { func(); this.executionTimers[id] = null; }, throttleTime);
3235
+ }
3236
+ }
3237
+ FormAutocompleteComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormAutocompleteComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i1.LocalizationService }, { token: i2$1.NgControl, optional: true, self: true }, { token: NG_VALIDATORS, optional: true }, { token: i2$4.AccessControlService, optional: true }, { token: i2$4.ComponentContext, optional: true }, { token: ACO_CUSTOMKEY, optional: true }], target: i0.ɵɵFactoryTarget.Component });
3238
+ FormAutocompleteComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: FormAutocompleteComponent, selector: "form-autocomplete", inputs: { SelectLabel: "SelectLabel", SearchFunction: "SearchFunction", MinChars: "MinChars", RequiredPlaceholder: "RequiredPlaceholder", CaseSensitive: "CaseSensitive" }, providers: [{ provide: LocalizationService, useClass: FormAutocompleteComponentLoc }], usesInheritance: true, usesOnChanges: true, ngImport: i0, 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 [label]=\"SelectLabel\"\r\n type=\"text\"\r\n [(ngModel)]=\"Model\"\r\n name=\"{{GeneratedName}}\"\r\n #validationControl=\"ngModel\"\r\n (inputChange)=\"filterSource($event);\"\r\n (optionChange)=\"changed($event);\"\r\n [placeholder]=\"Required ? ((RequiredPlaceholder != null ? RequiredPlaceholder : ('Select' | localize : lc) + '...')) : Placeholder\"\r\n [validationFailed]=\"FailedValidationMessage\"\r\n [FilteredSource]=\"FilteredBoundSource\"\r\n >\r\n </val-autocomplete>\r\n</ng-template>", components: [{ type: ValidationAutocompleteComponent, selector: "val-autocomplete", inputs: ["FilteredSource", "value", "label"], outputs: ["optionChange"] }], directives: [{ type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], pipes: { "localize": i1.LocalizePipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
3239
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormAutocompleteComponent, decorators: [{
3240
+ type: Component,
3241
+ args: [{ selector: "form-autocomplete", providers: [{ provide: LocalizationService, useClass: FormAutocompleteComponentLoc }], changeDetection: ChangeDetectionStrategy.OnPush, 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 [label]=\"SelectLabel\"\r\n type=\"text\"\r\n [(ngModel)]=\"Model\"\r\n name=\"{{GeneratedName}}\"\r\n #validationControl=\"ngModel\"\r\n (inputChange)=\"filterSource($event);\"\r\n (optionChange)=\"changed($event);\"\r\n [placeholder]=\"Required ? ((RequiredPlaceholder != null ? RequiredPlaceholder : ('Select' | localize : lc) + '...')) : Placeholder\"\r\n [validationFailed]=\"FailedValidationMessage\"\r\n [FilteredSource]=\"FilteredBoundSource\"\r\n >\r\n </val-autocomplete>\r\n</ng-template>" }]
3242
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i1.LocalizationService }, { type: i2$1.NgControl, decorators: [{
3243
+ type: Optional
3244
+ }, {
3245
+ type: Self
3246
+ }] }, { type: Array, decorators: [{
3247
+ type: Optional
3248
+ }, {
3249
+ type: Inject,
3250
+ args: [NG_VALIDATORS]
3251
+ }] }, { type: i2$4.AccessControlService, decorators: [{
3252
+ type: Optional
3253
+ }] }, { type: i2$4.ComponentContext, decorators: [{
3254
+ type: Optional
3255
+ }] }, { type: undefined, decorators: [{
3256
+ type: Optional
3257
+ }, {
3258
+ type: Inject,
3259
+ args: [ACO_CUSTOMKEY]
3260
+ }] }]; }, propDecorators: { SelectLabel: [{
3261
+ type: Input
3262
+ }], SearchFunction: [{
3263
+ type: Input
3264
+ }], MinChars: [{
3265
+ type: Input
3266
+ }], RequiredPlaceholder: [{
3267
+ type: Input
3268
+ }], CaseSensitive: [{
3269
+ type: Input
3270
+ }] } });
3271
+
3272
+ // Angular
3273
+ /**
3274
+ * Componente che identifica la selezione di un orario
3275
+ */
3276
+ class FormTimeComponent extends BaseFormControl {
3277
+ /**
3278
+ * @ignore
3279
+ */
3280
+ constructor(cdr, dateAdapter, ngControl, _validators, ac, AppContext, ACO_CUSTOMKEY) {
3281
+ super(cdr, ngControl, _validators, ac, AppContext, ACO_CUSTOMKEY, true);
3282
+ this.dateAdapter = dateAdapter;
3283
+ /**
3284
+ * Mostra o meno gli spinner dove cliccare per aumentare/diminuire le componenti dell'orologio (ore, minuti e secondi)
3285
+ */
3286
+ this.ShowSpinners = false;
3287
+ /**
3288
+ * Imposta lo step (minimo avanzamento) per la cella "ore"
3289
+ */
3290
+ this.StepHour = 1;
3291
+ /**
3292
+ * Imposta lo step (minimo avanzamento) per la cella "minuti"
3293
+ */
3294
+ this.StepMinute = 1;
3295
+ /**
3296
+ * Imposta lo step (minimo avanzamento) per la cella "secondi"
3297
+ */
3298
+ this.StepSecond = 5;
3299
+ /**
3300
+ * Indica se mostrare i secondi o meno
3301
+ */
3302
+ this.ShowSeconds = false;
3303
+ /**
3304
+ * Indica il formato da utilizzare sia in Input che in Output
3305
+ *
3306
+ * 1. Se date vengono utilizzate le Date di Javascript
3307
+ *
3308
+ * 2. Se timestring vengono utilizzate stringhe del tipo '00:00:00'
3309
+ *
3310
+ * 3. Se dayjs viene utilizzato, appunto, dayjs
3311
+ */
3312
+ this.InOutFormat = 'timestring';
3313
+ }
3314
+ /**
3315
+ * @ignore Override per gestire input in ingresso
3316
+ */
3317
+ writeValue(obj) {
3318
+ const [hours, minutes, seconds] = (obj || "0:0:0").split(":");
3319
+ //Qualsiasi cosa mi arrivi devo ricondurla a un dayjs
3320
+ switch (this.InOutFormat) {
3321
+ case 'date':
3322
+ obj = dayjs(obj);
3323
+ break;
3324
+ case 'timestring':
3325
+ obj = dayjs().hour(hours ?? 0).minute(minutes ?? 0).second(seconds ?? 0);
3326
+ break;
3327
+ case 'dayjs':
3328
+ obj = obj;
3329
+ break;
3330
+ }
3331
+ super.writeValue(obj);
3332
+ }
3333
+ /**
3334
+ * @ignore Override per gestire input in uscita
3335
+ */
3336
+ changed() {
3337
+ var toEmit = this.dateAdapter.clone(this.Model);
3338
+ switch (this.InOutFormat) {
3339
+ case 'date':
3340
+ toEmit = toEmit.toDate();
3341
+ break;
3342
+ case 'timestring':
3343
+ toEmit = toEmit.format("HH:mm" + (this.ShowSeconds ? ":ss" : ""));
3344
+ break;
3345
+ case 'dayjs':
3346
+ toEmit = toEmit;
3347
+ break;
3348
+ }
3349
+ super.changed(toEmit);
3350
+ }
3351
+ /**
3352
+ * @ignore
3353
+ */
3354
+ onNotNullValueSet() { }
3355
+ }
3356
+ FormTimeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormTimeComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i2$3.NgxMatDateAdapter }, { token: i2$1.NgControl, optional: true, self: true }, { token: NG_VALIDATORS, host: true, optional: true }, { token: i2$4.AccessControlService }, { token: i2$4.ComponentContext, optional: true }, { token: ACO_CUSTOMKEY, optional: true }], target: i0.ɵɵFactoryTarget.Component });
3357
+ FormTimeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: FormTimeComponent, selector: "form-time", inputs: { ShowSpinners: "ShowSpinners", StepHour: "StepHour", StepMinute: "StepMinute", StepSecond: "StepSecond", ShowSeconds: "ShowSeconds", InOutFormat: "InOutFormat" }, usesInheritance: true, ngImport: i0, 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}} m-t-5\">\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 <ngx-mat-timepicker name=\"val-time\" #elementRef #baseInput=\"ngModel\" [(ngModel)]=\"Model\" [disabled]=\"Readonly\"\r\n [showSpinners]=\"ShowSpinners\" [stepHour]=\"StepHour\" [stepMinute]=\"StepMinute\" [stepSecond]=\"StepSecond\"\r\n [showSeconds]=\"ShowSeconds\" (ngModelChange)=\"changed()\" #validationControl=\"ngModel\">\r\n </ngx-mat-timepicker>\r\n\r\n</ng-template>", components: [{ type: i2$3.NgxMatTimepickerComponent, selector: "ngx-mat-timepicker", inputs: ["disabled", "showSpinners", "stepHour", "stepMinute", "stepSecond", "showSeconds", "disableMinute", "enableMeridian", "defaultTime", "color"], exportAs: ["ngxMatTimepicker"] }], directives: [{ type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3358
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormTimeComponent, decorators: [{
3359
+ type: Component,
3360
+ args: [{ selector: "form-time", changeDetection: ChangeDetectionStrategy.OnPush, 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}} m-t-5\">\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 <ngx-mat-timepicker name=\"val-time\" #elementRef #baseInput=\"ngModel\" [(ngModel)]=\"Model\" [disabled]=\"Readonly\"\r\n [showSpinners]=\"ShowSpinners\" [stepHour]=\"StepHour\" [stepMinute]=\"StepMinute\" [stepSecond]=\"StepSecond\"\r\n [showSeconds]=\"ShowSeconds\" (ngModelChange)=\"changed()\" #validationControl=\"ngModel\">\r\n </ngx-mat-timepicker>\r\n\r\n</ng-template>" }]
3361
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i2$3.NgxMatDateAdapter }, { type: i2$1.NgControl, decorators: [{
3362
+ type: Optional
3363
+ }, {
3364
+ type: Self
3365
+ }] }, { type: Array, decorators: [{
3366
+ type: Optional
3367
+ }, {
3368
+ type: Host
3369
+ }, {
3370
+ type: Inject,
3371
+ args: [NG_VALIDATORS]
3372
+ }] }, { type: i2$4.AccessControlService }, { type: i2$4.ComponentContext, decorators: [{
3373
+ type: Optional
3374
+ }] }, { type: undefined, decorators: [{
3375
+ type: Optional
3376
+ }, {
3377
+ type: Inject,
3378
+ args: [ACO_CUSTOMKEY]
3379
+ }] }]; }, propDecorators: { ShowSpinners: [{
3380
+ type: Input
3381
+ }], StepHour: [{
3382
+ type: Input
3383
+ }], StepMinute: [{
3384
+ type: Input
3385
+ }], StepSecond: [{
3386
+ type: Input
3387
+ }], ShowSeconds: [{
3388
+ type: Input
3389
+ }], InOutFormat: [{
3390
+ type: Input
3391
+ }] } });
3392
+
3393
+ // Angular
3394
+ /**
3395
+ * Formato in display (modalità breve, senza ore, minuti e secondi) delle date per tutti i componenti che utilizzino input data.
3396
+ *
3397
+ * Da convenzione è sempre quello italiano quindi viene cablato
3398
+ */
3399
+ const formats = {
3400
+ parse: { dateInput: 'DD/MM/YYYY' },
3401
+ display: {
3402
+ dateInput: 'DD/MM/YYYY',
3403
+ monthYearLabel: 'MM YYYY',
3404
+ dateA11yLabel: 'DD/MM/YYYY',
3405
+ monthYearA11yLabel: 'MM YYYY',
3406
+ }
3407
+ };
3408
+ /**
3409
+ * Formato in display (modalità lunga, con ore, minuti e secondi) delle date per tutti i componenti che utilizzino input data.
3410
+ *
3411
+ * Da convenzione è sempre quello italiano quindi viene cablato
3412
+ */
3413
+ const formats_long = {
3414
+ parse: { dateInput: 'DD/MM/YYYY HH:mm:ss' },
3415
+ display: {
3416
+ dateInput: 'DD/MM/YYYY HH:mm:ss',
3417
+ monthYearLabel: 'MM YYYY',
3418
+ dateA11yLabel: 'DD/MM/YYYY HH:mm:ss',
3419
+ monthYearA11yLabel: 'MM YYYY',
3420
+ }
3421
+ };
3422
+ /**
3423
+ * Componenti Dichiarati ed esportati dalla libreria
3424
+ */
3425
+ const COMPONENTS = [
3426
+ ValidationInputComponent,
3427
+ ValidationSelectComponent,
3428
+ ValidationDateComponent,
3429
+ CustomRequiredDirective,
3430
+ ValidationCurrencyComponent,
3431
+ ValidationTextAreaComponent,
3432
+ FormCheckboxComponent,
3433
+ FormDateComponent,
3434
+ FormEmptyComponent,
3435
+ FormInputComponent,
3436
+ FormSelectComponent,
3437
+ FormTextareaComponent,
3438
+ FormTemplateComponent,
3439
+ FormErrorComponent,
3440
+ FormInfoComponent,
3441
+ FormAdaptiveComponent,
3442
+ FormMultiSelectComponent,
3443
+ FormFileComponent,
3444
+ ValidationAutocompleteComponent,
3445
+ FormAutocompleteComponent,
3446
+ FormDateTimeComponent,
3447
+ ValidationDateTimeComponent,
3448
+ FormTimeComponent
3449
+ ];
3450
+ /**
3451
+ * Moduli utilizzati solo dalla libreria
3452
+ */
3453
+ const MODULES = [
3454
+ CommonModule,
3455
+ FormsModule,
3456
+ LocalizationModule,
3457
+ MatInputModule,
3458
+ MatDatepickerModule,
3459
+ MatDayjsDateModule,
3460
+ TooltipModule,
3461
+ CurrencyMaskModule,
3462
+ MatAutocompleteModule,
3463
+ NgxMatDatetimePickerModule,
3464
+ NgxMatTimepickerModule
3465
+ ];
3466
+ /**
3467
+ * Moduli utilizzati dalla libreria e che devono essere esposti all'esterno
3468
+ */
3469
+ const MODULES_TO_EXPORT = [
3470
+ AngularMultiSelectModule
3471
+ ];
3472
+ class FormsAndValidationsModule {
3473
+ static forRoot(config) {
3474
+ return {
3475
+ ngModule: FormsAndValidationsModule,
3476
+ providers: [
3477
+ { provide: FAV_LOCALE, useValue: config?.locale || 'it-IT' },
3478
+ { provide: ACO_CUSTOMKEY, useValue: config?.acocustom || null },
3479
+ { provide: MAT_DATE_LOCALE, useValue: 'it' },
3480
+ { provide: MAT_DATE_FORMATS, useValue: formats },
3481
+ { provide: NGX_MAT_DATE_FORMATS, useValue: formats_long },
3482
+ { provide: NgxMatDateAdapter, useClass: NgxExpandedDayJsDateAdapter },
3483
+ ]
3484
+ };
3485
+ }
3486
+ }
3487
+ FormsAndValidationsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormsAndValidationsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3488
+ FormsAndValidationsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormsAndValidationsModule, declarations: [ValidationInputComponent,
3489
+ ValidationSelectComponent,
3490
+ ValidationDateComponent,
3491
+ CustomRequiredDirective,
3492
+ ValidationCurrencyComponent,
3493
+ ValidationTextAreaComponent,
3494
+ FormCheckboxComponent,
3495
+ FormDateComponent,
3496
+ FormEmptyComponent,
3497
+ FormInputComponent,
3498
+ FormSelectComponent,
3499
+ FormTextareaComponent,
3500
+ FormTemplateComponent,
3501
+ FormErrorComponent,
3502
+ FormInfoComponent,
3503
+ FormAdaptiveComponent,
3504
+ FormMultiSelectComponent,
3505
+ FormFileComponent,
3506
+ ValidationAutocompleteComponent,
3507
+ FormAutocompleteComponent,
3508
+ FormDateTimeComponent,
3509
+ ValidationDateTimeComponent,
3510
+ FormTimeComponent], imports: [CommonModule,
3511
+ FormsModule,
3512
+ LocalizationModule,
3513
+ MatInputModule,
3514
+ MatDatepickerModule,
3515
+ MatDayjsDateModule,
3516
+ TooltipModule,
3517
+ CurrencyMaskModule,
3518
+ MatAutocompleteModule,
3519
+ NgxMatDatetimePickerModule,
3520
+ NgxMatTimepickerModule, AngularMultiSelectModule], exports: [AngularMultiSelectModule, ValidationInputComponent,
3521
+ ValidationSelectComponent,
3522
+ ValidationDateComponent,
3523
+ CustomRequiredDirective,
3524
+ ValidationCurrencyComponent,
3525
+ ValidationTextAreaComponent,
3526
+ FormCheckboxComponent,
3527
+ FormDateComponent,
3528
+ FormEmptyComponent,
3529
+ FormInputComponent,
3530
+ FormSelectComponent,
3531
+ FormTextareaComponent,
3532
+ FormTemplateComponent,
3533
+ FormErrorComponent,
3534
+ FormInfoComponent,
3535
+ FormAdaptiveComponent,
3536
+ FormMultiSelectComponent,
3537
+ FormFileComponent,
3538
+ ValidationAutocompleteComponent,
3539
+ FormAutocompleteComponent,
3540
+ FormDateTimeComponent,
3541
+ ValidationDateTimeComponent,
3542
+ FormTimeComponent] });
3543
+ FormsAndValidationsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormsAndValidationsModule, imports: [[...MODULES, ...MODULES_TO_EXPORT], AngularMultiSelectModule] });
3544
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormsAndValidationsModule, decorators: [{
3545
+ type: NgModule,
3546
+ args: [{
3547
+ imports: [...MODULES, ...MODULES_TO_EXPORT],
3548
+ declarations: [...COMPONENTS],
3549
+ exports: [...MODULES_TO_EXPORT, ...COMPONENTS]
3550
+ }]
3551
+ }] });
3552
+
3553
+ /*
3554
+ * Public API Surface of forms-and-validations
3555
+ */
3556
+
3557
+ /**
3558
+ * Generated bundle index. Do not edit.
3559
+ */
3560
+
3561
+ export { AppFile, CustomRequiredDirective, FormAdaptiveComponent, FormAutocompleteComponent, FormCheckboxComponent, FormDateComponent, FormDateTimeComponent, FormEmptyComponent, FormErrorComponent, FormFileComponent, FormInfoComponent, FormInputComponent, FormMultiSelectComponent, FormSelectComponent, FormTemplateComponent, FormTextareaComponent, FormTimeComponent, FormsAndValidationsModule, FormsAndValidationsModuleConfig, ValidationAutocompleteComponent, ValidationCurrencyComponent, ValidationDateComponent, ValidationDateTimeComponent, ValidationInputComponent, ValidationSelectComponent, ValidationTextAreaComponent };
3562
+ //# sourceMappingURL=esfaenza-forms-and-validations.mjs.map