@eqproject/eqp-dynamic-module 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/README.md +43 -24
  2. package/bundles/eqproject-eqp-dynamic-module.umd.js +1166 -334
  3. package/bundles/eqproject-eqp-dynamic-module.umd.js.map +1 -1
  4. package/bundles/eqproject-eqp-dynamic-module.umd.min.js +2 -2
  5. package/bundles/eqproject-eqp-dynamic-module.umd.min.js.map +1 -1
  6. package/eqproject-eqp-dynamic-module.d.ts +2 -1
  7. package/eqproject-eqp-dynamic-module.metadata.json +1 -1
  8. package/esm2015/eqproject-eqp-dynamic-module.js +3 -2
  9. package/esm2015/lib/components/exported/eqp-dynamic-module/eqp-dynamic-module.component.js +198 -22
  10. package/esm2015/lib/components/exported/eqp-dynamic-module-configurator/eqp-dynamic-module-configurator.component.js +124 -9
  11. package/esm2015/lib/components/private/add-form-field/add-form-field.component.js +107 -16
  12. package/esm2015/lib/components/private/dynamic-module-field/dynamic-module-field.component.js +2 -2
  13. package/esm2015/lib/components/private/field-templates/attachment-field-template/attachment-field-template.component.js +10 -21
  14. package/esm2015/lib/components/private/field-templates/boolean-field-template/boolean-field-template.component.js +2 -2
  15. package/esm2015/lib/components/private/field-templates/date-field-template/date-field-template.component.js +2 -2
  16. package/esm2015/lib/components/private/field-templates/image-field-template/image-field-template.component.js +148 -6
  17. package/esm2015/lib/components/private/field-templates/list-value-field-template/list-value-field-template.component.js +21 -24
  18. package/esm2015/lib/components/private/field-templates/numeric-field-template/numeric-field-template.component.js +10 -2
  19. package/esm2015/lib/components/private/field-templates/text-field-template/text-field-template.component.js +18 -2
  20. package/esm2015/lib/components/private/field-templates/textarea-field-template/textarea-field-template.component.js +2 -2
  21. package/esm2015/lib/components/private/form-records/add-form-record/add-form-record.component.js +2 -2
  22. package/esm2015/lib/components/private/form-records/list-form-record/list-form-record.component.js +2 -18
  23. package/esm2015/lib/components/private/spinner/spinner.component.js +23 -0
  24. package/esm2015/lib/eqp-dynamic-module.module.js +6 -2
  25. package/esm2015/lib/models/endPointConfiguration.model.js +23 -0
  26. package/esm2015/lib/models/fields/dateField.model.js +1 -1
  27. package/esm2015/lib/models/fields/imageField.model.js +5 -1
  28. package/esm2015/lib/models/fields/listValueField.model.js +3 -1
  29. package/esm2015/lib/models/fields/numericField.model.js +1 -1
  30. package/esm2015/lib/models/fields/textField.model.js +10 -1
  31. package/esm2015/lib/models/form.model.js +1 -1
  32. package/esm2015/lib/models/record.model.js +6 -1
  33. package/esm2015/lib/services/eqp-dynamic-module-dialog.service.js +10 -1
  34. package/esm2015/lib/services/spinner.service.js +43 -0
  35. package/esm2015/lib/services/utilityHelper.services.js +180 -13
  36. package/esm2015/public-api.js +3 -1
  37. package/esm5/eqproject-eqp-dynamic-module.js +3 -2
  38. package/esm5/lib/components/exported/eqp-dynamic-module/eqp-dynamic-module.component.js +204 -22
  39. package/esm5/lib/components/exported/eqp-dynamic-module-configurator/eqp-dynamic-module-configurator.component.js +126 -8
  40. package/esm5/lib/components/private/add-form-field/add-form-field.component.js +107 -16
  41. package/esm5/lib/components/private/dynamic-module-field/dynamic-module-field.component.js +2 -2
  42. package/esm5/lib/components/private/field-templates/attachment-field-template/attachment-field-template.component.js +10 -21
  43. package/esm5/lib/components/private/field-templates/boolean-field-template/boolean-field-template.component.js +2 -2
  44. package/esm5/lib/components/private/field-templates/date-field-template/date-field-template.component.js +2 -2
  45. package/esm5/lib/components/private/field-templates/image-field-template/image-field-template.component.js +157 -6
  46. package/esm5/lib/components/private/field-templates/list-value-field-template/list-value-field-template.component.js +22 -24
  47. package/esm5/lib/components/private/field-templates/numeric-field-template/numeric-field-template.component.js +10 -2
  48. package/esm5/lib/components/private/field-templates/text-field-template/text-field-template.component.js +18 -2
  49. package/esm5/lib/components/private/field-templates/textarea-field-template/textarea-field-template.component.js +2 -2
  50. package/esm5/lib/components/private/form-records/add-form-record/add-form-record.component.js +2 -2
  51. package/esm5/lib/components/private/form-records/list-form-record/list-form-record.component.js +2 -18
  52. package/esm5/lib/components/private/spinner/spinner.component.js +24 -0
  53. package/esm5/lib/eqp-dynamic-module.module.js +6 -2
  54. package/esm5/lib/models/endPointConfiguration.model.js +33 -0
  55. package/esm5/lib/models/fields/dateField.model.js +1 -1
  56. package/esm5/lib/models/fields/imageField.model.js +9 -1
  57. package/esm5/lib/models/fields/listValueField.model.js +7 -1
  58. package/esm5/lib/models/fields/numericField.model.js +1 -1
  59. package/esm5/lib/models/fields/textField.model.js +10 -1
  60. package/esm5/lib/models/form.model.js +1 -1
  61. package/esm5/lib/models/record.model.js +8 -1
  62. package/esm5/lib/services/eqp-dynamic-module-dialog.service.js +11 -1
  63. package/esm5/lib/services/spinner.service.js +46 -0
  64. package/esm5/lib/services/utilityHelper.services.js +182 -11
  65. package/esm5/public-api.js +3 -1
  66. package/fesm2015/eqproject-eqp-dynamic-module.js +1021 -239
  67. package/fesm2015/eqproject-eqp-dynamic-module.js.map +1 -1
  68. package/fesm5/eqproject-eqp-dynamic-module.js +1160 -335
  69. package/fesm5/eqproject-eqp-dynamic-module.js.map +1 -1
  70. package/lib/components/exported/eqp-dynamic-module/eqp-dynamic-module.component.d.ts +78 -4
  71. package/lib/components/exported/eqp-dynamic-module-configurator/eqp-dynamic-module-configurator.component.d.ts +51 -2
  72. package/lib/components/private/add-form-field/add-form-field.component.d.ts +42 -3
  73. package/lib/components/private/field-templates/attachment-field-template/attachment-field-template.component.d.ts +1 -17
  74. package/lib/components/private/field-templates/image-field-template/image-field-template.component.d.ts +51 -2
  75. package/lib/components/private/field-templates/list-value-field-template/list-value-field-template.component.d.ts +3 -11
  76. package/lib/components/private/field-templates/text-field-template/text-field-template.component.d.ts +3 -1
  77. package/lib/components/private/spinner/spinner.component.d.ts +9 -0
  78. package/lib/models/endPointConfiguration.model.d.ts +35 -0
  79. package/lib/models/fields/dateField.model.d.ts +1 -0
  80. package/lib/models/fields/imageField.model.d.ts +10 -4
  81. package/lib/models/fields/listValueField.model.d.ts +17 -0
  82. package/lib/models/fields/numericField.model.d.ts +3 -1
  83. package/lib/models/fields/textField.model.d.ts +9 -1
  84. package/lib/models/form.model.d.ts +1 -0
  85. package/lib/models/record.model.d.ts +8 -0
  86. package/lib/services/eqp-dynamic-module-dialog.service.d.ts +6 -0
  87. package/lib/services/spinner.service.d.ts +15 -0
  88. package/lib/services/utilityHelper.services.d.ts +30 -1
  89. package/package.json +5 -3
  90. package/public-api.d.ts +2 -0
@@ -1,7 +1,10 @@
1
- import { __decorate } from 'tslib';
1
+ import { __decorate, __awaiter } from 'tslib';
2
2
  import { CommonModule } from '@angular/common';
3
- import { ɵɵdefineInjectable, ɵɵinject, Injectable, EventEmitter, Input, Output, Component, NgModule, ViewChild, ChangeDetectorRef, ViewChildren } from '@angular/core';
3
+ import { ɵɵdefineInjectable, Injectable, ɵɵinject, EventEmitter, Input, Output, Component, NgModule, ViewChild, ChangeDetectorRef, ViewChildren } from '@angular/core';
4
4
  import { Validators, FormControl, FormBuilder, FormsModule, ReactiveFormsModule } from '@angular/forms';
5
+ import Swal from 'sweetalert2';
6
+ import { HttpClient } from '@angular/common/http';
7
+ import { Subject } from 'rxjs';
5
8
  import { MatCheckboxModule } from '@angular/material/checkbox';
6
9
  import { MatButtonModule } from '@angular/material/button';
7
10
  import { MatInputModule } from '@angular/material/input';
@@ -34,12 +37,12 @@ import { MatSortModule } from '@angular/material/sort';
34
37
  import { MatPaginatorModule } from '@angular/material/paginator';
35
38
  import { MatNativeDateModule } from '@angular/material/core';
36
39
  import { TypeColumn, CellAlignmentEnum, NumberColumnPipe, EqpTableModule } from '@eqproject/eqp-table';
37
- import { EqpAttachmentsModule } from '@eqproject/eqp-attachments';
40
+ import { AttachmentType, EqpAttachmentsModule } from '@eqproject/eqp-attachments';
38
41
  import { EnumHelper, EqpSelectModule } from '@eqproject/eqp-select';
39
42
  import { PickerModeEnum, EqpDatetimepickerModule } from '@eqproject/eqp-datetimepicker';
43
+ import { EqpImgDrawingModule } from '@eqproject/eqp-img-drawing';
40
44
  import { EqpFiltersModule } from '@eqproject/eqp-filters';
41
- import { EqpNumericModule } from '@eqproject/eqp-numeric';
42
- import Swal from 'sweetalert2';
45
+ import { EqpNumericInputMode, EqpNumericModule } from '@eqproject/eqp-numeric';
43
46
  import { BrowserModule } from '@angular/platform-browser';
44
47
 
45
48
  class Context {
@@ -50,6 +53,29 @@ class Context {
50
53
  class ContextUser {
51
54
  }
52
55
 
56
+ class EndPointConfiguration {
57
+ }
58
+ class EndPointData {
59
+ }
60
+ class EndPointDataParams {
61
+ constructor() {
62
+ this.ParamValue = null;
63
+ }
64
+ }
65
+ var ParamTypeEnum;
66
+ (function (ParamTypeEnum) {
67
+ ParamTypeEnum[ParamTypeEnum["Query param"] = 1] = "Query param";
68
+ ParamTypeEnum[ParamTypeEnum["In route"] = 2] = "In route";
69
+ ParamTypeEnum[ParamTypeEnum["In Body"] = 3] = "In Body";
70
+ })(ParamTypeEnum || (ParamTypeEnum = {}));
71
+ var RequestMethodEnum;
72
+ (function (RequestMethodEnum) {
73
+ RequestMethodEnum["GET"] = "GET";
74
+ RequestMethodEnum["POST"] = "POST";
75
+ RequestMethodEnum["PUT"] = "PUT";
76
+ RequestMethodEnum["DELETE"] = "DELETE";
77
+ })(RequestMethodEnum || (RequestMethodEnum = {}));
78
+
53
79
  /**
54
80
  * Classe base che implementa la valorizzazione dell'ID (se null) con una nuova GUID
55
81
  * in creazione dell'oggetto.
@@ -82,6 +108,122 @@ var FormScalarTypeEnum;
82
108
  FormScalarTypeEnum[FormScalarTypeEnum["In accordion"] = 4] = "In accordion"; //GROUPED_BY_ACCORDION
83
109
  })(FormScalarTypeEnum || (FormScalarTypeEnum = {}));
84
110
 
111
+ class Record {
112
+ }
113
+ class DynRecord {
114
+ constructor() {
115
+ this.Values = {};
116
+ }
117
+ }
118
+
119
+ let EqpDynamicModuleDialogService = class EqpDynamicModuleDialogService {
120
+ constructor() {
121
+ }
122
+ /**
123
+ * Mostra uno sweet alert di tipo SUCCESS con il messaggio passato come parametro.
124
+ * @param message Messaggio da mostrare nello sweetalert
125
+ * @param title Titolo dello sweetalert (di default mostra 'Operazione completata')
126
+ */
127
+ static Success(message, title = null) {
128
+ let currentTitle = title != null ? title : 'Operazione completata con successo.';
129
+ Swal.fire(currentTitle, message, 'success');
130
+ }
131
+ /**
132
+ * Mostra uno sweet alert di tipo ERROR con il messaggio passato come parametro.
133
+ * @param message Messaggio d'errore da mostrare nello sweetalert
134
+ * @param title Titolo dello sweetalert (di default mostra 'Errore')
135
+ */
136
+ static Error(message, title = null) {
137
+ let currentTitle = title != null ? title : 'Errore';
138
+ if (Array.isArray(message)) {
139
+ currentTitle = title != null ? title : 'Errore';
140
+ let htmlErrors = message.join("<br>");
141
+ Swal.fire({
142
+ title: currentTitle,
143
+ html: htmlErrors,
144
+ icon: 'error'
145
+ });
146
+ }
147
+ else {
148
+ Swal.fire(currentTitle, message, 'error');
149
+ }
150
+ }
151
+ /**
152
+ * Mostra uno sweetalert di tipo CONFIRM con il messaggio passato come parametro e se viene premuto
153
+ * CONFERMA lancia la funzione di callback passata come parametro
154
+ * @param message Messaggio da mostrare nello sweetalert
155
+ * @param title Titolo dello sweetalert (di default mostra 'Info')
156
+ */
157
+ static Confirm(message, confirmCallback, isWarning = false, title = null, customWidth = null) {
158
+ let currentTitle = title != null ? title : 'Sei sicuro di voler procedere?';
159
+ if (Array.isArray(message)) {
160
+ let htmlErrors = message.join("<br>");
161
+ Swal.fire({
162
+ title: currentTitle,
163
+ html: htmlErrors,
164
+ width: customWidth ? customWidth : '32rem',
165
+ icon: !isWarning ? 'question' : 'warning',
166
+ showCancelButton: true,
167
+ allowOutsideClick: false,
168
+ allowEscapeKey: false
169
+ }).then((result) => {
170
+ if (result.value && confirmCallback) {
171
+ confirmCallback();
172
+ }
173
+ });
174
+ }
175
+ else {
176
+ Swal.fire({
177
+ title: currentTitle,
178
+ text: message,
179
+ width: customWidth ? customWidth : '32rem',
180
+ icon: !isWarning ? 'question' : 'warning',
181
+ showCancelButton: true,
182
+ allowOutsideClick: false,
183
+ allowEscapeKey: false
184
+ }).then((result) => {
185
+ if (result.value && confirmCallback) {
186
+ confirmCallback();
187
+ }
188
+ });
189
+ }
190
+ }
191
+ /**
192
+ * Mostra uno sweetalert di tipo INFO con il messaggio passato come parametro
193
+ * @param message Messaggio da mostrare nello sweetalert
194
+ * @param title Titolo dello sweetalert (di default mostra 'Info')
195
+ */
196
+ static Info(message, title = null, isToast = null) {
197
+ let currentTitle = title != null ? title : "Informazione:";
198
+ Swal.fire(currentTitle, message, 'info');
199
+ }
200
+ /**
201
+ * Mostra uno sweetalert di tipo WARNING con il messaggio passato come parametro
202
+ * @param message Messaggio da mostrare nello sweetalert
203
+ * @param title Titolo dello sweetalert (di default mostra 'Attenzione!')
204
+ */
205
+ static Warning(message, title = null, isToast = null) {
206
+ let currentTitle = title != null ? title : "Attenzione!";
207
+ if (Array.isArray(message)) {
208
+ let htmlWarnings = message.join("<br>");
209
+ Swal.fire({
210
+ title: currentTitle,
211
+ html: htmlWarnings,
212
+ icon: 'warning'
213
+ });
214
+ }
215
+ else {
216
+ Swal.fire(currentTitle, message, 'warning');
217
+ }
218
+ }
219
+ };
220
+ EqpDynamicModuleDialogService.ɵprov = ɵɵdefineInjectable({ factory: function EqpDynamicModuleDialogService_Factory() { return new EqpDynamicModuleDialogService(); }, token: EqpDynamicModuleDialogService, providedIn: "root" });
221
+ EqpDynamicModuleDialogService = __decorate([
222
+ Injectable({
223
+ providedIn: 'root'
224
+ })
225
+ ], EqpDynamicModuleDialogService);
226
+
85
227
  /**
86
228
  * Contiene le informazioni di base del campo, indipendentemente dal tipo.
87
229
  * Questa classe è volutamente astratta perché il tipo di campo è dettato dal tipo
@@ -117,6 +259,19 @@ var ColSpanSizesEnum;
117
259
  ColSpanSizesEnum[ColSpanSizesEnum["col-lg-12"] = 12] = "col-lg-12";
118
260
  })(ColSpanSizesEnum || (ColSpanSizesEnum = {}));
119
261
 
262
+ /**Campo di testo */
263
+ class TextField extends BaseField {
264
+ }
265
+ var TextMaskEnum;
266
+ (function (TextMaskEnum) {
267
+ TextMaskEnum[TextMaskEnum["Password"] = 1] = "Password";
268
+ TextMaskEnum[TextMaskEnum["Email"] = 2] = "Email";
269
+ TextMaskEnum[TextMaskEnum["Telefono"] = 3] = "Telefono";
270
+ TextMaskEnum[TextMaskEnum["Url"] = 4] = "Url";
271
+ })(TextMaskEnum || (TextMaskEnum = {}));
272
+ const UrlRegex = '(https?://)?([\\da-z.-]+)\\.([a-z.]{2,6})[/\\w .-]*/?';
273
+ const TelRegex = '([+]?[0-9]{10,14})';
274
+
120
275
  class ArrayValidators {
121
276
  static minLenght(minLenght) {
122
277
  var validationFunction = (control) => {
@@ -136,18 +291,70 @@ class ArrayValidators {
136
291
  }
137
292
  }
138
293
 
294
+ let SpinnerService = class SpinnerService {
295
+ constructor() {
296
+ this.isLoading = new Subject();
297
+ this.requestsCount = 0;
298
+ }
299
+ /**
300
+ * Mostra lo spinner
301
+ */
302
+ show() {
303
+ setTimeout(() => {
304
+ this.isLoading.next(true);
305
+ }, 100);
306
+ }
307
+ /**
308
+ * Nasconde lo spinner
309
+ */
310
+ hide() {
311
+ setTimeout(() => {
312
+ this.isLoading.next(false);
313
+ }, 100);
314
+ }
315
+ addRequestCounter() {
316
+ this.requestsCount++;
317
+ this.show();
318
+ }
319
+ removeRequestCounter() {
320
+ this.requestsCount--;
321
+ if (this.requestsCount == 0)
322
+ this.hide();
323
+ }
324
+ };
325
+ SpinnerService.ɵprov = ɵɵdefineInjectable({ factory: function SpinnerService_Factory() { return new SpinnerService(); }, token: SpinnerService, providedIn: "root" });
326
+ SpinnerService = __decorate([
327
+ Injectable({
328
+ providedIn: 'root'
329
+ })
330
+ ], SpinnerService);
331
+
139
332
  var UtilityHelperService_1;
140
333
  let UtilityHelperService = UtilityHelperService_1 = class UtilityHelperService {
141
- constructor(formBuilder) {
334
+ constructor(formBuilder, http, spinnerService) {
142
335
  this.formBuilder = formBuilder;
336
+ this.http = http;
337
+ this.spinnerService = spinnerService;
143
338
  }
144
339
  static EvaluateFieldFormula(formula, rec, ctx) {
145
- const evaluatedValue = eval(formula.replace('"', '\"'));
340
+ const evaluatedValue = eval(formula);
146
341
  return (evaluatedValue ? evaluatedValue : null);
147
342
  }
148
343
  static SetContext(ctx) {
149
344
  this.context = ctx;
150
345
  }
346
+ static GetFieldType(field) {
347
+ switch (field.FieldType) {
348
+ case FieldTypeEnum["Campo di testo"]: {
349
+ const t = Object.assign(new TextField, field);
350
+ return t;
351
+ break;
352
+ }
353
+ default: {
354
+ break;
355
+ }
356
+ }
357
+ }
151
358
  /**
152
359
  * Metodo per impostare i valori da suggerire nell'autocomplete per i campi in cui l'utente deve scrivere comandi javascript.
153
360
  * In base all'ultimo carattere digitato viene impostato un elenco di oggetti o proprietà che l'utente ha a disposizione in quel momento.
@@ -159,7 +366,7 @@ let UtilityHelperService = UtilityHelperService_1 = class UtilityHelperService {
159
366
  * 3) la stringa digitata dall'utente non coincide con nessun altro caso sopra (finisce con un carattere qualunque)
160
367
  */
161
368
  static GetAutocompleteOptions(fields, typedFormula) {
162
- var autocompleteOptions = [];
369
+ let autocompleteOptions = [];
163
370
  // Recupero i nomi di tutti i campi creati fino ad ora nella form.
164
371
  const availableRecProperties = fields.map(f => f.Label.split(' ').join('_'));
165
372
  // Nel casi in cui l'utente non ha inserito nulla oppure la stringa finisce con uno spazio vuoto o un simbolo diverso da "."
@@ -195,17 +402,17 @@ let UtilityHelperService = UtilityHelperService_1 = class UtilityHelperService {
195
402
  // funzione javascript. Controllo la parola che l'utente sta digitando e se fa parte di uno degli oggetti a disposizione
196
403
  // o una proprietà di essi allora suggerisco i possibili match.
197
404
  else {
198
- var availableOptions = [];
405
+ const availableOptions = [];
199
406
  // Prendo tutti i blocchi di caratteri digitati dall'utente
200
407
  const allFormulaWords = typedFormula.split(" ");
201
408
  // Prendo l'ultimo blocco di caratteri digitato dall'utente
202
- var lastTypedString = allFormulaWords[allFormulaWords.length - 1];
409
+ const lastTypedString = allFormulaWords[allFormulaWords.length - 1];
203
410
  // Se la l'ultima stringa digitata non contiene caratteri speciali allora splitto la stringa
204
411
  // sui "." e imposto i suggerimenti in base al path della prorpietà che si sta digitando.
205
412
  if (!new RegExp("[^0-9a-zA-Z_.]").test(lastTypedString)) {
206
- var propertyPath = lastTypedString.split(".");
207
- var lastTypedWork = propertyPath[propertyPath.length - 1];
208
- var propertiesToCheck = [];
413
+ const propertyPath = lastTypedString.split(".");
414
+ const lastTypedWork = propertyPath[propertyPath.length - 1];
415
+ let propertiesToCheck = [];
209
416
  if (propertyPath.length == 1) {
210
417
  propertiesToCheck = ["rec", "ctx"];
211
418
  }
@@ -218,7 +425,7 @@ let UtilityHelperService = UtilityHelperService_1 = class UtilityHelperService {
218
425
  else if (propertyPath.length > 1 && propertyPath[propertyPath.length - 2] === "rec") {
219
426
  propertiesToCheck = availableRecProperties;
220
427
  }
221
- // Eseguo il controllo sulle proprietà recuperate, aggiungo ai suggerimenti tutti i nomi che iniziano con
428
+ // Eseguo il controllo sulle proprietà recuperate, aggiungo ai suggerimenti tutti i nomi che iniziano con
222
429
  // quello che sta digitando l'utente.
223
430
  propertiesToCheck.forEach(prop => {
224
431
  if (prop.startsWith(lastTypedWork)) {
@@ -284,7 +491,7 @@ let UtilityHelperService = UtilityHelperService_1 = class UtilityHelperService {
284
491
  * @returns Restituisce un FormGroup rappresentate la Form a cui appartengono i BaseField ricevuti in input.
285
492
  */
286
493
  CreateFormFormGroup(formFields, record, onlyView = false, includeCurrentFormInField = true) {
287
- var formForm = this.formBuilder.group([]);
494
+ const formForm = this.formBuilder.group([]);
288
495
  formFields.forEach(field => {
289
496
  formForm.addControl(field.Name, this.createFieldFormControl(field, record));
290
497
  if (includeCurrentFormInField) {
@@ -313,6 +520,17 @@ let UtilityHelperService = UtilityHelperService_1 = class UtilityHelperService {
313
520
  if (field.MinLenght) {
314
521
  validators.push(Validators.minLength(field.MinLenght));
315
522
  }
523
+ switch (field.TextMask) {
524
+ case TextMaskEnum.Url:
525
+ validators.push(Validators.pattern(UrlRegex));
526
+ break;
527
+ case TextMaskEnum.Email:
528
+ validators.push(Validators.email);
529
+ break;
530
+ case TextMaskEnum.Telefono:
531
+ validators.push(Validators.pattern(TelRegex));
532
+ break;
533
+ }
316
534
  break;
317
535
  case FieldTypeEnum["Area di testo"]:
318
536
  if (field.MaxLenght) {
@@ -335,12 +553,147 @@ let UtilityHelperService = UtilityHelperService_1 = class UtilityHelperService {
335
553
  }
336
554
  return new FormControl(record[field.Name], validators);
337
555
  }
556
+ /**
557
+ * Metodo per configurare gli endpoint da usare di default a partire dall'url base del server
558
+ * a cui si deve connettere e al token da passare per autenticarsi.
559
+ * @param baseServerUrl Stringa dell'url base del server (es: "http://localhost:5000").
560
+ * @param userToken Token dell'utente loggato da usare per autenticarsi se necessario.
561
+ * @returns Resituisce la configurazione completa degli endPoint da usare di default.
562
+ */
563
+ ConfigureDefaultEndPoints(baseServerUrl, userToken) {
564
+ let endPointConfiguration = new EndPointConfiguration();
565
+ endPointConfiguration = new EndPointConfiguration();
566
+ endPointConfiguration.Records = {
567
+ GetByFormIDEndPoint: {
568
+ Url: baseServerUrl + "/api/v1/getall",
569
+ Token: userToken,
570
+ RequestMethod: RequestMethodEnum.GET,
571
+ },
572
+ GetByIDEndPoint: {
573
+ Url: baseServerUrl + "/api/v1/getByID",
574
+ Token: userToken,
575
+ RequestMethod: RequestMethodEnum.GET,
576
+ },
577
+ SaveEndPoint: {
578
+ Url: baseServerUrl + "/api/v1/save",
579
+ Token: userToken,
580
+ RequestMethod: RequestMethodEnum.POST,
581
+ },
582
+ DuplicateEndPoint: {
583
+ Url: baseServerUrl + "/api/v1/duplicate",
584
+ Token: userToken,
585
+ RequestMethod: RequestMethodEnum.POST,
586
+ },
587
+ DeleteEndPoint: {
588
+ Url: baseServerUrl + "/api/v1/delete",
589
+ Token: userToken,
590
+ RequestMethod: RequestMethodEnum.DELETE,
591
+ }
592
+ };
593
+ endPointConfiguration.Forms = {
594
+ GetByIDEndPoint: {
595
+ Url: baseServerUrl + "/api/conf/form",
596
+ Token: userToken,
597
+ RequestMethod: RequestMethodEnum.GET,
598
+ },
599
+ SaveEndPoint: {
600
+ Url: baseServerUrl + "/api/conf/form",
601
+ Token: userToken,
602
+ RequestMethod: RequestMethodEnum.POST,
603
+ }
604
+ };
605
+ return endPointConfiguration;
606
+ }
607
+ /**
608
+ * Metodo che data la configurazione di un endpoint costruisce l'url da chiamare, gli eventuali parametri
609
+ * da passare (nel body o nella rotta) ed effettua la chiamata. Al termine della chiamata esegue le eventuali
610
+ * funzioni di callback (sia in caso di successo che in caso di errore) passate in input.
611
+ * @param endPointData Cofigurazione dell'endpoint da chiamare.
612
+ * @param dynamicModuleParams Array dei parametri aggiunti dal modulo dinamico a quelli già configurati
613
+ * (ad esempio il record o la form da salvare oppure l'ID per recuperare una particolare entità).
614
+ * @param callback Metodo da eseguire in caso di successo dopo la chiamata http.
615
+ * NOTA: in input viene passata la risposta della chiamata stessa.
616
+ * @param errorCallBack Metodo da eseguire in caso di errore dopo la chiamata http.
617
+ * NOTA: in input viene passato l'errore generato della chiamata stessa.
618
+ */
619
+ RunEndPointCall(endPointData, dynamicModuleParams = null, callback = null, errorCallBack = null) {
620
+ this.spinnerService.addRequestCounter();
621
+ let url = `${endPointData.Url}`;
622
+ let queryParams = null;
623
+ const bodyParams = {
624
+ AdditionalParams: {}
625
+ };
626
+ // Se nella configurazione sono stati definiti parametri da aggiungere alla chiamata questi vengono ciclati
627
+ // e aggiunti nel punto in cui devono essere usati.
628
+ if (endPointData.Params) {
629
+ endPointData.Params.forEach(p => {
630
+ switch (p.ParamType) {
631
+ case ParamTypeEnum['Query param']: {
632
+ const stringParam = p.ParamName + "=" + p.ParamValue;
633
+ queryParams = (queryParams == null ? "" : queryParams + "&") + stringParam;
634
+ break;
635
+ }
636
+ case ParamTypeEnum['In route']: {
637
+ url = url + (url.endsWith("/") ? "" : "/") + p.ParamValue;
638
+ break;
639
+ }
640
+ case ParamTypeEnum['In Body']: {
641
+ bodyParams.AdditionalParams[p.ParamName] = p.ParamValue;
642
+ break;
643
+ }
644
+ }
645
+ });
646
+ }
647
+ // Se sono stati passati parametri da aggiungere alla chiamata definiti all'interno del modulo dinamico
648
+ // vengono ciclati e aggiunti nel punto in cui devono essere usati dopo quelli definiti nella configurazione.
649
+ if (dynamicModuleParams) {
650
+ dynamicModuleParams.forEach(p => {
651
+ switch (p.ParamType) {
652
+ case ParamTypeEnum['Query param']: {
653
+ const stringParam = p.ParamName + "=" + p.ParamValue;
654
+ queryParams = (queryParams == null ? "" : queryParams + "&") + stringParam;
655
+ break;
656
+ }
657
+ case ParamTypeEnum['In route']: {
658
+ url = url + (url.endsWith("/") ? "" : "/") + p.ParamValue;
659
+ break;
660
+ }
661
+ case ParamTypeEnum['In Body']: {
662
+ bodyParams[p.ParamName] = p.ParamValue;
663
+ break;
664
+ }
665
+ }
666
+ });
667
+ }
668
+ if (queryParams != null) {
669
+ url = (url.endsWith("/") ? url.substring(0, url.length - 1) : url) + "?" + queryParams;
670
+ }
671
+ this.http.request(endPointData.RequestMethod, url, {
672
+ headers: endPointData.Token ? { Authorization: endPointData.Token } : null,
673
+ body: ![RequestMethodEnum.DELETE, RequestMethodEnum.GET].includes(endPointData.RequestMethod) ? bodyParams : null
674
+ })
675
+ .subscribe((res) => {
676
+ this.spinnerService.removeRequestCounter();
677
+ if (callback) {
678
+ callback(res);
679
+ }
680
+ }, (error) => {
681
+ this.spinnerService.removeRequestCounter();
682
+ if (errorCallBack) {
683
+ errorCallBack(error);
684
+ }
685
+ EqpDynamicModuleDialogService.Error(error.message);
686
+ throw new Error(error.message);
687
+ });
688
+ }
338
689
  };
339
690
  UtilityHelperService.context = new Context();
340
691
  UtilityHelperService.ctorParameters = () => [
341
- { type: FormBuilder }
692
+ { type: FormBuilder },
693
+ { type: HttpClient },
694
+ { type: SpinnerService }
342
695
  ];
343
- UtilityHelperService.ɵprov = ɵɵdefineInjectable({ factory: function UtilityHelperService_Factory() { return new UtilityHelperService(ɵɵinject(FormBuilder)); }, token: UtilityHelperService, providedIn: "root" });
696
+ UtilityHelperService.ɵprov = ɵɵdefineInjectable({ factory: function UtilityHelperService_Factory() { return new UtilityHelperService(ɵɵinject(FormBuilder), ɵɵinject(HttpClient), ɵɵinject(SpinnerService)); }, token: UtilityHelperService, providedIn: "root" });
344
697
  UtilityHelperService = UtilityHelperService_1 = __decorate([
345
698
  Injectable({
346
699
  providedIn: 'root'
@@ -348,56 +701,214 @@ UtilityHelperService = UtilityHelperService_1 = __decorate([
348
701
  ], UtilityHelperService);
349
702
 
350
703
  let EqpDynamicModuleComponent = class EqpDynamicModuleComponent {
351
- constructor() {
704
+ constructor(utilityHelperService) {
705
+ this.utilityHelperService = utilityHelperService;
352
706
  this.context = new Context();
353
- this.form = new Form();
354
707
  this.showButtons = true;
355
708
  this.showTitle = true;
356
- this.viewMode = FormTypeEnum.LIST;
709
+ /**
710
+ * Url del server da chiamare per recuperare, salvare o eliminare i record.
711
+ * Usato per creare la configurazione di default degli endpoint da chiamare.
712
+ */
713
+ this.baseServerUrl = null;
714
+ /**
715
+ * Token da usare negli endpoint da chiamare per recuperare o salvare i record.
716
+ * Usato solo se viene popolata la proprietà "baseServerUrl".
717
+ */
718
+ this.userToken = null;
719
+ /**
720
+ * Configurazione degli endpoint da chiamare per recuperare o salvare i dati.
721
+ * Può essere definita dall'utente oppure lasciata null, viene popolata con dei
722
+ * valori di default se viene valorizzata la proprietà "baseServerUrl" altrimenti
723
+ * viene lasciata null e non viene eseguita nessuna chiamata al server.
724
+ */
725
+ this.endPointConfiguration = null;
726
+ /**
727
+ * Eventi emessi quando si salva, elimina o duplica un record
728
+ * se non è stato specificato un endpoint da chiamare.
729
+ */
357
730
  this.saveRecord = new EventEmitter();
358
731
  this.deleteRecord = new EventEmitter();
359
732
  this.duplicateRecord = new EventEmitter();
733
+ /**
734
+ * Eventi emessi DOPO aver eseguito una chiamata al server per il salvataggio,
735
+ * l'eliminazione o la duplicazione di un record all'endpoint specificato.
736
+ */
737
+ this.afterSaveRecord = new EventEmitter();
738
+ this.afterDeleteRecord = new EventEmitter();
739
+ this.afterDuplicateRecord = new EventEmitter();
740
+ this.form = new Form();
741
+ this.viewMode = FormTypeEnum.LIST;
360
742
  this.FormTypeEnum = FormTypeEnum;
361
743
  }
362
744
  ngOnInit() {
363
745
  UtilityHelperService.SetContext(this.context);
746
+ this.configureDefaultEndPoints();
747
+ this.getFormByID();
748
+ }
749
+ getFormByID() {
750
+ const dynamicModuleParams = new Array();
751
+ dynamicModuleParams.push({
752
+ ParamName: "id",
753
+ ParamValue: this.formID,
754
+ ParamType: ParamTypeEnum['Query param']
755
+ });
756
+ this.utilityHelperService.RunEndPointCall(this.endPointConfiguration.Forms.GetByIDEndPoint, dynamicModuleParams, (res) => {
757
+ this.form = res;
758
+ this.getRecordsByFormID();
759
+ }, (err) => {
760
+ console.log(err);
761
+ });
762
+ }
763
+ /**
764
+ * Metodo per configurare gli endpoint da usare di default a partire dall'url base del server
765
+ * a cui si deve connettere e al token da passare per autenticarsi.
766
+ * Se la proprietà "baseServerUrl" è null e non sono stati configurati i vari endpoint allora
767
+ * non viene eseguita nessuna chiamata http per recuperare/salvare i dati.
768
+ */
769
+ configureDefaultEndPoints() {
770
+ if (!this.endPointConfiguration && this.baseServerUrl) {
771
+ this.endPointConfiguration = this.utilityHelperService.ConfigureDefaultEndPoints(this.baseServerUrl, this.userToken);
772
+ }
773
+ }
774
+ /**
775
+ * Metodo per recuperare tutti i record salvati per una particolare Form.
776
+ * La chiamata viene effettuata solo se è stato configurato l'endPoint da usare.
777
+ * La risposta della chiamata deve essere un array di oggetti di tipo "DynRecord"
778
+ * a partire dai quali vengono ricreati i Record usati nel client.
779
+ */
780
+ getRecordsByFormID() {
781
+ if (this.endPointConfiguration && this.endPointConfiguration.Records && this.endPointConfiguration.Records.GetByFormIDEndPoint) {
782
+ var dynamicModuleParams = [
783
+ { ParamName: 'EntID', ParamValue: this.form.ID, ParamType: ParamTypeEnum['Query param'] }
784
+ ];
785
+ this.utilityHelperService.RunEndPointCall(this.endPointConfiguration.Records.GetByFormIDEndPoint, dynamicModuleParams, (res) => {
786
+ this.values = new Array();
787
+ res.forEach(r => {
788
+ var tmpRec = new Record();
789
+ tmpRec = JSON.parse(r.SerializedValues);
790
+ tmpRec.ID = r.ID;
791
+ tmpRec.EntID = r.EntID;
792
+ this.values.push(tmpRec);
793
+ });
794
+ });
795
+ }
364
796
  }
797
+ /**
798
+ * Metodo invocato quando si vuole aggiungere, visualizzare o modificare un record.
799
+ * Se l'evento è null vuol dire che stiamo aggiungendo un nuovo record altrimenti siamo in modifica
800
+ * o visualizzazione. In questi ultimi due casi, se è stato configurato un endpoint per il recupero
801
+ * del record completo allora viene effettuata una chiamata al server, altrimenti viene usato l'oggetto selezionato.
802
+ * @param event Oggetto con due proprietà:
803
+ * "record" = oggetto da modificare/visualizzare,
804
+ * "onlyView" = booleano (se TRUE siamo in visualizzazione altrimenti in modifica)
805
+ */
365
806
  onAddViewEditRecord(event) {
366
807
  if (event != null) {
367
- this.selectedRecord = JSON.parse(JSON.stringify(event.record));
368
808
  this.onlyView = event.onlyView;
809
+ if (this.endPointConfiguration && this.endPointConfiguration.Records && this.endPointConfiguration.Records.GetByIDEndPoint) {
810
+ var dynamicModuleParams = [
811
+ { ParamName: "id", ParamValue: event.record.ID, ParamType: ParamTypeEnum['Query param'] }
812
+ ];
813
+ this.utilityHelperService.RunEndPointCall(this.endPointConfiguration.Records.GetByIDEndPoint, dynamicModuleParams, (res) => {
814
+ this.selectedRecord = JSON.parse(res.SerializedValues);
815
+ this.selectedRecord.ID = res.ID;
816
+ this.selectedRecord.EntID = res.EntID;
817
+ this.viewMode = FormTypeEnum.SCALAR;
818
+ });
819
+ }
820
+ else {
821
+ this.selectedRecord = JSON.parse(JSON.stringify(event.record));
822
+ this.viewMode = FormTypeEnum.SCALAR;
823
+ }
369
824
  }
370
825
  else {
371
826
  this.selectedRecord = null;
372
827
  this.onlyView = false;
828
+ this.viewMode = FormTypeEnum.SCALAR;
373
829
  }
374
- this.viewMode = FormTypeEnum.SCALAR;
375
- }
376
- onSaveForm(event) {
377
- //TODO: Salvare il record!
378
- // if (event != null) {
379
- // if (event.ID && this.values.find(v => v.ID == event.ID)) {
380
- // this.values[this.values.findIndex(v => v.ID == event.ID)] = event;
381
- // } else {
382
- // this.values.push(event);
383
- // }
384
- // }
385
- this.saveRecord.emit(event);
386
- this.viewMode = FormTypeEnum.LIST;
387
830
  }
831
+ /**
832
+ * Metodo per salvare il record aggiunto o modificato.
833
+ * Se è stato configurato un endPoint per il salvataggio viene effettuata una chiamata al server passando l'oggeto da salvare
834
+ * nel body della chiamata, altrimenti scatena l'evento "saveRecord".
835
+ * @param event Oggetto di tipo Record da salvare.
836
+ */
837
+ onSaveRecord(event) {
838
+ var _a;
839
+ if (event != null && this.endPointConfiguration != null && this.endPointConfiguration.Records.SaveEndPoint) {
840
+ var dynRec = new DynRecord();
841
+ dynRec.ID = (_a = event.ID, (_a !== null && _a !== void 0 ? _a : null));
842
+ dynRec.EntID = this.form.ID;
843
+ dynRec.Values = (event !== null && event !== void 0 ? event : null);
844
+ var dynamicModuleParams = [
845
+ { ParamName: "Record", ParamValue: dynRec, ParamType: ParamTypeEnum['In Body'] }
846
+ ];
847
+ this.utilityHelperService.RunEndPointCall(this.endPointConfiguration.Records.SaveEndPoint, dynamicModuleParams, (res) => {
848
+ this.getRecordsByFormID();
849
+ this.afterSaveRecord.emit(event);
850
+ this.viewMode = FormTypeEnum.LIST;
851
+ });
852
+ }
853
+ else {
854
+ this.saveRecord.emit(event);
855
+ this.viewMode = FormTypeEnum.LIST;
856
+ }
857
+ }
858
+ /**
859
+ * Metodo per duplicare un record precedentemente salvato.
860
+ * Se è stato configurato un endPoint per la duplicazione lato server allora effettua una chiamata passando nel body
861
+ * un oggetto contenente il record da duplicare, altrimenti scatena l'evento di output "duplicateRecord".
862
+ * @param record Oggetto di tipo Record da duplicare.
863
+ */
388
864
  onDuplicateRecord(record) {
389
- this.duplicateRecord.emit(record);
865
+ if (this.endPointConfiguration && this.endPointConfiguration.Records.DuplicateEndPoint) {
866
+ EqpDynamicModuleDialogService.Confirm('Duplicare il record selezionato?', () => {
867
+ var dynamicModuleParams = [
868
+ { ParamName: "id", ParamValue: record.ID, ParamType: ParamTypeEnum['Query param'] }
869
+ ];
870
+ this.utilityHelperService.RunEndPointCall(this.endPointConfiguration.Records.DuplicateEndPoint, dynamicModuleParams, (res) => {
871
+ this.getRecordsByFormID();
872
+ this.afterDuplicateRecord.emit(record);
873
+ });
874
+ }, false, 'Richiesta conferma');
875
+ }
876
+ else {
877
+ this.duplicateRecord.emit(record);
878
+ }
390
879
  }
880
+ /**
881
+ * Metodo per eliminare un record.
882
+ * Se è stato configurato un endPoint per l'eliminazione allora effettua una chiamata passando l'ID del record da eliminare
883
+ * come query param all'interno della rotta, altrimenti scatena l'evento di output "deleteRecord".
884
+ * @param record Oggetto di tipo Record da duplicare.
885
+ */
391
886
  onDeleteRecord(record) {
392
- this.deleteRecord.emit(record);
887
+ if (this.endPointConfiguration && this.endPointConfiguration.Records.DeleteEndPoint) {
888
+ EqpDynamicModuleDialogService.Confirm('Eliminare il record selezionato?', () => {
889
+ var dynamicModuleParams = [
890
+ { ParamName: "id", ParamValue: record.ID, ParamType: ParamTypeEnum['Query param'] }
891
+ ];
892
+ this.utilityHelperService.RunEndPointCall(this.endPointConfiguration.Records.DeleteEndPoint, dynamicModuleParams, (res) => {
893
+ this.getRecordsByFormID();
894
+ this.afterDeleteRecord.emit(record);
895
+ });
896
+ }, false, 'Richiesta conferma');
897
+ }
898
+ else {
899
+ this.deleteRecord.emit(record);
900
+ }
393
901
  }
394
902
  };
903
+ EqpDynamicModuleComponent.ctorParameters = () => [
904
+ { type: UtilityHelperService }
905
+ ];
395
906
  __decorate([
396
907
  Input()
397
908
  ], EqpDynamicModuleComponent.prototype, "context", void 0);
398
909
  __decorate([
399
910
  Input()
400
- ], EqpDynamicModuleComponent.prototype, "form", void 0);
911
+ ], EqpDynamicModuleComponent.prototype, "formID", void 0);
401
912
  __decorate([
402
913
  Input()
403
914
  ], EqpDynamicModuleComponent.prototype, "values", void 0);
@@ -409,7 +920,13 @@ __decorate([
409
920
  ], EqpDynamicModuleComponent.prototype, "showTitle", void 0);
410
921
  __decorate([
411
922
  Input()
412
- ], EqpDynamicModuleComponent.prototype, "viewMode", void 0);
923
+ ], EqpDynamicModuleComponent.prototype, "baseServerUrl", void 0);
924
+ __decorate([
925
+ Input()
926
+ ], EqpDynamicModuleComponent.prototype, "userToken", void 0);
927
+ __decorate([
928
+ Input()
929
+ ], EqpDynamicModuleComponent.prototype, "endPointConfiguration", void 0);
413
930
  __decorate([
414
931
  Output()
415
932
  ], EqpDynamicModuleComponent.prototype, "saveRecord", void 0);
@@ -419,10 +936,19 @@ __decorate([
419
936
  __decorate([
420
937
  Output()
421
938
  ], EqpDynamicModuleComponent.prototype, "duplicateRecord", void 0);
939
+ __decorate([
940
+ Output()
941
+ ], EqpDynamicModuleComponent.prototype, "afterSaveRecord", void 0);
942
+ __decorate([
943
+ Output()
944
+ ], EqpDynamicModuleComponent.prototype, "afterDeleteRecord", void 0);
945
+ __decorate([
946
+ Output()
947
+ ], EqpDynamicModuleComponent.prototype, "afterDuplicateRecord", void 0);
422
948
  EqpDynamicModuleComponent = __decorate([
423
949
  Component({
424
950
  selector: 'eqp-dynamic-module',
425
- template: "<add-form-record *ngIf=\"viewMode == FormTypeEnum.SCALAR\" [form]=\"form\" [record]=\"selectedRecord\"\r\n [showButtons]=\"showButtons\" [onlyView]=\"onlyView\" (saveRecordEvent)=\"onSaveForm($event)\" [showTitle]=\"showTitle\">\r\n</add-form-record>\r\n\r\n<list-form-record *ngIf=\"viewMode == FormTypeEnum.LIST\" [form]=\"form\" [values]=\"values\"\r\n (onAddViewEditRecord)=\"onAddViewEditRecord($event)\" [showTitle]=\"showTitle\"\r\n (onDeleteRecord)=\"onDeleteRecord($event)\" (onDuplicateRecord)=\"onDuplicateRecord($event)\">\r\n</list-form-record>",
951
+ template: "<eqp-dynamic-module-spinner></eqp-dynamic-module-spinner>\r\n\r\n<add-form-record *ngIf=\"viewMode == FormTypeEnum.SCALAR\" [form]=\"form\" [record]=\"selectedRecord\"\r\n [showButtons]=\"showButtons\" [onlyView]=\"onlyView\" (saveRecordEvent)=\"onSaveRecord($event)\" [showTitle]=\"showTitle\">\r\n</add-form-record>\r\n\r\n<list-form-record *ngIf=\"viewMode == FormTypeEnum.LIST && values\" [form]=\"form\" [values]=\"values\"\r\n (onAddViewEditRecord)=\"onAddViewEditRecord($event)\" [showTitle]=\"showTitle\"\r\n (onDeleteRecord)=\"onDeleteRecord($event)\" (onDuplicateRecord)=\"onDuplicateRecord($event)\">\r\n</list-form-record>",
426
952
  styles: ["::ng-deep mat-form-field{width:100%}"]
427
953
  })
428
954
  ], EqpDynamicModuleComponent);
@@ -500,125 +1026,82 @@ MaterialModule = __decorate([
500
1026
  })
501
1027
  ], MaterialModule);
502
1028
 
503
- let EqpDynamicModuleDialogService = class EqpDynamicModuleDialogService {
504
- constructor() {
505
- }
506
- /**
507
- * Mostra uno sweet alert di tipo ERROR con il messaggio passato come parametro.
508
- * @param message Messaggio d'errore da mostrare nello sweetalert
509
- * @param title Titolo dello sweetalert (di default mostra 'Errore')
510
- */
511
- static Error(message, title = null) {
512
- let currentTitle = title != null ? title : 'Errore';
513
- if (Array.isArray(message)) {
514
- currentTitle = title != null ? title : 'Errore';
515
- let htmlErrors = message.join("<br>");
516
- Swal.fire({
517
- title: currentTitle,
518
- html: htmlErrors,
519
- icon: 'error'
520
- });
521
- }
522
- else {
523
- Swal.fire(currentTitle, message, 'error');
524
- }
525
- }
526
- /**
527
- * Mostra uno sweetalert di tipo CONFIRM con il messaggio passato come parametro e se viene premuto
528
- * CONFERMA lancia la funzione di callback passata come parametro
529
- * @param message Messaggio da mostrare nello sweetalert
530
- * @param title Titolo dello sweetalert (di default mostra 'Info')
531
- */
532
- static Confirm(message, confirmCallback, isWarning = false, title = null, customWidth = null) {
533
- let currentTitle = title != null ? title : 'Sei sicuro di voler procedere?';
534
- if (Array.isArray(message)) {
535
- let htmlErrors = message.join("<br>");
536
- Swal.fire({
537
- title: currentTitle,
538
- html: htmlErrors,
539
- width: customWidth ? customWidth : '32rem',
540
- icon: !isWarning ? 'question' : 'warning',
541
- showCancelButton: true,
542
- allowOutsideClick: false,
543
- allowEscapeKey: false
544
- }).then((result) => {
545
- if (result.value && confirmCallback) {
546
- confirmCallback();
547
- }
548
- });
549
- }
550
- else {
551
- Swal.fire({
552
- title: currentTitle,
553
- text: message,
554
- width: customWidth ? customWidth : '32rem',
555
- icon: !isWarning ? 'question' : 'warning',
556
- showCancelButton: true,
557
- allowOutsideClick: false,
558
- allowEscapeKey: false
559
- }).then((result) => {
560
- if (result.value && confirmCallback) {
561
- confirmCallback();
562
- }
563
- });
564
- }
565
- }
566
- /**
567
- * Mostra uno sweetalert di tipo INFO con il messaggio passato come parametro
568
- * @param message Messaggio da mostrare nello sweetalert
569
- * @param title Titolo dello sweetalert (di default mostra 'Info')
570
- */
571
- static Info(message, title = null, isToast = null) {
572
- let currentTitle = title != null ? title : "Informazione:";
573
- Swal.fire(currentTitle, message, 'info');
574
- }
575
- /**
576
- * Mostra uno sweetalert di tipo WARNING con il messaggio passato come parametro
577
- * @param message Messaggio da mostrare nello sweetalert
578
- * @param title Titolo dello sweetalert (di default mostra 'Attenzione!')
579
- */
580
- static Warning(message, title = null, isToast = null) {
581
- let currentTitle = title != null ? title : "Attenzione!";
582
- if (Array.isArray(message)) {
583
- let htmlWarnings = message.join("<br>");
584
- Swal.fire({
585
- title: currentTitle,
586
- html: htmlWarnings,
587
- icon: 'warning'
588
- });
589
- }
590
- else {
591
- Swal.fire(currentTitle, message, 'warning');
592
- }
593
- }
594
- };
595
- EqpDynamicModuleDialogService.ɵprov = ɵɵdefineInjectable({ factory: function EqpDynamicModuleDialogService_Factory() { return new EqpDynamicModuleDialogService(); }, token: EqpDynamicModuleDialogService, providedIn: "root" });
596
- EqpDynamicModuleDialogService = __decorate([
597
- Injectable({
598
- providedIn: 'root'
599
- })
600
- ], EqpDynamicModuleDialogService);
601
-
602
1029
  let EqpDynamicModuleConfiguratorComponent = class EqpDynamicModuleConfiguratorComponent {
603
- constructor(formBuilder, dialog) {
1030
+ constructor(formBuilder, dialog, utilityHelperService) {
604
1031
  this.formBuilder = formBuilder;
605
1032
  this.dialog = dialog;
1033
+ this.utilityHelperService = utilityHelperService;
606
1034
  this.context = new Context();
607
1035
  this.form = new Form();
1036
+ this.formID = null;
608
1037
  this.innerFormManagment = false;
1038
+ /**
1039
+ * Url del server da chiamare per recuerare, salvare o eliminare i record.
1040
+ * Usato per creare la configurazione di default degli endpoint da chiamare.
1041
+ */
1042
+ this.baseServerUrl = null;
1043
+ /**
1044
+ * Token da usare negli endpoint da chiamare per recuperare o salvare i record.
1045
+ * Usato solo se viene popolata la proprietà "baseServerUrl".
1046
+ */
1047
+ this.userToken = null;
1048
+ /**
1049
+ * Configurazione degli endpoint da chiamare per recuperare o salvare i dati.
1050
+ * Può essere definita dall'utente oppure lasciata null, viene popolata con dei
1051
+ * valori di default se viene valorizzata la proprietà "baseServerUrl" altrimenti
1052
+ * viene lasciata null e non viene eseguita nessuna chiamata al server.
1053
+ */
1054
+ this.endPointConfiguration = null;
609
1055
  this.formCompleted = false;
610
1056
  //#region Enumeratori usati nell'html
611
1057
  this.FormTypeEnum = FormTypeEnum;
612
1058
  this.FormScalarTypeEnum = FormScalarTypeEnum;
613
1059
  //#endregion
1060
+ /**
1061
+ * Evento emesso quando si salva una form e non è stato specificato un endpoint da chiamare.
1062
+ */
614
1063
  this.saveFormEvent = new EventEmitter();
1064
+ /**
1065
+ * Evento emesso DOPO aver eseguito una chiamata al server per il salvataggiodi una form all'endpoint specificato.
1066
+ */
1067
+ this.afterSaveFormEvent = new EventEmitter();
615
1068
  }
616
1069
  ngOnInit() {
1070
+ this.configureDefaultEndPoints();
1071
+ this.getFormByID();
617
1072
  if (this.context) {
618
1073
  UtilityHelperService.SetContext(this.context);
619
1074
  }
620
- this.configureColumns();
621
- this.createFormForm();
1075
+ }
1076
+ /**
1077
+ * Metodo per configurare gli endpoint da usare di default a partire dall'url base del server
1078
+ * a cui si deve connettere e al token da passare per autenticarsi.
1079
+ * Se la proprietà baseServerUrl è null e non sono stati configurati i vari endpoint allora
1080
+ * non viene eseguita nessuna chiamata http per recuperare/salvare i dati.
1081
+ */
1082
+ configureDefaultEndPoints() {
1083
+ if (!this.endPointConfiguration && this.baseServerUrl) {
1084
+ this.endPointConfiguration = this.utilityHelperService.ConfigureDefaultEndPoints(this.baseServerUrl, this.userToken);
1085
+ if (this.formID) {
1086
+ this.endPointConfiguration.Forms.GetByIDEndPoint.Params = [{ ParamName: 'id', ParamValue: this.formID, ParamType: ParamTypeEnum['Query param'] }];
1087
+ }
1088
+ }
1089
+ }
1090
+ /**
1091
+ * Metodo per recuperare tutti i record salvati per una particolare Form.
1092
+ * La chiamata viene effettuata solo se è stato configurato l'endPoint da usare.
1093
+ */
1094
+ getFormByID() {
1095
+ if (this.formID && this.endPointConfiguration && this.endPointConfiguration.Forms && this.endPointConfiguration.Forms.GetByIDEndPoint) {
1096
+ this.utilityHelperService.RunEndPointCall(this.endPointConfiguration.Forms.GetByIDEndPoint, null, (res) => {
1097
+ this.setFormAndConfigure(res);
1098
+ }, (err) => {
1099
+ this.setFormAndConfigure(new Form());
1100
+ });
1101
+ }
1102
+ else {
1103
+ this.setFormAndConfigure();
1104
+ }
622
1105
  }
623
1106
  /**
624
1107
  * Metodo invocato al cambio del tipo di visualizzazione della form.
@@ -776,7 +1259,7 @@ let EqpDynamicModuleConfiguratorComponent = class EqpDynamicModuleConfiguratorCo
776
1259
  EqpDynamicModuleDialogService.Warning('Impossibile inserire due form di dettaglio con lo stesso nome.');
777
1260
  throw new Error('Impossibile inserire due form di dettaglio con lo stesso nome.');
778
1261
  }
779
- let innerFormField = new BaseField();
1262
+ const innerFormField = new BaseField();
780
1263
  innerFormField.Name = event.Name.split(" ").join("_");
781
1264
  innerFormField.Label = event.Name;
782
1265
  innerFormField.FieldType = FieldTypeEnum['Form di dettaglio'];
@@ -887,10 +1370,52 @@ let EqpDynamicModuleConfiguratorComponent = class EqpDynamicModuleConfiguratorCo
887
1370
  }
888
1371
  }
889
1372
  /**
890
- * Metodo che scatena l'evento di output per salvare la form creata alla fine del wizard
1373
+ * Metodo per salvare la form creata alla fine del wizard.
1374
+ * Se è stato configurato un endPoint per il salvataggio viene effettuata una chiamata al server passando l'oggeto da salvare
1375
+ * nel body della chiamata, altrimenti scatena l'evento "saveFormEvent".
1376
+ * NOTA: Per comunicare correttamente con la parte server del modulo dinamico bisogna modificare l'array dei Fields.
1377
+ * Al posto di passare un array di BaseField bisogna passare un array di oggetti del tipo { FieldType: FieldTypeEnum, Value: BaseField }.
891
1378
  */
892
1379
  saveForm() {
893
- this.saveFormEvent.emit(this.form);
1380
+ if (this.endPointConfiguration != null && this.endPointConfiguration.Forms.SaveEndPoint) {
1381
+ // Copio la form da salvare per riwrappare i Fields in oggetti del tipo { FieldType: FieldTypeEnum, Value: BaseField }.
1382
+ // Necessario per far funzionare correttamente il FieldConverter del server.
1383
+ const formToSave = JSON.parse(JSON.stringify(this.form));
1384
+ /*formToSave.Fields = [];
1385
+ this.form.Fields.forEach(field => {
1386
+ formToSave.Fields.push({
1387
+ FieldType: field.FieldType,
1388
+ Value: JSON.parse(JSON.stringify(field))
1389
+ });
1390
+ });*/
1391
+ formToSave.Fields = [];
1392
+ this.form.Fields.forEach(field => {
1393
+ let fld = UtilityHelperService.GetFieldType(field);
1394
+ formToSave.Fields.push(fld);
1395
+ });
1396
+ const dynamicModuleParams = [
1397
+ { ParamName: "Form", ParamValue: formToSave, ParamType: ParamTypeEnum['In Body'] }
1398
+ ];
1399
+ this.utilityHelperService.RunEndPointCall(this.endPointConfiguration.Forms.SaveEndPoint, dynamicModuleParams, (res) => {
1400
+ EqpDynamicModuleDialogService.Success("Form salvata con successo!");
1401
+ this.afterSaveFormEvent.emit(this.form);
1402
+ });
1403
+ }
1404
+ else {
1405
+ this.saveFormEvent.emit(this.form);
1406
+ }
1407
+ }
1408
+ //#region FUNZIONI PRIVATE
1409
+ /**
1410
+ * Metodo per impostare la form e configurare colonne/FormGourp.
1411
+ * @param form Form da utilizzare.
1412
+ */
1413
+ setFormAndConfigure(form = null) {
1414
+ if (form != null) {
1415
+ this.form = form;
1416
+ }
1417
+ this.configureColumns();
1418
+ this.createFormForm();
894
1419
  }
895
1420
  /**
896
1421
  * Configura le colonne per le tabelle necessarie alla creazione della form:
@@ -1081,7 +1606,8 @@ let EqpDynamicModuleConfiguratorComponent = class EqpDynamicModuleConfiguratorCo
1081
1606
  };
1082
1607
  EqpDynamicModuleConfiguratorComponent.ctorParameters = () => [
1083
1608
  { type: FormBuilder },
1084
- { type: MatDialog }
1609
+ { type: MatDialog },
1610
+ { type: UtilityHelperService }
1085
1611
  ];
1086
1612
  __decorate([
1087
1613
  Input()
@@ -1089,9 +1615,21 @@ __decorate([
1089
1615
  __decorate([
1090
1616
  Input()
1091
1617
  ], EqpDynamicModuleConfiguratorComponent.prototype, "form", void 0);
1618
+ __decorate([
1619
+ Input()
1620
+ ], EqpDynamicModuleConfiguratorComponent.prototype, "formID", void 0);
1092
1621
  __decorate([
1093
1622
  Input()
1094
1623
  ], EqpDynamicModuleConfiguratorComponent.prototype, "innerFormManagment", void 0);
1624
+ __decorate([
1625
+ Input()
1626
+ ], EqpDynamicModuleConfiguratorComponent.prototype, "baseServerUrl", void 0);
1627
+ __decorate([
1628
+ Input()
1629
+ ], EqpDynamicModuleConfiguratorComponent.prototype, "userToken", void 0);
1630
+ __decorate([
1631
+ Input()
1632
+ ], EqpDynamicModuleConfiguratorComponent.prototype, "endPointConfiguration", void 0);
1095
1633
  __decorate([
1096
1634
  ViewChild('fieldsTable', { static: false })
1097
1635
  ], EqpDynamicModuleConfiguratorComponent.prototype, "fieldsTable", void 0);
@@ -1113,10 +1651,13 @@ __decorate([
1113
1651
  __decorate([
1114
1652
  Output()
1115
1653
  ], EqpDynamicModuleConfiguratorComponent.prototype, "saveFormEvent", void 0);
1654
+ __decorate([
1655
+ Output()
1656
+ ], EqpDynamicModuleConfiguratorComponent.prototype, "afterSaveFormEvent", void 0);
1116
1657
  EqpDynamicModuleConfiguratorComponent = __decorate([
1117
1658
  Component({
1118
1659
  selector: 'eqp-dynamic-module-configurator',
1119
- template: "<mat-horizontal-stepper linear #stepper>\r\n <!-- DATI GENERALI DELLA FORM -->\r\n <mat-step [stepControl]=\"formFormGroup\">\r\n <form [formGroup]=\"formFormGroup\" (keydown.enter)=\"false\">\r\n <ng-template matStepLabel>\r\n <div class=\"stepper-header-overlay\" (click)=\"setFormStatus(false)\"></div>\r\n Dati generali della form\r\n </ng-template>\r\n\r\n <div class=\"row\">\r\n <div class=\"col-md-4\">\r\n <mat-form-field>\r\n <mat-label>Nome</mat-label>\r\n <input matInput formControlName=\"Name\" [(ngModel)]=\"form.Name\" required>\r\n </mat-form-field>\r\n </div>\r\n\r\n <div class=\"col-md-4\">\r\n <eqp-select [enumData]=\"FormScalarTypeEnum\" [(ngModelInput)]=\"form.FormScalarType\"\r\n [isRequired]=\"true\" [showCancelButton]=\"false\" placeholder=\"Tipo di visualizzazione\"\r\n [formGroupInput]=\"formFormGroup\" [formControlNameInput]=\"'FormScalarType'\"\r\n (ngModelInputChange)=\"onChangeFormScalarType()\">\r\n </eqp-select>\r\n </div>\r\n </div>\r\n <div class=\"row\" *ngIf=\"form.FormScalarType && form.FormScalarType != FormScalarTypeEnum.Semplice\">\r\n <div class=\"col-md-4 d-flex align-items-center\">\r\n <mat-form-field>\r\n <mat-label> Nome sezione (invio per confermare) </mat-label>\r\n <input matInput [(ngModel)]=\"formFieldGroupName\" [ngModelOptions]=\"{standalone: true}\"\r\n (keyup)=\"onFormFieldGroupNameKeyUp($event)\">\r\n </mat-form-field>\r\n </div>\r\n <div class=\"col-md-4 d-flex align-items-center\">\r\n <span class=\"mr-3\">Sezioni inserite:</span>\r\n <ul class=\"section-list\">\r\n <li *ngFor=\"let groupName of form.FormFieldsGroups, let i=index\">\r\n <mat-icon class=\"mr-1\" (click)=\"onDeleteFormFieldGroupName(groupName.Name)\">close\r\n </mat-icon>\r\n <span> {{i+1}}) {{groupName.Name}}</span>\r\n </li>\r\n </ul>\r\n </div>\r\n </div>\r\n\r\n <div class=\"mt-2 d-flex justify-content-end\">\r\n <button mat-raised-button color=\"primary\" matStepperNext\r\n [disabled]=\"formFormGroup.invalid\">Successivo</button>\r\n </div>\r\n </form>\r\n </mat-step>\r\n\r\n <!-- AGGIUNTA DEI CAMPI DELLA FORM -->\r\n <mat-step [completed]=\"isFieldStepCompleted()\">\r\n <ng-template matStepLabel>\r\n <div class=\"stepper-header-overlay\" (click)=\"setFormStatus(false)\"></div>\r\n Campi da inserire\r\n </ng-template>\r\n\r\n <div class=\"row justify-content-end\">\r\n <button class=\"btn btn-primary\" mat-raised-button color=\"primary\" type=\"button\" (click)=\"openFieldDialog()\">\r\n <mat-icon>add</mat-icon>\r\n <span style=\"margin-left: 10px;\">Aggiungi campo</span>\r\n </button>\r\n\r\n <button class=\"btn btn-primary ml-2\" mat-raised-button color=\"primary\" type=\"button\"\r\n (click)=\"openInnerFormDialog()\" *ngIf=\"!innerFormManagment\">\r\n <mat-icon>add</mat-icon>\r\n <span style=\"margin-left: 10px;\">Aggiungi form di dettaglio</span>\r\n </button>\r\n </div>\r\n\r\n <eqp-table #fieldsTable [createMatCard]=\"false\" [columns]=\"fieldsColumns\" [data]=\"form.Fields\"\r\n [emptyTableMessage]=\"'Nessun campo inserito'\" [searchText]=\"'Cerca'\">\r\n </eqp-table>\r\n\r\n <div class=\"mt-2 d-flex justify-content-end\">\r\n <button class=\"mr-2\" mat-raised-button matStepperPrevious>Precedente</button>\r\n <button mat-raised-button color=\"primary\" matStepperNext [disabled]=\"!isFieldStepCompleted()\"\r\n (click)=\"setFormStatus(false)\">Successivo</button>\r\n </div>\r\n </mat-step>\r\n\r\n <!-- AGGIUNTA DELLE OPERAZIONI SUI RECORD -->\r\n <mat-step>\r\n <ng-template matStepLabel>\r\n <div class=\"stepper-header-overlay\" (click)=\"setFormStatus(false)\"></div>\r\n Azioni aggiuntive sui record\r\n </ng-template>\r\n\r\n <div class=\"row justify-content-end\">\r\n <button class=\"btn btn-primary\" mat-raised-button color=\"primary\" type=\"button\"\r\n (click)=\"openActionOnRecordDialog()\">\r\n <mat-icon>add</mat-icon>\r\n <span style=\"margin-left: 10px;\">Aggiungi azione</span>\r\n </button>\r\n </div>\r\n <eqp-table #actionsOnRecordTable [createMatCard]=\"false\" [columns]=\"actionsOnRecordColumns\"\r\n [data]=\"form.ActionsOnRecord\" [emptyTableMessage]=\"'Nessuna action inserita'\" [searchText]=\"'Cerca'\">\r\n </eqp-table>\r\n\r\n <div class=\"mt-2 d-flex justify-content-end\">\r\n <button class=\"mr-2\" mat-raised-button matStepperPrevious>Precedente</button>\r\n <button mat-raised-button color=\"primary\" matStepperNext (click)=\"setFormStatus(true)\">\r\n Successivo\r\n </button>\r\n </div>\r\n </mat-step>\r\n\r\n <!-- VISUALIZZAZIONE FORM CREATA -->\r\n <mat-step>\r\n <ng-template matStepLabel>\r\n <div class=\"stepper-header-overlay\"\r\n (click)=\"setFormStatus(formFormGroup.valid && form.Fields && form.Fields.length > 0)\"></div>\r\n Riepilogo\r\n </ng-template>\r\n\r\n <eqp-dynamic-module [form]=\"previewForm\" *ngIf=\"previewForm && formCompleted\" [showButtons]=\"false\"\r\n [viewMode]=\"FormTypeEnum.SCALAR\"></eqp-dynamic-module>\r\n\r\n <div class=\"mt-2 d-flex justify-content-end\">\r\n <button class=\"mr-2\" mat-raised-button matStepperPrevious (click)=\"setFormStatus(false)\">Precedente</button>\r\n <button mat-raised-button color=\"primary\" (click)=\"saveForm()\">Salva form</button>\r\n </div>\r\n </mat-step>\r\n</mat-horizontal-stepper>\r\n\r\n<div class=\"row\" *ngIf=\"innerFormManagment\">\r\n <div class=\"col-md-12 text-right\">\r\n <button mat-raised-button (click)=\"saveFormEvent.emit(null)\">Esci</button>\r\n </div>\r\n</div>\r\n\r\n<!-- DIALOG AGGIUNTA/MODIFICA CAMPO -->\r\n<ng-template #dialogField>\r\n <eqp-dynamic-module-add-form-field [field]=\"selectedField\" [indexField]=\"indexSelectedField\"\r\n (saveFieldEvent)=\"onSaveField($event)\" [availableFields]=\"form.Fields\"\r\n [formFieldsGroups]=\"form.FormScalarType != FormScalarTypeEnum.Semplice ? form.FormFieldsGroups : null\">\r\n </eqp-dynamic-module-add-form-field>\r\n</ng-template>\r\n\r\n<!-- TEMPLATE PER VISUALIZZARE LA COLONNA DELLA SEZIONE NELLA TABELLA DEI FIELDS -->\r\n<ng-template #fieldSectionColumnTemplate let-row=\"row\">\r\n <eqp-select [arrayData]=\"form.FormFieldsGroups\" [(ngModelInput)]=\"row.FieldGroup\" [arrayKeyProperty]=\"'Name'\"\r\n [arrayValueProperty]=\"'Name'\" placeholder=\"Sezione\" [isRequired]=\"true\" [includeFullObject]=\"false\">\r\n </eqp-select>\r\n</ng-template>\r\n\r\n<!-- DIALOG PER AGGIUNGERE/MODIFICARE UNA ACTION SUI RECORD DELLA FORM -->\r\n<ng-template #dialogActionOnRecord>\r\n <div class=\"container-fluid\" style=\"max-height: 70vh !important; overflow-x: hidden; overflow-y: auto;\">\r\n <form [formGroup]=\"actionOnRecordFormGroup\">\r\n <div class=\"row\">\r\n <div class=\"header-title-standard\">{{indexSelectedAction != null && indexSelectedAction >= 0 ?\r\n \"Modifica\"\r\n : \"Aggiungi\"}} azione sul record</div>\r\n </div>\r\n <div class=\"row\">\r\n <div class=\"col-sm-12 col-md-4 mt-2\">\r\n <mat-form-field>\r\n <mat-label> Nome </mat-label>\r\n <input formControlName=\"Name\" required matInput [(ngModel)]=\"selectedAction.Name\">\r\n </mat-form-field>\r\n </div>\r\n\r\n <div class=\"col-sm-12 col-md-4 mt-2\">\r\n <mat-form-field>\r\n <mat-label> Icona </mat-label>\r\n <input formControlName=\"Icon\" required matInput [(ngModel)]=\"selectedAction.Icon\">\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n <div class=\"row\">\r\n <div class=\"col-sm-12 col-md-12 mt-2\">\r\n <mat-form-field>\r\n <textarea matInput [placeholder]=\"'Azione (Javascript)'\" [rows]=\"3\" formControlName=\"Action\"\r\n required [(ngModel)]=\"selectedAction.Action\" [matAutocomplete]=\"actionAutocomplete\"\r\n (keyup)=\"setActionAutocompleteOptions($event)\"\r\n (focus)=\"setActionAutocompleteOptions(null)\"></textarea>\r\n <mat-autocomplete #actionAutocomplete=\"matAutocomplete\">\r\n <mat-option *ngFor=\"let option of actionAutocompleteOptions\" [value]=\"option.value\">\r\n {{option.label}}\r\n </mat-option>\r\n </mat-autocomplete>\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n\r\n\r\n <div class=\"row mt-2 mb-1\">\r\n <div class=\"col-sm-12 text-right\">\r\n <button class=\"mr-2\" mat-raised-button color=\"primary\" (click)=\"saveActionOnRecord()\"\r\n [disabled]=\"actionOnRecordFormGroup.invalid\" type=\"button\">\r\n Salva\r\n </button>\r\n <button class=\"btn mat-raised-button\" (click)=\"closeDialogActionOnRecord()\" type=\"button\">\r\n Esci\r\n </button>\r\n </div>\r\n </div>\r\n </form>\r\n </div>\r\n</ng-template>\r\n\r\n<ng-template #dialogInnerForm>\r\n <eqp-dynamic-module-configurator [form]=\"selectedInnerForm\" [innerFormManagment]=\"true\"\r\n (saveFormEvent)=\"onSaveOrExitInnerForm($event)\"></eqp-dynamic-module-configurator>\r\n</ng-template>",
1660
+ template: "<eqp-dynamic-module-spinner></eqp-dynamic-module-spinner>\r\n\r\n<mat-horizontal-stepper linear #stepper>\r\n <!-- DATI GENERALI DELLA FORM -->\r\n <mat-step [stepControl]=\"formFormGroup\">\r\n <form [formGroup]=\"formFormGroup\" (keydown.enter)=\"false\">\r\n <ng-template matStepLabel>\r\n <div class=\"stepper-header-overlay\" (click)=\"setFormStatus(false)\"></div>\r\n Dati generali della form\r\n </ng-template>\r\n\r\n <div class=\"row\">\r\n <div class=\"col-md-4\">\r\n <mat-form-field>\r\n <mat-label>Nome</mat-label>\r\n <input matInput formControlName=\"Name\" [(ngModel)]=\"form.Name\" required>\r\n </mat-form-field>\r\n </div>\r\n\r\n <div class=\"col-md-4\">\r\n <eqp-select [enumData]=\"FormScalarTypeEnum\" [(ngModelInput)]=\"form.FormScalarType\"\r\n [isRequired]=\"true\" [showCancelButton]=\"false\" placeholder=\"Tipo di visualizzazione\"\r\n [formGroupInput]=\"formFormGroup\" [formControlNameInput]=\"'FormScalarType'\"\r\n (ngModelInputChange)=\"onChangeFormScalarType()\">\r\n </eqp-select>\r\n </div>\r\n </div>\r\n <div class=\"row\" *ngIf=\"form.FormScalarType && form.FormScalarType != FormScalarTypeEnum.Semplice\">\r\n <div class=\"col-md-4 d-flex align-items-center\">\r\n <mat-form-field>\r\n <mat-label> Nome sezione (invio per confermare) </mat-label>\r\n <input matInput [(ngModel)]=\"formFieldGroupName\" [ngModelOptions]=\"{standalone: true}\"\r\n (keyup)=\"onFormFieldGroupNameKeyUp($event)\">\r\n </mat-form-field>\r\n </div>\r\n <div class=\"col-md-4 d-flex align-items-center\">\r\n <span class=\"mr-3\">Sezioni inserite:</span>\r\n <ul class=\"section-list\">\r\n <li *ngFor=\"let groupName of form.FormFieldsGroups, let i=index\">\r\n <mat-icon class=\"mr-1\" (click)=\"onDeleteFormFieldGroupName(groupName.Name)\">close\r\n </mat-icon>\r\n <span> {{i+1}}) {{groupName.Name}}</span>\r\n </li>\r\n </ul>\r\n </div>\r\n </div>\r\n\r\n <div class=\"mt-2 d-flex justify-content-end\">\r\n <button mat-raised-button color=\"primary\" matStepperNext\r\n [disabled]=\"formFormGroup.invalid\">Successivo</button>\r\n </div>\r\n </form>\r\n </mat-step>\r\n\r\n <!-- AGGIUNTA DEI CAMPI DELLA FORM -->\r\n <mat-step [completed]=\"isFieldStepCompleted()\">\r\n <ng-template matStepLabel>\r\n <div class=\"stepper-header-overlay\" (click)=\"setFormStatus(false)\"></div>\r\n Campi da inserire\r\n </ng-template>\r\n\r\n <div class=\"row justify-content-end\">\r\n <button class=\"btn btn-primary\" mat-raised-button color=\"primary\" type=\"button\" (click)=\"openFieldDialog()\">\r\n <mat-icon>add</mat-icon>\r\n <span style=\"margin-left: 10px;\">Aggiungi campo</span>\r\n </button>\r\n\r\n <button class=\"btn btn-primary ml-2\" mat-raised-button color=\"primary\" type=\"button\"\r\n (click)=\"openInnerFormDialog()\" *ngIf=\"!innerFormManagment\">\r\n <mat-icon>add</mat-icon>\r\n <span style=\"margin-left: 10px;\">Aggiungi form di dettaglio</span>\r\n </button>\r\n </div>\r\n\r\n <eqp-table #fieldsTable [createMatCard]=\"false\" [columns]=\"fieldsColumns\" [data]=\"form.Fields\"\r\n [emptyTableMessage]=\"'Nessun campo inserito'\" [searchText]=\"'Cerca'\">\r\n </eqp-table>\r\n\r\n <div class=\"mt-2 d-flex justify-content-end\">\r\n <button class=\"mr-2\" mat-raised-button matStepperPrevious>Precedente</button>\r\n <button mat-raised-button color=\"primary\" matStepperNext [disabled]=\"!isFieldStepCompleted()\"\r\n (click)=\"setFormStatus(false)\">Successivo</button>\r\n </div>\r\n </mat-step>\r\n\r\n <!-- AGGIUNTA DELLE OPERAZIONI SUI RECORD -->\r\n <mat-step>\r\n <ng-template matStepLabel>\r\n <div class=\"stepper-header-overlay\" (click)=\"setFormStatus(false)\"></div>\r\n Azioni aggiuntive sui record\r\n </ng-template>\r\n\r\n <div class=\"row justify-content-end\">\r\n <button class=\"btn btn-primary\" mat-raised-button color=\"primary\" type=\"button\"\r\n (click)=\"openActionOnRecordDialog()\">\r\n <mat-icon>add</mat-icon>\r\n <span style=\"margin-left: 10px;\">Aggiungi azione</span>\r\n </button>\r\n </div>\r\n <eqp-table #actionsOnRecordTable [createMatCard]=\"false\" [columns]=\"actionsOnRecordColumns\"\r\n [data]=\"form.ActionsOnRecord\" [emptyTableMessage]=\"'Nessuna action inserita'\" [searchText]=\"'Cerca'\">\r\n </eqp-table>\r\n\r\n <div class=\"mt-2 d-flex justify-content-end\">\r\n <button class=\"mr-2\" mat-raised-button matStepperPrevious>Precedente</button>\r\n <button mat-raised-button color=\"primary\" matStepperNext (click)=\"setFormStatus(true)\">\r\n Successivo\r\n </button>\r\n </div>\r\n </mat-step>\r\n\r\n <!-- VISUALIZZAZIONE FORM CREATA -->\r\n <mat-step>\r\n <ng-template matStepLabel>\r\n <div class=\"stepper-header-overlay\"\r\n (click)=\"setFormStatus(formFormGroup.valid && form.Fields && form.Fields.length > 0)\"></div>\r\n Anteprima\r\n </ng-template>\r\n\r\n <add-form-record *ngIf=\"previewForm && formCompleted\" [form]=\"previewForm\" [showButtons]=\"false\">\r\n </add-form-record>\r\n\r\n\r\n <div class=\"mt-2 d-flex justify-content-end\">\r\n <button class=\"mr-2\" mat-raised-button matStepperPrevious (click)=\"setFormStatus(false)\">Precedente</button>\r\n <button mat-raised-button color=\"primary\" (click)=\"saveForm()\">Salva form</button>\r\n </div>\r\n </mat-step>\r\n</mat-horizontal-stepper>\r\n\r\n<div class=\"row\" *ngIf=\"innerFormManagment\">\r\n <div class=\"col-md-12 text-right\">\r\n <button mat-raised-button (click)=\"saveFormEvent.emit(null)\">Esci</button>\r\n </div>\r\n</div>\r\n\r\n<!-- DIALOG AGGIUNTA/MODIFICA CAMPO -->\r\n<ng-template #dialogField>\r\n <eqp-dynamic-module-add-form-field [field]=\"selectedField\" [indexField]=\"indexSelectedField\"\r\n (saveFieldEvent)=\"onSaveField($event)\" [availableFields]=\"form.Fields\"\r\n [formFieldsGroups]=\"form.FormScalarType != FormScalarTypeEnum.Semplice ? form.FormFieldsGroups : null\">\r\n </eqp-dynamic-module-add-form-field>\r\n</ng-template>\r\n\r\n<!-- TEMPLATE PER VISUALIZZARE LA COLONNA DELLA SEZIONE NELLA TABELLA DEI FIELDS -->\r\n<ng-template #fieldSectionColumnTemplate let-row=\"row\">\r\n <eqp-select [arrayData]=\"form.FormFieldsGroups\" [(ngModelInput)]=\"row.FieldGroup\" [arrayKeyProperty]=\"'Name'\"\r\n [arrayValueProperty]=\"'Name'\" placeholder=\"Sezione\" [isRequired]=\"true\" [includeFullObject]=\"false\">\r\n </eqp-select>\r\n</ng-template>\r\n\r\n<!-- DIALOG PER AGGIUNGERE/MODIFICARE UNA ACTION SUI RECORD DELLA FORM -->\r\n<ng-template #dialogActionOnRecord>\r\n <div class=\"container-fluid\" style=\"max-height: 70vh !important; overflow-x: hidden; overflow-y: auto;\">\r\n <form [formGroup]=\"actionOnRecordFormGroup\">\r\n <div class=\"row\">\r\n <div class=\"header-title-standard\">{{indexSelectedAction != null && indexSelectedAction >= 0 ?\r\n \"Modifica\"\r\n : \"Aggiungi\"}} azione sul record</div>\r\n </div>\r\n <div class=\"row\">\r\n <div class=\"col-sm-12 col-md-4 mt-2\">\r\n <mat-form-field>\r\n <mat-label> Nome </mat-label>\r\n <input formControlName=\"Name\" required matInput [(ngModel)]=\"selectedAction.Name\">\r\n </mat-form-field>\r\n </div>\r\n\r\n <div class=\"col-sm-12 col-md-4 mt-2\">\r\n <mat-form-field>\r\n <mat-label> Icona </mat-label>\r\n <input formControlName=\"Icon\" required matInput [(ngModel)]=\"selectedAction.Icon\">\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n <div class=\"row\">\r\n <div class=\"col-sm-12 col-md-12 mt-2\">\r\n <mat-form-field>\r\n <textarea matInput [placeholder]=\"'Azione (Javascript)'\" [rows]=\"3\" formControlName=\"Action\"\r\n required [(ngModel)]=\"selectedAction.Action\" [matAutocomplete]=\"actionAutocomplete\"\r\n (keyup)=\"setActionAutocompleteOptions($event)\"\r\n (focus)=\"setActionAutocompleteOptions(null)\"></textarea>\r\n <mat-autocomplete #actionAutocomplete=\"matAutocomplete\">\r\n <mat-option *ngFor=\"let option of actionAutocompleteOptions\" [value]=\"option.value\">\r\n {{option.label}}\r\n </mat-option>\r\n </mat-autocomplete>\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n\r\n\r\n <div class=\"row mt-2 mb-1\">\r\n <div class=\"col-sm-12 text-right\">\r\n <button class=\"mr-2\" mat-raised-button color=\"primary\" (click)=\"saveActionOnRecord()\"\r\n [disabled]=\"actionOnRecordFormGroup.invalid\" type=\"button\">\r\n Salva\r\n </button>\r\n <button class=\"btn mat-raised-button\" (click)=\"closeDialogActionOnRecord()\" type=\"button\">\r\n Esci\r\n </button>\r\n </div>\r\n </div>\r\n </form>\r\n </div>\r\n</ng-template>\r\n\r\n<!-- TEMPLATE PER CONFIGURARE LE FORM DI DETTAGLIO -->\r\n<ng-template #dialogInnerForm>\r\n <eqp-dynamic-module-configurator [form]=\"selectedInnerForm\" [innerFormManagment]=\"true\"\r\n (saveFormEvent)=\"onSaveOrExitInnerForm($event)\"></eqp-dynamic-module-configurator>\r\n</ng-template>",
1120
1661
  styles: ["::ng-deep mat-form-field{width:100%}.stepper-header-overlay{position:absolute;top:0;left:0;width:100%;height:100%}.section-list{list-style:none;padding:0}.section-list mat-icon{vertical-align:middle;font-size:15px;height:15px;width:15px;color:var(--danger);margin-right:10px;cursor:pointer}.danger-color{color:var(--danger)}"]
1121
1662
  })
1122
1663
  ], EqpDynamicModuleConfiguratorComponent);
@@ -1166,6 +1707,8 @@ var DateTimeTypeEnum;
1166
1707
  /**Lista di valori */
1167
1708
  class ListValueField extends BaseField {
1168
1709
  }
1710
+ class ButtonImage {
1711
+ }
1169
1712
  var ListPresentationEnum;
1170
1713
  (function (ListPresentationEnum) {
1171
1714
  ListPresentationEnum[ListPresentationEnum["Combo box"] = 1] = "Combo box";
@@ -1176,10 +1719,11 @@ var ListPresentationEnum;
1176
1719
 
1177
1720
  let AddFormFieldComponent = class AddFormFieldComponent {
1178
1721
  //#endregion
1179
- constructor(formBuilder, enumHelper, dialog) {
1722
+ constructor(formBuilder, enumHelper, dialog, cdr) {
1180
1723
  this.formBuilder = formBuilder;
1181
1724
  this.enumHelper = enumHelper;
1182
1725
  this.dialog = dialog;
1726
+ this.cdr = cdr;
1183
1727
  this.fieldTypesToExclude = [FieldTypeEnum['Form di dettaglio']];
1184
1728
  this.keyValueObject = { key: '', value: '' };
1185
1729
  this.availableColSpanSizes = [];
@@ -1192,6 +1736,8 @@ let AddFormFieldComponent = class AddFormFieldComponent {
1192
1736
  this.BoolPresentantioEnum = BoolPresentantioEnum;
1193
1737
  this.DateTimeTypeEnum = DateTimeTypeEnum;
1194
1738
  this.ListPresentationEnum = ListPresentationEnum;
1739
+ this.TextMaskEnum = TextMaskEnum;
1740
+ this.AttachmentType = AttachmentType;
1195
1741
  }
1196
1742
  ngOnInit() {
1197
1743
  if (!this.fieldTypesToExclude.includes(FieldTypeEnum['Form di dettaglio'])) {
@@ -1229,7 +1775,7 @@ let AddFormFieldComponent = class AddFormFieldComponent {
1229
1775
  Required: [this.field.Required],
1230
1776
  FieldType: [this.field.FieldType, Validators.required],
1231
1777
  Formula: [this.field.Formula],
1232
- ColSizes: [this.field.ColSizes],
1778
+ ColSpanSizes: [this.field.ColSpanSizes],
1233
1779
  InListView: [this.field.InListView],
1234
1780
  });
1235
1781
  if (this.formFieldsGroups) {
@@ -1247,7 +1793,7 @@ let AddFormFieldComponent = class AddFormFieldComponent {
1247
1793
  if (restoreField)
1248
1794
  this.restoreBaseFieldProperties();
1249
1795
  this.createFieldForm();
1250
- this.onColSizeSelect();
1796
+ this.onColSpanSizeSelect();
1251
1797
  this.fieldTypeFormTemplate = null;
1252
1798
  switch (this.field.FieldType) {
1253
1799
  case FieldTypeEnum['Campo di testo']:
@@ -1271,13 +1817,16 @@ let AddFormFieldComponent = class AddFormFieldComponent {
1271
1817
  this.fieldFormGroup.addControl('IsOnlyDate', new FormControl(this.field.IsOnlyDate, Validators.required));
1272
1818
  this.fieldFormGroup.addControl('MinDate', new FormControl(this.field.MinDate));
1273
1819
  this.fieldFormGroup.addControl('MaxDate', new FormControl(this.field.MaxDate));
1820
+ this.fieldFormGroup.addControl('DateFormat', new FormControl(this.field.DateFormat));
1274
1821
  this.fieldTypeFormTemplate = this.dateFieldFormTemplate;
1275
1822
  break;
1276
1823
  case FieldTypeEnum['Campo numerico']:
1277
1824
  this.fieldFormGroup.addControl('IsInteger', new FormControl(this.field.IsInteger));
1278
1825
  this.fieldFormGroup.addControl('MinValue', new FormControl(this.field.MinValue));
1279
1826
  this.fieldFormGroup.addControl('MaxValue', new FormControl(this.field.MaxValue));
1280
- this.fieldFormGroup.addControl('NumberFormat', new FormControl(this.field.NumberFormat));
1827
+ this.fieldFormGroup.addControl('DecimalSeparator', new FormControl(this.field.DecimalSeparator));
1828
+ this.fieldFormGroup.addControl('DecimalPrecision', new FormControl(this.field.DecimalPrecision));
1829
+ this.fieldFormGroup.addControl('ThousandsSeparator', new FormControl(this.field.ThousandsSeparator));
1281
1830
  this.fieldFormGroup.addControl('CurrencySymbol', new FormControl(this.field.CurrencySymbol));
1282
1831
  this.fieldTypeFormTemplate = this.numericFieldFormTemplate;
1283
1832
  break;
@@ -1288,11 +1837,10 @@ let AddFormFieldComponent = class AddFormFieldComponent {
1288
1837
  break;
1289
1838
  case FieldTypeEnum.Immagine:
1290
1839
  this.field.AttachDefinition = new AttachmentField();
1291
- this.fieldFormGroup.addControl('IsMultiAttach', new FormControl(this.field.AttachDefinition.IsMultiAttach));
1292
- // this.fieldFormGroup.addControl('ImgName', new FormControl((this.field as ImageField).ImgName, Validators.required));
1293
- this.fieldFormGroup.addControl('IsMultiPoint', new FormControl(this.field.IsMultiPoint));
1294
- this.fieldFormGroup.addControl("AllowedExtensions", new FormControl(this.field.AttachDefinition.AllowedExtensions));
1840
+ this.fieldFormGroup.addControl('EnableDrawing', new FormControl(this.field.EnableDrawing));
1295
1841
  this.fieldFormGroup.addControl('ImageIsContextualAttachment', new FormControl(this.field.ImageIsContextualAttachment));
1842
+ // Imposto i FormControl variabili.
1843
+ this.onImageIsContextualAttachmentChange();
1296
1844
  this.fieldTypeFormTemplate = this.imageFieldFormTemplate;
1297
1845
  break;
1298
1846
  case FieldTypeEnum['Elenco generico']:
@@ -1309,10 +1857,50 @@ let AddFormFieldComponent = class AddFormFieldComponent {
1309
1857
  if ([FieldTypeEnum.Allegato, FieldTypeEnum.Immagine, FieldTypeEnum['Form di dettaglio']].includes(this.field.FieldType)) {
1310
1858
  this.field.Formula = null;
1311
1859
  this.fieldFormGroup.controls["Formula"].disable();
1860
+ this.fieldFormGroup.controls["InListView"].disable();
1312
1861
  }
1313
1862
  else {
1314
1863
  this.fieldFormGroup.controls["Formula"].enable();
1864
+ this.fieldFormGroup.controls["InListView"].enable();
1865
+ }
1866
+ }
1867
+ /**
1868
+ * Metodo invocato al cambio del valore della proprietà ImageIsContextualAttachment nel caso
1869
+ * di campi di tipo Immagine. Se TRUE allora rimuove i FormControl per le proprietà IsMultiAttach
1870
+ * e AllowedExtensions e aggiunge i FormControl per le proprietà ImgName e ContextualAttachment,
1871
+ * altrimenti il contrario.
1872
+ */
1873
+ onImageIsContextualAttachmentChange() {
1874
+ this.field.ImgName = null;
1875
+ this.field.AttachDefinition.AllowedExtensions = [];
1876
+ this.field.AttachDefinition.IsMultiAttach = false;
1877
+ this.field.ContextualAttachment = null;
1878
+ if (this.field.ImageIsContextualAttachment) {
1879
+ this.fieldFormGroup.removeControl("IsMultiAttach");
1880
+ this.fieldFormGroup.removeControl("AllowedExtensions");
1881
+ this.fieldFormGroup.addControl('ImgName', new FormControl(this.field.ImgName, Validators.required));
1882
+ this.fieldFormGroup.addControl('ContextualAttachment', new FormControl(this.field.ContextualAttachment, Validators.required));
1883
+ }
1884
+ else {
1885
+ this.fieldFormGroup.removeControl("ImgName");
1886
+ this.fieldFormGroup.removeControl("ContextualAttachment");
1887
+ this.fieldFormGroup.addControl('IsMultiAttach', new FormControl(this.field.AttachDefinition.IsMultiAttach));
1888
+ this.fieldFormGroup.addControl("AllowedExtensions", new FormControl(this.field.AttachDefinition.AllowedExtensions));
1889
+ }
1890
+ }
1891
+ /**
1892
+ * Metodo per intercettare l'aggiunta di un allegato nei campi di tipo Immagine per aggiornare
1893
+ * il valore della proprietà ContextualAttachment e la validazione del relativo FormControl.
1894
+ * @param event Array contenente l'elenco aggiornato degli allegati caricati (nel nostro caso ne contiene al più 1).
1895
+ */
1896
+ catchContextualAttachmentChange(event) {
1897
+ if (event && event.length > 0) {
1898
+ this.field.ContextualAttachment = event[0];
1899
+ }
1900
+ else {
1901
+ this.field.ContextualAttachment = null;
1315
1902
  }
1903
+ this.fieldFormGroup.controls['ContextualAttachment'].setValue(this.field.ContextualAttachment);
1316
1904
  }
1317
1905
  /**
1318
1906
  * Metodo invocato alla selezione di una classe nella select per le colonne di bootstrap
@@ -1322,15 +1910,48 @@ let AddFormFieldComponent = class AddFormFieldComponent {
1322
1910
  * seleziona la classe "col-sm-6", al change del valore questo metodo rimuove dalla select
1323
1911
  * tutti gli altri valori per la grandezza di schermo selezionata.
1324
1912
  */
1325
- onColSizeSelect() {
1913
+ onColSpanSizeSelect() {
1326
1914
  // Recupero l'array degli oggetti chiave-valore che rappreseta l'enumeratore
1327
1915
  let colSizeClassEnumArray = this.enumHelper.getEnumArray(ColSpanSizesEnum, false, null);
1328
1916
  // Costruisco l'array delle classi selezionate dall'utente in formato stringa
1329
- let selectedDimensions = this.field.ColSizes ? this.field.ColSizes.map(col => ColSpanSizesEnum[col]) : [];
1917
+ let selectedDimensions = this.field.ColSpanSizes ? this.field.ColSpanSizes.map(col => ColSpanSizesEnum[col]) : [];
1330
1918
  // Filtro i valori ottenuti dall'enumeratore per escludere tutti i valori per le
1331
1919
  // grandezze di schermo già selezionatead esclusione dei valori selezionati.
1332
1920
  this.availableColSpanSizes = colSizeClassEnumArray.filter((value) => !selectedDimensions.find(col => value.value.includes(col.substring(4, 6)) && value.value != col));
1333
1921
  }
1922
+ /**
1923
+ * Metodo invocato al cambio del tipo di visualizzazione scelta per i campi di tipo elenco generico.
1924
+ * Se viene scelta la visualizzazione ad immagini svuota la lista delle coppie chiave-valore inserite
1925
+ * in precedenza, altrimenti svuota la lista delle immagini caricate.
1926
+ */
1927
+ onPresentationModeChange() {
1928
+ if (this.field.PresentationMode === ListPresentationEnum.Immagini) {
1929
+ this.field.ValuePairs = null;
1930
+ }
1931
+ else {
1932
+ this.field.ButtonImageList = null;
1933
+ }
1934
+ }
1935
+ /**
1936
+ * Metodo invocato quando viene caricato il componente eqp-attachments per caricare le immagini da usare
1937
+ * nella visualizzazione ad immagini dei campi di tipo "Elenco generico". Aggiunge due colonne a quelle
1938
+ * configurate nel componente in cui l'utente può indicare chiave e valore della scelta.
1939
+ * @param component Istanza del componente eqp-attachments in cui effettuare la modifica.
1940
+ */
1941
+ configureButtonImagesColumns(component) {
1942
+ component.attachmentsColumns.splice(component.attachmentsColumns.length - 1, 0, { key: "ButtonKey", display: "Label", type: TypeColumn.ExternalTemplate, externalTemplate: this.buttonImagesKeyValueInputColumn });
1943
+ component.attachmentsColumns.splice(component.attachmentsColumns.length - 1, 0, { key: "ButtonValue", display: "Valore", type: TypeColumn.ExternalTemplate, externalTemplate: this.buttonImagesKeyValueInputColumn });
1944
+ this.cdr.detectChanges();
1945
+ }
1946
+ /**
1947
+ * Metodo invocato al salvataggio degli allegati quando viene configurato un campo di tipo "Elenco generico"
1948
+ * con il tipo di visualizzazione ad immagini. Intercetta l'elenco aggiornato delle immagini caricate e lo
1949
+ * memorizza nell'oggetto field corrente.
1950
+ * @param attachments Array aggiornato degli allegati caricati.
1951
+ */
1952
+ catchButtonImagesChange(attachments) {
1953
+ this.field.ButtonImageList = attachments;
1954
+ }
1334
1955
  /**
1335
1956
  * Metodo chiamato al keyup degli input testuali che prevedono l'aggiunta del valore inserito in un array.
1336
1957
  * Se l'utente preme il tasto invio, in base al tipo di campo che sta inserendo/modificando, questo metodo
@@ -1475,7 +2096,14 @@ let AddFormFieldComponent = class AddFormFieldComponent {
1475
2096
  }
1476
2097
  switch (this.field.FieldType) {
1477
2098
  case FieldTypeEnum['Elenco generico']:
1478
- return !this.field.ValuePairs || this.field.ValuePairs.length === 0;
2099
+ if (this.field.PresentationMode != ListPresentationEnum.Immagini) {
2100
+ return !this.field.ValuePairs || this.field.ValuePairs.length === 0;
2101
+ }
2102
+ else {
2103
+ return (!this.field.ButtonImageList
2104
+ || this.field.ButtonImageList.length === 0
2105
+ || !!this.field.ButtonImageList.find(i => !i.ButtonKey || !i.ButtonValue));
2106
+ }
1479
2107
  case FieldTypeEnum.Lookup:
1480
2108
  return !this.field.FieldNames || this.field.FieldNames.length === 0;
1481
2109
  default:
@@ -1509,7 +2137,7 @@ let AddFormFieldComponent = class AddFormFieldComponent {
1509
2137
  this.field.Required = tmpBaseField.Required;
1510
2138
  this.field.FieldType = tmpBaseField.FieldType;
1511
2139
  this.field.Formula = tmpBaseField.Formula;
1512
- this.field.ColSizes = tmpBaseField.ColSizes;
2140
+ this.field.ColSpanSizes = tmpBaseField.ColSpanSizes;
1513
2141
  this.field.FieldGroup = tmpBaseField.FieldGroup;
1514
2142
  }
1515
2143
  }
@@ -1585,7 +2213,8 @@ let AddFormFieldComponent = class AddFormFieldComponent {
1585
2213
  AddFormFieldComponent.ctorParameters = () => [
1586
2214
  { type: FormBuilder },
1587
2215
  { type: EnumHelper },
1588
- { type: MatDialog }
2216
+ { type: MatDialog },
2217
+ { type: ChangeDetectorRef }
1589
2218
  ];
1590
2219
  __decorate([
1591
2220
  Input()
@@ -1638,10 +2267,13 @@ __decorate([
1638
2267
  __decorate([
1639
2268
  ViewChild('dialogMetadata', { static: true })
1640
2269
  ], AddFormFieldComponent.prototype, "dialogMetadata", void 0);
2270
+ __decorate([
2271
+ ViewChild('buttonImagesKeyValueInputColumn', { static: true })
2272
+ ], AddFormFieldComponent.prototype, "buttonImagesKeyValueInputColumn", void 0);
1641
2273
  AddFormFieldComponent = __decorate([
1642
2274
  Component({
1643
2275
  selector: 'eqp-dynamic-module-add-form-field',
1644
- template: "<div class=\"container-fluid\" style=\"max-height: 70vh !important; overflow-x: hidden; overflow-y: auto;\">\n <form [formGroup]=\"fieldFormGroup\">\n <div class=\"row\">\n <div class=\"header-title-standard\">{{indexField != null && indexField >= 0 ? \"Modifica\"\n : \"Aggiungi\"}} campo</div>\n </div>\n <div class=\"row\">\n <div class=\"col-sm-12 col-md-4 mt-2\">\n <eqp-select [enumData]=\"FieldTypeEnum\" [(ngModelInput)]=\"field.FieldType\" [isRequired]=\"true\"\n [showCancelButton]=\"false\" placeholder=\"Tipo campo\" (ngModelInputChange)=\"onFieldTypeChange()\"\n [formGroupInput]=\"fieldFormGroup\" [formControlNameInput]=\"'FieldType'\"\n [enumDataToExclude]=\"fieldTypesToExclude\">\n </eqp-select>\n </div>\n\n <div class=\"col-sm-12 col-md-4 mt-2\">\n <mat-form-field>\n <mat-label> Label </mat-label>\n <input formControlName=\"Label\" required matInput [(ngModel)]=\"field.Label\">\n </mat-form-field>\n </div>\n\n <div class=\"col-sm-12 col-md-4 mt-2\">\n <mat-form-field>\n <mat-label> Descrizione </mat-label>\n <input formControlName=\"Description\" required matInput [(ngModel)]=\"field.Description\">\n </mat-form-field>\n </div>\n\n <div class=\"col-sm-12 col-md-4 mt-2 d-flex align-items-center\">\n <mat-slide-toggle [(ngModel)]=\"field.Required\" formControlName=\"Required\" color=\"primary\">\n Obbligatorio\n </mat-slide-toggle>\n </div>\n\n <div class=\"col-sm-12 col-md-4 mt-2\">\n <mat-form-field>\n <mat-label> Formula (Javascript) </mat-label>\n <input formControlName=\"Formula\" matInput [(ngModel)]=\"field.Formula\"\n [matAutocomplete]=\"formulaAutocomplete\" (keyup)=\"setFormulaAutocompleteOptions($event)\"\n (focus)=\"setFormulaAutocompleteOptions(null)\">\n <mat-autocomplete #formulaAutocomplete=\"matAutocomplete\">\n <mat-option *ngFor=\"let option of formulaAutocompleteOptions\" [value]=\"option.value\">\n {{option.label}}\n </mat-option>\n </mat-autocomplete>\n </mat-form-field>\n </div>\n\n <div class=\"col-sm-12 col-md-4 mt-2\" *ngIf=\"formFieldsGroups\">\n <eqp-select [arrayData]=\"formFieldsGroups\" [(ngModelInput)]=\"field.FieldGroup\"\n [arrayKeyProperty]=\"'Name'\" [arrayValueProperty]=\"'Name'\" placeholder=\"Sezione\"\n [formGroupInput]=\"fieldFormGroup\" [formControlNameInput]=\"'FieldGroup'\" [isRequired]=\"true\"\n [includeFullObject]=\"false\">\n </eqp-select>\n </div>\n\n <div class=\"col-sm-12 col-md-4 mt-2\">\n <eqp-select [arrayData]=\"availableColSpanSizes\" [(ngModelInput)]=\"field.ColSizes\"\n [arrayKeyProperty]=\"'key'\" [arrayValueProperty]=\"'value'\" (ngModelInputChange)=\"onColSizeSelect()\"\n [isMultiSelect]=\"true\" placeholder=\"Larghezza campo\" [formGroupInput]=\"fieldFormGroup\"\n [formControlNameInput]=\"'ColSizes'\" [includeFullObject]=\"false\">\n </eqp-select>\n </div>\n\n <div class=\"col-sm-12 col-md-4 mt-2 d-flex align-items-center\">\n <mat-slide-toggle [(ngModel)]=\"field.InListView\" formControlName=\"InListView\" color=\"primary\">\n Mostrare nella visualizzazione a lista\n </mat-slide-toggle>\n </div>\n\n <ng-container *ngTemplateOutlet=\"fieldTypeFormTemplate\">\n </ng-container>\n </div>\n\n\n <div class=\"row mt-2 mb-1\">\n <div class=\"col-sm-12 text-right\">\n <button class=\"mr-2\" mat-raised-button color=\"primary\" (click)=\"saveAndExitAddField(true)\"\n [disabled]=\"disableSaveField()\" type=\"button\">\n Salva\n </button>\n <button class=\"btn mat-raised-button\" (click)=\"saveAndExitAddField(false)\" type=\"button\">\n Esci\n </button>\n </div>\n </div>\n </form>\n</div>\n\n\n<!-- FORM PROPRIET\u00C0 CAMPI DI TESTO -->\n<ng-template #textFieldFormTemplate>\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\n <mat-form-field>\n <mat-label> Maschera </mat-label>\n <input formControlName=\"TextMask\" matInput [(ngModel)]=\"field.TextMask\">\n </mat-form-field>\n </div>\n <div class=\"col-sm-12 col-md-4\" [formGroup]=\"fieldFormGroup\">\n <mat-form-field>\n <mat-label> Lunghezza massima </mat-label>\n <input formControlName=\"MaxLenght\" type=\"number\" [min]=\"0\" matInput [(ngModel)]=\"field.MaxLenght\">\n </mat-form-field>\n </div>\n <div class=\"col-sm-12 col-md-4\" [formGroup]=\"fieldFormGroup\">\n <mat-form-field>\n <mat-label> Lunghezza minima </mat-label>\n <input formControlName=\"MinLenght\" type=\"number\" [min]=\"0\" matInput [(ngModel)]=\"field.MinLenght\">\n </mat-form-field>\n </div>\n</ng-template>\n\n<!-- FORM PROPRIET\u00C0 CAMPI AREA DI TESTO -->\n<ng-template #textareaFieldFormTemplate>\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\n <mat-form-field>\n <mat-label> Righe </mat-label>\n <input formControlName=\"Rows\" type=\"number\" [min]=\"0\" matInput [(ngModel)]=\"field.Rows\">\n </mat-form-field>\n </div>\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\n <mat-form-field>\n <mat-label> Lunghezza massima </mat-label>\n <input formControlName=\"MaxLenght\" type=\"number\" [min]=\"0\" matInput [(ngModel)]=\"field.MaxLenght\">\n </mat-form-field>\n </div>\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\n <mat-form-field>\n <mat-label> Lunghezza minima </mat-label>\n <input formControlName=\"MinLenght\" type=\"number\" [min]=\"0\" matInput [(ngModel)]=\"field.MinLenght\">\n </mat-form-field>\n </div>\n</ng-template>\n\n<!-- FORM PROPRIET\u00C0 CAMPI BOOLEANI -->\n<ng-template #booleadFieldFormTemplate>\n <div class=\"col-sm-12 col-md-4 mt-2 d-flex align-items-center\" [formGroup]=\"fieldFormGroup\">\n <mat-slide-toggle [(ngModel)]=\"field.IsTristate\" formControlName=\"IsTristate\" color=\"primary\">\n A tre stati\n </mat-slide-toggle>\n </div>\n <div class=\"col-sm-12 col-md-4 mt-2\">\n <eqp-select [enumData]=\"BoolPresentantioEnum\" [(ngModelInput)]=\"field.PresetationType\" [isRequired]=\"true\"\n [showCancelButton]=\"false\" placeholder=\"Tipo di presentazione\" [formGroupInput]=\"fieldFormGroup\"\n [formControlNameInput]=\"'PresetationType'\">\n </eqp-select>\n </div>\n</ng-template>\n\n<!-- FORM PROPRIET\u00C0 CAMPI DATA -->\n<ng-template #dateFieldFormTemplate>\n <div class=\"col-sm-12 col-md-4 mt-2\">\n <eqp-datetimepicker [placeholder]=\"'Data minima'\" [(ngModelInput)]=\"field.MinDate\"\n [formGroupInput]=\"fieldFormGroup\" [formControlNameInput]=\"'MinDate'\" [UTCDate]=\"true\" [showSeconds]=\"false\">\n </eqp-datetimepicker>\n </div>\n <div class=\"col-sm-12 col-md-4 mt-2\">\n <eqp-datetimepicker [placeholder]=\"'Data massima'\" [(ngModelInput)]=\"field.MaxDate\"\n [formGroupInput]=\"fieldFormGroup\" [formControlNameInput]=\"'MaxDate'\" [UTCDate]=\"true\" [showSeconds]=\"false\">\n </eqp-datetimepicker>\n </div>\n <div class=\"col-sm-12 col-md-4 mt-2\">\n <eqp-select [enumData]=\"DateTimeTypeEnum\" [(ngModelInput)]=\"field.IsOnlyDate\" [isRequired]=\"true\"\n [showCancelButton]=\"false\" placeholder=\"Tipo di data\" [formGroupInput]=\"fieldFormGroup\"\n [formControlNameInput]=\"'IsOnlyDate'\">\n </eqp-select>\n </div>\n</ng-template>\n\n<!-- FORM PROPRIET\u00C0 CAMPI NUMERICI -->\n<ng-template #numericFieldFormTemplate>\n <div class=\"col-sm-12 col-md-4 mt-2 d-flex align-items-center\" [formGroup]=\"fieldFormGroup\">\n <mat-slide-toggle [(ngModel)]=\"field.IsInteger\" formControlName=\"IsInteger\" color=\"primary\">\n Valore intero\n </mat-slide-toggle>\n </div>\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\n <mat-form-field>\n <mat-label> Formato numerico </mat-label>\n <input formControlName=\"NumberFormat\" matInput [(ngModel)]=\"field.NumberFormat\">\n </mat-form-field>\n </div>\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\n <mat-form-field>\n <mat-label> Simbolo valuta </mat-label>\n <input formControlName=\"CurrencySymbol\" matInput [(ngModel)]=\"field.CurrencySymbol\">\n </mat-form-field>\n </div>\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\n <mat-form-field>\n <mat-label> Valore massimo </mat-label>\n <input formControlName=\"MinValue\" type=\"number\" [min]=\"0\" matInput [(ngModel)]=\"field.MinValue\">\n </mat-form-field>\n </div>\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\n <mat-form-field>\n <mat-label> Valore minimo </mat-label>\n <input formControlName=\"MaxValue\" type=\"number\" [min]=\"0\" matInput [(ngModel)]=\"field.MaxValue\">\n </mat-form-field>\n </div>\n</ng-template>\n\n<!-- FORM PROPRIET\u00C0 CAMPI ALLEGATO -->\n<ng-template #attachmentFieldFormTemplate>\n <div class=\"col-sm-12 col-md-4 mt-2 d-flex align-items-center\" [formGroup]=\"fieldFormGroup\">\n <mat-slide-toggle [(ngModel)]=\"field.IsMultiAttach\" formControlName=\"IsMultiAttach\" color=\"primary\">\n Allegati multipli\n </mat-slide-toggle>\n </div>\n <div class=\"col-sm-12 col-md-4 mt-2\">\n <eqp-select [arrayData]=\"AvailableFileExtensions.concat(AvailableImageExtensions)\"\n [(ngModelInput)]=\"field.AllowedExtensions\" [arrayKeyProperty]=\"'key'\" [arrayValueProperty]=\"'value'\"\n [isMultiSelect]=\"true\" placeholder=\"Estensioni accettate\" [formGroupInput]=\"fieldFormGroup\"\n [formControlNameInput]=\"'AllowedExtensions'\" [includeFullObject]=\"false\">\n </eqp-select>\n </div>\n <div class=\"col-sm-12 mt-2\">\n <div class=\"row mt-2\">\n <div class=\"col-sm-12 col-md-6\">\n <div class=\"header-title-standard\">\n Elenco metadata\n </div>\n </div>\n <div class=\"col-sm-12 col-md-6 text-right\">\n <button class=\"btn btn-primary\" mat-raised-button color=\"primary\" type=\"button\"\n (click)=\"openMetadataDialog()\">\n <mat-icon>add</mat-icon>\n <span style=\"margin-left: 10px;\">Aggiungi</span>\n </button>\n </div>\n </div>\n <eqp-table #metadataFieldsTable [createMatCard]=\"false\" [columns]=\"metadataColumns\"\n [data]=\"field.MetadataFields\" [emptyTableMessage]=\"'Nessun metadata inserito'\" [searchText]=\"'Cerca'\">\n </eqp-table>\n </div>\n</ng-template>\n\n<!-- FORM PROPRIET\u00C0 CAMPI IMMAGINE -->\n<ng-template #imageFieldFormTemplate>\n <!-- <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\n <mat-form-field>\n <mat-label> Nome immagine </mat-label>\n <input formControlName=\"ImgName\" matInput [(ngModel)]=\"field.ImgName\">\n </mat-form-field>\n </div> -->\n <div class=\"col-sm-12 col-md-4 mt-2 d-flex align-items-center\" [formGroup]=\"fieldFormGroup\">\n <mat-slide-toggle [(ngModel)]=\"field.IsMultiPoint\" formControlName=\"IsMultiPoint\" color=\"primary\">\n Immagine multi-point\n </mat-slide-toggle>\n </div>\n <div class=\"col-sm-12 col-md-4 mt-2 d-flex align-items-center\" [formGroup]=\"fieldFormGroup\">\n <mat-slide-toggle [(ngModel)]=\"field.ImageIsContextualAttachment\" formControlName=\"ImageIsContextualAttachment\"\n color=\"primary\">\n Carica immagine come allegato\n </mat-slide-toggle>\n </div>\n <div class=\"col-sm-12 col-md-4 mt-2 d-flex align-items-center\" [formGroup]=\"fieldFormGroup\">\n <mat-slide-toggle [(ngModel)]=\"field.AttachDefinition.IsMultiAttach\" formControlName=\"IsMultiAttach\"\n color=\"primary\">\n Immagini multiple\n </mat-slide-toggle>\n </div>\n <div class=\"col-sm-12 col-md-4 mt-2\">\n <eqp-select [arrayData]=\"AvailableImageExtensions\" [(ngModelInput)]=\"field.AttachDefinition.AllowedExtensions\"\n [arrayKeyProperty]=\"'key'\" [arrayValueProperty]=\"'value'\" [isMultiSelect]=\"true\"\n placeholder=\"Estensioni accettate\" [formGroupInput]=\"fieldFormGroup\"\n [formControlNameInput]=\"'AllowedExtensions'\" [includeFullObject]=\"false\">\n </eqp-select>\n </div>\n <div class=\"col-sm-12 mt-2\">\n <div class=\"row mt-2\">\n <div class=\"col-sm-12 col-md-6\">\n <div class=\"header-title-standard\">\n Elenco metadata\n </div>\n </div>\n <div class=\"col-sm-12 col-md-6 text-right\">\n <button class=\"btn btn-primary\" mat-raised-button color=\"primary\" type=\"button\"\n (click)=\"openMetadataDialog()\">\n <mat-icon>add</mat-icon>\n <span style=\"margin-left: 10px;\">Aggiungi</span>\n </button>\n </div>\n </div>\n <eqp-table #metadataFieldsTable [createMatCard]=\"false\" [columns]=\"metadataColumns\"\n [data]=\"field.AttachDefinition.MetadataFields\" [emptyTableMessage]=\"'Nessun metadata inserito'\"\n [searchText]=\"'Cerca'\">\n </eqp-table>\n </div>\n</ng-template>\n\n<!-- FORM PROPRIET\u00C0 CAMPI LISTA DI VALORI -->\n<ng-template #listValueFieldFormTemplate>\n <div class=\"col-sm-12 col-md-4 mt-2 d-flex align-items-center\" [formGroup]=\"fieldFormGroup\">\n <mat-slide-toggle [(ngModel)]=\"field.IsMultiChoiche\" formControlName=\"IsMultiChoiche\" color=\"primary\">\n Scelta multipla\n </mat-slide-toggle>\n </div>\n <div class=\"col-sm-12 col-md-4 mt-2\">\n <eqp-select [enumData]=\"ListPresentationEnum\" [(ngModelInput)]=\"field.PresentationMode\" [isRequired]=\"true\"\n [showCancelButton]=\"false\" placeholder=\"Tipo di presentazione\" [formGroupInput]=\"fieldFormGroup\"\n [formControlNameInput]=\"'PresentationMode'\">\n </eqp-select>\n </div>\n <div class=\"col-sm-12 mt-2\">\n <div class=\"row\">\n <h4 class=\"key-value-list-section-title\"> </h4>\n <div class=\"col-md-4 d-flex align-items-center\">\n <mat-form-field>\n <mat-label> Label opzione (invio per confermare)</mat-label>\n <input matInput [(ngModel)]=\"keyValueObject.key\" (keyup)=\"onMultiSelectInputKeyup($event, null)\">\n </mat-form-field>\n </div>\n <div class=\"col-md-4 d-flex align-items-center\">\n <mat-form-field>\n <mat-label> Valore opzione (invio per confermare)</mat-label>\n <input matInput [(ngModel)]=\"keyValueObject.value\" (keyup)=\"onMultiSelectInputKeyup($event, null)\">\n </mat-form-field>\n </div>\n <div class=\"col-md-4 d-flex align-items-center\">\n <span class=\"mr-3\">Opzioni inserite:</span>\n <ul class=\"value-pairs-list\">\n <li *ngFor=\"let keyValuePair of getDictionaryKeyValue()\">\n <mat-icon class=\"mr-1\" (click)=\"deleteKeyFromDictionary(keyValuePair.key)\">close\n </mat-icon>\n <span><b>Label: </b> {{keyValuePair.key}} - <b>Valore: </b> {{keyValuePair.value}}</span>\n </li>\n </ul>\n </div>\n </div>\n </div>\n</ng-template>\n\n<!-- FORM PROPRIET\u00C0 CAMPI LOOKUP -->\n<ng-template #lookupFieldFormTemplate>\n <div class=\"col-sm-12 col-md-4 mt-2 d-flex align-items-center\" [formGroup]=\"fieldFormGroup\">\n <mat-slide-toggle [(ngModel)]=\"field.UseAsGetOrDiscard\" formControlName=\"UseAsGetOrDiscard\" color=\"primary\"\n matTooltip=\"Se true la lookup viene visualizzata in una modale per lo scegli scarta\">\n Usa per scegli o scarta\n </mat-slide-toggle>\n </div>\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\n <mat-form-field matTooltip=\"Nome dell'entit\u00E0 relazionata\">\n <mat-label> Nome entit\u00E0 </mat-label>\n <input formControlName=\"EntitySourceName\" required matInput [(ngModel)]=\"field.EntitySourceName\">\n </mat-form-field>\n </div>\n <div class=\"col-sm-12 mt-2\">\n <div class=\"row\">\n <div class=\"col-md-4\">\n <mat-form-field\n matTooltip=\"Elenco di campi ordinato che verr\u00E0 visualizzato nella lookup (premere invio per confermare)\">\n <mat-label>\n Nomi dei campi (invio per confermare) </mat-label>\n <input matInput (keyup)=\"onMultiSelectInputKeyup($event, 'FieldNames')\">\n </mat-form-field>\n </div>\n <div class=\"col-md-8 d-flex align-items-center\">\n <span class=\"mr-3\">Nomi selezionati:</span>\n <div class=\"extension-container\" *ngFor=\"let extension of field.FieldNames; let i = index\">\n <span>{{extension}}</span>\n <mat-icon class=\"ml-1\" (click)=\"field.FieldNames.splice(i,1)\">close\n </mat-icon>\n </div>\n </div>\n </div>\n </div>\n</ng-template>\n\n<!-- DIALOG PER AGGIUNGERE UN METADATA NEI CAMPI DI TIPO ALLEGATO O IMMAGINE -->\n<ng-template #dialogMetadata>\n <eqp-dynamic-module-add-form-field [field]=\"selectedMetadata\" [availableFields]=\"availableFields\"\n [indexField]=\"indexSelectedMetadata\" (saveFieldEvent)=\"onSaveMetadata($event)\" [fieldTypesToExclude]=\"[6,7,10]\">\n </eqp-dynamic-module-add-form-field>\n</ng-template>",
2276
+ template: "<div class=\"container-fluid\" style=\"max-height: 70vh !important; overflow-x: hidden; overflow-y: auto;\">\r\n <form [formGroup]=\"fieldFormGroup\">\r\n <div class=\"row\">\r\n <div class=\"header-title-standard\">{{indexField != null && indexField >= 0 ? \"Modifica\"\r\n : \"Aggiungi\"}} campo</div>\r\n </div>\r\n <div class=\"row\">\r\n <div class=\"col-sm-12 col-md-4 mt-2\">\r\n <eqp-select [enumData]=\"FieldTypeEnum\" [(ngModelInput)]=\"field.FieldType\" [isRequired]=\"true\"\r\n [showCancelButton]=\"false\" placeholder=\"Tipo campo\" (ngModelInputChange)=\"onFieldTypeChange()\"\r\n [formGroupInput]=\"fieldFormGroup\" [formControlNameInput]=\"'FieldType'\"\r\n [enumDataToExclude]=\"fieldTypesToExclude\">\r\n </eqp-select>\r\n </div>\r\n\r\n <div class=\"col-sm-12 col-md-4 mt-2\">\r\n <mat-form-field>\r\n <mat-label> Label </mat-label>\r\n <input formControlName=\"Label\" required matInput [(ngModel)]=\"field.Label\">\r\n </mat-form-field>\r\n </div>\r\n\r\n <div class=\"col-sm-12 col-md-4 mt-2\">\r\n <mat-form-field>\r\n <mat-label> Descrizione </mat-label>\r\n <input formControlName=\"Description\" required matInput [(ngModel)]=\"field.Description\">\r\n </mat-form-field>\r\n </div>\r\n\r\n <div class=\"col-sm-12 col-md-4 mt-2 d-flex align-items-center\">\r\n <mat-slide-toggle [(ngModel)]=\"field.Required\" formControlName=\"Required\" color=\"primary\">\r\n Obbligatorio\r\n </mat-slide-toggle>\r\n </div>\r\n\r\n <div class=\"col-sm-12 col-md-4 mt-2\">\r\n <mat-form-field>\r\n <mat-label> Formula (Javascript) </mat-label>\r\n <input formControlName=\"Formula\" matInput [(ngModel)]=\"field.Formula\"\r\n [matAutocomplete]=\"formulaAutocomplete\" (keyup)=\"setFormulaAutocompleteOptions($event)\"\r\n (focus)=\"setFormulaAutocompleteOptions(null)\">\r\n <mat-autocomplete #formulaAutocomplete=\"matAutocomplete\">\r\n <mat-option *ngFor=\"let option of formulaAutocompleteOptions\" [value]=\"option.value\">\r\n {{option.label}}\r\n </mat-option>\r\n </mat-autocomplete>\r\n </mat-form-field>\r\n </div>\r\n\r\n <div class=\"col-sm-12 col-md-4 mt-2\" *ngIf=\"formFieldsGroups\">\r\n <eqp-select [arrayData]=\"formFieldsGroups\" [(ngModelInput)]=\"field.FieldGroup\"\r\n [arrayKeyProperty]=\"'Name'\" [arrayValueProperty]=\"'Name'\" placeholder=\"Sezione\"\r\n [formGroupInput]=\"fieldFormGroup\" [formControlNameInput]=\"'FieldGroup'\" [isRequired]=\"true\"\r\n [includeFullObject]=\"false\">\r\n </eqp-select>\r\n </div>\r\n\r\n <div class=\"col-sm-12 col-md-4 mt-2\">\r\n <eqp-select [arrayData]=\"availableColSpanSizes\" [(ngModelInput)]=\"field.ColSpanSizes\"\r\n [arrayKeyProperty]=\"'key'\" [arrayValueProperty]=\"'value'\" (ngModelInputChange)=\"onColSpanSizeSelect()\"\r\n [isMultiSelect]=\"true\" placeholder=\"Larghezza campo\" [formGroupInput]=\"fieldFormGroup\"\r\n [formControlNameInput]=\"'ColSpanSizes'\" [includeFullObject]=\"false\">\r\n </eqp-select>\r\n </div>\r\n\r\n <div class=\"col-sm-12 col-md-4 mt-2 d-flex align-items-center\">\r\n <mat-slide-toggle [(ngModel)]=\"field.InListView\" formControlName=\"InListView\" color=\"primary\"\r\n [disabled]=\"fieldFormGroup.controls['InListView'].disabled\">\r\n Mostrare nella visualizzazione a lista\r\n </mat-slide-toggle>\r\n </div>\r\n\r\n <ng-container *ngTemplateOutlet=\"fieldTypeFormTemplate\">\r\n </ng-container>\r\n </div>\r\n\r\n\r\n <div class=\"row mt-2 mb-1\">\r\n <div class=\"col-sm-12 text-right\">\r\n <button class=\"mr-2\" mat-raised-button color=\"primary\" (click)=\"saveAndExitAddField(true)\"\r\n [disabled]=\"disableSaveField()\" type=\"button\">\r\n Salva\r\n </button>\r\n <button class=\"btn mat-raised-button\" (click)=\"saveAndExitAddField(false)\" type=\"button\">\r\n Esci\r\n </button>\r\n </div>\r\n </div>\r\n </form>\r\n</div>\r\n\r\n\r\n<!-- FORM PROPRIET\u00C0 CAMPI DI TESTO -->\r\n<ng-template #textFieldFormTemplate>\r\n <div class=\"col-sm-12 col-md-4\">\r\n <eqp-select [enumData]=\"TextMaskEnum\" [(ngModelInput)]=\"field.TextMask\" placeholder=\"Maschera\"\r\n [formGroupInput]=\"fieldFormGroup\" [formControlNameInput]=\"'TextMask'\">\r\n </eqp-select>\r\n </div>\r\n <div class=\"col-sm-12 col-md-4\" [formGroup]=\"fieldFormGroup\">\r\n <mat-form-field>\r\n <mat-label> Lunghezza massima </mat-label>\r\n <input formControlName=\"MaxLenght\" type=\"number\" [min]=\"0\" matInput [(ngModel)]=\"field.MaxLenght\">\r\n </mat-form-field>\r\n </div>\r\n <div class=\"col-sm-12 col-md-4\" [formGroup]=\"fieldFormGroup\">\r\n <mat-form-field>\r\n <mat-label> Lunghezza minima </mat-label>\r\n <input formControlName=\"MinLenght\" type=\"number\" [min]=\"0\" matInput [(ngModel)]=\"field.MinLenght\">\r\n </mat-form-field>\r\n </div>\r\n</ng-template>\r\n\r\n<!-- FORM PROPRIET\u00C0 CAMPI AREA DI TESTO -->\r\n<ng-template #textareaFieldFormTemplate>\r\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\r\n <mat-form-field>\r\n <mat-label> Righe </mat-label>\r\n <input formControlName=\"Rows\" type=\"number\" [min]=\"0\" matInput [(ngModel)]=\"field.Rows\">\r\n </mat-form-field>\r\n </div>\r\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\r\n <mat-form-field>\r\n <mat-label> Lunghezza massima </mat-label>\r\n <input formControlName=\"MaxLenght\" type=\"number\" [min]=\"0\" matInput [(ngModel)]=\"field.MaxLenght\">\r\n </mat-form-field>\r\n </div>\r\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\r\n <mat-form-field>\r\n <mat-label> Lunghezza minima </mat-label>\r\n <input formControlName=\"MinLenght\" type=\"number\" [min]=\"0\" matInput [(ngModel)]=\"field.MinLenght\">\r\n </mat-form-field>\r\n </div>\r\n</ng-template>\r\n\r\n<!-- FORM PROPRIET\u00C0 CAMPI BOOLEANI -->\r\n<ng-template #booleadFieldFormTemplate>\r\n <div class=\"col-sm-12 col-md-4 mt-2 d-flex align-items-center\" [formGroup]=\"fieldFormGroup\">\r\n <mat-slide-toggle [(ngModel)]=\"field.IsTristate\" formControlName=\"IsTristate\" color=\"primary\">\r\n A tre stati\r\n </mat-slide-toggle>\r\n </div>\r\n <div class=\"col-sm-12 col-md-4 mt-2\">\r\n <eqp-select [enumData]=\"BoolPresentantioEnum\" [(ngModelInput)]=\"field.PresetationType\" [isRequired]=\"true\"\r\n [showCancelButton]=\"false\" placeholder=\"Tipo di presentazione\" [formGroupInput]=\"fieldFormGroup\"\r\n [formControlNameInput]=\"'PresetationType'\">\r\n </eqp-select>\r\n </div>\r\n</ng-template>\r\n\r\n<!-- FORM PROPRIET\u00C0 CAMPI DATA -->\r\n<ng-template #dateFieldFormTemplate>\r\n <div class=\"col-sm-12 col-md-4 mt-2\">\r\n <eqp-datetimepicker [placeholder]=\"'Data minima'\" [(ngModelInput)]=\"field.MinDate\"\r\n [formGroupInput]=\"fieldFormGroup\" [formControlNameInput]=\"'MinDate'\" [UTCDate]=\"true\" [showSeconds]=\"false\">\r\n </eqp-datetimepicker>\r\n </div>\r\n <div class=\"col-sm-12 col-md-4 mt-2\">\r\n <eqp-datetimepicker [placeholder]=\"'Data massima'\" [(ngModelInput)]=\"field.MaxDate\"\r\n [formGroupInput]=\"fieldFormGroup\" [formControlNameInput]=\"'MaxDate'\" [UTCDate]=\"true\" [showSeconds]=\"false\">\r\n </eqp-datetimepicker>\r\n </div>\r\n <div class=\"col-sm-12 col-md-4 mt-2\">\r\n <eqp-select [enumData]=\"DateTimeTypeEnum\" [(ngModelInput)]=\"field.IsOnlyDate\" [isRequired]=\"true\"\r\n [showCancelButton]=\"false\" placeholder=\"Tipo di data\" [formGroupInput]=\"fieldFormGroup\"\r\n [formControlNameInput]=\"'IsOnlyDate'\">\r\n </eqp-select>\r\n </div>\r\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\r\n <mat-form-field>\r\n <mat-label> Formato </mat-label>\r\n <input formControlName=\"DateFormat\" matInput [(ngModel)]=\"field.DateFormat\"\r\n [matTooltip]=\"'Indicare il formato senguendo la guida del pacchetto momentjs.'\">\r\n </mat-form-field>\r\n </div>\r\n</ng-template>\r\n\r\n<!-- FORM PROPRIET\u00C0 CAMPI NUMERICI -->\r\n<ng-template #numericFieldFormTemplate>\r\n <div class=\"col-sm-12 col-md-4 mt-2 d-flex align-items-center\" [formGroup]=\"fieldFormGroup\">\r\n <mat-slide-toggle [(ngModel)]=\"field.IsInteger\" formControlName=\"IsInteger\" color=\"primary\">\r\n Valore intero\r\n </mat-slide-toggle>\r\n </div>\r\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\r\n <mat-form-field>\r\n <mat-label> Separatore decimali </mat-label>\r\n <input formControlName=\"DecimalSeparator\" matInput [(ngModel)]=\"field.DecimalSeparator\">\r\n </mat-form-field>\r\n </div>\r\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\r\n <mat-form-field>\r\n <mat-label> Precisione decimali </mat-label>\r\n <input formControlName=\"DecimalPrecision\" type=\"number\" [min]=\"0\" matInput\r\n [(ngModel)]=\"field.DecimalPrecision\">\r\n </mat-form-field>\r\n </div>\r\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\r\n <mat-form-field>\r\n <mat-label> Separatore migliaia </mat-label>\r\n <input formControlName=\"ThousandsSeparator\" matInput [(ngModel)]=\"field.ThousandsSeparator\">\r\n </mat-form-field>\r\n </div>\r\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\r\n <mat-form-field>\r\n <mat-label> Simbolo valuta </mat-label>\r\n <input formControlName=\"CurrencySymbol\" matInput [(ngModel)]=\"field.CurrencySymbol\">\r\n </mat-form-field>\r\n </div>\r\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\r\n <mat-form-field>\r\n <mat-label> Valore massimo </mat-label>\r\n <input formControlName=\"MinValue\" type=\"number\" [min]=\"0\" matInput [(ngModel)]=\"field.MinValue\">\r\n </mat-form-field>\r\n </div>\r\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\r\n <mat-form-field>\r\n <mat-label> Valore minimo </mat-label>\r\n <input formControlName=\"MaxValue\" type=\"number\" [min]=\"0\" matInput [(ngModel)]=\"field.MaxValue\">\r\n </mat-form-field>\r\n </div>\r\n</ng-template>\r\n\r\n<!-- FORM PROPRIET\u00C0 CAMPI ALLEGATO -->\r\n<ng-template #attachmentFieldFormTemplate>\r\n <div class=\"col-sm-12 col-md-4 mt-2 d-flex align-items-center\" [formGroup]=\"fieldFormGroup\">\r\n <mat-slide-toggle [(ngModel)]=\"field.IsMultiAttach\" formControlName=\"IsMultiAttach\" color=\"primary\">\r\n Allegati multipli\r\n </mat-slide-toggle>\r\n </div>\r\n <div class=\"col-sm-12 col-md-4 mt-2\">\r\n <eqp-select [arrayData]=\"AvailableFileExtensions.concat(AvailableImageExtensions)\"\r\n [(ngModelInput)]=\"field.AllowedExtensions\" [arrayKeyProperty]=\"'key'\" [arrayValueProperty]=\"'value'\"\r\n [isMultiSelect]=\"true\" placeholder=\"Estensioni accettate\" [formGroupInput]=\"fieldFormGroup\"\r\n [formControlNameInput]=\"'AllowedExtensions'\" [includeFullObject]=\"false\">\r\n </eqp-select>\r\n </div>\r\n <div class=\"col-sm-12 mt-2\">\r\n <div class=\"row mt-2\">\r\n <div class=\"col-sm-12 col-md-6\">\r\n <div class=\"header-title-standard\">\r\n Elenco metadata\r\n </div>\r\n </div>\r\n <div class=\"col-sm-12 col-md-6 text-right\">\r\n <button class=\"btn btn-primary\" mat-raised-button color=\"primary\" type=\"button\"\r\n (click)=\"openMetadataDialog()\">\r\n <mat-icon>add</mat-icon>\r\n <span style=\"margin-left: 10px;\">Aggiungi</span>\r\n </button>\r\n </div>\r\n </div>\r\n <eqp-table #metadataFieldsTable [createMatCard]=\"false\" [columns]=\"metadataColumns\"\r\n [data]=\"field.MetadataFields\" [emptyTableMessage]=\"'Nessun metadata inserito'\" [searchText]=\"'Cerca'\">\r\n </eqp-table>\r\n </div>\r\n</ng-template>\r\n\r\n<!-- FORM PROPRIET\u00C0 CAMPI IMMAGINE -->\r\n<ng-template #imageFieldFormTemplate>\r\n <div class=\"col-sm-12 col-md-4 mt-2 mb-2 d-flex align-items-center\" [formGroup]=\"fieldFormGroup\">\r\n <mat-slide-toggle [(ngModel)]=\"field.ImageIsContextualAttachment\" formControlName=\"ImageIsContextualAttachment\"\r\n color=\"primary\" (ngModelChange)=\"onImageIsContextualAttachmentChange()\">\r\n Immagine pre-caricata nel campo\r\n </mat-slide-toggle>\r\n </div>\r\n <div class=\"col-sm-12 col-md-4 mt-2 mb-2 d-flex align-items-center\" [formGroup]=\"fieldFormGroup\">\r\n <mat-slide-toggle [(ngModel)]=\"field.EnableDrawing\" formControlName=\"EnableDrawing\" color=\"primary\">\r\n Abilita il disegno\r\n </mat-slide-toggle>\r\n </div>\r\n <div class=\"col-sm-12 col-md-4 mt-2 d-flex align-items-center\" [formGroup]=\"fieldFormGroup\"\r\n *ngIf=\"!field.ImageIsContextualAttachment\">\r\n <mat-slide-toggle [(ngModel)]=\"field.AttachDefinition.IsMultiAttach\" formControlName=\"IsMultiAttach\"\r\n color=\"primary\">\r\n Immagini multiple\r\n </mat-slide-toggle>\r\n </div>\r\n <div class=\"col-sm-12 col-md-4 mt-2\" *ngIf=\"!field.ImageIsContextualAttachment\">\r\n <eqp-select [arrayData]=\"AvailableImageExtensions\" [(ngModelInput)]=\"field.AttachDefinition.AllowedExtensions\"\r\n [arrayKeyProperty]=\"'key'\" [arrayValueProperty]=\"'value'\" [isMultiSelect]=\"true\"\r\n placeholder=\"Estensioni accettate\" [formGroupInput]=\"fieldFormGroup\"\r\n [formControlNameInput]=\"'AllowedExtensions'\" [includeFullObject]=\"false\">\r\n </eqp-select>\r\n </div>\r\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\" *ngIf=\"field.ImageIsContextualAttachment\">\r\n <mat-form-field>\r\n <mat-label> Nome immagine </mat-label>\r\n <input formControlName=\"ImgName\" matInput [(ngModel)]=\"field.ImgName\" required>\r\n </mat-form-field>\r\n </div>\r\n <div class=\"col-sm-12 col-md-8 mt-2\" [formGroup]=\"fieldFormGroup\" *ngIf=\"field.ImageIsContextualAttachment\">\r\n <eqp-attachments [attachmentsList]=\"field._contextualAttachments\" [showMatCard]=\"false\" [allowOnlyImages]=\"true\"\r\n [isDisabled]=\"false\" [showInlinePreview]=\"true\" [multipleAttachment]=\"false\" [showHeader]=\"false\"\r\n (localEditedAttachments)=\"catchContextualAttachmentChange($event)\" #contextualAttachmentEqpAttachments>\r\n </eqp-attachments>\r\n </div>\r\n <div class=\"col-sm-12 mt-2\">\r\n <div class=\"row mt-2\">\r\n <div class=\"col-sm-12 col-md-6\">\r\n <div class=\"header-title-standard\">\r\n Elenco metadata\r\n </div>\r\n </div>\r\n <div class=\"col-sm-12 col-md-6 text-right\">\r\n <button class=\"btn btn-primary\" mat-raised-button color=\"primary\" type=\"button\"\r\n (click)=\"openMetadataDialog()\">\r\n <mat-icon>add</mat-icon>\r\n <span style=\"margin-left: 10px;\">Aggiungi</span>\r\n </button>\r\n </div>\r\n </div>\r\n <eqp-table #metadataFieldsTable [createMatCard]=\"false\" [columns]=\"metadataColumns\"\r\n [data]=\"field.AttachDefinition.MetadataFields\" [emptyTableMessage]=\"'Nessun metadata inserito'\"\r\n [searchText]=\"'Cerca'\">\r\n </eqp-table>\r\n </div>\r\n</ng-template>\r\n\r\n<!-- FORM PROPRIET\u00C0 CAMPI LISTA DI VALORI -->\r\n<ng-template #listValueFieldFormTemplate>\r\n <div class=\"col-sm-12 col-md-4 mt-2 d-flex align-items-center\" [formGroup]=\"fieldFormGroup\">\r\n <mat-slide-toggle [(ngModel)]=\"field.IsMultiChoiche\" formControlName=\"IsMultiChoiche\" color=\"primary\">\r\n Scelta multipla\r\n </mat-slide-toggle>\r\n </div>\r\n <div class=\"col-sm-12 col-md-4 mt-2\">\r\n <eqp-select [enumData]=\"ListPresentationEnum\" [(ngModelInput)]=\"field.PresentationMode\" [isRequired]=\"true\"\r\n [showCancelButton]=\"false\" placeholder=\"Tipo di presentazione\" [formGroupInput]=\"fieldFormGroup\"\r\n [formControlNameInput]=\"'PresentationMode'\" (ngModelInputChange)=\"onPresentationModeChange()\">\r\n </eqp-select>\r\n </div>\r\n <div class=\"col-sm-12 mt-2\" *ngIf=\"field.PresentationMode != ListPresentationEnum.Immagini\">\r\n <div class=\"row\">\r\n <h4 class=\"key-value-list-section-title\"> </h4>\r\n <div class=\"col-md-4 d-flex align-items-center\">\r\n <mat-form-field>\r\n <mat-label> Label opzione (invio per confermare)</mat-label>\r\n <input matInput [(ngModel)]=\"keyValueObject.key\" (keyup)=\"onMultiSelectInputKeyup($event, null)\">\r\n </mat-form-field>\r\n </div>\r\n <div class=\"col-md-4 d-flex align-items-center\">\r\n <mat-form-field>\r\n <mat-label> Valore opzione (invio per confermare)</mat-label>\r\n <input matInput [(ngModel)]=\"keyValueObject.value\" (keyup)=\"onMultiSelectInputKeyup($event, null)\">\r\n </mat-form-field>\r\n </div>\r\n <div class=\"col-md-4 d-flex align-items-center\">\r\n <span class=\"mr-3\">Opzioni inserite:</span>\r\n <ul class=\"value-pairs-list\">\r\n <li *ngFor=\"let keyValuePair of getDictionaryKeyValue()\">\r\n <mat-icon class=\"mr-1\" (click)=\"deleteKeyFromDictionary(keyValuePair.key)\">close\r\n </mat-icon>\r\n <span><b>Label: </b> {{keyValuePair.key}} - <b>Valore: </b> {{keyValuePair.value}}</span>\r\n </li>\r\n </ul>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"col-sm-12 col-md-12 mt-2\" *ngIf=\"field.PresentationMode == ListPresentationEnum.Immagini\">\r\n <eqp-attachments [attachmentsList]=\"field.ButtonImageList\" [showMatCard]=\"false\" [allowOnlyImages]=\"true\"\r\n [isDisabled]=\"false\" [showInlinePreview]=\"true\" [multipleAttachment]=\"true\" [showHeader]=\"false\"\r\n [allowedTypes]=\"[AttachmentType.FILE]\" (localEditedAttachments)=\"catchButtonImagesChange($event)\"\r\n (onComponentLoaded)=\"configureButtonImagesColumns($event)\">\r\n </eqp-attachments>\r\n </div>\r\n</ng-template>\r\n\r\n<!-- FORM PROPRIET\u00C0 CAMPI LOOKUP -->\r\n<ng-template #lookupFieldFormTemplate>\r\n <div class=\"col-sm-12 col-md-4 mt-2 d-flex align-items-center\" [formGroup]=\"fieldFormGroup\">\r\n <mat-slide-toggle [(ngModel)]=\"field.UseAsGetOrDiscard\" formControlName=\"UseAsGetOrDiscard\" color=\"primary\"\r\n matTooltip=\"Se true la lookup viene visualizzata in una modale per lo scegli scarta\">\r\n Usa per scegli o scarta\r\n </mat-slide-toggle>\r\n </div>\r\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\r\n <mat-form-field matTooltip=\"Nome dell'entit\u00E0 relazionata\">\r\n <mat-label> Nome entit\u00E0 </mat-label>\r\n <input formControlName=\"EntitySourceName\" required matInput [(ngModel)]=\"field.EntitySourceName\">\r\n </mat-form-field>\r\n </div>\r\n <div class=\"col-sm-12 mt-2\">\r\n <div class=\"row\">\r\n <div class=\"col-md-4\">\r\n <mat-form-field\r\n matTooltip=\"Elenco di campi ordinato che verr\u00E0 visualizzato nella lookup (premere invio per confermare)\">\r\n <mat-label>\r\n Nomi dei campi (invio per confermare) </mat-label>\r\n <input matInput (keyup)=\"onMultiSelectInputKeyup($event, 'FieldNames')\">\r\n </mat-form-field>\r\n </div>\r\n <div class=\"col-md-8 d-flex align-items-center\">\r\n <span class=\"mr-3\">Nomi selezionati:</span>\r\n <div class=\"extension-container\" *ngFor=\"let extension of field.FieldNames; let i = index\">\r\n <span>{{extension}}</span>\r\n <mat-icon class=\"ml-1\" (click)=\"field.FieldNames.splice(i,1)\">close\r\n </mat-icon>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</ng-template>\r\n\r\n<!-- DIALOG PER AGGIUNGERE UN METADATA NEI CAMPI DI TIPO ALLEGATO O IMMAGINE -->\r\n<ng-template #dialogMetadata>\r\n <eqp-dynamic-module-add-form-field [field]=\"selectedMetadata\" [availableFields]=\"availableFields\"\r\n [indexField]=\"indexSelectedMetadata\" (saveFieldEvent)=\"onSaveMetadata($event)\" [fieldTypesToExclude]=\"[6,7,10]\">\r\n </eqp-dynamic-module-add-form-field>\r\n</ng-template>\r\n\r\n<ng-template #buttonImagesKeyValueInputColumn let-row=\"row\" let-col=\"col\">\r\n <mat-form-field>\r\n <mat-label> {{col.display}} </mat-label>\r\n <input matInput [(ngModel)]=\"row[col.key]\" required>\r\n </mat-form-field>\r\n</ng-template>",
1645
2277
  styles: [".extension-container{display:inline-block;font-size:15px;border:1px solid var(--primary);border-radius:15px;margin-right:10px}.extension-container mat-icon{vertical-align:middle;font-size:15px;height:15px;width:15px;color:var(--danger);margin-right:10px;cursor:pointer}.extension-container span{margin-left:10px}.key-value-list-section-title{background:linear-gradient(to right,var(--gray) 0,#fff 100%) left bottom #fff no-repeat;background-size:100% 1px}.value-pairs-list{list-style:none;padding:0}.value-pairs-list mat-icon{vertical-align:middle;font-size:15px;height:15px;width:15px;color:var(--danger);margin-right:10px;cursor:pointer}"]
1646
2278
  })
1647
2279
  ], AddFormFieldComponent);
@@ -1649,6 +2281,7 @@ AddFormFieldComponent = __decorate([
1649
2281
  let TextFieldTemplateComponent = class TextFieldTemplateComponent {
1650
2282
  constructor() {
1651
2283
  this.recordChange = new EventEmitter();
2284
+ this.InputMaskEnum = TextMaskEnum;
1652
2285
  }
1653
2286
  ngOnInit() {
1654
2287
  }
@@ -1659,6 +2292,20 @@ let TextFieldTemplateComponent = class TextFieldTemplateComponent {
1659
2292
  this.updateField();
1660
2293
  }
1661
2294
  }
2295
+ getInputType() {
2296
+ switch (this.field.TextMask) {
2297
+ case TextMaskEnum.Email:
2298
+ return 'email';
2299
+ case TextMaskEnum.Password:
2300
+ return 'password';
2301
+ case TextMaskEnum.Telefono:
2302
+ return 'tel';
2303
+ case TextMaskEnum.Url:
2304
+ return 'url';
2305
+ default:
2306
+ return 'text';
2307
+ }
2308
+ }
1662
2309
  /**
1663
2310
  * Metodo per aggiornare il valore del campo quando questo è rappresentato da una formula.
1664
2311
  */
@@ -1688,7 +2335,7 @@ __decorate([
1688
2335
  TextFieldTemplateComponent = __decorate([
1689
2336
  Component({
1690
2337
  selector: 'text-field-template',
1691
- template: "<mat-form-field [formGroup]=\"field.FormFormGroup\">\r\n <mat-label> {{field.Label}} </mat-label>\r\n <input matInput type=\"text\" [formControlName]=\"field.Name\" [disabled]=\"field.FormFormGroup.disabled\"\r\n [required]=\"field.Required\" [(ngModel)]=\"record[field.Name]\" (ngModelChange)=\"onRecordValueChange()\">\r\n</mat-form-field>",
2338
+ template: "<mat-form-field [formGroup]=\"field.FormFormGroup\">\r\n <mat-label> {{field.Label}} </mat-label>\r\n <input matInput [type]=\"getInputType()\" [formControlName]=\"field.Name\" [disabled]=\"field.FormFormGroup.disabled\"\r\n [required]=\"field.Required\" [(ngModel)]=\"record[field.Name]\" (ngModelChange)=\"onRecordValueChange()\">\r\n</mat-form-field>",
1692
2339
  styles: [""]
1693
2340
  })
1694
2341
  ], TextFieldTemplateComponent);
@@ -1739,7 +2386,7 @@ __decorate([
1739
2386
  BooleanFieldTemplateComponent = __decorate([
1740
2387
  Component({
1741
2388
  selector: 'boolean-field-template',
1742
- template: "<div [formGroup]=\"field.FormFormGroup\">\n\n <!-- VISUALIZZAZIONE A TOGGLE -->\n <mat-slide-toggle color=\"primary\" *ngIf=\"field.PresetationType == BoolPresentantioEnum.Toggle\"\n [formControlName]=\"field.Name\" [disabled]=\"field.FormFormGroup.disabled\" [required]=\"field.Required\"\n [(ngModel)]=\"record[field.Name]\" (ngModelChange)=\"onRecordValueChange()\">\n {{field.Label + (field.Required ? \" *\" : \"\")}}\n </mat-slide-toggle>\n\n\n <!-- VISUALIZZAZIONE A RADIOBUTTON -->\n <mat-label class=\"mr-3\" *ngIf=\"field.PresetationType == BoolPresentantioEnum['Radio button']\">\n {{field.Label + (field.Required ? \" *\" : \"\")}}\n </mat-label>\n <mat-radio-group *ngIf=\"field.PresetationType == BoolPresentantioEnum['Radio button']\"\n [formControlName]=\"field.Name\" [disabled]=\"field.FormFormGroup.disabled\" [required]=\"field.Required\"\n [(ngModel)]=\"record[field.Name]\" (ngModelChange)=\"onRecordValueChange()\">\n <mat-radio-button class=\"mr-2\" [value]=\"true\" color=\"primary\"> Si </mat-radio-button>\n <mat-radio-button class=\"mr-2\" [value]=\"false\" color=\"primary\"> No </mat-radio-button>\n <mat-radio-button class=\"mr-2\" [value]=\"null\" color=\"primary\" *ngIf=\"field.IsTristate\"> ND\n </mat-radio-button>\n </mat-radio-group>\n\n <!-- VISUALIZZAZIONE A CHECKBOX -->\n <mat-checkbox class=\"mr-2\" *ngIf=\"field.PresetationType == BoolPresentantioEnum.Checkbox\"\n [disabled]=\"field.FormFormGroup.disabled\" [required]=\"field.Required\" [formControlName]=\"field.Name\"\n [(ngModel)]=\"record[field.Name]\" (ngModelChange)=\"onRecordValueChange()\">\n {{field.Label + (field.Required ? \" *\" : \"\")}}\n </mat-checkbox>\n\n <!-- TODO: Visualizzazione \"Stringa true o false\" e \"Numerico 0 o 1\" ?? -->\n</div>",
2389
+ template: "<div [formGroup]=\"field.FormFormGroup\">\r\n\r\n <!-- VISUALIZZAZIONE A TOGGLE -->\r\n <mat-slide-toggle color=\"primary\" *ngIf=\"field.PresetationType == BoolPresentantioEnum.Toggle\"\r\n [formControlName]=\"field.Name\" [disabled]=\"field.FormFormGroup.disabled\" [required]=\"field.Required\"\r\n [(ngModel)]=\"record[field.Name]\" (ngModelChange)=\"onRecordValueChange()\">\r\n {{field.Label + (field.Required ? \" *\" : \"\")}}\r\n </mat-slide-toggle>\r\n\r\n\r\n <!-- VISUALIZZAZIONE A RADIOBUTTON -->\r\n <mat-label class=\"mr-3\" *ngIf=\"field.PresetationType == BoolPresentantioEnum['Radio button']\">\r\n {{field.Label + (field.Required ? \" *\" : \"\")}}\r\n </mat-label>\r\n <mat-radio-group *ngIf=\"field.PresetationType == BoolPresentantioEnum['Radio button']\"\r\n [formControlName]=\"field.Name\" [disabled]=\"field.FormFormGroup.disabled\" [required]=\"field.Required\"\r\n [(ngModel)]=\"record[field.Name]\" (ngModelChange)=\"onRecordValueChange()\">\r\n <mat-radio-button class=\"mr-2\" [value]=\"true\" color=\"primary\"> Si </mat-radio-button>\r\n <mat-radio-button class=\"mr-2\" [value]=\"false\" color=\"primary\"> No </mat-radio-button>\r\n <mat-radio-button class=\"mr-2\" [value]=\"null\" color=\"primary\" *ngIf=\"field.IsTristate\"> ND\r\n </mat-radio-button>\r\n </mat-radio-group>\r\n\r\n <!-- VISUALIZZAZIONE A CHECKBOX -->\r\n <mat-checkbox class=\"mr-2\" *ngIf=\"field.PresetationType == BoolPresentantioEnum.Checkbox\"\r\n [disabled]=\"field.FormFormGroup.disabled\" [required]=\"field.Required\" [formControlName]=\"field.Name\"\r\n [(ngModel)]=\"record[field.Name]\" (ngModelChange)=\"onRecordValueChange()\">\r\n {{field.Label + (field.Required ? \" *\" : \"\")}}\r\n </mat-checkbox>\r\n\r\n <!-- TODO: Visualizzazione \"Stringa true o false\" e \"Numerico 0 o 1\" ?? -->\r\n</div>",
1743
2390
  styles: [""]
1744
2391
  })
1745
2392
  ], BooleanFieldTemplateComponent);
@@ -1804,7 +2451,7 @@ __decorate([
1804
2451
  DateFieldTemplateComponent = __decorate([
1805
2452
  Component({
1806
2453
  selector: 'date-field-template',
1807
- template: "<eqp-datetimepicker [placeholder]=\"field.Label\" [UTCDate]=\"true\" [pickerMode]=\"pickerMode\"\n [formGroupInput]=\"field.FormFormGroup\" [formControlNameInput]=\"field.Name\"\n [minDate]=\"field.MinDate ? field.MinDate : null\" [maxDate]=\"field.MaxDate ? field.MaxDate : null\"\n [isRequired]=\"field.Required\" [disabled]=\"field.FormFormGroup.disabled\" [(ngModelInput)]=\"record[field.Name]\"\n (ngModelInputChange)=\"onRecordValueChange()\">\n</eqp-datetimepicker>",
2454
+ template: "<eqp-datetimepicker [placeholder]=\"field.Label\" [UTCDate]=\"true\" [pickerMode]=\"pickerMode\"\r\n [formGroupInput]=\"field.FormFormGroup\" [formControlNameInput]=\"field.Name\"\r\n [minDate]=\"field.MinDate ? field.MinDate : null\" [maxDate]=\"field.MaxDate ? field.MaxDate : null\"\r\n [isRequired]=\"field.Required\" [disabled]=\"field.FormFormGroup.disabled\" [(ngModelInput)]=\"record[field.Name]\"\r\n (ngModelInputChange)=\"onRecordValueChange()\" [customDateFormat]=\"field.DateFormat ? field.DateFormat : null\">\r\n</eqp-datetimepicker>",
1808
2455
  styles: [""]
1809
2456
  })
1810
2457
  ], DateFieldTemplateComponent);
@@ -1851,7 +2498,7 @@ __decorate([
1851
2498
  TextareaFieldTemplateComponent = __decorate([
1852
2499
  Component({
1853
2500
  selector: 'textarea-field-template',
1854
- template: "<mat-form-field [formGroup]=\"field.FormFormGroup\">\n <textarea matInput [placeholder]=\"field.Label\" [rows]=\"field.Rows\" [formControlName]=\"field.Name\"\n [disabled]=\"field.FormFormGroup.disabled\" [required]=\"field.Required\" [(ngModel)]=\"record[field.Name]\"\n (ngModelChange)=\"onRecordValueChange()\"></textarea>\n</mat-form-field>",
2501
+ template: "<mat-form-field [formGroup]=\"field.FormFormGroup\">\r\n <textarea matInput [placeholder]=\"field.Label\" [rows]=\"field.Rows\" [formControlName]=\"field.Name\"\r\n [disabled]=\"field.FormFormGroup.disabled\" [required]=\"field.Required\" [(ngModel)]=\"record[field.Name]\"\r\n (ngModelChange)=\"onRecordValueChange()\"></textarea>\r\n</mat-form-field>",
1855
2502
  styles: [""]
1856
2503
  })
1857
2504
  ], TextareaFieldTemplateComponent);
@@ -1892,10 +2539,17 @@ let NumericFieldTemplateComponent = class NumericFieldTemplateComponent {
1892
2539
  */
1893
2540
  configureEqpNumericOptions() {
1894
2541
  this.eqpNumericOptions.prefix = this.field.CurrencySymbol ? this.field.CurrencySymbol : "";
2542
+ this.eqpNumericOptions.inputMode = this.field.CurrencySymbol ? EqpNumericInputMode.FINANCIAL : EqpNumericInputMode.NATURAL;
1895
2543
  if (this.field.MinValue != null && this.field.MinValue != undefined)
1896
2544
  this.eqpNumericOptions.min = this.field.MinValue;
1897
2545
  if (this.field.MaxValue != null && this.field.MaxValue != undefined)
1898
2546
  this.eqpNumericOptions.max = this.field.MaxValue;
2547
+ if (this.field.DecimalSeparator != null && this.field.DecimalSeparator != undefined)
2548
+ this.eqpNumericOptions.decimal = this.field.DecimalSeparator;
2549
+ if (this.field.ThousandsSeparator != null && this.field.ThousandsSeparator != undefined)
2550
+ this.eqpNumericOptions.thousands = this.field.ThousandsSeparator;
2551
+ if (this.field.DecimalPrecision != null && this.field.DecimalPrecision != undefined)
2552
+ this.eqpNumericOptions.precision = this.field.DecimalPrecision;
1899
2553
  }
1900
2554
  };
1901
2555
  __decorate([
@@ -1910,7 +2564,7 @@ __decorate([
1910
2564
  NumericFieldTemplateComponent = __decorate([
1911
2565
  Component({
1912
2566
  selector: 'numeric-field-template',
1913
- template: "<mat-form-field [formGroup]=\"field.FormFormGroup\">\n <mat-label> {{field.Label}} </mat-label>\n <input matInput eqpNumericMask [formControlName]=\"field.Name\" [disabled]=\"field.FormFormGroup.disabled\"\n [required]=\"field.Required\" [(ngModel)]=\"record[field.Name]\" [options]=\"eqpNumericOptions\"\n [step]=\"field.IsInteger ? 1 : null\" (ngModelChange)=\"onRecordValueChange()\" />\n</mat-form-field>",
2567
+ template: "<mat-form-field [formGroup]=\"field.FormFormGroup\">\r\n <mat-label> {{field.Label}} </mat-label>\r\n <input matInput eqpNumericMask [formControlName]=\"field.Name\" [disabled]=\"field.FormFormGroup.disabled\"\r\n [required]=\"field.Required\" [(ngModel)]=\"record[field.Name]\" [options]=\"eqpNumericOptions\"\r\n [step]=\"field.IsInteger ? 1 : null\" (ngModelChange)=\"onRecordValueChange()\" />\r\n</mat-form-field>",
1914
2568
  styles: [""]
1915
2569
  })
1916
2570
  ], NumericFieldTemplateComponent);
@@ -1946,26 +2600,17 @@ let ListValueFieldTemplateComponent = class ListValueFieldTemplateComponent {
1946
2600
  this.record[this.field.Name] = UtilityHelperService.EvaluateFieldFormula(this.field.Formula, this.record, null);
1947
2601
  }
1948
2602
  }
1949
- /**
1950
- * Metodo per recuperare la classe da applicare al button (nella relativa visualizzazione).
1951
- * Se il pulsante è stato selezionato imposta la classe "selected-button".
1952
- * @param data Oggetto bindato al pulsante
1953
- * @returns Restituisce la classe da applicare tramite [ngClass]
1954
- */
1955
- getSelectButtonClass(data) {
1956
- const selectedButtonClass = "selected-button";
1957
- return data.Selected ? selectedButtonClass : null;
1958
- }
1959
2603
  /**
1960
2604
  * Metodo invocato quando viene selezionata un'opzione nella visualizzazione a button
1961
2605
  * @param data Rappresenta l'oggetto selezionato
1962
2606
  */
1963
2607
  buttonSelectClick(data) {
2608
+ data.Selected = !data.Selected;
1964
2609
  if (this.field.IsMultiChoiche) {
1965
- data.Selected = !data.Selected;
1966
2610
  this.updateSelected(false);
1967
2611
  }
1968
2612
  else {
2613
+ this.arrayData.filter(d => d.Key != data.Key && d.Value != data.Value).forEach(d => d.Selected = false);
1969
2614
  this.record[this.field.Name] = data.Value;
1970
2615
  }
1971
2616
  this.onRecordValueChange();
@@ -1993,16 +2638,22 @@ let ListValueFieldTemplateComponent = class ListValueFieldTemplateComponent {
1993
2638
  * Metodo per creare un array di oggetti del tipo { Key: string, Value: any } da usare come sorgente dati per la eqp-select.
1994
2639
  */
1995
2640
  setArrayData() {
1996
- Object.keys(this.field.ValuePairs).forEach(k => {
1997
- var isOptionSelected;
1998
- if (this.field.IsMultiChoiche && this.record[this.field.Name] && this.record[this.field.Name].length > 0) {
1999
- isOptionSelected = !!this.record[this.field.Name].find(v => v == this.field.ValuePairs[k]);
2000
- }
2001
- else {
2002
- isOptionSelected = this.record[this.field.Name] === this.field.ValuePairs[k];
2003
- }
2004
- this.arrayData.push({ Key: k, Value: this.field.ValuePairs[k], Selected: isOptionSelected });
2005
- });
2641
+ if (this.field.PresentationMode != ListPresentationEnum.Immagini) {
2642
+ Object.keys(this.field.ValuePairs).forEach(k => { this.createArrayDataElement(k, this.field.ValuePairs[k]); });
2643
+ }
2644
+ else {
2645
+ this.field.ButtonImageList.forEach(i => { this.createArrayDataElement(i.ButtonKey, i.ButtonValue, 'data:' + i.FileContentType + ';base64,' + i.FileDataBase64); });
2646
+ }
2647
+ }
2648
+ createArrayDataElement(key, value, imgUrl = null) {
2649
+ var isOptionSelected;
2650
+ if (this.field.IsMultiChoiche && this.record[this.field.Name] && this.record[this.field.Name].length > 0) {
2651
+ isOptionSelected = !!this.record[this.field.Name].find(v => v == value);
2652
+ }
2653
+ else {
2654
+ isOptionSelected = this.record[this.field.Name] === value;
2655
+ }
2656
+ this.arrayData.push({ Key: key, Value: value, Selected: isOptionSelected, ImgUrl: imgUrl });
2006
2657
  }
2007
2658
  /**
2008
2659
  * Metodo per aggiornare il valore e il validator del FormControl associato al campo.
@@ -2023,37 +2674,19 @@ __decorate([
2023
2674
  ListValueFieldTemplateComponent = __decorate([
2024
2675
  Component({
2025
2676
  selector: 'list-value-field-template',
2026
- template: "<eqp-select *ngIf=\"field.PresentationMode == ListPresentationEnum['Combo box']\" [arrayData]=\"arrayData\"\n [arrayKeyProperty]=\"'Value'\" [showCancelButton]=\"!field.Required\" [arrayValueProperty]=\"'Key'\"\n [formGroupInput]=\"field.FormFormGroup\" [formControlNameInput]=\"field.Name\" [placeholder]=\"field.Label\"\n [includeFullObject]=\"false\" [isRequired]=\"field.Required\" [isDisabled]=\"field.FormFormGroup.disabled\"\n [(ngModelInput)]=\"record[field.Name]\" [isMultiSelect]=\"field.IsMultiChoiche\"\n (ngModelInputChange)=\"onRecordValueChange()\">\n</eqp-select>\n\n<div *ngIf=\"field.PresentationMode != ListPresentationEnum['Combo box']\" [formGroup]=\"field.FormFormGroup\">\n\n <mat-label class=\"mr-3\"> {{field.Label + (field.Required ? \" *\" : \"\")}} </mat-label>\n\n <!-- VISUALIZZAZIONE A RADIO BUTTON (SENZA SELEZIONE MULTIPLA) -->\n <mat-radio-group *ngIf=\"field.PresentationMode == ListPresentationEnum['Radio button'] && !field.IsMultiChoiche\"\n [formControlName]=\"field.Name\" [disabled]=\"field.FormFormGroup.disabled\" [required]=\"field.Required\"\n [(ngModel)]=\"record[field.Name]\" (ngModelChange)=\"onRecordValueChange()\">\n <mat-radio-button class=\"mr-2\" *ngFor=\"let data of arrayData\" [value]=\"data.Value\" color=\"primary\">\n {{data.Key}}\n </mat-radio-button>\n </mat-radio-group>\n\n <!-- VISUALIZZAZIONE A CHECKBOX (SELEZIONE MULTIPLA) -->\n <div class=\"d-inline-block\"\n *ngIf=\"field.PresentationMode == ListPresentationEnum['Radio button'] && field.IsMultiChoiche\">\n <mat-checkbox class=\"mr-2\" *ngFor=\"let data of arrayData\" [disabled]=\"field.FormFormGroup.disabled\"\n [formControlName]=\"field.Name\" [(ngModel)]=\"data.Selected\" (ngModelChange)=\"updateSelected()\">\n {{data.Key}}\n </mat-checkbox>\n </div>\n\n <!-- VISUALIZZAZIONE A PULSANTI (CON TESTO) -->\n <div class=\"d-inline-block\" *ngIf=\"field.PresentationMode == ListPresentationEnum['Pulsante con testo']\">\n <button mat-raised-button color=\"primary\" class=\"btn btn-primary mr-2\" *ngFor=\"let data of arrayData\"\n (click)=\"buttonSelectClick(data)\" [ngClass]=\"getSelectButtonClass(data)\"\n [disabled]=\"field.FormFormGroup.disabled\">\n {{data.Key}}\n </button>\n </div>\n\n <!-- TODO: VISUALIZZAZIONE A PULSANTI (CON IMMAGINI) ?? -->\n</div>",
2027
- styles: [".selected-button{opacity:.7}.selected-button:disabled{background-color:var(--primary)!important;opacity:.3;color:#fff}"]
2677
+ template: "<eqp-select *ngIf=\"field.PresentationMode == ListPresentationEnum['Combo box']\" [arrayData]=\"arrayData\"\r\n [arrayKeyProperty]=\"'Value'\" [showCancelButton]=\"!field.Required\" [arrayValueProperty]=\"'Key'\"\r\n [formGroupInput]=\"field.FormFormGroup\" [formControlNameInput]=\"field.Name\" [placeholder]=\"field.Label\"\r\n [includeFullObject]=\"false\" [isRequired]=\"field.Required\" [isDisabled]=\"field.FormFormGroup.disabled\"\r\n [(ngModelInput)]=\"record[field.Name]\" [isMultiSelect]=\"field.IsMultiChoiche\"\r\n (ngModelInputChange)=\"onRecordValueChange()\">\r\n</eqp-select>\r\n\r\n<div *ngIf=\"field.PresentationMode != ListPresentationEnum['Combo box']\" [formGroup]=\"field.FormFormGroup\">\r\n\r\n <mat-label class=\"mr-3\"> {{field.Label + (field.Required ? \" *\" : \"\")}} </mat-label>\r\n\r\n <!-- VISUALIZZAZIONE A RADIO BUTTON (SENZA SELEZIONE MULTIPLA) -->\r\n <mat-radio-group *ngIf=\"field.PresentationMode == ListPresentationEnum['Radio button'] && !field.IsMultiChoiche\"\r\n [formControlName]=\"field.Name\" [disabled]=\"field.FormFormGroup.disabled\" [required]=\"field.Required\"\r\n [(ngModel)]=\"record[field.Name]\" (ngModelChange)=\"onRecordValueChange()\">\r\n <mat-radio-button class=\"mr-2\" *ngFor=\"let data of arrayData\" [value]=\"data.Value\" color=\"primary\">\r\n {{data.Key}}\r\n </mat-radio-button>\r\n </mat-radio-group>\r\n\r\n <!-- VISUALIZZAZIONE A CHECKBOX (SELEZIONE MULTIPLA) -->\r\n <div class=\"d-inline-block\"\r\n *ngIf=\"field.PresentationMode == ListPresentationEnum['Radio button'] && field.IsMultiChoiche\">\r\n <mat-checkbox class=\"mr-2\" *ngFor=\"let data of arrayData\" [disabled]=\"field.FormFormGroup.disabled\"\r\n [formControlName]=\"field.Name\" [(ngModel)]=\"data.Selected\" (ngModelChange)=\"updateSelected()\">\r\n {{data.Key}}\r\n </mat-checkbox>\r\n </div>\r\n\r\n <!-- VISUALIZZAZIONE A PULSANTI (CON TESTO O IMMAGINI) -->\r\n <div class=\"d-inline-block\"\r\n *ngIf=\"[ListPresentationEnum['Pulsante con testo'], ListPresentationEnum.Immagini].includes(field.PresentationMode)\">\r\n <button mat-raised-button color=\"primary\" class=\"btn btn-primary m-1 data-button\" *ngFor=\"let data of arrayData\"\r\n [ngClass]=\"{'selected-button': data.Selected == true, 'p-0': field.PresentationMode == ListPresentationEnum.Immagini}\"\r\n (click)=\"buttonSelectClick(data)\" [disabled]=\"field.FormFormGroup.disabled\">\r\n\r\n <!-- TESTO DEL PULSANTE -->\r\n <span *ngIf=\"field.PresentationMode == ListPresentationEnum['Pulsante con testo']\"> {{data.Key}}</span>\r\n\r\n <!-- IMMAGINE DEL PULSANTE -->\r\n <img *ngIf=\"field.PresentationMode == ListPresentationEnum.Immagini\" [src]=\"data.ImgUrl\">\r\n </button>\r\n </div>\r\n\r\n</div>",
2678
+ styles: [".selected-button{opacity:.7}.selected-button:disabled{background-color:var(--primary)!important;opacity:.3;color:#fff}.data-button img{max-height:300px;max-width:300px}"]
2028
2679
  })
2029
2680
  ], ListValueFieldTemplateComponent);
2030
2681
 
2031
2682
  let AttachmentFieldTemplateComponent = class AttachmentFieldTemplateComponent {
2032
- //#endregion
2033
2683
  constructor(utilityService, cdr) {
2034
2684
  this.utilityService = utilityService;
2035
2685
  this.cdr = cdr;
2036
2686
  this.onlyImages = false;
2037
2687
  this.recordChange = new EventEmitter();
2688
+ this.onAttachmentsChange = new EventEmitter();
2038
2689
  this.metadataFormGroups = new Array();
2039
- //#region Etichette per eqp-attachments
2040
- this.previewLabel = "Anteprima";
2041
- this.emptyTableMessage = "No record found";
2042
- this.downloadTooltipPosition = "below";
2043
- this.openLinkLabel = "Apri link";
2044
- this.addButtonLabel = "Aggiungi";
2045
- this.downloadLabel = "Download";
2046
- this.deleteLabel = "Elimina";
2047
- this.fileNameLabel = "Nome file";
2048
- this.uploadFileLabel = "Carica file";
2049
- this.confirmLabel = "Conferma";
2050
- this.abortLabel = "Annulla";
2051
- this.saveLabel = "Salva";
2052
- this.exitLabel = "Esci";
2053
- this.eqpTableSearchText = "Cerca...";
2054
- this.deleteDialogTitle = "Attenzione:";
2055
- this.deleteDialogMessage = "Sicuro di voler eliminare questo allegato?";
2056
- this.noImageSelectedErrorMessage = "Nessuna immagine selezionata!";
2057
2690
  }
2058
2691
  ngOnInit() {
2059
2692
  // Nel caso in cui sono in modifica di un Record aggiorno il valore
@@ -2104,6 +2737,10 @@ let AttachmentFieldTemplateComponent = class AttachmentFieldTemplateComponent {
2104
2737
  this.createMetadataFormGroups();
2105
2738
  this.setFormControlValue();
2106
2739
  this.onRecordValueChange();
2740
+ // Scateno un evento di output necessario al componente ImageFieldTemplate al
2741
+ // variare degli allegati caricati. Viene usato per aprire il dialog per disegnare
2742
+ // sull'immagine caricata in base alla configurazione del Field.
2743
+ this.onAttachmentsChange.emit();
2107
2744
  this.cdr.detectChanges();
2108
2745
  }
2109
2746
  /**
@@ -2189,6 +2826,9 @@ __decorate([
2189
2826
  __decorate([
2190
2827
  Output()
2191
2828
  ], AttachmentFieldTemplateComponent.prototype, "recordChange", void 0);
2829
+ __decorate([
2830
+ Output()
2831
+ ], AttachmentFieldTemplateComponent.prototype, "onAttachmentsChange", void 0);
2192
2832
  __decorate([
2193
2833
  ViewChild("eqpAttachments", { static: true })
2194
2834
  ], AttachmentFieldTemplateComponent.prototype, "eqpAttachments", void 0);
@@ -2198,14 +2838,36 @@ __decorate([
2198
2838
  AttachmentFieldTemplateComponent = __decorate([
2199
2839
  Component({
2200
2840
  selector: 'attachment-field-template',
2201
- template: "<p *ngIf=\"!field.IsMultiAttach\" class=\"mb-2\">\n {{field.Label + (field.Required ? \" *\" : \"\")}}\n</p>\n<div class=\"row\" *ngIf=\"!field.IsMultiAttach && record[field.Name] && record[field.Name][0]\">\n <div class=\"mt-2\" *ngFor=\"let metadata of field.MetadataFields\" [ngClass]=\"utilityService.getFieldSyleClass(metadata)\">\n <dynamic-module-field [field]=\"metadata\" [record]=\"record[field.Name][0]\"\n (recordChange)=\"updateMetadataValidity()\">\n </dynamic-module-field>\n </div>\n</div>\n\n\n\n<eqp-attachments [attachmentsList]=\"record[field.Name]\" [showMatCard]=\"true\" [allowOnlyImages]=\"onlyImages\"\n [isDisabled]=\"field.FormFormGroup.disabled\" [showInlinePreview]=\"true\" [multipleAttachment]=\"field.IsMultiAttach\"\n [disableAction]=\"field.FormFormGroup.disabled\" [acceptedFileTypes]=\"field.AllowedExtensions\" [showHeader]=\"true\"\n [headerTitle]=\"field.Label + (field.Required ? ' *' : '')\" [previewLabel]=\"previewLabel\"\n [emptyTableMessage]=\"emptyTableMessage\" [downloadTooltipPosition]=\"downloadTooltipPosition\"\n [openLinkLabel]=\"openLinkLabel\" [addButtonLabel]=\"addButtonLabel\" [downloadLabel]=\"downloadLabel\"\n [deleteLabel]=\"deleteLabel\" [fileNameLabel]=\"fileNameLabel\" [uploadFileLabel]=\"uploadFileLabel\"\n [confirmLabel]=\"confirmLabel\" [abortLabel]=\"abortLabel\" [saveLabel]=\"saveLabel\" [exitLabel]=\"exitLabel\"\n [eqpTableSearchText]=\"eqpTableSearchText\" [deleteDialogTitle]=\"deleteDialogTitle\"\n [deleteDialogMessage]=\"deleteDialogMessage\" [noImageSelectedErrorMessage]=\"noImageSelectedErrorMessage\"\n (localEditedAttachments)=\"catchAttachmentList($event)\" #eqpAttachments>\n</eqp-attachments>\n\n<!-- TEMPLATE PER VISUALIZZARE LA COLONNA DELLA SEZIONE NELLA TABELLA DEI FIELDS -->\n<ng-template #metadataColumnTemplate let-row=\"row\" let-col=\"col\">\n <dynamic-module-field [field]=\"getFieldFromMetadata(col, row)\" [record]=\"row\"\n (recordChange)=\"updateMetadataValidity()\">\n </dynamic-module-field>\n</ng-template>",
2841
+ template: "<p *ngIf=\"!field.IsMultiAttach\" class=\"mb-2\">\r\n {{field.Label + (field.Required ? \" *\" : \"\")}}\r\n</p>\r\n<div class=\"row\" *ngIf=\"!field.IsMultiAttach && record[field.Name] && record[field.Name][0]\">\r\n <div class=\"mt-2\" *ngFor=\"let metadata of field.MetadataFields\"\r\n [ngClass]=\"utilityService.getFieldSyleClass(metadata)\">\r\n <dynamic-module-field [field]=\"metadata\" [record]=\"record[field.Name][0]\"\r\n (recordChange)=\"updateMetadataValidity()\">\r\n </dynamic-module-field>\r\n </div>\r\n</div>\r\n\r\n<eqp-attachments [attachmentsList]=\"record[field.Name]\" [showMatCard]=\"true\" [allowOnlyImages]=\"onlyImages\"\r\n [isDisabled]=\"field.FormFormGroup.disabled\" [showInlinePreview]=\"true\" [multipleAttachment]=\"field.IsMultiAttach\"\r\n [disableAction]=\"field.FormFormGroup.disabled\" [acceptedFileTypes]=\"field.AllowedExtensions\" [showHeader]=\"true\"\r\n [headerTitle]=\"field.Label + (field.Required ? ' *' : '')\" (localEditedAttachments)=\"catchAttachmentList($event)\"\r\n #eqpAttachments>\r\n</eqp-attachments>\r\n\r\n<!-- TEMPLATE PER VISUALIZZARE LA COLONNA DELLA SEZIONE NELLA TABELLA DEI FIELDS -->\r\n<ng-template #metadataColumnTemplate let-row=\"row\" let-col=\"col\">\r\n <dynamic-module-field [field]=\"getFieldFromMetadata(col, row)\" [record]=\"row\"\r\n (recordChange)=\"updateMetadataValidity()\">\r\n </dynamic-module-field>\r\n</ng-template>",
2202
2842
  styles: [""]
2203
2843
  })
2204
2844
  ], AttachmentFieldTemplateComponent);
2205
2845
 
2846
+ /**
2847
+ * Metodo per recuperare, a partire da un Blob, la stringa contenente il base64 del file.
2848
+ * Usato per prendere il base64 dell'immagine dopo che l'utente ci ha disegnato sopra.
2849
+ * @param file Blob che rappresenta l'immagine.
2850
+ */
2851
+ const toBase64 = file => new Promise((resolve, reject) => {
2852
+ const reader = new FileReader();
2853
+ reader.readAsDataURL(file);
2854
+ reader.onload = () => resolve(reader.result.toString());
2855
+ reader.onerror = error => reject(error);
2856
+ });
2857
+ const ɵ0 = toBase64;
2206
2858
  let ImageFieldTemplateComponent = class ImageFieldTemplateComponent {
2207
- constructor() {
2859
+ //#endregion
2860
+ constructor(dialog, utilityService) {
2861
+ this.dialog = dialog;
2862
+ this.utilityService = utilityService;
2208
2863
  this.recordChange = new EventEmitter();
2864
+ //#region Proprietà per configurare il componente ngx-image-drawing e aprire il relativo dialog.
2865
+ this.width = null;
2866
+ this.height = null;
2867
+ this.i18n = {
2868
+ saveBtn: 'Salva modifiche',
2869
+ cancelBtn: 'Ricarica originale'
2870
+ };
2209
2871
  }
2210
2872
  ngOnInit() {
2211
2873
  this.field.AttachDefinition.FormFormGroup = this.field.FormFormGroup;
@@ -2218,6 +2880,19 @@ let ImageFieldTemplateComponent = class ImageFieldTemplateComponent {
2218
2880
  this.field.AttachDefinition.Required = this.field.Required;
2219
2881
  this.field.AttachDefinition.Formula = this.field.Formula;
2220
2882
  this.field.AttachDefinition.FieldValue = this.field.FieldValue;
2883
+ // Se il campo prevede un'immagine pre-caricata (ImageIsContextualAttachment == true) sulla quale
2884
+ // l'utente può disegnare (EnableDrawing == true) e non sono in modifica di un record (ovvero nel record
2885
+ // non ho un'immagine già salvata) allora imposta l'immagine pre caricata come valore iniziale
2886
+ // nel record corrente e ne recupera le dimensioni per visualizzare correttamente l'area in cui
2887
+ // l'utente può disegnare. Se non effettua modifiche o non salva i disegni fatti viene salvata
2888
+ // l'immagine originale.
2889
+ if (this.field.ImageIsContextualAttachment && this.field.ContextualAttachment) {
2890
+ if (!this.record[this.field.Name] || !Array.isArray(this.record[this.field.Name]) || !(this.record[this.field.Name].length > 0)) {
2891
+ this.record[this.field.Name] = [JSON.parse(JSON.stringify(this.field.ContextualAttachment))];
2892
+ }
2893
+ this.preLoadedImageMetadataFormGroup = this.utilityService.CreateFormFormGroup(this.field.AttachDefinition.MetadataFields, this.record[this.field.Name][0]);
2894
+ this.getImageDimensions();
2895
+ }
2221
2896
  }
2222
2897
  ngOnChanges(changes) {
2223
2898
  // Se viene modificato il valore di "ngModelInput" allora aggiorna l'input
@@ -2226,6 +2901,15 @@ let ImageFieldTemplateComponent = class ImageFieldTemplateComponent {
2226
2901
  this.updateField();
2227
2902
  }
2228
2903
  }
2904
+ updateMetadataValidity() {
2905
+ if (this.preLoadedImageMetadataFormGroup.invalid) {
2906
+ this.field.FormFormGroup.controls[this.field.Name].setErrors({ 'incorrect': true });
2907
+ }
2908
+ else {
2909
+ this.field.FormFormGroup.controls[this.field.Name].setErrors(null);
2910
+ }
2911
+ this.onRecordValueChange();
2912
+ }
2229
2913
  /**
2230
2914
  * Metodo per aggiornare il valore del campo quando questo è rappresentato da una formula.
2231
2915
  */
@@ -2234,7 +2918,100 @@ let ImageFieldTemplateComponent = class ImageFieldTemplateComponent {
2234
2918
  this.record[this.field.Name] = UtilityHelperService.EvaluateFieldFormula(this.field.Formula, this.record, null);
2235
2919
  }
2236
2920
  }
2921
+ resetPreLoadedImage() {
2922
+ this.width = null;
2923
+ this.height = null;
2924
+ this.record[this.field.Name] = [JSON.parse(JSON.stringify(this.field.ContextualAttachment))];
2925
+ this.getImageDimensions();
2926
+ }
2927
+ /**
2928
+ * Metodo invocato quando vengono aggiunti o eliminati gli allegati nel componente AttachmentFieldTemplate.
2929
+ * Se l'ImageField è abilitato al disegno (EnableDrawing == true), non permette allegati multipli (IsMulitAttach == false)
2930
+ * e nel Record corrente è presente l'immagine caricata dall'utente allora recupera le dimensioni dell'immagine e
2931
+ * apre il dialog con il componente image-drawing per permettere il disegno sull'immagine appena caricata.
2932
+ */
2933
+ onAttachmentsChange() {
2934
+ if (!this.field.AttachDefinition.IsMultiAttach && this.field.EnableDrawing && this.record[this.field.Name] && this.record[this.field.Name][0]) {
2935
+ this.getImageDimensions();
2936
+ this.dialogImageDrowingRef = this.dialog.open(this.dialogImageDrowing, {
2937
+ disableClose: true,
2938
+ hasBackdrop: true,
2939
+ width: '75%'
2940
+ });
2941
+ }
2942
+ }
2943
+ /**
2944
+ * Metodo invocato al salvataggio dell'immagine dal componente image-drawing.
2945
+ * Trasforma il Blob ricevuto in un base64, aggiorna il FileContetType e il FileDataBase64
2946
+ * dell'allegato caricato e chiude il dialog in cui disegnare.
2947
+ * @param drawnPicture Blob dell'immagine disegnata.
2948
+ */
2949
+ saveDrowning(drawnPicture) {
2950
+ return __awaiter(this, void 0, void 0, function* () {
2951
+ let base64File = yield toBase64(drawnPicture);
2952
+ if (base64File) {
2953
+ this.record[this.field.Name][0].FileContentType = base64File.split(",")[0].split(":")[1].split(";")[0];
2954
+ this.record[this.field.Name][0].FileDataBase64 = base64File.split(",")[1];
2955
+ }
2956
+ if (this.dialogImageDrowingRef) {
2957
+ this.closeImageDrowingDialog();
2958
+ }
2959
+ });
2960
+ }
2961
+ /**
2962
+ * Metodo per chiudere il dialog in cui disegnare sull'immagine cariata e svuotare le dimensioni.
2963
+ */
2964
+ closeImageDrowingDialog() {
2965
+ this.dialogImageDrowingRef.close();
2966
+ this.width = null;
2967
+ this.height = null;
2968
+ }
2969
+ /**
2970
+ * Metodo per recuperare le dimensioni dell'immagine caricata per mostrare correttamente
2971
+ * il componente image-drawing. Se non viene eseguito questo passaggio l'area in cui disegnare
2972
+ * è più grande dell'immagine stessa e al salvataggio i tratti disegnati vengono spostati.
2973
+ */
2974
+ getImageDimensions() {
2975
+ var blob = this.getBlobFromBase64();
2976
+ const reader = new FileReader();
2977
+ reader.onload = (e) => {
2978
+ const image = new Image();
2979
+ image.src = e.target.result;
2980
+ image.onload = rs => {
2981
+ this.height = rs.currentTarget['height'];
2982
+ this.width = rs.currentTarget['width'];
2983
+ };
2984
+ };
2985
+ reader.readAsDataURL(blob);
2986
+ }
2987
+ /**
2988
+ * Metodo per convertire il base64 di un'immagine in un Blob.
2989
+ * Necessario per il recupero delle dimensioni dell'immagine caricata a partire dal suo base64.
2990
+ * Viene eseguito solo nel caso in cui l'ImageField non ammette allegati multipli.
2991
+ * @returns Restituisce il Blob dell'immagine caricata.
2992
+ */
2993
+ getBlobFromBase64() {
2994
+ const byteCharacters = atob(this.record[this.field.Name][0].FileDataBase64);
2995
+ const byteNumbers = new Array(byteCharacters.length);
2996
+ for (let i = 0; i < byteCharacters.length; i++) {
2997
+ byteNumbers[i] = byteCharacters.charCodeAt(i);
2998
+ }
2999
+ const byteArray = new Uint8Array(byteNumbers);
3000
+ return new Blob([byteArray], { type: this.record[this.field.Name][0].FileContentType });
3001
+ }
3002
+ /**
3003
+ * Metodo per emettere l'evento che il valore del record è cambiato.
3004
+ */
3005
+ onRecordValueChange() {
3006
+ if (!this.field.Formula) {
3007
+ this.recordChange.emit(this.record);
3008
+ }
3009
+ }
2237
3010
  };
3011
+ ImageFieldTemplateComponent.ctorParameters = () => [
3012
+ { type: MatDialog },
3013
+ { type: UtilityHelperService }
3014
+ ];
2238
3015
  __decorate([
2239
3016
  Input()
2240
3017
  ], ImageFieldTemplateComponent.prototype, "record", void 0);
@@ -2244,11 +3021,14 @@ __decorate([
2244
3021
  __decorate([
2245
3022
  Output()
2246
3023
  ], ImageFieldTemplateComponent.prototype, "recordChange", void 0);
3024
+ __decorate([
3025
+ ViewChild("dialogImageDrowing", { static: true })
3026
+ ], ImageFieldTemplateComponent.prototype, "dialogImageDrowing", void 0);
2247
3027
  ImageFieldTemplateComponent = __decorate([
2248
3028
  Component({
2249
3029
  selector: 'image-field-template',
2250
- template: "<attachment-field-template [(record)]=\"record\" [field]=\"field.AttachDefinition\"\n [onlyImages]=\"true\">\n</attachment-field-template>",
2251
- styles: [""]
3030
+ template: "<!-- VISUALIZZAZIONE ALLEGATO PRE CARICATO CON POSSIBILITA' DI DISEGNO -->\r\n<div class=\"row\" *ngIf=\"field.ImageIsContextualAttachment && field.ContextualAttachment\">\r\n <div class=\"col-sm-12 col-md-6 col-lg-4\">\r\n <p class=\"mb-2\">\r\n {{ field.Label + (field.Required ? \" *\" : \"\")}}\r\n <br>\r\n Nome immagine: {{ field.ImgName}}\r\n </p>\r\n <eqp-img-drawing\r\n *ngIf=\"field.EnableDrawing && record[field.Name] && record[field.Name][0] && width != null && height != null\"\r\n [src]=\"'data:'+ record[field.Name][0].FileContentType + ';base64,'+ record[field.Name][0].FileDataBase64\"\r\n [showCancelButton]=\"false\" [enableLoadAnotherImage]=\"false\" [enableRemoveImage]=\"false\" [width]=\"width\"\r\n [height]=\"height\" [i18n]=\"i18n\" [showCancelButton]=\"true\" (save)=\"saveDrowning($event)\"\r\n (cancel)=\"resetPreLoadedImage()\">\r\n </eqp-img-drawing>\r\n\r\n <img *ngIf=\"!field.EnableDrawing\"\r\n [src]=\"'data:'+ record[field.Name][0].FileContentType+ ';base64,'+ record[field.Name][0].FileDataBase64\">\r\n </div>\r\n\r\n <div class=\"col-sm-12 col-md-6 col-lg-8\">\r\n <div class=\"row\"\r\n *ngIf=\"field.AttachDefinition && field.AttachDefinition.MetadataFields && preLoadedImageMetadataFormGroup\">\r\n <div class=\"mt-2\" *ngFor=\"let metadata of field.AttachDefinition.MetadataFields\"\r\n [ngClass]=\"utilityService.getFieldSyleClass(metadata)\">\r\n <dynamic-module-field #fieldTemplate [field]=\"metadata\" [form]=\"preLoadedImageMetadataFormGroup\"\r\n [record]=\"record[field.Name][0]\" (recordChange)=\"updateMetadataValidity()\">\r\n </dynamic-module-field>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n<!-- COMPONENTE IN CUI CARICARE NUOVI ALLEGATI -->\r\n<attachment-field-template [(record)]=\"record\" [field]=\"field.AttachDefinition\" [onlyImages]=\"true\"\r\n (onAttachmentsChange)=\"onAttachmentsChange()\" *ngIf=\"!field.ImageIsContextualAttachment\">\r\n</attachment-field-template>\r\n\r\n<!-- DIALOG PER DISEGNARE SUL NUOVO ALLEGATO CARICATO -->\r\n<ng-template #dialogImageDrowing>\r\n <div *ngIf=\"field.EnableDrawing && record[field.Name] && record[field.Name][0] && width != null && height != null\"\r\n class=\"row\">\r\n <div class=\"col-sm-12 col-md-12\">\r\n <eqp-img-drawing [showCancelButton]=\"false\" [enableLoadAnotherImage]=\"false\" [enableRemoveImage]=\"false\"\r\n [src]=\"'data:'+ record[field.Name][0].FileContentType + ';base64,'+ record[field.Name][0].FileDataBase64\"\r\n [i18n]=\"i18n\" [showCancelButton]=\"false\" (save)=\"saveDrowning($event)\">\r\n </eqp-img-drawing>\r\n </div>\r\n </div>\r\n <div class=\"row mt-2 mb-1\">\r\n <div class=\"col-sm-12 text-right\">\r\n <button class=\"btn mat-raised-button\" (click)=\"closeImageDrowingDialog()\" type=\"button\">\r\n Annulla disegno\r\n </button>\r\n </div>\r\n </div>\r\n</ng-template>",
3031
+ styles: ["::ng-deep image-drawing>button{background-color:var(--primary)!important;color:#fff!important}"]
2252
3032
  })
2253
3033
  ], ImageFieldTemplateComponent);
2254
3034
 
@@ -2325,30 +3105,14 @@ let ListFormRecordComponent = class ListFormRecordComponent {
2325
3105
  * @param record Record da duplicare.
2326
3106
  */
2327
3107
  duplicateRecord(record) {
2328
- // EqpDynamicModuleDialogService.Confirm('Duplicare il record selezionato?', () => {
2329
- // var copiedRecord: Record = JSON.parse(JSON.stringify(record));
2330
- // if (!isNaN(parseInt(copiedRecord.ID))) {
2331
- // copiedRecord.ID = (parseInt(copiedRecord.ID) + 1).toString();
2332
- // } else {
2333
- // copiedRecord.ID = "xxxxxxxxx".replace("x", (c) => { return (Math.random() + 16 | 0).toString(16); });
2334
- // }
2335
- // this.values.push(copiedRecord);
2336
- // this.reloadTables();
2337
- // }, false, 'Richiesta conferma');
2338
3108
  this.onDuplicateRecord.emit(record);
2339
- //TODO
2340
3109
  }
2341
3110
  /**
2342
3111
  * Metodo per eliminare un record dalla lista.
2343
3112
  * @param record Record da eliminare selezionato sulla eqp-table.
2344
3113
  */
2345
3114
  deleteRecord(record) {
2346
- // EqpDynamicModuleDialogService.Confirm('Eliminare il record selezionato?', () => {
2347
- // this.values.splice(this.values.indexOf(record), 1);
2348
- // this.reloadTables();
2349
- // }, false, 'Richiesta conferma');
2350
3115
  this.onDeleteRecord.emit(record);
2351
- // TODO
2352
3116
  }
2353
3117
  /**
2354
3118
  * Metodo per creare la configurazione delle colonne per la eqp-table.
@@ -2390,7 +3154,7 @@ let ListFormRecordComponent = class ListFormRecordComponent {
2390
3154
  column.format = "dd/MM/yyyy HH:mm";
2391
3155
  }
2392
3156
  else if (field.IsOnlyDate == DateTimeTypeEnum['Solo data']) {
2393
- column.format = "dd/MM/yyyy";
3157
+ column.format = field.DateFormat ? field.DateFormat.replace("DD", "dd") : "dd/MM/yyyy";
2394
3158
  }
2395
3159
  }
2396
3160
  break;
@@ -2477,9 +3241,6 @@ ListFormRecordComponent = __decorate([
2477
3241
  })
2478
3242
  ], ListFormRecordComponent);
2479
3243
 
2480
- class Record {
2481
- }
2482
-
2483
3244
  let AddFormRecordComponent = class AddFormRecordComponent {
2484
3245
  constructor(cdr, utilityService) {
2485
3246
  this.cdr = cdr;
@@ -2598,7 +3359,7 @@ __decorate([
2598
3359
  AddFormRecordComponent = __decorate([
2599
3360
  Component({
2600
3361
  selector: 'add-form-record',
2601
- template: "<div class=\"row eqp-dynamic-module-title\" *ngIf=\"showTitle\">\n <div class=\"col-md-12\">\n <h4><b>{{form.Name}}</b></h4>\n </div>\n</div>\n\n<form [formGroup]=\"formForm\">\n\n <!-- VISUALIZZAZIONE SEMPLICE -->\n <ng-container *ngIf=\"form.FormScalarType == FormScalarTypeEnum.Semplice\" [ngTemplateOutlet]=\"fieldTemplates\"\n [ngTemplateOutletContext]=\"{ fields: form.Fields }\">\n </ng-container>\n\n <!-- VISUALIZZAZIONE A STEPPER -->\n <mat-horizontal-stepper linear *ngIf=\"form.FormScalarType == FormScalarTypeEnum['A step']\">\n <mat-step *ngFor=\"let group of form.FormFieldsGroups\">\n <ng-template matStepLabel>\n {{group.Name}}\n </ng-template>\n\n <ng-container [ngTemplateOutlet]=\"fieldTemplates\"\n [ngTemplateOutletContext]=\"{ fields: fieldGroups[group.Name] }\">\n </ng-container>\n </mat-step>\n </mat-horizontal-stepper>\n\n <!-- VISUALIZZAZIONE A TAB -->\n <mat-tab-group *ngIf=\"form.FormScalarType == FormScalarTypeEnum['In tab']\">\n <mat-tab *ngFor=\"let group of form.FormFieldsGroups\" [label]=\"group.Name\">\n <div class=\"mt-3\">\n <ng-container [ngTemplateOutlet]=\"fieldTemplates\"\n [ngTemplateOutletContext]=\"{ fields: fieldGroups[group.Name] }\">\n </ng-container>\n </div>\n </mat-tab>\n </mat-tab-group>\n\n <!-- VISUALIZZAZIONE AD ACCORDION -->\n <mat-accordion multi *ngIf=\"form.FormScalarType == FormScalarTypeEnum['In accordion']\">\n <mat-expansion-panel *ngFor=\"let group of form.FormFieldsGroups\">\n <mat-expansion-panel-header>\n <mat-panel-title>\n {{group.Name}}\n </mat-panel-title>\n </mat-expansion-panel-header>\n\n <ng-container [ngTemplateOutlet]=\"fieldTemplates\"\n [ngTemplateOutletContext]=\"{ fields: fieldGroups[group.Name] }\">\n </ng-container>\n </mat-expansion-panel>\n </mat-accordion>\n</form>\n\n<div class=\"row mt-2\" *ngIf=\"showButtons\">\n <div class=\"col-sm-12 text-right\">\n <button class=\"mr-2\" mat-raised-button (click)=\"saveOrExitForm(true)\" type=\"button\">\n Annulla\n </button>\n <button class=\"mr-2\" mat-raised-button color=\"primary\" (click)=\"saveOrExitForm(false)\"\n [disabled]=\"formForm.invalid || formForm.disabled\" type=\"button\">\n Salva\n </button>\n </div>\n</div>\n\n<!-- TEMPLATE PER LA VISUALIZZAZIONE DEI CAMPI DELLA FORM -->\n<ng-template #fieldTemplates let-fields='fields'>\n <div class=\"row\">\n <div class=\"mt-2\" *ngFor=\"let field of fields\" [ngClass]=\"utilityService.getFieldSyleClass(field)\">\n <dynamic-module-field #fieldTemplate [field]=\"field\" [form]=\"form\" [record]=\"record\"\n (recordChange)=\"onRecordChange()\"></dynamic-module-field>\n </div>\n </div>\n</ng-template>",
3362
+ template: "<div class=\"row eqp-dynamic-module-title\" *ngIf=\"showTitle\">\r\n <div class=\"col-md-12\">\r\n <h4><b>{{form.Name}}</b></h4>\r\n </div>\r\n</div>\r\n\r\n<form [formGroup]=\"formForm\">\r\n\r\n <!-- VISUALIZZAZIONE SEMPLICE -->\r\n <ng-container *ngIf=\"form.FormScalarType == FormScalarTypeEnum.Semplice\" [ngTemplateOutlet]=\"fieldTemplates\"\r\n [ngTemplateOutletContext]=\"{ fields: form.Fields }\">\r\n </ng-container>\r\n\r\n <!-- VISUALIZZAZIONE A STEPPER -->\r\n <mat-horizontal-stepper linear *ngIf=\"form.FormScalarType == FormScalarTypeEnum['A step']\">\r\n <mat-step *ngFor=\"let group of form.FormFieldsGroups\">\r\n <ng-template matStepLabel>\r\n {{group.Name}}\r\n </ng-template>\r\n\r\n <ng-container [ngTemplateOutlet]=\"fieldTemplates\"\r\n [ngTemplateOutletContext]=\"{ fields: fieldGroups[group.Name] }\">\r\n </ng-container>\r\n </mat-step>\r\n </mat-horizontal-stepper>\r\n\r\n <!-- VISUALIZZAZIONE A TAB -->\r\n <mat-tab-group *ngIf=\"form.FormScalarType == FormScalarTypeEnum['In tab']\">\r\n <mat-tab *ngFor=\"let group of form.FormFieldsGroups\" [label]=\"group.Name\">\r\n <div class=\"mt-3\">\r\n <ng-container [ngTemplateOutlet]=\"fieldTemplates\"\r\n [ngTemplateOutletContext]=\"{ fields: fieldGroups[group.Name] }\">\r\n </ng-container>\r\n </div>\r\n </mat-tab>\r\n </mat-tab-group>\r\n\r\n <!-- VISUALIZZAZIONE AD ACCORDION -->\r\n <mat-accordion multi *ngIf=\"form.FormScalarType == FormScalarTypeEnum['In accordion']\">\r\n <mat-expansion-panel *ngFor=\"let group of form.FormFieldsGroups\">\r\n <mat-expansion-panel-header>\r\n <mat-panel-title>\r\n {{group.Name}}\r\n </mat-panel-title>\r\n </mat-expansion-panel-header>\r\n\r\n <ng-container [ngTemplateOutlet]=\"fieldTemplates\"\r\n [ngTemplateOutletContext]=\"{ fields: fieldGroups[group.Name] }\">\r\n </ng-container>\r\n </mat-expansion-panel>\r\n </mat-accordion>\r\n</form>\r\n\r\n<div class=\"row mt-2\" *ngIf=\"showButtons\">\r\n <div class=\"col-sm-12 text-right\">\r\n <button class=\"mr-2\" mat-raised-button (click)=\"saveOrExitForm(true)\" type=\"button\">\r\n Annulla\r\n </button>\r\n <button class=\"mr-2\" mat-raised-button color=\"primary\" (click)=\"saveOrExitForm(false)\"\r\n [disabled]=\"formForm.invalid || formForm.disabled\" type=\"button\">\r\n Salva\r\n </button>\r\n </div>\r\n</div>\r\n\r\n<!-- TEMPLATE PER LA VISUALIZZAZIONE DEI CAMPI DELLA FORM -->\r\n<ng-template #fieldTemplates let-fields='fields'>\r\n <div class=\"row\">\r\n <div class=\"mt-2\" *ngFor=\"let field of fields\" [ngClass]=\"utilityService.getFieldSyleClass(field)\">\r\n <dynamic-module-field #fieldTemplate [field]=\"field\" [form]=\"form\" [record]=\"record\"\r\n (recordChange)=\"onRecordChange()\"></dynamic-module-field>\r\n </div>\r\n </div>\r\n</ng-template>",
2602
3363
  styles: [""]
2603
3364
  })
2604
3365
  ], AddFormRecordComponent);
@@ -2719,11 +3480,30 @@ __decorate([
2719
3480
  DynamicModuleFieldComponent = __decorate([
2720
3481
  Component({
2721
3482
  selector: 'dynamic-module-field',
2722
- template: "<text-field-template #fieldTemplate *ngIf=\"field.FieldType == FieldTypeEnum['Campo di testo']\"\n [matTooltip]=\"field.Description\" [(record)]=\"record\" [field]=\"field\" (recordChange)=\"onRecordChange()\">\n</text-field-template>\n\n<textarea-field-template #fieldTemplate *ngIf=\"field.FieldType == FieldTypeEnum['Area di testo']\"\n [matTooltip]=\"field.Description\" [(record)]=\"record\" [field]=\"field\" (recordChange)=\"onRecordChange()\">\n</textarea-field-template>\n\n<boolean-field-template #fieldTemplate *ngIf=\"field.FieldType == FieldTypeEnum['Booleano']\"\n [matTooltip]=\"field.Description\" [(record)]=\"record\" [field]=\"field\" (recordChange)=\"onRecordChange()\">\n</boolean-field-template>\n\n<date-field-template #fieldTemplate *ngIf=\"field.FieldType == FieldTypeEnum['Data e/o ora']\"\n [matTooltip]=\"field.Description\" [(record)]=\"record\" [field]=\"field\" (recordChange)=\"onRecordChange()\">\n</date-field-template>\n\n<numeric-field-template #fieldTemplate *ngIf=\"field.FieldType == FieldTypeEnum['Campo numerico']\"\n [matTooltip]=\"field.Description\" [(record)]=\"record\" [field]=\"field\" (recordChange)=\"onRecordChange()\">\n</numeric-field-template>\n\n<list-value-field-template #fieldTemplate *ngIf=\"field.FieldType == FieldTypeEnum['Elenco generico']\"\n [matTooltip]=\"field.Description\" [(record)]=\"record\" [field]=\"field\" (recordChange)=\"onRecordChange()\">\n</list-value-field-template>\n\n<attachment-field-template #fieldTemplate *ngIf=\"field.FieldType == FieldTypeEnum['Allegato']\"\n [matTooltip]=\"field.Description\" [(record)]=\"record\" [field]=\"field\" (recordChange)=\"onRecordChange()\">\n</attachment-field-template>\n\n<image-field-template #fieldTemplate *ngIf=\"field.FieldType == FieldTypeEnum['Immagine']\"\n [matTooltip]=\"field.Description\" [(record)]=\"record\" [field]=\"field\" (recordChange)=\"onRecordChange()\">\n</image-field-template>\n\n<list-form-record #listInnerFormRecords *ngIf=\"field.FieldType == FieldTypeEnum['Form di dettaglio']\"\n [form]=\"getInnerFormFromField(field)\" [values]=\"record[field.Name]\"\n (onAddViewEditRecord)=\"onAddViewEditInnerFormRecord($event, field)\">\n</list-form-record>\n\n<!-- DIALOG PER AGGIUNGERE/MODIFICARE/VISUALIZZARE UN RECORD IN UNA FORM DI DETTAGLIO -->\n<ng-template #dialogInnerFormRecord>\n <add-form-record [form]=\"selectedInnerForm\" [record]=\"selectedInnerFormRecord\" [onlyView]=\"onlyViewInnerFormRecord\"\n (saveRecordEvent)=\"onSaveInnerFormRecord($event)\"></add-form-record>\n</ng-template>",
3483
+ template: "<text-field-template #fieldTemplate *ngIf=\"field.FieldType == FieldTypeEnum['Campo di testo']\"\r\n [matTooltip]=\"field.Description\" [(record)]=\"record\" [field]=\"field\" (recordChange)=\"onRecordChange()\">\r\n</text-field-template>\r\n\r\n<textarea-field-template #fieldTemplate *ngIf=\"field.FieldType == FieldTypeEnum['Area di testo']\"\r\n [matTooltip]=\"field.Description\" [(record)]=\"record\" [field]=\"field\" (recordChange)=\"onRecordChange()\">\r\n</textarea-field-template>\r\n\r\n<boolean-field-template #fieldTemplate *ngIf=\"field.FieldType == FieldTypeEnum['Booleano']\"\r\n [matTooltip]=\"field.Description\" [(record)]=\"record\" [field]=\"field\" (recordChange)=\"onRecordChange()\">\r\n</boolean-field-template>\r\n\r\n<date-field-template #fieldTemplate *ngIf=\"field.FieldType == FieldTypeEnum['Data e/o ora']\"\r\n [matTooltip]=\"field.Description\" [(record)]=\"record\" [field]=\"field\" (recordChange)=\"onRecordChange()\">\r\n</date-field-template>\r\n\r\n<numeric-field-template #fieldTemplate *ngIf=\"field.FieldType == FieldTypeEnum['Campo numerico']\"\r\n [matTooltip]=\"field.Description\" [(record)]=\"record\" [field]=\"field\" (recordChange)=\"onRecordChange()\">\r\n</numeric-field-template>\r\n\r\n<list-value-field-template #fieldTemplate *ngIf=\"field.FieldType == FieldTypeEnum['Elenco generico']\"\r\n [matTooltip]=\"field.Description\" [(record)]=\"record\" [field]=\"field\" (recordChange)=\"onRecordChange()\">\r\n</list-value-field-template>\r\n\r\n<attachment-field-template #fieldTemplate *ngIf=\"field.FieldType == FieldTypeEnum['Allegato']\"\r\n [matTooltip]=\"field.Description\" [(record)]=\"record\" [field]=\"field\" (recordChange)=\"onRecordChange()\">\r\n</attachment-field-template>\r\n\r\n<image-field-template #fieldTemplate *ngIf=\"field.FieldType == FieldTypeEnum['Immagine']\"\r\n [matTooltip]=\"field.Description\" [(record)]=\"record\" [field]=\"field\" (recordChange)=\"onRecordChange()\">\r\n</image-field-template>\r\n\r\n<list-form-record #listInnerFormRecords *ngIf=\"field.FieldType == FieldTypeEnum['Form di dettaglio']\"\r\n [form]=\"getInnerFormFromField(field)\" [values]=\"record[field.Name]\"\r\n (onAddViewEditRecord)=\"onAddViewEditInnerFormRecord($event, field)\">\r\n</list-form-record>\r\n\r\n<!-- DIALOG PER AGGIUNGERE/MODIFICARE/VISUALIZZARE UN RECORD IN UNA FORM DI DETTAGLIO -->\r\n<ng-template #dialogInnerFormRecord>\r\n <add-form-record [form]=\"selectedInnerForm\" [record]=\"selectedInnerFormRecord\" [onlyView]=\"onlyViewInnerFormRecord\"\r\n (saveRecordEvent)=\"onSaveInnerFormRecord($event)\"></add-form-record>\r\n</ng-template>",
2723
3484
  styles: [""]
2724
3485
  })
2725
3486
  ], DynamicModuleFieldComponent);
2726
3487
 
3488
+ let SpinnerComponent = class SpinnerComponent {
3489
+ constructor(spinnerService) {
3490
+ this.spinnerService = spinnerService;
3491
+ this.isLoading = this.spinnerService.isLoading;
3492
+ }
3493
+ ngOnInit() {
3494
+ }
3495
+ };
3496
+ SpinnerComponent.ctorParameters = () => [
3497
+ { type: SpinnerService }
3498
+ ];
3499
+ SpinnerComponent = __decorate([
3500
+ Component({
3501
+ selector: 'eqp-dynamic-module-spinner',
3502
+ template: "<div class=\"eqp-splash-screen\" *ngIf=\"isLoading | async\">\r\n <div id=\"loader\"></div>\r\n</div>",
3503
+ styles: [":host #loader{display:block;position:relative;width:150px;height:150px;border-radius:50%;border:3px solid transparent;border-top-color:var(--primary);-webkit-animation:2s linear infinite spin;animation:2s linear infinite spin}:host #loader:before{content:\"\";position:absolute;top:5px;left:5px;right:5px;bottom:5px;border-radius:50%;border:3px solid transparent;border-top-color:var(--primary);-webkit-animation:3s linear infinite spin;animation:3s linear infinite spin}:host #loader:after{content:\"\";position:absolute;top:15px;left:15px;right:15px;bottom:15px;border-radius:50%;border:3px solid transparent;border-top-color:var(--primary);-webkit-animation:1.5s linear infinite spin;animation:1.5s linear infinite spin}@-webkit-keyframes spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}:host .eqp-splash-screen{background-color:#343a4040;position:fixed;display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;width:100%;z-index:9999}:host .eqp-splash-screen img{margin-left:calc(100vw - 100%);width:90px;margin-bottom:30px}:host .eqp-splash-screen span{margin-left:calc(100vw - 100%);margin-bottom:30px}:host .eqp-splash-screen ::ng-deep .mat-progress-spinner circle,:host .eqp-splash-screen ::ng-deep .mat-spinner circle{stroke:#5d78ff}"]
3504
+ })
3505
+ ], SpinnerComponent);
3506
+
2727
3507
  let EqpDynamicModuleModule = class EqpDynamicModuleModule {
2728
3508
  };
2729
3509
  EqpDynamicModuleModule = __decorate([
@@ -2743,6 +3523,7 @@ EqpDynamicModuleModule = __decorate([
2743
3523
  ListFormRecordComponent,
2744
3524
  AddFormRecordComponent,
2745
3525
  DynamicModuleFieldComponent,
3526
+ SpinnerComponent,
2746
3527
  ],
2747
3528
  imports: [
2748
3529
  BrowserModule,
@@ -2755,7 +3536,8 @@ EqpDynamicModuleModule = __decorate([
2755
3536
  EqpSelectModule,
2756
3537
  EqpDatetimepickerModule,
2757
3538
  EqpFiltersModule,
2758
- EqpNumericModule
3539
+ EqpNumericModule,
3540
+ EqpImgDrawingModule
2759
3541
  ],
2760
3542
  exports: [
2761
3543
  EqpDynamicModuleComponent,
@@ -2771,6 +3553,10 @@ class Entity extends BaseObj {
2771
3553
  }
2772
3554
 
2773
3555
  class ImageField extends BaseField {
3556
+ /**Proprietà per recuperare l'allegato caricato come array per eqp-attachments (se ImageIsContextualAttachment == true) */
3557
+ get _contextualAttachments() {
3558
+ return this.ContextualAttachment ? [this.ContextualAttachment] : [];
3559
+ }
2774
3560
  }
2775
3561
 
2776
3562
  /**Questo tipo di campo rappresenta una lookup ad altri valori */
@@ -2784,10 +3570,6 @@ class NumericField extends BaseField {
2784
3570
  class TextareaField extends BaseField {
2785
3571
  }
2786
3572
 
2787
- /**Campo di testo */
2788
- class TextField extends BaseField {
2789
- }
2790
-
2791
3573
  /*
2792
3574
  * Public API Surface of eqp-dynamic-module
2793
3575
  */
@@ -2796,5 +3578,5 @@ class TextField extends BaseField {
2796
3578
  * Generated bundle index. Do not edit.
2797
3579
  */
2798
3580
 
2799
- export { ActionOnRecord, AddFormFieldComponent, AddFormRecordComponent, ArrayValidators, AttachmentField, AttachmentFieldTemplateComponent, AvailableFileExtensions, AvailableImageExtensions, BaseField, BaseObj, BoolPresentantioEnum, BooleanField, BooleanFieldTemplateComponent, ColSpanSizesEnum, Context, ContextUser, DateField, DateFieldTemplateComponent, DateTimeTypeEnum, DynamicModuleFieldComponent, Entity, EqpDynamicModuleComponent, EqpDynamicModuleConfiguratorComponent, EqpDynamicModuleDialogService, EqpDynamicModuleModule, FieldTypeEnum, Form, FormFieldGroup, FormScalarTypeEnum, FormTypeEnum, ImageField, ImageFieldTemplateComponent, ListFormRecordComponent, ListPresentationEnum, ListValueField, ListValueFieldTemplateComponent, LookupField, NumericField, NumericFieldTemplateComponent, Record, TextField, TextFieldTemplateComponent, TextareaField, TextareaFieldTemplateComponent, UtilityHelperService, MaterialModule as ɵa };
3581
+ export { ActionOnRecord, AddFormFieldComponent, AddFormRecordComponent, ArrayValidators, AttachmentField, AttachmentFieldTemplateComponent, AvailableFileExtensions, AvailableImageExtensions, BaseField, BaseObj, BoolPresentantioEnum, BooleanField, BooleanFieldTemplateComponent, ButtonImage, ColSpanSizesEnum, Context, ContextUser, DateField, DateFieldTemplateComponent, DateTimeTypeEnum, DynRecord, DynamicModuleFieldComponent, EndPointConfiguration, EndPointData, EndPointDataParams, Entity, EqpDynamicModuleComponent, EqpDynamicModuleConfiguratorComponent, EqpDynamicModuleDialogService, EqpDynamicModuleModule, FieldTypeEnum, Form, FormFieldGroup, FormScalarTypeEnum, FormTypeEnum, ImageField, ImageFieldTemplateComponent, ListFormRecordComponent, ListPresentationEnum, ListValueField, ListValueFieldTemplateComponent, LookupField, NumericField, NumericFieldTemplateComponent, ParamTypeEnum, Record, RequestMethodEnum, SpinnerService, TelRegex, TextField, TextFieldTemplateComponent, TextMaskEnum, TextareaField, TextareaFieldTemplateComponent, UrlRegex, UtilityHelperService, ɵ0, SpinnerComponent as ɵa, MaterialModule as ɵb };
2800
3582
  //# sourceMappingURL=eqproject-eqp-dynamic-module.js.map