@eqproject/eqp-dynamic-module 0.0.1

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 (125) hide show
  1. package/README.md +24 -0
  2. package/bundles/eqproject-eqp-dynamic-module.umd.js +3117 -0
  3. package/bundles/eqproject-eqp-dynamic-module.umd.js.map +1 -0
  4. package/bundles/eqproject-eqp-dynamic-module.umd.min.js +17 -0
  5. package/bundles/eqproject-eqp-dynamic-module.umd.min.js.map +1 -0
  6. package/eqproject-eqp-dynamic-module.d.ts +5 -0
  7. package/eqproject-eqp-dynamic-module.metadata.json +1 -0
  8. package/esm2015/eqproject-eqp-dynamic-module.js +6 -0
  9. package/esm2015/lib/components/exported/eqp-dynamic-module/eqp-dynamic-module.component.js +65 -0
  10. package/esm2015/lib/components/exported/eqp-dynamic-module-configurator/eqp-dynamic-module-configurator.component.js +534 -0
  11. package/esm2015/lib/components/private/add-form-field/add-form-field.component.js +486 -0
  12. package/esm2015/lib/components/private/dynamic-module-field/dynamic-module-field.component.js +127 -0
  13. package/esm2015/lib/components/private/field-templates/attachment-field-template/attachment-field-template.component.js +181 -0
  14. package/esm2015/lib/components/private/field-templates/boolean-field-template/boolean-field-template.component.js +56 -0
  15. package/esm2015/lib/components/private/field-templates/date-field-template/date-field-template.component.js +71 -0
  16. package/esm2015/lib/components/private/field-templates/image-field-template/image-field-template.component.js +54 -0
  17. package/esm2015/lib/components/private/field-templates/list-value-field-template/list-value-field-template.component.js +118 -0
  18. package/esm2015/lib/components/private/field-templates/numeric-field-template/numeric-field-template.component.js +63 -0
  19. package/esm2015/lib/components/private/field-templates/text-field-template/text-field-template.component.js +51 -0
  20. package/esm2015/lib/components/private/field-templates/textarea-field-template/textarea-field-template.component.js +51 -0
  21. package/esm2015/lib/components/private/form-records/add-form-record/add-form-record.component.js +126 -0
  22. package/esm2015/lib/components/private/form-records/list-form-record/list-form-record.component.js +210 -0
  23. package/esm2015/lib/eqp-dynamic-module.module.js +67 -0
  24. package/esm2015/lib/interfaces/iBaseFieldComponent.interface.js +1 -0
  25. package/esm2015/lib/interfaces/iRootObject.interface.js +1 -0
  26. package/esm2015/lib/models/baseField.model.js +36 -0
  27. package/esm2015/lib/models/baseObj.model.js +9 -0
  28. package/esm2015/lib/models/context.model.js +8 -0
  29. package/esm2015/lib/models/entity.model.js +7 -0
  30. package/esm2015/lib/models/fields/attachmentField.model.js +22 -0
  31. package/esm2015/lib/models/fields/booleanField.model.js +12 -0
  32. package/esm2015/lib/models/fields/dateField.model.js +11 -0
  33. package/esm2015/lib/models/fields/imageField.model.js +4 -0
  34. package/esm2015/lib/models/fields/listValueField.model.js +12 -0
  35. package/esm2015/lib/models/fields/lookupField.model.js +5 -0
  36. package/esm2015/lib/models/fields/numericField.model.js +5 -0
  37. package/esm2015/lib/models/fields/testareaField.model.js +4 -0
  38. package/esm2015/lib/models/fields/textField.model.js +5 -0
  39. package/esm2015/lib/models/form.model.js +24 -0
  40. package/esm2015/lib/models/record.model.js +3 -0
  41. package/esm2015/lib/modules/material.module.js +108 -0
  42. package/esm2015/lib/services/custom-form-validators.service.js +19 -0
  43. package/esm2015/lib/services/eqp-dynamic-module-dialog.service.js +104 -0
  44. package/esm2015/lib/services/utilityHelper.services.js +220 -0
  45. package/esm2015/public-api.js +37 -0
  46. package/esm5/eqproject-eqp-dynamic-module.js +6 -0
  47. package/esm5/lib/components/exported/eqp-dynamic-module/eqp-dynamic-module.component.js +66 -0
  48. package/esm5/lib/components/exported/eqp-dynamic-module-configurator/eqp-dynamic-module-configurator.component.js +546 -0
  49. package/esm5/lib/components/private/add-form-field/add-form-field.component.js +497 -0
  50. package/esm5/lib/components/private/dynamic-module-field/dynamic-module-field.component.js +128 -0
  51. package/esm5/lib/components/private/field-templates/attachment-field-template/attachment-field-template.component.js +184 -0
  52. package/esm5/lib/components/private/field-templates/boolean-field-template/boolean-field-template.component.js +57 -0
  53. package/esm5/lib/components/private/field-templates/date-field-template/date-field-template.component.js +72 -0
  54. package/esm5/lib/components/private/field-templates/image-field-template/image-field-template.component.js +55 -0
  55. package/esm5/lib/components/private/field-templates/list-value-field-template/list-value-field-template.component.js +121 -0
  56. package/esm5/lib/components/private/field-templates/numeric-field-template/numeric-field-template.component.js +64 -0
  57. package/esm5/lib/components/private/field-templates/text-field-template/text-field-template.component.js +52 -0
  58. package/esm5/lib/components/private/field-templates/textarea-field-template/textarea-field-template.component.js +52 -0
  59. package/esm5/lib/components/private/form-records/add-form-record/add-form-record.component.js +129 -0
  60. package/esm5/lib/components/private/form-records/list-form-record/list-form-record.component.js +216 -0
  61. package/esm5/lib/eqp-dynamic-module.module.js +70 -0
  62. package/esm5/lib/interfaces/iBaseFieldComponent.interface.js +1 -0
  63. package/esm5/lib/interfaces/iRootObject.interface.js +1 -0
  64. package/esm5/lib/models/baseField.model.js +43 -0
  65. package/esm5/lib/models/baseObj.model.js +13 -0
  66. package/esm5/lib/models/context.model.js +14 -0
  67. package/esm5/lib/models/entity.model.js +14 -0
  68. package/esm5/lib/models/fields/attachmentField.model.js +29 -0
  69. package/esm5/lib/models/fields/booleanField.model.js +19 -0
  70. package/esm5/lib/models/fields/dateField.model.js +18 -0
  71. package/esm5/lib/models/fields/imageField.model.js +11 -0
  72. package/esm5/lib/models/fields/listValueField.model.js +19 -0
  73. package/esm5/lib/models/fields/lookupField.model.js +12 -0
  74. package/esm5/lib/models/fields/numericField.model.js +12 -0
  75. package/esm5/lib/models/fields/testareaField.model.js +11 -0
  76. package/esm5/lib/models/fields/textField.model.js +12 -0
  77. package/esm5/lib/models/form.model.js +39 -0
  78. package/esm5/lib/models/record.model.js +7 -0
  79. package/esm5/lib/modules/material.module.js +111 -0
  80. package/esm5/lib/services/custom-form-validators.service.js +23 -0
  81. package/esm5/lib/services/eqp-dynamic-module-dialog.service.js +113 -0
  82. package/esm5/lib/services/utilityHelper.services.js +225 -0
  83. package/esm5/public-api.js +37 -0
  84. package/fesm2015/eqproject-eqp-dynamic-module.js +2757 -0
  85. package/fesm2015/eqproject-eqp-dynamic-module.js.map +1 -0
  86. package/fesm5/eqproject-eqp-dynamic-module.js +2902 -0
  87. package/fesm5/eqproject-eqp-dynamic-module.js.map +1 -0
  88. package/lib/components/exported/eqp-dynamic-module/eqp-dynamic-module.component.d.ts +21 -0
  89. package/lib/components/exported/eqp-dynamic-module-configurator/eqp-dynamic-module-configurator.component.d.ts +186 -0
  90. package/lib/components/private/add-form-field/add-form-field.component.d.ts +160 -0
  91. package/lib/components/private/dynamic-module-field/dynamic-module-field.component.d.ts +55 -0
  92. package/lib/components/private/field-templates/attachment-field-template/attachment-field-template.component.d.ts +84 -0
  93. package/lib/components/private/field-templates/boolean-field-template/boolean-field-template.component.d.ts +21 -0
  94. package/lib/components/private/field-templates/date-field-template/date-field-template.component.d.ts +27 -0
  95. package/lib/components/private/field-templates/image-field-template/image-field-template.component.d.ts +16 -0
  96. package/lib/components/private/field-templates/list-value-field-template/list-value-field-template.component.d.ts +59 -0
  97. package/lib/components/private/field-templates/numeric-field-template/numeric-field-template.component.d.ts +26 -0
  98. package/lib/components/private/field-templates/text-field-template/text-field-template.component.d.ts +20 -0
  99. package/lib/components/private/field-templates/textarea-field-template/textarea-field-template.component.d.ts +20 -0
  100. package/lib/components/private/form-records/add-form-record/add-form-record.component.d.ts +50 -0
  101. package/lib/components/private/form-records/list-form-record/list-form-record.component.d.ts +59 -0
  102. package/lib/eqp-dynamic-module.module.d.ts +2 -0
  103. package/lib/interfaces/iBaseFieldComponent.interface.d.ts +8 -0
  104. package/lib/interfaces/iRootObject.interface.d.ts +10 -0
  105. package/lib/models/baseField.model.d.ts +56 -0
  106. package/lib/models/baseObj.model.d.ts +9 -0
  107. package/lib/models/context.model.d.ts +9 -0
  108. package/lib/models/entity.model.d.ts +10 -0
  109. package/lib/models/fields/attachmentField.model.d.ts +17 -0
  110. package/lib/models/fields/booleanField.model.d.ts +11 -0
  111. package/lib/models/fields/dateField.model.d.ts +12 -0
  112. package/lib/models/fields/imageField.model.d.ts +10 -0
  113. package/lib/models/fields/listValueField.model.d.ts +21 -0
  114. package/lib/models/fields/lookupField.model.d.ts +10 -0
  115. package/lib/models/fields/numericField.model.d.ts +9 -0
  116. package/lib/models/fields/testareaField.model.d.ts +7 -0
  117. package/lib/models/fields/textField.model.d.ts +7 -0
  118. package/lib/models/form.model.d.ts +45 -0
  119. package/lib/models/record.model.d.ts +5 -0
  120. package/lib/modules/material.module.d.ts +2 -0
  121. package/lib/services/custom-form-validators.service.d.ts +5 -0
  122. package/lib/services/eqp-dynamic-module-dialog.service.d.ts +28 -0
  123. package/lib/services/utilityHelper.services.d.ts +48 -0
  124. package/package.json +39 -0
  125. package/public-api.d.ts +35 -0
@@ -0,0 +1,2757 @@
1
+ import { __decorate } from 'tslib';
2
+ import { CommonModule } from '@angular/common';
3
+ import { ɵɵdefineInjectable, ɵɵinject, Injectable, Input, Component, NgModule, EventEmitter, ViewChild, Output, ChangeDetectorRef, ViewChildren } from '@angular/core';
4
+ import { Validators, FormControl, FormBuilder, FormsModule, ReactiveFormsModule } from '@angular/forms';
5
+ import { MatCheckboxModule } from '@angular/material/checkbox';
6
+ import { MatButtonModule } from '@angular/material/button';
7
+ import { MatInputModule } from '@angular/material/input';
8
+ import { MatAutocompleteModule } from '@angular/material/autocomplete';
9
+ import { MatDatepickerModule } from '@angular/material/datepicker';
10
+ import { MatFormFieldModule } from '@angular/material/form-field';
11
+ import { MatRadioModule } from '@angular/material/radio';
12
+ import { MatSelectModule } from '@angular/material/select';
13
+ import { MatSliderModule } from '@angular/material/slider';
14
+ import { MatSlideToggleModule } from '@angular/material/slide-toggle';
15
+ import { MatMenuModule } from '@angular/material/menu';
16
+ import { MatSidenavModule } from '@angular/material/sidenav';
17
+ import { MatToolbarModule } from '@angular/material/toolbar';
18
+ import { MatListModule } from '@angular/material/list';
19
+ import { MatGridListModule } from '@angular/material/grid-list';
20
+ import { MatCardModule } from '@angular/material/card';
21
+ import { MatStepperModule } from '@angular/material/stepper';
22
+ import { MatTabsModule } from '@angular/material/tabs';
23
+ import { MatExpansionModule } from '@angular/material/expansion';
24
+ import { MatButtonToggleModule } from '@angular/material/button-toggle';
25
+ import { MatChipsModule } from '@angular/material/chips';
26
+ import { MatIconModule } from '@angular/material/icon';
27
+ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
28
+ import { MatProgressBarModule } from '@angular/material/progress-bar';
29
+ import { MatDialogModule, MatDialog } from '@angular/material/dialog';
30
+ import { MatTooltipModule } from '@angular/material/tooltip';
31
+ import { MatSnackBarModule } from '@angular/material/snack-bar';
32
+ import { MatTableModule } from '@angular/material/table';
33
+ import { MatSortModule } from '@angular/material/sort';
34
+ import { MatPaginatorModule } from '@angular/material/paginator';
35
+ import { MatNativeDateModule } from '@angular/material/core';
36
+ import { TypeColumn, CellAlignmentEnum, NumberColumnPipe, EqpTableModule } from '@eqproject/eqp-table';
37
+ import { EqpAttachmentsModule } from '@eqproject/eqp-attachments';
38
+ import { EnumHelper, EqpSelectModule } from '@eqproject/eqp-select';
39
+ import { PickerModeEnum, EqpDatetimepickerModule } from '@eqproject/eqp-datetimepicker';
40
+ import { EqpFiltersModule } from '@eqproject/eqp-filters';
41
+ import { EqpNumericModule } from '@eqproject/eqp-numeric';
42
+ import Swal from 'sweetalert2';
43
+ import { BrowserModule } from '@angular/platform-browser';
44
+ import { UtilityHelperService as UtilityHelperService$1 } from 'projects/eqp-dynamic-module/src/lib/services/utilityHelper.services';
45
+ import { UtilityHelperService as UtilityHelperService$2, EqpDynamicModuleDialogService as EqpDynamicModuleDialogService$1, FieldTypeEnum as FieldTypeEnum$1, DateTimeTypeEnum as DateTimeTypeEnum$1 } from 'projects/eqp-dynamic-module/src/public-api';
46
+
47
+ class Context {
48
+ constructor() {
49
+ this.User = new ContextUser();
50
+ }
51
+ }
52
+ class ContextUser {
53
+ }
54
+
55
+ /**
56
+ * Classe base che implementa la valorizzazione dell'ID (se null) con una nuova GUID
57
+ * in creazione dell'oggetto.
58
+ * Per scelta architetturale, visto che non possiamo assumere la persistenza su DB relazionale o su NOSQL, ogni
59
+ * oggetto della configurazione viene persistito, e gestito con ID di tipo stringa creato da una GUID.
60
+ */
61
+ class BaseObj {
62
+ }
63
+
64
+ /**
65
+ * Classe che rappresenta una Form completa.
66
+ * Si tratta dell'oggetto che viene rappresentato a video e con cui l'utente interagisce.
67
+ */
68
+ class Form extends BaseObj {
69
+ }
70
+ class FormFieldGroup {
71
+ }
72
+ class ActionOnRecord {
73
+ }
74
+ var FormTypeEnum;
75
+ (function (FormTypeEnum) {
76
+ FormTypeEnum[FormTypeEnum["SCALAR"] = 1] = "SCALAR";
77
+ FormTypeEnum[FormTypeEnum["LIST"] = 2] = "LIST"; /* form di tipo lista che viene rappresentata con molti record */
78
+ })(FormTypeEnum || (FormTypeEnum = {}));
79
+ var FormScalarTypeEnum;
80
+ (function (FormScalarTypeEnum) {
81
+ FormScalarTypeEnum[FormScalarTypeEnum["Semplice"] = 1] = "Semplice";
82
+ FormScalarTypeEnum[FormScalarTypeEnum["A step"] = 2] = "A step";
83
+ FormScalarTypeEnum[FormScalarTypeEnum["In tab"] = 3] = "In tab";
84
+ FormScalarTypeEnum[FormScalarTypeEnum["In accordion"] = 4] = "In accordion"; //GROUPED_BY_ACCORDION
85
+ })(FormScalarTypeEnum || (FormScalarTypeEnum = {}));
86
+
87
+ /**
88
+ * Contiene le informazioni di base del campo, indipendentemente dal tipo.
89
+ * Questa classe è volutamente astratta perché il tipo di campo è dettato dal tipo
90
+ */
91
+ class BaseField extends BaseObj {
92
+ }
93
+ var FieldTypeEnum;
94
+ (function (FieldTypeEnum) {
95
+ FieldTypeEnum[FieldTypeEnum["Campo di testo"] = 1] = "Campo di testo";
96
+ FieldTypeEnum[FieldTypeEnum["Area di testo"] = 2] = "Area di testo";
97
+ FieldTypeEnum[FieldTypeEnum["Booleano"] = 3] = "Booleano";
98
+ FieldTypeEnum[FieldTypeEnum["Data e/o ora"] = 4] = "Data e/o ora";
99
+ FieldTypeEnum[FieldTypeEnum["Campo numerico"] = 5] = "Campo numerico";
100
+ FieldTypeEnum[FieldTypeEnum["Allegato"] = 6] = "Allegato";
101
+ FieldTypeEnum[FieldTypeEnum["Immagine"] = 7] = "Immagine";
102
+ FieldTypeEnum[FieldTypeEnum["Elenco generico"] = 8] = "Elenco generico";
103
+ FieldTypeEnum[FieldTypeEnum["Lookup"] = 9] = "Lookup";
104
+ FieldTypeEnum[FieldTypeEnum["Form di dettaglio"] = 10] = "Form di dettaglio";
105
+ })(FieldTypeEnum || (FieldTypeEnum = {}));
106
+ var ColSpanSizesEnum;
107
+ (function (ColSpanSizesEnum) {
108
+ ColSpanSizesEnum[ColSpanSizesEnum["col-sm-3"] = 1] = "col-sm-3";
109
+ ColSpanSizesEnum[ColSpanSizesEnum["col-sm-4"] = 2] = "col-sm-4";
110
+ ColSpanSizesEnum[ColSpanSizesEnum["col-sm-6"] = 3] = "col-sm-6";
111
+ ColSpanSizesEnum[ColSpanSizesEnum["col-sm-12"] = 4] = "col-sm-12";
112
+ ColSpanSizesEnum[ColSpanSizesEnum["col-md-3"] = 5] = "col-md-3";
113
+ ColSpanSizesEnum[ColSpanSizesEnum["col-md-4"] = 6] = "col-md-4";
114
+ ColSpanSizesEnum[ColSpanSizesEnum["col-md-6"] = 7] = "col-md-6";
115
+ ColSpanSizesEnum[ColSpanSizesEnum["col-md-12"] = 8] = "col-md-12";
116
+ ColSpanSizesEnum[ColSpanSizesEnum["col-lg-3"] = 9] = "col-lg-3";
117
+ ColSpanSizesEnum[ColSpanSizesEnum["col-lg-4"] = 10] = "col-lg-4";
118
+ ColSpanSizesEnum[ColSpanSizesEnum["col-lg-6"] = 11] = "col-lg-6";
119
+ ColSpanSizesEnum[ColSpanSizesEnum["col-lg-12"] = 12] = "col-lg-12";
120
+ })(ColSpanSizesEnum || (ColSpanSizesEnum = {}));
121
+
122
+ class ArrayValidators {
123
+ static minLenght(minLenght) {
124
+ var validationFunction = (control) => {
125
+ return !!control && !!control.value && Array.isArray(control.value) && control.value.length >= minLenght
126
+ ? null
127
+ : { hasMinLenght: false };
128
+ };
129
+ return validationFunction;
130
+ }
131
+ static maxLenght(maxLenght) {
132
+ var validationFunction = (control) => {
133
+ return !!control && !!control.value && Array.isArray(control.value) && control.value.length <= maxLenght
134
+ ? null
135
+ : { hasMinLenght: false };
136
+ };
137
+ return validationFunction;
138
+ }
139
+ }
140
+
141
+ var UtilityHelperService_1;
142
+ let UtilityHelperService = UtilityHelperService_1 = class UtilityHelperService {
143
+ constructor(formBuilder) {
144
+ this.formBuilder = formBuilder;
145
+ }
146
+ static EvaluateFieldFormula(formula, rec, ctx) {
147
+ const evaluatedValue = eval(formula.replace('"', '\"'));
148
+ return (evaluatedValue ? evaluatedValue : null);
149
+ }
150
+ static SetContext(ctx) {
151
+ this.context = ctx;
152
+ }
153
+ /**
154
+ * Metodo per impostare i valori da suggerire nell'autocomplete per i campi in cui l'utente deve scrivere comandi javascript.
155
+ * In base all'ultimo carattere digitato viene impostato un elenco di oggetti o proprietà che l'utente ha a disposizione in quel momento.
156
+ * @param fields Array di BaseField aggiunti alla Form
157
+ * @param typedFormula Stringa digitata dall'utente
158
+ * @summary Il metodo imposta i suggerimenti basandosi su 3 casi:
159
+ * 1) l'utente non ha digitato nulla o la stringa digitata dall'utente finisce con uno spazio vuoto
160
+ * 2) la stringa digitata dall'utente finisce con un "."
161
+ * 3) la stringa digitata dall'utente non coincide con nessun altro caso sopra (finisce con un carattere qualunque)
162
+ */
163
+ static GetAutocompleteOptions(fields, typedFormula) {
164
+ var autocompleteOptions = [];
165
+ // Recupero i nomi di tutti i campi creati fino ad ora nella form.
166
+ const availableRecProperties = fields.map(f => f.Label.split(' ').join('_'));
167
+ // Nel casi in cui l'utente non ha inserito nulla oppure la stringa finisce con uno spazio vuoto o un simbolo diverso da "."
168
+ // (un carattere non alfanumerico) imposto come suggerimenti solo "rec" e "ctx", ovvero gli unici due oggetti a cui l'utente ha accesso.
169
+ if (!typedFormula ||
170
+ (!typedFormula.endsWith(".")
171
+ && new RegExp("[^0-9a-zA-Z_]").test(typedFormula.substring(typedFormula.length - 1, typedFormula.length)))) {
172
+ autocompleteOptions = [
173
+ { label: "rec", value: (typedFormula ? typedFormula : '') + "rec" },
174
+ { label: "ctx", value: (typedFormula ? typedFormula : '') + "ctx" }
175
+ ];
176
+ }
177
+ // Se la stringa finisce con un "." vuol dire che l'utente sta cercando di accedere ad una proprietà di un oggetto
178
+ // a sua disposizione. Recupero il nome dell'ultimo oggetto digitato dall'utente e se l'oggetto scelto è "rec" o "ctx"
179
+ // allora suggerisco le proprietà che esistono all'interno di questi oggetti altrimenti non mostro nulla.
180
+ else if (typedFormula.endsWith(".")) {
181
+ const formulaPieces = typedFormula.split(" ")[typedFormula.split(" ").length - 1].split('.');
182
+ if (formulaPieces[formulaPieces.length - 2] === "rec") {
183
+ autocompleteOptions = availableRecProperties.map(f => { return { label: f, value: typedFormula + f }; });
184
+ }
185
+ else if (formulaPieces[formulaPieces.length - 2] === "ctx") {
186
+ autocompleteOptions = Object.keys(UtilityHelperService_1.context).map(f => { return { label: f, value: typedFormula + f }; });
187
+ }
188
+ else if (formulaPieces.length > 2 && formulaPieces[formulaPieces.length - 3] === "ctx" && formulaPieces[formulaPieces.length - 2] === "User") {
189
+ autocompleteOptions = Object.keys(UtilityHelperService_1.context.User).map(f => { return { label: f, value: typedFormula + f }; });
190
+ }
191
+ else {
192
+ autocompleteOptions = [];
193
+ }
194
+ }
195
+ // In tutti gli altri casi, ovvero quando la stringa digitata finisce con un carattere diverso da quelli
196
+ // controllati finora, vuol dire che l'utente sta digitanto il nome di un oggetto, una proprietà o una
197
+ // funzione javascript. Controllo la parola che l'utente sta digitando e se fa parte di uno degli oggetti a disposizione
198
+ // o una proprietà di essi allora suggerisco i possibili match.
199
+ else {
200
+ var availableOptions = [];
201
+ // Prendo tutti i blocchi di caratteri digitati dall'utente
202
+ const allFormulaWords = typedFormula.split(" ");
203
+ // Prendo l'ultimo blocco di caratteri digitato dall'utente
204
+ var lastTypedString = allFormulaWords[allFormulaWords.length - 1];
205
+ // Se la l'ultima stringa digitata non contiene caratteri speciali allora splitto la stringa
206
+ // sui "." e imposto i suggerimenti in base al path della prorpietà che si sta digitando.
207
+ if (!new RegExp("[^0-9a-zA-Z_.]").test(lastTypedString)) {
208
+ var propertyPath = lastTypedString.split(".");
209
+ var lastTypedWork = propertyPath[propertyPath.length - 1];
210
+ var propertiesToCheck = [];
211
+ if (propertyPath.length == 1) {
212
+ propertiesToCheck = ["rec", "ctx"];
213
+ }
214
+ else if (propertyPath.length > 1 && propertyPath[propertyPath.length - 2] === "ctx") {
215
+ propertiesToCheck = Object.keys(UtilityHelperService_1.context);
216
+ }
217
+ else if (propertyPath.length > 2 && propertyPath[propertyPath.length - 3] === "ctx" && propertyPath[propertyPath.length - 2] === "User") {
218
+ propertiesToCheck = Object.keys(UtilityHelperService_1.context.User);
219
+ }
220
+ else if (propertyPath.length > 1 && propertyPath[propertyPath.length - 2] === "rec") {
221
+ propertiesToCheck = availableRecProperties;
222
+ }
223
+ // Eseguo il controllo sulle proprietà recuperate, aggiungo ai suggerimenti tutti i nomi che iniziano con
224
+ // quello che sta digitando l'utente.
225
+ propertiesToCheck.forEach(prop => {
226
+ if (prop.startsWith(lastTypedWork)) {
227
+ availableOptions.push({ label: prop, value: typedFormula + prop.substring(lastTypedWork.length, prop.length) });
228
+ }
229
+ });
230
+ }
231
+ autocompleteOptions = availableOptions;
232
+ }
233
+ return autocompleteOptions;
234
+ }
235
+ /**
236
+ * Metodo invocato dall'html per impostare le classi css per visualizzare il campo all'interno della form.
237
+ * Se per il field sono state specificate delle classi allora vengono applcate quelle, altrimenti vengono usate
238
+ * delle classi di default.
239
+ * @param field BaseField da visualizzare.
240
+ * @returns Restituisce una stringa contenente le classi css da applicare.
241
+ */
242
+ getFieldSyleClass(field) {
243
+ if (field.ColSpanSizes && field.ColSpanSizes.length > 0)
244
+ return field.ColSpanSizes.map(size => ColSpanSizesEnum[size].toString()).join(" ");
245
+ switch (field.FieldType) {
246
+ case FieldTypeEnum["Campo di testo"]:
247
+ return "col-sm-12 col-md-4 col-lg-4";
248
+ case FieldTypeEnum["Area di testo"]:
249
+ return "col-sm-12 col-md-12 col-lg-12";
250
+ case FieldTypeEnum["Booleano"]:
251
+ return "col-sm-12 col-md-4 col-lg-4 d-flex align-items-center";
252
+ case FieldTypeEnum["Data e/o ora"]:
253
+ return "col-sm-12 col-md-4 col-lg-4";
254
+ case FieldTypeEnum["Campo numerico"]:
255
+ return "col-sm-12 col-md-4 col-lg-4";
256
+ case FieldTypeEnum["Allegato"]:
257
+ if (field.IsMultiAttach ||
258
+ (field.MetadataFields && field.MetadataFields.length > 0)) {
259
+ return "col-sm-12 col-md-12 col-lg-12";
260
+ }
261
+ else {
262
+ return "col-sm-12 col-md-4 col-lg-4";
263
+ }
264
+ case FieldTypeEnum["Immagine"]:
265
+ if (field.AttachDefinition.IsMultiAttach ||
266
+ (field.AttachDefinition.MetadataFields && field.AttachDefinition.MetadataFields.length > 0)) {
267
+ return "col-sm-12 col-md-12 col-lg-12";
268
+ }
269
+ else {
270
+ return "col-sm-12 col-md-4 col-lg-4";
271
+ }
272
+ case FieldTypeEnum["Elenco generico"]:
273
+ return "col-sm-12 col-md-4 col-lg-4";
274
+ case FieldTypeEnum["Lookup"]:
275
+ return "col-sm-12 col-md-4 col-lg-4";
276
+ case FieldTypeEnum['Form di dettaglio']:
277
+ return "col-sm-12 col-md-12 col-lg-12";
278
+ }
279
+ }
280
+ /**
281
+ * Metodo per creare il FormGroup che rappresenta una Form a partire dai suoi BaseField.
282
+ * @param formFields Lista dei BaseField che compongono la form.
283
+ * @param record Oggetto di tipo Record che contiene i valori dei campi.
284
+ * @param onlyView Se TRUE disabilita la form per renderla in sola lettura.
285
+ * @param includeCurrentFormInField Se TRUE popola la proprietà FormFormGroup all'interno di ogni BaseField con il FormGroup corrente.
286
+ * @returns Restituisce un FormGroup rappresentate la Form a cui appartengono i BaseField ricevuti in input.
287
+ */
288
+ CreateFormFormGroup(formFields, record, onlyView = false, includeCurrentFormInField = true) {
289
+ var formForm = this.formBuilder.group([]);
290
+ formFields.forEach(field => {
291
+ formForm.addControl(field.Name, this.createFieldFormControl(field, record));
292
+ if (includeCurrentFormInField) {
293
+ field.FormFormGroup = formForm;
294
+ }
295
+ });
296
+ if (onlyView) {
297
+ formForm.disable();
298
+ }
299
+ return formForm;
300
+ }
301
+ /**
302
+ * Funzione per creare e aggiungere al FormGroup rappresentante la form un nuovo FormControl a partire da un Field.
303
+ * In nuovo FormControl avrà il nome del campo passato e verranno impostati i Validators in base al tipo del campo stesso.
304
+ * @param field BaseField per cui creare il FormControl da inserire nel FormGroup dela form.
305
+ */
306
+ createFieldFormControl(field, record) {
307
+ const validators = [];
308
+ if (field.Required)
309
+ validators.push(Validators.required);
310
+ switch (field.FieldType) {
311
+ case FieldTypeEnum["Campo di testo"]:
312
+ if (field.MaxLenght) {
313
+ validators.push(Validators.maxLength(field.MaxLenght));
314
+ }
315
+ if (field.MinLenght) {
316
+ validators.push(Validators.minLength(field.MinLenght));
317
+ }
318
+ break;
319
+ case FieldTypeEnum["Area di testo"]:
320
+ if (field.MaxLenght) {
321
+ validators.push(Validators.maxLength(field.MaxLenght));
322
+ }
323
+ if (field.MinLenght) {
324
+ validators.push(Validators.minLength(field.MinLenght));
325
+ }
326
+ break;
327
+ case FieldTypeEnum.Allegato:
328
+ case FieldTypeEnum.Immagine:
329
+ if (field.Required)
330
+ validators.push(ArrayValidators.minLenght(1));
331
+ break;
332
+ case FieldTypeEnum['Elenco generico']:
333
+ if (field.IsMultiChoiche)
334
+ if (field.Required)
335
+ validators.push(ArrayValidators.minLenght(1));
336
+ break;
337
+ }
338
+ return new FormControl(record[field.Name], validators);
339
+ }
340
+ };
341
+ UtilityHelperService.context = new Context();
342
+ UtilityHelperService.ctorParameters = () => [
343
+ { type: FormBuilder }
344
+ ];
345
+ UtilityHelperService.ɵprov = ɵɵdefineInjectable({ factory: function UtilityHelperService_Factory() { return new UtilityHelperService(ɵɵinject(FormBuilder)); }, token: UtilityHelperService, providedIn: "root" });
346
+ UtilityHelperService = UtilityHelperService_1 = __decorate([
347
+ Injectable({
348
+ providedIn: 'root'
349
+ })
350
+ ], UtilityHelperService);
351
+
352
+ let EqpDynamicModuleComponent = class EqpDynamicModuleComponent {
353
+ constructor() {
354
+ this.context = new Context();
355
+ this.form = new Form();
356
+ this.showButtons = true;
357
+ this.viewMode = FormTypeEnum.LIST;
358
+ this.FormTypeEnum = FormTypeEnum;
359
+ }
360
+ ngOnInit() {
361
+ UtilityHelperService.SetContext(this.context);
362
+ }
363
+ onAddViewEditRecord(event) {
364
+ if (event != null) {
365
+ this.selectedRecord = JSON.parse(JSON.stringify(event.record));
366
+ this.onlyView = event.onlyView;
367
+ }
368
+ else {
369
+ this.selectedRecord = null;
370
+ this.onlyView = false;
371
+ }
372
+ this.viewMode = FormTypeEnum.SCALAR;
373
+ }
374
+ onSaveForm(event) {
375
+ //TODO: Salvare il record!
376
+ if (event != null) {
377
+ if (event.ID && this.values.find(v => v.ID == event.ID)) {
378
+ this.values[this.values.findIndex(v => v.ID == event.ID)] = event;
379
+ }
380
+ else {
381
+ this.values.push(event);
382
+ }
383
+ }
384
+ this.viewMode = FormTypeEnum.LIST;
385
+ console.log(event);
386
+ }
387
+ };
388
+ __decorate([
389
+ Input()
390
+ ], EqpDynamicModuleComponent.prototype, "context", void 0);
391
+ __decorate([
392
+ Input()
393
+ ], EqpDynamicModuleComponent.prototype, "form", void 0);
394
+ __decorate([
395
+ Input()
396
+ ], EqpDynamicModuleComponent.prototype, "values", void 0);
397
+ __decorate([
398
+ Input()
399
+ ], EqpDynamicModuleComponent.prototype, "showButtons", void 0);
400
+ __decorate([
401
+ Input()
402
+ ], EqpDynamicModuleComponent.prototype, "viewMode", void 0);
403
+ EqpDynamicModuleComponent = __decorate([
404
+ Component({
405
+ selector: 'eqp-dynamic-module',
406
+ template: "<add-form-record *ngIf=\"viewMode == FormTypeEnum.SCALAR\" [form]=\"form\" [record]=\"selectedRecord\"\r\n [showButtons]=\"showButtons\" [onlyView]=\"onlyView\" (saveRecordEvent)=\"onSaveForm($event)\">\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)\">\r\n</list-form-record>",
407
+ styles: ["::ng-deep mat-form-field{width:100%}"]
408
+ })
409
+ ], EqpDynamicModuleComponent);
410
+
411
+ let MaterialModule = class MaterialModule {
412
+ };
413
+ MaterialModule = __decorate([
414
+ NgModule({
415
+ imports: [
416
+ MatCheckboxModule,
417
+ MatButtonModule,
418
+ MatInputModule,
419
+ MatAutocompleteModule,
420
+ MatDatepickerModule,
421
+ MatFormFieldModule,
422
+ MatRadioModule,
423
+ MatSelectModule,
424
+ MatSliderModule,
425
+ MatSlideToggleModule,
426
+ MatMenuModule,
427
+ MatSidenavModule,
428
+ MatToolbarModule,
429
+ MatListModule,
430
+ MatGridListModule,
431
+ MatCardModule,
432
+ MatStepperModule,
433
+ MatTabsModule,
434
+ MatExpansionModule,
435
+ MatButtonToggleModule,
436
+ MatChipsModule,
437
+ MatIconModule,
438
+ MatProgressSpinnerModule,
439
+ MatProgressBarModule,
440
+ MatDialogModule,
441
+ MatTooltipModule,
442
+ MatSnackBarModule,
443
+ MatTableModule,
444
+ MatSortModule,
445
+ MatPaginatorModule,
446
+ MatDatepickerModule,
447
+ MatNativeDateModule
448
+ ],
449
+ exports: [
450
+ MatCheckboxModule,
451
+ MatButtonModule,
452
+ MatInputModule,
453
+ MatAutocompleteModule,
454
+ MatDatepickerModule,
455
+ MatFormFieldModule,
456
+ MatRadioModule,
457
+ MatSelectModule,
458
+ MatSliderModule,
459
+ MatSlideToggleModule,
460
+ MatMenuModule,
461
+ MatSidenavModule,
462
+ MatToolbarModule,
463
+ MatListModule,
464
+ MatGridListModule,
465
+ MatCardModule,
466
+ MatStepperModule,
467
+ MatTabsModule,
468
+ MatExpansionModule,
469
+ MatButtonToggleModule,
470
+ MatChipsModule,
471
+ MatIconModule,
472
+ MatProgressSpinnerModule,
473
+ MatProgressBarModule,
474
+ MatDialogModule,
475
+ MatTooltipModule,
476
+ MatSnackBarModule,
477
+ MatTableModule,
478
+ MatSortModule,
479
+ MatPaginatorModule
480
+ ],
481
+ })
482
+ ], MaterialModule);
483
+
484
+ let EqpDynamicModuleDialogService = class EqpDynamicModuleDialogService {
485
+ constructor() {
486
+ }
487
+ /**
488
+ * Mostra uno sweet alert di tipo ERROR con il messaggio passato come parametro.
489
+ * @param message Messaggio d'errore da mostrare nello sweetalert
490
+ * @param title Titolo dello sweetalert (di default mostra 'Errore')
491
+ */
492
+ static Error(message, title = null) {
493
+ let currentTitle = title != null ? title : 'Errore';
494
+ if (Array.isArray(message)) {
495
+ currentTitle = title != null ? title : 'Errore';
496
+ let htmlErrors = message.join("<br>");
497
+ Swal.fire({
498
+ title: currentTitle,
499
+ html: htmlErrors,
500
+ icon: 'error'
501
+ });
502
+ }
503
+ else {
504
+ Swal.fire(currentTitle, message, 'error');
505
+ }
506
+ }
507
+ /**
508
+ * Mostra uno sweetalert di tipo CONFIRM con il messaggio passato come parametro e se viene premuto
509
+ * CONFERMA lancia la funzione di callback passata come parametro
510
+ * @param message Messaggio da mostrare nello sweetalert
511
+ * @param title Titolo dello sweetalert (di default mostra 'Info')
512
+ */
513
+ static Confirm(message, confirmCallback, isWarning = false, title = null, customWidth = null) {
514
+ let currentTitle = title != null ? title : 'Sei sicuro di voler procedere?';
515
+ if (Array.isArray(message)) {
516
+ let htmlErrors = message.join("<br>");
517
+ Swal.fire({
518
+ title: currentTitle,
519
+ html: htmlErrors,
520
+ width: customWidth ? customWidth : '32rem',
521
+ icon: !isWarning ? 'question' : 'warning',
522
+ showCancelButton: true,
523
+ allowOutsideClick: false,
524
+ allowEscapeKey: false
525
+ }).then((result) => {
526
+ if (result.value && confirmCallback) {
527
+ confirmCallback();
528
+ }
529
+ });
530
+ }
531
+ else {
532
+ Swal.fire({
533
+ title: currentTitle,
534
+ text: message,
535
+ width: customWidth ? customWidth : '32rem',
536
+ icon: !isWarning ? 'question' : 'warning',
537
+ showCancelButton: true,
538
+ allowOutsideClick: false,
539
+ allowEscapeKey: false
540
+ }).then((result) => {
541
+ if (result.value && confirmCallback) {
542
+ confirmCallback();
543
+ }
544
+ });
545
+ }
546
+ }
547
+ /**
548
+ * Mostra uno sweetalert di tipo INFO con il messaggio passato come parametro
549
+ * @param message Messaggio da mostrare nello sweetalert
550
+ * @param title Titolo dello sweetalert (di default mostra 'Info')
551
+ */
552
+ static Info(message, title = null, isToast = null) {
553
+ let currentTitle = title != null ? title : "Informazione:";
554
+ Swal.fire(currentTitle, message, 'info');
555
+ }
556
+ /**
557
+ * Mostra uno sweetalert di tipo WARNING con il messaggio passato come parametro
558
+ * @param message Messaggio da mostrare nello sweetalert
559
+ * @param title Titolo dello sweetalert (di default mostra 'Attenzione!')
560
+ */
561
+ static Warning(message, title = null, isToast = null) {
562
+ let currentTitle = title != null ? title : "Attenzione!";
563
+ if (Array.isArray(message)) {
564
+ let htmlWarnings = message.join("<br>");
565
+ Swal.fire({
566
+ title: currentTitle,
567
+ html: htmlWarnings,
568
+ icon: 'warning'
569
+ });
570
+ }
571
+ else {
572
+ Swal.fire(currentTitle, message, 'warning');
573
+ }
574
+ }
575
+ };
576
+ EqpDynamicModuleDialogService.ɵprov = ɵɵdefineInjectable({ factory: function EqpDynamicModuleDialogService_Factory() { return new EqpDynamicModuleDialogService(); }, token: EqpDynamicModuleDialogService, providedIn: "root" });
577
+ EqpDynamicModuleDialogService = __decorate([
578
+ Injectable({
579
+ providedIn: 'root'
580
+ })
581
+ ], EqpDynamicModuleDialogService);
582
+
583
+ let EqpDynamicModuleConfiguratorComponent = class EqpDynamicModuleConfiguratorComponent {
584
+ constructor(formBuilder, dialog) {
585
+ this.formBuilder = formBuilder;
586
+ this.dialog = dialog;
587
+ this.context = new Context();
588
+ this.form = new Form();
589
+ this.innerFormManagment = false;
590
+ this.formCompleted = false;
591
+ //#region Enumeratori usati nell'html
592
+ this.FormTypeEnum = FormTypeEnum;
593
+ this.FormScalarTypeEnum = FormScalarTypeEnum;
594
+ //#endregion
595
+ this.saveFormEvent = new EventEmitter();
596
+ }
597
+ ngOnInit() {
598
+ if (this.context) {
599
+ UtilityHelperService.SetContext(this.context);
600
+ }
601
+ this.configureColumns();
602
+ this.createFormForm();
603
+ }
604
+ /**
605
+ * Metodo invocato al cambio del tipo di visualizzazione della form.
606
+ * Se l'utente sceglie una visualizzazione raggruppata il metodo aggiunge al FormGroup un nuovo
607
+ * controllo per l'array dei nomi delle sezioni da creare.
608
+ */
609
+ onChangeFormScalarType() {
610
+ if (this.form.FormScalarType != FormScalarTypeEnum.Semplice) {
611
+ if (!this.formFormGroup.contains("FormFieldsGroups")) {
612
+ this.formFormGroup.removeControl("FormFieldsGroups");
613
+ this.formFormGroup.addControl("FormFieldsGroups", new FormControl(this.form.FormFieldsGroups, [Validators.required, ArrayValidators.minLenght(1)]));
614
+ }
615
+ }
616
+ else {
617
+ this.form.FormFieldsGroups = null;
618
+ if (this.formFormGroup.contains("FormFieldsGroups"))
619
+ this.formFormGroup.removeControl("FormFieldsGroups");
620
+ }
621
+ this.formFormGroup.updateValueAndValidity();
622
+ this.configureColumns();
623
+ }
624
+ /**
625
+ * Evento invocato al keyup nell'input per inserire i nomi delle sezioni per la visualizzazione
626
+ * raggruppata della form. Quanto l'utente preme il tasto invio viene aggiunto il nuovo nome alle
627
+ * sezioni dispobili se non ne esiste una con lo stesso nome.
628
+ * @param event Evento che rappresenta il keyup sulla tastiera.
629
+ */
630
+ onFormFieldGroupNameKeyUp(event) {
631
+ if (event.code === 'Enter' || event.code === 'NumpadEnter') {
632
+ if (!this.form.FormFieldsGroups) {
633
+ this.form.FormFieldsGroups = new Array();
634
+ }
635
+ if (!this.form.FormFieldsGroups.find(n => n.Name == this.formFieldGroupName)) {
636
+ this.form.FormFieldsGroups.push({ Name: this.formFieldGroupName });
637
+ }
638
+ // Imposto il nuovo valore del FormControl per aggiornare lo stato della form.
639
+ this.formFormGroup.controls["FormFieldsGroups"].setValue(this.form.FormFieldsGroups);
640
+ this.formFieldGroupName = null;
641
+ this.setFormFieldGroupOrdinalPosition();
642
+ }
643
+ }
644
+ /**
645
+ * Metodo per rimuovere la sezione selezionata da quelle disponibili per la form.
646
+ * @param groupName Nome della sezione da eliminare.
647
+ */
648
+ onDeleteFormFieldGroupName(groupName) {
649
+ this.form.FormFieldsGroups.splice(this.form.FormFieldsGroups.findIndex(g => g.Name === groupName), 1);
650
+ // Imposto il nuovo valore del FormControl per aggiornare lo stato della form.
651
+ this.formFormGroup.controls["FormFieldsGroups"].setValue(this.form.FormFieldsGroups);
652
+ // Se esistono Field legati alla sezione che si vuole eliminare allora rompo il legame.
653
+ if (this.form.Fields.find(f => f.FieldGroup == groupName)) {
654
+ this.form.Fields.filter(f => f.FieldGroup == groupName).forEach(f => f.FieldGroup = null);
655
+ }
656
+ this.setFormFieldGroupOrdinalPosition();
657
+ }
658
+ /**
659
+ * Metodo chiamato quando si vuole aggiungere un nuovo campo o si vuole modificare uno esistente.
660
+ * Memorizza l'eventuale Field scelto one crea uno nuovo prima di aprire il dialog per modificarlo/aggiungerlo.
661
+ * @param field Oggetto BaseField da modificare. Se null ne viene creata una nuova istanza per l'aggiunta.
662
+ */
663
+ openFieldDialog(field = null) {
664
+ if (field) {
665
+ this.indexSelectedField = this.form.Fields.indexOf(field);
666
+ this.selectedField = JSON.parse(JSON.stringify(field));
667
+ }
668
+ else {
669
+ this.selectedField = new BaseField();
670
+ this.indexSelectedField = null;
671
+ }
672
+ this.dialogFieldRef = this.dialog.open(this.dialogField, {
673
+ disableClose: true,
674
+ hasBackdrop: true,
675
+ width: '75%'
676
+ });
677
+ }
678
+ /**
679
+ * Metodo che salva il campo appena creato o modificato.
680
+ * Prima del salvataggio controlla se esiste un altro campo con la stessa label, in questo
681
+ * case genere un errore (i campi devono avere nomi, e quindi label, univoche - i nomi vengono
682
+ * ricavati unendo le parole che formano la label tramite "_").
683
+ * @param field Campo da salvare
684
+ */
685
+ onSaveField(field) {
686
+ if (field) {
687
+ if (this.form.Fields
688
+ && this.form.Fields.find((f, i) => f.Label === field.Label
689
+ && (this.indexSelectedField == null ? true : this.indexSelectedField !== i))) {
690
+ EqpDynamicModuleDialogService.Warning('Impossibile inserire due campi con la stessa label.');
691
+ throw new Error('Impossibile inserire due campi con la stessa label.');
692
+ }
693
+ if (this.indexSelectedField != null && this.indexSelectedField >= 0) {
694
+ this.form.Fields[this.indexSelectedField] = field;
695
+ }
696
+ else {
697
+ if (!this.form.Fields) {
698
+ this.form.Fields = new Array();
699
+ }
700
+ this.form.Fields.push(field);
701
+ }
702
+ }
703
+ this.closeFieldDialog();
704
+ this.setFieldOrdinalPosition();
705
+ this.reloadFieldsTable();
706
+ }
707
+ /**
708
+ * Metodo che controlla se lo step per l'aggiunta dei campi nella form è concluso.
709
+ * @returns Se TRUE lo step viene considerato completato ed è possbile passare al successivo.
710
+ */
711
+ isFieldStepCompleted() {
712
+ if (!this.form.Fields) {
713
+ return false;
714
+ }
715
+ if (this.form.FormScalarType != FormScalarTypeEnum.Semplice && this.form.Fields.find(f => !f.FieldGroup)) {
716
+ return false;
717
+ }
718
+ return this.form.Fields.length > 0;
719
+ }
720
+ /**
721
+ * Metodo per aprire il dialog di creazione/modifica delle form di dettaglio.
722
+ * Se il parametro passato è null sono in aggiunta altrimenti sono in modifica.
723
+ * @param innenrForm Form di dettaglio da modificare (se null allora vado in add).
724
+ */
725
+ openInnerFormDialog(innenrForm = null) {
726
+ if (innenrForm) {
727
+ this.indexSelectedInnerForm = this.form.InnerForms.indexOf(innenrForm);
728
+ this.selectedInnerForm = JSON.parse(JSON.stringify(innenrForm));
729
+ this.selectedInnerForm.OldName = innenrForm.Name;
730
+ this.indexSelectedField = this.form.Fields.findIndex(f => f.Label === innenrForm.Name);
731
+ }
732
+ else {
733
+ this.selectedInnerForm = new Form();
734
+ this.indexSelectedInnerForm = null;
735
+ this.indexSelectedField = null;
736
+ }
737
+ this.dialogInnerFormRef = this.dialog.open(this.dialogInnerForm, {
738
+ disableClose: true,
739
+ hasBackdrop: true,
740
+ width: '85%'
741
+ });
742
+ }
743
+ /**
744
+ * Metodo scatenato al salvataggio di una form di dettaglio.
745
+ * @param event Form creata/modificata dall'utente. Se è null allora l'utente ha abbandonato la configurazione.
746
+ */
747
+ onSaveOrExitInnerForm(event) {
748
+ if (event != null) {
749
+ if (this.form.Name === event.Name ||
750
+ (this.form.InnerForms
751
+ && this.form.InnerForms.find((a, i) => a.Name === event.Name
752
+ && (this.indexSelectedInnerForm == null ? true : this.indexSelectedInnerForm !== i))) ||
753
+ (this.form.Fields
754
+ && this.indexSelectedInnerForm == null
755
+ && this.form.Fields.find((f, i) => f.Label === event.Name
756
+ && (this.indexSelectedField == null ? true : this.indexSelectedField !== i)))) {
757
+ EqpDynamicModuleDialogService.Warning('Impossibile inserire due form di dettaglio con lo stesso nome.');
758
+ throw new Error('Impossibile inserire due form di dettaglio con lo stesso nome.');
759
+ }
760
+ let innerFormField = new BaseField();
761
+ innerFormField.Name = event.Name.split(" ").join("_");
762
+ innerFormField.Label = event.Name;
763
+ innerFormField.FieldType = FieldTypeEnum['Form di dettaglio'];
764
+ innerFormField.FieldGroup = this.indexSelectedField != null ? this.form.Fields[this.indexSelectedField].FieldGroup : null;
765
+ if (this.indexSelectedInnerForm != null && this.indexSelectedInnerForm >= 0) {
766
+ this.form.InnerForms[this.indexSelectedInnerForm] = event;
767
+ this.form.Fields[this.indexSelectedField] = innerFormField;
768
+ }
769
+ else {
770
+ if (!this.form.InnerForms) {
771
+ this.form.InnerForms = new Array();
772
+ }
773
+ this.form.InnerForms.push(event);
774
+ this.form.Fields.push(innerFormField);
775
+ }
776
+ this.reloadFieldsTable();
777
+ }
778
+ this.dialogInnerFormRef.close();
779
+ }
780
+ /**
781
+ * Metodo per aprire il dialog di creazione/modifica delle action.
782
+ * Se il parametro passato è null sono in aggiunta altrimenti sono in modifica.
783
+ * @param action ActionOnRecord da modificare (se null allora vado in add).
784
+ */
785
+ openActionOnRecordDialog(action = null) {
786
+ if (action) {
787
+ this.indexSelectedAction = this.form.ActionsOnRecord.indexOf(action);
788
+ this.selectedAction = JSON.parse(JSON.stringify(action));
789
+ }
790
+ else {
791
+ this.selectedAction = new ActionOnRecord();
792
+ this.indexSelectedAction = null;
793
+ }
794
+ this.createActionOnRecordForm();
795
+ this.dialogActionOnRecordRef = this.dialog.open(this.dialogActionOnRecord, {
796
+ disableClose: true,
797
+ hasBackdrop: true,
798
+ width: '75%'
799
+ });
800
+ }
801
+ /**
802
+ * Metodo per impostare i valori da suggerire nell'autocomplete del campo Formula.
803
+ * Viene scatenato al focus (in questo caso viene passato il parametro a null per differenziarlo
804
+ * dall'evento di click sulla tastiera) e al keyup sull'input (il parametro è diverso da null).
805
+ * @param keyboardEvent Evento scatenato al keyup sulla tastiera. Se null allora il metodo è stato invocato dal focus sull'input.
806
+ * @summary Aggiorna l'elenco dei suggerimenti per l'autocomplete se l'utente esegue il focus sull'input
807
+ * oppure al keyup sulla tastiera di un tasto diverso dalle frecce.
808
+ */
809
+ setActionAutocompleteOptions(keyboardEvent) {
810
+ // Creo l'array per l'autocomplete solo se sto facendo il focus sull'input o se sto premendo un tasto
811
+ // sulla tastiera diverso dalle frecce (in quest'ultimo caso, se non viene eseguito il filtro sull'evento,
812
+ // non si può selezionare un suggerimento dell'autocomplete perchè al click verrebbe ricaricato l'array e
813
+ // si prederebbe la selezione appena fatta).
814
+ if (!keyboardEvent || !keyboardEvent.code.includes("Arrow")) {
815
+ this.actionAutocompleteOptions = UtilityHelperService.GetAutocompleteOptions(this.form.Fields, this.selectedAction.Action);
816
+ }
817
+ }
818
+ /**
819
+ * Metodo per salvare l'azione creata/modificate.
820
+ */
821
+ saveActionOnRecord() {
822
+ if (this.form.ActionsOnRecord
823
+ && this.form.ActionsOnRecord.find((a, i) => a.Name === this.selectedAction.Name
824
+ && (this.indexSelectedAction == null ? true : this.indexSelectedAction !== i))) {
825
+ EqpDynamicModuleDialogService.Warning('Impossibile inserire due action con lo stesso nome.');
826
+ throw new Error('Impossibile inserire due action con lo stesso nome.');
827
+ }
828
+ if (this.indexSelectedAction != null && this.indexSelectedAction >= 0) {
829
+ this.form.ActionsOnRecord[this.indexSelectedAction] = this.selectedAction;
830
+ }
831
+ else {
832
+ if (!this.form.ActionsOnRecord) {
833
+ this.form.ActionsOnRecord = new Array();
834
+ }
835
+ this.form.ActionsOnRecord.push(this.selectedAction);
836
+ }
837
+ this.closeDialogActionOnRecord();
838
+ this.setActionOrdinalPosition();
839
+ this.reloadActionsOnRecordTable();
840
+ }
841
+ /**
842
+ * Metodo per chiudere il dialog di gestione delle action.
843
+ */
844
+ closeDialogActionOnRecord() {
845
+ this.dialogActionOnRecordRef.close();
846
+ }
847
+ /**
848
+ * Metodo per segnare come conclusa la creazione della form e per crearne una copia
849
+ * da visalizzare come anteprima.
850
+ * @param completed Se TRUE segna la form come conclusa e ne crea una copia da visualizzare
851
+ */
852
+ setFormStatus(completed) {
853
+ if (completed) {
854
+ this.formCompleted = true;
855
+ this.previewForm = JSON.parse(JSON.stringify(this.form));
856
+ // Per visualizzare correttamente l'oanteprima della form appena creata
857
+ // bisogna valorizzare la proprietà Name dei campi della form e delle InnerForms.
858
+ this.previewForm.Fields.forEach(field => { field.Name = field.Label.split(' ').join('_'); });
859
+ if (this.previewForm.InnerForms && this.previewForm.InnerForms.length > 0) {
860
+ this.previewForm.InnerForms.forEach(form => {
861
+ form.Fields.forEach(field => { field.Name = field.Label.split(' ').join('_'); });
862
+ });
863
+ }
864
+ }
865
+ else {
866
+ this.formCompleted = false;
867
+ this.previewForm = null;
868
+ }
869
+ }
870
+ /**
871
+ * Metodo che scatena l'evento di output per salvare la form creata alla fine del wizard
872
+ */
873
+ saveForm() {
874
+ this.saveFormEvent.emit(this.form);
875
+ }
876
+ /**
877
+ * Configura le colonne per le tabelle necessarie alla creazione della form:
878
+ * - per la visualizzazione dei campi inseriti
879
+ * - per le form di dettaglio create
880
+ * - per le azioni configurate sui record della form
881
+ */
882
+ configureColumns() {
883
+ this.fieldsColumns = [
884
+ {
885
+ key: 'action', display: '', type: TypeColumn.MenuAction, buttonMenuIcon: 'more_vert', styles: { flex: '0 0 6%' },
886
+ actions: [
887
+ { name: 'Modifica', icon: 'edit', fn: (element, index, col) => this.editField(element) },
888
+ { name: 'Elimina', icon: 'delete', fn: (element, index, col) => this.deleteElement(element, "Fields") },
889
+ {
890
+ name: 'Sposta su', icon: 'arrow_upward',
891
+ fn: (element, index, col) => this.moveElement(element, true, "Fields"),
892
+ disabled: (element) => this.form.Fields.indexOf(element) === 0
893
+ },
894
+ {
895
+ name: 'Sposta giù', icon: 'arrow_downward',
896
+ fn: (element, index, col) => this.moveElement(element, false, "Fields"),
897
+ disabled: (element) => this.form.Fields.indexOf(element) >= (this.form.Fields.length - 1)
898
+ },
899
+ ]
900
+ },
901
+ { key: 'FieldType', display: 'Tipologia', type: TypeColumn.Enum, enumModel: FieldTypeEnum },
902
+ { key: 'Label', display: 'Label' },
903
+ { key: 'Description', display: 'Descrizione' },
904
+ {
905
+ key: 'Required', display: 'Obbligatorio',
906
+ value: (element) => !!element.Required,
907
+ type: TypeColumn.Boolean,
908
+ booleanValues: {
909
+ true: '<i class="fa fa-check success-color"></i>',
910
+ false: '<i class="fa fa-close error-color"></i>'
911
+ },
912
+ styles: { flex: '0 0 7%', cellAlignment: CellAlignmentEnum.CENTER }
913
+ },
914
+ ];
915
+ if (this.form.FormScalarType && this.form.FormScalarType != FormScalarTypeEnum.Semplice) {
916
+ this.fieldsColumns.splice(this.fieldsColumns.findIndex(c => c.key == 'Description'), 0, { key: 'FieldGroup', display: 'Sezione', type: TypeColumn.ExternalTemplate, externalTemplate: this.fieldSectionColumnTemplate });
917
+ }
918
+ this.actionsOnRecordColumns = [
919
+ {
920
+ key: 'action', display: '', type: TypeColumn.MenuAction, buttonMenuIcon: 'more_vert', styles: { flex: '0 0 6%' },
921
+ actions: [
922
+ { name: 'Modifica', icon: 'edit', fn: (element, index, col) => this.openActionOnRecordDialog(element) },
923
+ { name: 'Elimina', icon: 'delete', fn: (element, index, col) => this.deleteElement(element, "ActionsOnRecord") },
924
+ {
925
+ name: 'Sposta su', icon: 'arrow_upward',
926
+ fn: (element, index, col) => this.moveElement(element, true, "ActionsOnRecord"),
927
+ disabled: (element) => this.form.ActionsOnRecord.indexOf(element) === 0
928
+ },
929
+ {
930
+ name: 'Sposta giù', icon: 'arrow_downward',
931
+ fn: (element, index, col) => this.moveElement(element, false, "ActionsOnRecord"),
932
+ disabled: (element) => this.form.ActionsOnRecord.indexOf(element) >= (this.form.ActionsOnRecord.length - 1)
933
+ },
934
+ ]
935
+ },
936
+ { key: 'Icon', display: 'Icona', styles: { flex: ' 0 0 15%' } },
937
+ { key: 'Name', display: 'Nome', styles: { flex: ' 0 0 20%' } },
938
+ { key: 'Action', display: 'Azione' },
939
+ ];
940
+ }
941
+ /**
942
+ * Crea il FormGroup per l'oggetto Form
943
+ */
944
+ createFormForm() {
945
+ this.formFormGroup = this.formBuilder.group({
946
+ Name: [this.form.Name, Validators.required],
947
+ FormScalarType: [this.form.FormScalarType, Validators.required],
948
+ });
949
+ this.onChangeFormScalarType();
950
+ }
951
+ /**
952
+ * Crea il FormGroup epr l'aggiunta o la modifica di una action sui record della Form.
953
+ */
954
+ createActionOnRecordForm() {
955
+ this.actionOnRecordFormGroup = this.formBuilder.group({
956
+ Name: [this.selectedAction.Name, Validators.required],
957
+ Icon: [this.selectedAction.Icon, Validators.required],
958
+ Action: [this.selectedAction.Action, Validators.required],
959
+ });
960
+ }
961
+ /**
962
+ * Chiude il dialog per aggiungere/modificare un Field senza salvare
963
+ */
964
+ closeFieldDialog() {
965
+ this.dialogFieldRef.close();
966
+ }
967
+ /**
968
+ * Metodo per gestire l'apertura del dialog per la modifica di un Field.
969
+ * Se il field è di tipo "Form di dettaglio" apre il dialog per la modifica di una
970
+ * InnerForm altrimenti apre quello per la modifica di un Field.
971
+ * @param field Campo da modificare
972
+ */
973
+ editField(field) {
974
+ if (field.FieldType != FieldTypeEnum['Form di dettaglio']) {
975
+ this.openFieldDialog(field);
976
+ }
977
+ else {
978
+ this.openInnerFormDialog(this.form.InnerForms.find(f => f.Name == field.Label));
979
+ }
980
+ }
981
+ /**
982
+ * Metodo per rimuovere un Field all'interno di una Form.
983
+ * Richiede conferma all'utente prima di rimuoverlo.
984
+ * @param field BaseField da rimuovere
985
+ */
986
+ deleteElement(element, propertyName) {
987
+ EqpDynamicModuleDialogService.Confirm('Eliminare l\'elemento selezionato?', () => {
988
+ this.form[propertyName].splice(this.form[propertyName].indexOf(element), 1);
989
+ if (propertyName === "Fields") {
990
+ this.setFieldOrdinalPosition();
991
+ this.reloadFieldsTable();
992
+ }
993
+ else if (propertyName === "ActionsOnRecord") {
994
+ this.setActionOrdinalPosition();
995
+ this.reloadActionsOnRecordTable();
996
+ }
997
+ }, false, 'Richiesta conferma');
998
+ }
999
+ /**
1000
+ * Metodo per spostare un campo all'interno della form.
1001
+ * @param field Oggetto di tipo BaseField da spostare.
1002
+ * @param moveUp Se TRUE allora sposta verso l'alto il campo (abbassa l'indice) altrimenti il contrario.
1003
+ */
1004
+ moveElement(element, moveUp, propertyName) {
1005
+ const startingIndex = this.form[propertyName].indexOf(element);
1006
+ const endingIndex = startingIndex + (moveUp ? -1 : 1);
1007
+ this.form[propertyName].splice(startingIndex, 1);
1008
+ this.form[propertyName].splice(endingIndex, 0, element);
1009
+ if (propertyName === "Fields") {
1010
+ this.setFieldOrdinalPosition();
1011
+ this.reloadFieldsTable();
1012
+ }
1013
+ else if (propertyName === "ActionsOnRecord") {
1014
+ this.setActionOrdinalPosition();
1015
+ this.reloadActionsOnRecordTable();
1016
+ }
1017
+ }
1018
+ /**
1019
+ * Imposta l'ordinamento delle sezioni che compongono la form.
1020
+ */
1021
+ setFormFieldGroupOrdinalPosition() {
1022
+ this.form.FormFieldsGroups.forEach((g, i) => g.OrdinalPosition = i);
1023
+ }
1024
+ /**
1025
+ * Imposta l'ordinamento dei campi all'interno della form in base all'ordine che l'utente
1026
+ * ha definito nella tabella in cui sono mostrati
1027
+ */
1028
+ setFieldOrdinalPosition() {
1029
+ if (this.form.Fields) {
1030
+ this.form.Fields.forEach(field => {
1031
+ field.OrdinalPosition = this.form.Fields.indexOf(field);
1032
+ });
1033
+ }
1034
+ }
1035
+ /**
1036
+ * Metodo per ricaricare i dati della tabella dei campi aggiunti in una form
1037
+ */
1038
+ reloadFieldsTable() {
1039
+ if (this.fieldsTable) {
1040
+ this.fieldsTable.reloadDatatable();
1041
+ }
1042
+ }
1043
+ /**
1044
+ * Imposta l'ordinamento dei campi all'interno della form in base all'ordine che l'utente
1045
+ * ha definito nella tabella in cui sono mostrati
1046
+ */
1047
+ setActionOrdinalPosition() {
1048
+ if (this.form.ActionsOnRecord) {
1049
+ this.form.ActionsOnRecord.forEach(action => {
1050
+ action.OrdinalPosition = this.form.ActionsOnRecord.indexOf(action);
1051
+ });
1052
+ }
1053
+ }
1054
+ /**
1055
+ * Metodo per ricaricare i dati della tabella delle azioni aggiuntive sui record della Form.
1056
+ */
1057
+ reloadActionsOnRecordTable() {
1058
+ if (this.actionsOnRecordTable) {
1059
+ this.actionsOnRecordTable.reloadDatatable();
1060
+ }
1061
+ }
1062
+ };
1063
+ EqpDynamicModuleConfiguratorComponent.ctorParameters = () => [
1064
+ { type: FormBuilder },
1065
+ { type: MatDialog }
1066
+ ];
1067
+ __decorate([
1068
+ Input()
1069
+ ], EqpDynamicModuleConfiguratorComponent.prototype, "context", void 0);
1070
+ __decorate([
1071
+ Input()
1072
+ ], EqpDynamicModuleConfiguratorComponent.prototype, "form", void 0);
1073
+ __decorate([
1074
+ Input()
1075
+ ], EqpDynamicModuleConfiguratorComponent.prototype, "innerFormManagment", void 0);
1076
+ __decorate([
1077
+ ViewChild('fieldsTable', { static: false })
1078
+ ], EqpDynamicModuleConfiguratorComponent.prototype, "fieldsTable", void 0);
1079
+ __decorate([
1080
+ ViewChild('dialogField', { static: true })
1081
+ ], EqpDynamicModuleConfiguratorComponent.prototype, "dialogField", void 0);
1082
+ __decorate([
1083
+ ViewChild('fieldSectionColumnTemplate', { static: true })
1084
+ ], EqpDynamicModuleConfiguratorComponent.prototype, "fieldSectionColumnTemplate", void 0);
1085
+ __decorate([
1086
+ ViewChild('dialogInnerForm', { static: true })
1087
+ ], EqpDynamicModuleConfiguratorComponent.prototype, "dialogInnerForm", void 0);
1088
+ __decorate([
1089
+ ViewChild('actionsOnRecordTable', { static: false })
1090
+ ], EqpDynamicModuleConfiguratorComponent.prototype, "actionsOnRecordTable", void 0);
1091
+ __decorate([
1092
+ ViewChild('dialogActionOnRecord', { static: true })
1093
+ ], EqpDynamicModuleConfiguratorComponent.prototype, "dialogActionOnRecord", void 0);
1094
+ __decorate([
1095
+ Output()
1096
+ ], EqpDynamicModuleConfiguratorComponent.prototype, "saveFormEvent", void 0);
1097
+ EqpDynamicModuleConfiguratorComponent = __decorate([
1098
+ Component({
1099
+ selector: 'eqp-dynamic-module-configurator',
1100
+ 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>",
1101
+ 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)}"]
1102
+ })
1103
+ ], EqpDynamicModuleConfiguratorComponent);
1104
+
1105
+ class AttachmentField extends BaseField {
1106
+ }
1107
+ const AvailableFileExtensions = [
1108
+ { value: '.pdf', key: 'application/pdf' },
1109
+ { value: '.doc', key: 'application/msword' },
1110
+ { value: '.xls', key: 'application/vnd.ms-excel' },
1111
+ { value: '.ppt', key: 'application/vnd.ms-powerpoint' },
1112
+ { value: '.docx', key: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' },
1113
+ { value: '.xlsx', key: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' },
1114
+ { value: '.pptx', key: 'application/vnd.openxmlformats-officedocument.presentationml.presentation' },
1115
+ { value: '.csv', key: 'text/csv' },
1116
+ { value: '.txt', key: 'text/plain' },
1117
+ ];
1118
+ const AvailableImageExtensions = [
1119
+ { value: '.jpg/.jpeg', key: 'image/jpeg' },
1120
+ { value: '.png', key: 'image/png' },
1121
+ { value: '.bmp', key: 'image/bmp' },
1122
+ { value: '.svg', key: 'image/svg+xml' },
1123
+ { value: '.ico', key: 'image/x-icon' },
1124
+ ];
1125
+
1126
+ class BooleanField extends BaseField {
1127
+ }
1128
+ var BoolPresentantioEnum;
1129
+ (function (BoolPresentantioEnum) {
1130
+ BoolPresentantioEnum[BoolPresentantioEnum["Checkbox"] = 1] = "Checkbox";
1131
+ BoolPresentantioEnum[BoolPresentantioEnum["Toggle"] = 2] = "Toggle";
1132
+ BoolPresentantioEnum[BoolPresentantioEnum["Radio button"] = 3] = "Radio button";
1133
+ // "Stringa true o false" = 3,
1134
+ // "Numerico 0 o 1" = 4
1135
+ })(BoolPresentantioEnum || (BoolPresentantioEnum = {}));
1136
+
1137
+ /**Rappresenta la configurazione di un campo Data o Data e ora, o solo ora */
1138
+ class DateField extends BaseField {
1139
+ }
1140
+ var DateTimeTypeEnum;
1141
+ (function (DateTimeTypeEnum) {
1142
+ DateTimeTypeEnum[DateTimeTypeEnum["Solo data"] = 1] = "Solo data";
1143
+ DateTimeTypeEnum[DateTimeTypeEnum["Solo orario"] = 2] = "Solo orario";
1144
+ DateTimeTypeEnum[DateTimeTypeEnum["Data e ora"] = 3] = "Data e ora";
1145
+ })(DateTimeTypeEnum || (DateTimeTypeEnum = {}));
1146
+
1147
+ /**Lista di valori */
1148
+ class ListValueField extends BaseField {
1149
+ }
1150
+ var ListPresentationEnum;
1151
+ (function (ListPresentationEnum) {
1152
+ ListPresentationEnum[ListPresentationEnum["Combo box"] = 1] = "Combo box";
1153
+ ListPresentationEnum[ListPresentationEnum["Radio button"] = 2] = "Radio button";
1154
+ ListPresentationEnum[ListPresentationEnum["Pulsante con testo"] = 3] = "Pulsante con testo";
1155
+ ListPresentationEnum[ListPresentationEnum["Immagini"] = 4] = "Immagini";
1156
+ })(ListPresentationEnum || (ListPresentationEnum = {}));
1157
+
1158
+ let AddFormFieldComponent = class AddFormFieldComponent {
1159
+ //#endregion
1160
+ constructor(formBuilder, enumHelper, dialog) {
1161
+ this.formBuilder = formBuilder;
1162
+ this.enumHelper = enumHelper;
1163
+ this.dialog = dialog;
1164
+ this.fieldTypesToExclude = [FieldTypeEnum['Form di dettaglio']];
1165
+ this.keyValueObject = { key: '', value: '' };
1166
+ this.availableColSpanSizes = [];
1167
+ this.AvailableFileExtensions = AvailableFileExtensions;
1168
+ this.AvailableImageExtensions = AvailableImageExtensions;
1169
+ this.saveFieldEvent = new EventEmitter();
1170
+ //#endregion
1171
+ //#region Enumeratori usati nell'html
1172
+ this.FieldTypeEnum = FieldTypeEnum;
1173
+ this.BoolPresentantioEnum = BoolPresentantioEnum;
1174
+ this.DateTimeTypeEnum = DateTimeTypeEnum;
1175
+ this.ListPresentationEnum = ListPresentationEnum;
1176
+ }
1177
+ ngOnInit() {
1178
+ if (!this.fieldTypesToExclude.includes(FieldTypeEnum['Form di dettaglio'])) {
1179
+ this.fieldTypesToExclude.push(FieldTypeEnum['Form di dettaglio']);
1180
+ }
1181
+ this.onFieldTypeChange(false);
1182
+ this.availableFields = this.availableFields ? this.availableFields.filter(f => f != this.field) : [];
1183
+ this.configureColumns();
1184
+ }
1185
+ /**
1186
+ * Metodo per impostare i valori da suggerire nell'autocomplete del campo Formula.
1187
+ * Viene scatenato al focus (in questo caso viene passato il parametro a null per differenziarlo
1188
+ * dall'evento di click sulla tastiera) e al keyup sull'input (il parametro è diverso da null).
1189
+ * @param keyboardEvent Evento scatenato al keyup sulla tastiera. Se null allora il metodo è stato invocato dal focus sull'input.
1190
+ * @summary Aggiorna l'elenco dei suggerimenti per l'autocomplete se l'utente esegue il focus sull'input
1191
+ * oppure al keyup sulla tastiera di un tasto diverso dalle frecce.
1192
+ */
1193
+ setFormulaAutocompleteOptions(keyboardEvent) {
1194
+ // Creo l'array per l'autocomplete solo se sto facendo il focus sull'input o se sto premendo un tasto
1195
+ // sulla tastiera diverso dalle frecce (in quest'ultimo caso, se non viene eseguito il filtro sull'evento,
1196
+ // non si può selezionare un suggerimento dell'autocomplete perchè al click verrebbe ricaricato l'array e
1197
+ // si prederebbe la selezione appena fatta).
1198
+ if (!keyboardEvent || !keyboardEvent.code.includes("Arrow")) {
1199
+ this.formulaAutocompleteOptions = UtilityHelperService.GetAutocompleteOptions(this.availableFields, this.field.Formula);
1200
+ }
1201
+ }
1202
+ /**
1203
+ * Crea il FormGroup per l'aggiunta di un nuovo campo all'interno della form.
1204
+ * Metodo richiamato ogni volta che cambia il tipo del campo scelto o viene aggiunto/modificato un Field
1205
+ */
1206
+ createFieldForm() {
1207
+ this.fieldFormGroup = this.formBuilder.group({
1208
+ Label: [this.field.Label, Validators.required],
1209
+ Description: [this.field.Description],
1210
+ Required: [this.field.Required],
1211
+ FieldType: [this.field.FieldType, Validators.required],
1212
+ Formula: [this.field.Formula],
1213
+ ColSizes: [this.field.ColSizes],
1214
+ InListView: [this.field.InListView],
1215
+ });
1216
+ if (this.formFieldsGroups) {
1217
+ this.fieldFormGroup.addControl('FieldGroup', new FormControl(this.field.FieldGroup, Validators.required));
1218
+ }
1219
+ }
1220
+ /**
1221
+ * Metodo chiamato quando cambia il FieldType del BaseField che si sta aggiungendo/modificando.
1222
+ * Ricrea l'oggetto field popolando solo le proprietà del BaseField inserite dall'utente
1223
+ * (quelle comuni a tutte le tipologie di campo), ricrea la form e, in base al FieldType scelto,
1224
+ * aggiunge alla form i FormControl necessari e seleziona il template corretto da usare.
1225
+ * @param restoreField Se TRUE ripristina i valori base (ereditati dal modello BaseField) del campo aggiunto/modificato
1226
+ */
1227
+ onFieldTypeChange(restoreField = true) {
1228
+ if (restoreField)
1229
+ this.restoreBaseFieldProperties();
1230
+ this.createFieldForm();
1231
+ this.onColSizeSelect();
1232
+ this.fieldTypeFormTemplate = null;
1233
+ switch (this.field.FieldType) {
1234
+ case FieldTypeEnum['Campo di testo']:
1235
+ this.fieldFormGroup.addControl('TextMask', new FormControl(this.field.TextMask));
1236
+ this.fieldFormGroup.addControl('MaxLenght', new FormControl(this.field.MaxLenght));
1237
+ this.fieldFormGroup.addControl('MinLenght', new FormControl(this.field.MinLenght));
1238
+ this.fieldTypeFormTemplate = this.textFieldFormTemplate;
1239
+ break;
1240
+ case FieldTypeEnum['Area di testo']:
1241
+ this.fieldFormGroup.addControl('Rows', new FormControl(this.field.Rows));
1242
+ this.fieldFormGroup.addControl('MaxLenght', new FormControl(this.field.MaxLenght));
1243
+ this.fieldFormGroup.addControl('MinLenght', new FormControl(this.field.MinLenght));
1244
+ this.fieldTypeFormTemplate = this.textareaFieldFormTemplate;
1245
+ break;
1246
+ case FieldTypeEnum.Booleano:
1247
+ this.fieldFormGroup.addControl('IsTristate', new FormControl(this.field.IsTristate));
1248
+ this.fieldFormGroup.addControl('PresetationType', new FormControl(this.field.PresetationType, Validators.required));
1249
+ this.fieldTypeFormTemplate = this.booleadFieldFormTemplate;
1250
+ break;
1251
+ case FieldTypeEnum['Data e/o ora']:
1252
+ this.fieldFormGroup.addControl('IsOnlyDate', new FormControl(this.field.IsOnlyDate, Validators.required));
1253
+ this.fieldFormGroup.addControl('MinDate', new FormControl(this.field.MinDate));
1254
+ this.fieldFormGroup.addControl('MaxDate', new FormControl(this.field.MaxDate));
1255
+ this.fieldTypeFormTemplate = this.dateFieldFormTemplate;
1256
+ break;
1257
+ case FieldTypeEnum['Campo numerico']:
1258
+ this.fieldFormGroup.addControl('IsInteger', new FormControl(this.field.IsInteger));
1259
+ this.fieldFormGroup.addControl('MinValue', new FormControl(this.field.MinValue));
1260
+ this.fieldFormGroup.addControl('MaxValue', new FormControl(this.field.MaxValue));
1261
+ this.fieldFormGroup.addControl('NumberFormat', new FormControl(this.field.NumberFormat));
1262
+ this.fieldFormGroup.addControl('CurrencySymbol', new FormControl(this.field.CurrencySymbol));
1263
+ this.fieldTypeFormTemplate = this.numericFieldFormTemplate;
1264
+ break;
1265
+ case FieldTypeEnum.Allegato:
1266
+ this.fieldFormGroup.addControl("AllowedExtensions", new FormControl(this.field.AllowedExtensions));
1267
+ this.fieldFormGroup.addControl('IsMultiAttach', new FormControl(this.field.IsMultiAttach));
1268
+ this.fieldTypeFormTemplate = this.attachmentFieldFormTemplate;
1269
+ break;
1270
+ case FieldTypeEnum.Immagine:
1271
+ this.field.AttachDefinition = new AttachmentField();
1272
+ this.fieldFormGroup.addControl('IsMultiAttach', new FormControl(this.field.AttachDefinition.IsMultiAttach));
1273
+ // this.fieldFormGroup.addControl('ImgName', new FormControl((this.field as ImageField).ImgName, Validators.required));
1274
+ this.fieldFormGroup.addControl('IsMultiPoint', new FormControl(this.field.IsMultiPoint));
1275
+ this.fieldFormGroup.addControl("AllowedExtensions", new FormControl(this.field.AttachDefinition.AllowedExtensions));
1276
+ this.fieldFormGroup.addControl('ImageIsContextualAttachment', new FormControl(this.field.ImageIsContextualAttachment));
1277
+ this.fieldTypeFormTemplate = this.imageFieldFormTemplate;
1278
+ break;
1279
+ case FieldTypeEnum['Elenco generico']:
1280
+ this.fieldFormGroup.addControl('IsMultiChoiche', new FormControl(this.field.IsMultiChoiche));
1281
+ this.fieldFormGroup.addControl('PresentationMode', new FormControl(this.field.PresentationMode, Validators.required));
1282
+ this.fieldTypeFormTemplate = this.listValueFieldFormTemplate;
1283
+ break;
1284
+ case FieldTypeEnum.Lookup:
1285
+ this.fieldFormGroup.addControl('EntitySourceName', new FormControl(this.field.EntitySourceName, Validators.required));
1286
+ this.fieldFormGroup.addControl('UseAsGetOrDiscard', new FormControl(this.field.UseAsGetOrDiscard));
1287
+ this.fieldTypeFormTemplate = this.lookupFieldFormTemplate;
1288
+ break;
1289
+ }
1290
+ if ([FieldTypeEnum.Allegato, FieldTypeEnum.Immagine, FieldTypeEnum['Form di dettaglio']].includes(this.field.FieldType)) {
1291
+ this.field.Formula = null;
1292
+ this.fieldFormGroup.controls["Formula"].disable();
1293
+ }
1294
+ else {
1295
+ this.fieldFormGroup.controls["Formula"].enable();
1296
+ }
1297
+ }
1298
+ /**
1299
+ * Metodo invocato alla selezione di una classe nella select per le colonne di bootstrap
1300
+ * da usare nella visualizzazione del campo. Questa funzione manipola la sorgente dati per
1301
+ * la eqp-select in modo da escludere i valori dell'enumeratore che fanno riferimento ad
1302
+ * una larghezza di schermo già selezionata. Esempio: per gli schermi piccoli (sm) l'utente
1303
+ * seleziona la classe "col-sm-6", al change del valore questo metodo rimuove dalla select
1304
+ * tutti gli altri valori per la grandezza di schermo selezionata.
1305
+ */
1306
+ onColSizeSelect() {
1307
+ // Recupero l'array degli oggetti chiave-valore che rappreseta l'enumeratore
1308
+ let colSizeClassEnumArray = this.enumHelper.getEnumArray(ColSpanSizesEnum, false, null);
1309
+ // Costruisco l'array delle classi selezionate dall'utente in formato stringa
1310
+ let selectedDimensions = this.field.ColSizes ? this.field.ColSizes.map(col => ColSpanSizesEnum[col]) : [];
1311
+ // Filtro i valori ottenuti dall'enumeratore per escludere tutti i valori per le
1312
+ // grandezze di schermo già selezionatead esclusione dei valori selezionati.
1313
+ this.availableColSpanSizes = colSizeClassEnumArray.filter((value) => !selectedDimensions.find(col => value.value.includes(col.substring(4, 6)) && value.value != col));
1314
+ }
1315
+ /**
1316
+ * Metodo chiamato al keyup degli input testuali che prevedono l'aggiunta del valore inserito in un array.
1317
+ * Se l'utente preme il tasto invio, in base al tipo di campo che sta inserendo/modificando, questo metodo
1318
+ * aggiunge il valore inserito dall'utente nella lista di stringhe corretta (in input viene passato il nome
1319
+ * della proprietà in cui inserire la stringa).
1320
+ * @param event Evento che rappresenta il keyup dell'utente
1321
+ * @param propertyName Nome della proprietà del field in cui inserire la stringa digitata.
1322
+ */
1323
+ onMultiSelectInputKeyup(event, propertyName) {
1324
+ if (event.code === 'Enter' || event.code === 'NumpadEnter') {
1325
+ switch (this.field.FieldType) {
1326
+ case FieldTypeEnum.Lookup:
1327
+ case FieldTypeEnum.Allegato:
1328
+ if (!this.field[propertyName]) {
1329
+ this.field[propertyName] = new Array();
1330
+ }
1331
+ this.field[propertyName].push(event.currentTarget.value);
1332
+ break;
1333
+ case FieldTypeEnum.Immagine:
1334
+ if (!this.field.AttachDefinition[propertyName]) {
1335
+ this.field.AttachDefinition[propertyName] = new Array();
1336
+ }
1337
+ this.field.AttachDefinition[propertyName].push(event.currentTarget.value);
1338
+ break;
1339
+ case FieldTypeEnum['Elenco generico']:
1340
+ if (!this.keyValueObject.key || !this.keyValueObject.value) {
1341
+ return;
1342
+ }
1343
+ if (!this.field.ValuePairs) {
1344
+ this.field.ValuePairs = {};
1345
+ }
1346
+ this.field.ValuePairs[this.keyValueObject.key] = this.keyValueObject.value;
1347
+ this.keyValueObject = { key: '', value: '' };
1348
+ break;
1349
+ }
1350
+ event.currentTarget.value = null;
1351
+ }
1352
+ }
1353
+ /**
1354
+ * Metodo chiamato per mostrare come elenco le opzioni aggiunte in un campo di tipo "Elenco generico".
1355
+ * @returns Restituisce un array di oggetti del tipo { key: string, value: string } con i valori inseriti dall'utente.
1356
+ */
1357
+ getDictionaryKeyValue() {
1358
+ if (this.field.ValuePairs) {
1359
+ return Object.keys(this.field.ValuePairs).map(k => {
1360
+ return {
1361
+ key: k,
1362
+ value: this.field.ValuePairs[k]
1363
+ };
1364
+ });
1365
+ }
1366
+ else {
1367
+ return [];
1368
+ }
1369
+ }
1370
+ /**
1371
+ * Metodo per rimuovere una opzione aggiunta al campo di tipo "Elenco generico"
1372
+ * @param key Nome della chiave da rimuovere
1373
+ */
1374
+ deleteKeyFromDictionary(key) {
1375
+ delete this.field.ValuePairs[key];
1376
+ }
1377
+ /**
1378
+ * Metodo per aprire il dialog per aggiungere/modificare un metadata in un campo di tipo Allegato o Immagine.
1379
+ * @param metadata Metadata da modificare, se null allora ne sto creando uno nuovo.
1380
+ */
1381
+ openMetadataDialog(field = null) {
1382
+ if (field) {
1383
+ if (this.field.FieldType === FieldTypeEnum.Allegato) {
1384
+ this.indexSelectedMetadata = this.field.MetadataFields.indexOf(field);
1385
+ this.selectedMetadata = JSON.parse(JSON.stringify(field));
1386
+ }
1387
+ else if (this.field.FieldType === FieldTypeEnum.Immagine) {
1388
+ this.indexSelectedMetadata = this.field.AttachDefinition.MetadataFields.indexOf(field);
1389
+ this.selectedMetadata = JSON.parse(JSON.stringify(field));
1390
+ }
1391
+ }
1392
+ else {
1393
+ this.selectedMetadata = new BaseField();
1394
+ this.indexSelectedMetadata = null;
1395
+ }
1396
+ this.dialogMetadataRef = this.dialog.open(this.dialogMetadata, {
1397
+ disableClose: true,
1398
+ hasBackdrop: true,
1399
+ width: '75%'
1400
+ });
1401
+ }
1402
+ /**
1403
+ * Metodo invocato dall'output dal dialog per aggiungere/modificare un metadata
1404
+ * nei campi di tipo Allegato o Immagine. Prima di aggiungere il metadata nell'elenco
1405
+ * contolla se esiste un altro metadata con lo stesso nome e nel caso genera un errore
1406
+ * (i metadata, come per i campi della form, devono avere un nome univoco).
1407
+ * @param metadata Metadata aggiunto o modificato, se null allora il dialog è stato chiuso senza fare modifiche.
1408
+ */
1409
+ onSaveMetadata(metadata) {
1410
+ if (metadata) {
1411
+ if ((this.field.FieldType === FieldTypeEnum.Allegato
1412
+ && this.field.MetadataFields
1413
+ && this.field.MetadataFields.find((m, i) => m.Label === metadata.Label
1414
+ && (this.indexSelectedMetadata == null ? true : this.indexSelectedMetadata !== i))) ||
1415
+ (this.field.FieldType === FieldTypeEnum.Immagine
1416
+ && this.field.AttachDefinition.MetadataFields
1417
+ && this.field.AttachDefinition.MetadataFields.find((m, i) => m.Label === metadata.Label
1418
+ && (this.indexSelectedMetadata == null ? true : this.indexSelectedMetadata !== i)))) {
1419
+ EqpDynamicModuleDialogService.Warning('Impossibile inserire due metadata con la stessa label.');
1420
+ throw new Error('Impossibile inserire due metadata con la stessa label.');
1421
+ }
1422
+ if (this.indexSelectedMetadata != null && this.indexSelectedMetadata >= 0) {
1423
+ if (this.field.FieldType === FieldTypeEnum.Allegato) {
1424
+ this.field.MetadataFields[this.indexSelectedMetadata] = metadata;
1425
+ }
1426
+ else if (this.field.FieldType === FieldTypeEnum.Immagine) {
1427
+ this.field.AttachDefinition.MetadataFields[this.indexSelectedMetadata] = metadata;
1428
+ }
1429
+ }
1430
+ else {
1431
+ if (this.field.FieldType === FieldTypeEnum.Allegato) {
1432
+ if (!this.field.MetadataFields) {
1433
+ this.field.MetadataFields = new Array();
1434
+ }
1435
+ this.field.MetadataFields.push(metadata);
1436
+ }
1437
+ else if (this.field.FieldType === FieldTypeEnum.Immagine) {
1438
+ if (!this.field.AttachDefinition.MetadataFields) {
1439
+ this.field.AttachDefinition.MetadataFields = new Array();
1440
+ }
1441
+ this.field.AttachDefinition.MetadataFields.push(metadata);
1442
+ }
1443
+ }
1444
+ }
1445
+ this.dialogMetadataRef.close();
1446
+ this.setMetadataOrdinalPosition();
1447
+ this.reloadMetadataTable();
1448
+ }
1449
+ /**
1450
+ * Metodo per disabilitare il pulsante per salvare il campo inserito/modificato.
1451
+ * @returns Restituisce un booleano, se true il salvataggio viene disabilitato.
1452
+ */
1453
+ disableSaveField() {
1454
+ if (this.fieldFormGroup.invalid) {
1455
+ return true;
1456
+ }
1457
+ switch (this.field.FieldType) {
1458
+ case FieldTypeEnum['Elenco generico']:
1459
+ return !this.field.ValuePairs || this.field.ValuePairs.length === 0;
1460
+ case FieldTypeEnum.Lookup:
1461
+ return !this.field.FieldNames || this.field.FieldNames.length === 0;
1462
+ default:
1463
+ return false;
1464
+ }
1465
+ }
1466
+ /**
1467
+ * Metodo per salvare il campo inserito/modificato.
1468
+ * Se è stato inserito un field con la stessa label viene generato un errore (le label devono essere univoche).
1469
+ * Una volta aggiunto/aggiornato il campo nell'elenco dei Field della Form chiude il dialog e ricarica la tabella
1470
+ * che mostra l'elenco dei campi aggiunti alla form.
1471
+ */
1472
+ saveAndExitAddField(save) {
1473
+ if (save) {
1474
+ this.saveFieldEvent.emit(this.field);
1475
+ }
1476
+ else {
1477
+ this.saveFieldEvent.emit(null);
1478
+ }
1479
+ }
1480
+ /**
1481
+ * Metodo per ripristinare l'oggetto field al cambio del tipo selezionato.
1482
+ * Lascia valorizzate solo le proprietà dell'oggetto BaseField comune a tutti i tipi di campo.
1483
+ */
1484
+ restoreBaseFieldProperties() {
1485
+ if (this.field) {
1486
+ const tmpBaseField = JSON.parse(JSON.stringify(this.field));
1487
+ this.field = new BaseField();
1488
+ this.field.Label = tmpBaseField.Label;
1489
+ this.field.Description = tmpBaseField.Description;
1490
+ this.field.Required = tmpBaseField.Required;
1491
+ this.field.FieldType = tmpBaseField.FieldType;
1492
+ this.field.Formula = tmpBaseField.Formula;
1493
+ this.field.ColSizes = tmpBaseField.ColSizes;
1494
+ this.field.FieldGroup = tmpBaseField.FieldGroup;
1495
+ }
1496
+ }
1497
+ configureColumns() {
1498
+ this.metadataColumns = [
1499
+ {
1500
+ key: 'action', display: '', type: TypeColumn.MenuAction, buttonMenuIcon: 'more_vert', styles: { flex: '0 0 6%' },
1501
+ actions: [
1502
+ { name: 'Modifica', icon: 'edit', fn: (element, index, col) => this.openMetadataDialog(element) },
1503
+ { name: 'Elimina', icon: 'delete', fn: (element, index, col) => this.deleteMetadata(element) },
1504
+ ]
1505
+ },
1506
+ { key: 'FieldType', display: 'Tipologia', type: TypeColumn.Enum, enumModel: FieldTypeEnum },
1507
+ { key: 'Label', display: 'Label' },
1508
+ { key: 'Description', display: 'Descrizione' },
1509
+ {
1510
+ key: 'Required', display: 'Obbligatorio',
1511
+ value: (element) => !!element.Required,
1512
+ type: TypeColumn.Boolean,
1513
+ booleanValues: {
1514
+ true: '<i class="fa fa-check success-color"></i>',
1515
+ false: '<i class="fa fa-close error-color"></i>'
1516
+ },
1517
+ styles: { flex: '0 0 7%', cellAlignment: CellAlignmentEnum.CENTER }
1518
+ },
1519
+ ];
1520
+ }
1521
+ /**
1522
+ * Metodo per eliminare un metadata aggiunto per un campo di tipo Allegato o Immagine.
1523
+ * @param metadata Metadata da eliminare.
1524
+ */
1525
+ deleteMetadata(metadata) {
1526
+ EqpDynamicModuleDialogService.Confirm('Eliminare il metadata selezionato?', () => {
1527
+ if (this.field.FieldType === FieldTypeEnum.Allegato) {
1528
+ this.field.MetadataFields.splice(this.field.MetadataFields.indexOf(metadata), 1);
1529
+ }
1530
+ else if (this.field.FieldType === FieldTypeEnum.Immagine) {
1531
+ this.field.AttachDefinition.MetadataFields.splice(this.field.AttachDefinition.MetadataFields.indexOf(metadata), 1);
1532
+ }
1533
+ this.setMetadataOrdinalPosition();
1534
+ this.reloadMetadataTable();
1535
+ }, false, 'Richiesta conferma');
1536
+ }
1537
+ /**
1538
+ * Imposta l'ordinamento dei metadata all'interno dei campi di tipo Allegato e Immagine.
1539
+ */
1540
+ setMetadataOrdinalPosition() {
1541
+ if (this.field.FieldType === FieldTypeEnum.Allegato) {
1542
+ if (this.field.MetadataFields) {
1543
+ this.field.MetadataFields.forEach(metadata => {
1544
+ metadata.OrdinalPosition = this.field.MetadataFields.indexOf(metadata);
1545
+ });
1546
+ }
1547
+ }
1548
+ else if (this.field.FieldType === FieldTypeEnum.Immagine) {
1549
+ if (this.field.AttachDefinition.MetadataFields) {
1550
+ this.field.AttachDefinition.MetadataFields.forEach(metadata => {
1551
+ metadata.OrdinalPosition = this.field.AttachDefinition.MetadataFields.indexOf(metadata);
1552
+ });
1553
+ }
1554
+ }
1555
+ }
1556
+ /**
1557
+ * Metodo per ricaricare i dati della tabella dei metadata visualizzata nella creazione/modifica
1558
+ * dei campi di tipo Allegato o Immagine.
1559
+ */
1560
+ reloadMetadataTable() {
1561
+ if (this.metadataFieldsTable) {
1562
+ this.metadataFieldsTable.reloadDatatable();
1563
+ }
1564
+ }
1565
+ };
1566
+ AddFormFieldComponent.ctorParameters = () => [
1567
+ { type: FormBuilder },
1568
+ { type: EnumHelper },
1569
+ { type: MatDialog }
1570
+ ];
1571
+ __decorate([
1572
+ Input()
1573
+ ], AddFormFieldComponent.prototype, "field", void 0);
1574
+ __decorate([
1575
+ Input()
1576
+ ], AddFormFieldComponent.prototype, "indexField", void 0);
1577
+ __decorate([
1578
+ Input()
1579
+ ], AddFormFieldComponent.prototype, "formFieldsGroups", void 0);
1580
+ __decorate([
1581
+ Input()
1582
+ ], AddFormFieldComponent.prototype, "availableFields", void 0);
1583
+ __decorate([
1584
+ Input()
1585
+ ], AddFormFieldComponent.prototype, "fieldTypesToExclude", void 0);
1586
+ __decorate([
1587
+ Output()
1588
+ ], AddFormFieldComponent.prototype, "saveFieldEvent", void 0);
1589
+ __decorate([
1590
+ ViewChild('textFieldFormTemplate', { static: true })
1591
+ ], AddFormFieldComponent.prototype, "textFieldFormTemplate", void 0);
1592
+ __decorate([
1593
+ ViewChild('textareaFieldFormTemplate', { static: true })
1594
+ ], AddFormFieldComponent.prototype, "textareaFieldFormTemplate", void 0);
1595
+ __decorate([
1596
+ ViewChild('booleadFieldFormTemplate', { static: true })
1597
+ ], AddFormFieldComponent.prototype, "booleadFieldFormTemplate", void 0);
1598
+ __decorate([
1599
+ ViewChild('dateFieldFormTemplate', { static: true })
1600
+ ], AddFormFieldComponent.prototype, "dateFieldFormTemplate", void 0);
1601
+ __decorate([
1602
+ ViewChild('numericFieldFormTemplate', { static: true })
1603
+ ], AddFormFieldComponent.prototype, "numericFieldFormTemplate", void 0);
1604
+ __decorate([
1605
+ ViewChild('attachmentFieldFormTemplate', { static: true })
1606
+ ], AddFormFieldComponent.prototype, "attachmentFieldFormTemplate", void 0);
1607
+ __decorate([
1608
+ ViewChild('imageFieldFormTemplate', { static: true })
1609
+ ], AddFormFieldComponent.prototype, "imageFieldFormTemplate", void 0);
1610
+ __decorate([
1611
+ ViewChild('listValueFieldFormTemplate', { static: true })
1612
+ ], AddFormFieldComponent.prototype, "listValueFieldFormTemplate", void 0);
1613
+ __decorate([
1614
+ ViewChild('lookupFieldFormTemplate', { static: true })
1615
+ ], AddFormFieldComponent.prototype, "lookupFieldFormTemplate", void 0);
1616
+ __decorate([
1617
+ ViewChild('metadataFieldsTable', { static: false })
1618
+ ], AddFormFieldComponent.prototype, "metadataFieldsTable", void 0);
1619
+ __decorate([
1620
+ ViewChild('dialogMetadata', { static: true })
1621
+ ], AddFormFieldComponent.prototype, "dialogMetadata", void 0);
1622
+ AddFormFieldComponent = __decorate([
1623
+ Component({
1624
+ selector: 'eqp-dynamic-module-add-form-field',
1625
+ 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>",
1626
+ 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}"]
1627
+ })
1628
+ ], AddFormFieldComponent);
1629
+
1630
+ let TextFieldTemplateComponent = class TextFieldTemplateComponent {
1631
+ constructor() {
1632
+ this.recordChange = new EventEmitter();
1633
+ }
1634
+ ngOnInit() {
1635
+ }
1636
+ ngOnChanges(changes) {
1637
+ // Se viene modificato il valore di "ngModelInput" allora aggiorna l'input
1638
+ if (changes['record'] != undefined && changes['record'].firstChange == false && JSON.stringify(changes['record'].currentValue) != JSON.stringify(changes['record'].previousValue)) {
1639
+ this.record = changes['record'].currentValue;
1640
+ this.updateField();
1641
+ }
1642
+ }
1643
+ /**
1644
+ * Metodo per aggiornare il valore del campo quando questo è rappresentato da una formula.
1645
+ */
1646
+ updateField() {
1647
+ if (this.field.Formula) {
1648
+ this.record[this.field.Name] = UtilityHelperService.EvaluateFieldFormula(this.field.Formula, this.record, null);
1649
+ }
1650
+ }
1651
+ /**
1652
+ * Metodo per emettere l'evento che il valore del record è cambiato.
1653
+ */
1654
+ onRecordValueChange() {
1655
+ if (!this.field.Formula) {
1656
+ this.recordChange.emit(this.record);
1657
+ }
1658
+ }
1659
+ };
1660
+ __decorate([
1661
+ Input()
1662
+ ], TextFieldTemplateComponent.prototype, "field", void 0);
1663
+ __decorate([
1664
+ Input()
1665
+ ], TextFieldTemplateComponent.prototype, "record", void 0);
1666
+ __decorate([
1667
+ Output()
1668
+ ], TextFieldTemplateComponent.prototype, "recordChange", void 0);
1669
+ TextFieldTemplateComponent = __decorate([
1670
+ Component({
1671
+ selector: 'text-field-template',
1672
+ 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>",
1673
+ styles: [""]
1674
+ })
1675
+ ], TextFieldTemplateComponent);
1676
+
1677
+ let BooleanFieldTemplateComponent = class BooleanFieldTemplateComponent {
1678
+ constructor() {
1679
+ this.recordChange = new EventEmitter();
1680
+ this.BoolPresentantioEnum = BoolPresentantioEnum;
1681
+ }
1682
+ ngOnInit() {
1683
+ if (this.record[this.field.Name] == undefined || this.record[this.field.Name] == null) {
1684
+ this.record[this.field.Name] = this.field.IsTristate ? null : false;
1685
+ }
1686
+ }
1687
+ ngOnChanges(changes) {
1688
+ // Se viene modificato il valore di "ngModelInput" allora aggiorna l'input
1689
+ if (changes['record'] != undefined && changes['record'].firstChange == false && JSON.stringify(changes['record'].currentValue) != JSON.stringify(changes['record'].previousValue)) {
1690
+ this.record = changes['record'].currentValue;
1691
+ this.updateField();
1692
+ }
1693
+ }
1694
+ /**
1695
+ * Metodo per aggiornare il valore del campo quando questo è rappresentato da una formula.
1696
+ */
1697
+ updateField() {
1698
+ if (this.field.Formula) {
1699
+ this.record[this.field.Name] = UtilityHelperService.EvaluateFieldFormula(this.field.Formula, this.record, null);
1700
+ }
1701
+ }
1702
+ /**
1703
+ * Metodo per emettere l'evento che il valore del record è cambiato.
1704
+ */
1705
+ onRecordValueChange() {
1706
+ if (!this.field.Formula) {
1707
+ this.recordChange.emit(this.record);
1708
+ }
1709
+ }
1710
+ };
1711
+ __decorate([
1712
+ Input()
1713
+ ], BooleanFieldTemplateComponent.prototype, "field", void 0);
1714
+ __decorate([
1715
+ Input()
1716
+ ], BooleanFieldTemplateComponent.prototype, "record", void 0);
1717
+ __decorate([
1718
+ Output()
1719
+ ], BooleanFieldTemplateComponent.prototype, "recordChange", void 0);
1720
+ BooleanFieldTemplateComponent = __decorate([
1721
+ Component({
1722
+ selector: 'boolean-field-template',
1723
+ 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>",
1724
+ styles: [""]
1725
+ })
1726
+ ], BooleanFieldTemplateComponent);
1727
+
1728
+ let DateFieldTemplateComponent = class DateFieldTemplateComponent {
1729
+ constructor() {
1730
+ this.recordChange = new EventEmitter();
1731
+ }
1732
+ ngOnInit() {
1733
+ this.setTimeType();
1734
+ }
1735
+ ngOnChanges(changes) {
1736
+ // Se viene modificato il valore di "ngModelInput" allora aggiorna l'input
1737
+ if (changes['record'] != undefined && changes['record'].firstChange == false && JSON.stringify(changes['record'].currentValue) != JSON.stringify(changes['record'].previousValue)) {
1738
+ this.record = changes['record'].currentValue;
1739
+ this.updateField();
1740
+ }
1741
+ }
1742
+ /**
1743
+ * Metodo per aggiornare il valore del campo quando questo è rappresentato da una formula.
1744
+ */
1745
+ updateField() {
1746
+ if (this.field.Formula) {
1747
+ this.record[this.field.Name] = UtilityHelperService.EvaluateFieldFormula(this.field.Formula, this.record, null);
1748
+ }
1749
+ }
1750
+ /**
1751
+ * Metodo per emettere l'evento che il valore del record è cambiato.
1752
+ */
1753
+ onRecordValueChange() {
1754
+ if (!this.field.Formula) {
1755
+ this.recordChange.emit(this.record);
1756
+ }
1757
+ }
1758
+ /**
1759
+ * In base al formato della data richiesta nel DateField (solo data, solo orario o data e ora)
1760
+ * imposta la visualizzazione corretta del componente eqp-datetimepicker.
1761
+ */
1762
+ setTimeType() {
1763
+ switch (this.field.IsOnlyDate) {
1764
+ case DateTimeTypeEnum["Solo data"]:
1765
+ this.pickerMode = PickerModeEnum.DATE;
1766
+ break;
1767
+ case DateTimeTypeEnum["Solo orario"]:
1768
+ this.pickerMode = PickerModeEnum.TIME;
1769
+ break;
1770
+ case DateTimeTypeEnum["Data e ora"]:
1771
+ this.pickerMode = PickerModeEnum.DATETIME;
1772
+ break;
1773
+ }
1774
+ }
1775
+ };
1776
+ __decorate([
1777
+ Input()
1778
+ ], DateFieldTemplateComponent.prototype, "field", void 0);
1779
+ __decorate([
1780
+ Input()
1781
+ ], DateFieldTemplateComponent.prototype, "record", void 0);
1782
+ __decorate([
1783
+ Output()
1784
+ ], DateFieldTemplateComponent.prototype, "recordChange", void 0);
1785
+ DateFieldTemplateComponent = __decorate([
1786
+ Component({
1787
+ selector: 'date-field-template',
1788
+ 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>",
1789
+ styles: [""]
1790
+ })
1791
+ ], DateFieldTemplateComponent);
1792
+
1793
+ let TextareaFieldTemplateComponent = class TextareaFieldTemplateComponent {
1794
+ constructor() {
1795
+ this.recordChange = new EventEmitter();
1796
+ }
1797
+ ngOnInit() {
1798
+ }
1799
+ ngOnChanges(changes) {
1800
+ // Se viene modificato il valore di "ngModelInput" allora aggiorna l'input
1801
+ if (changes['record'] != undefined && changes['record'].firstChange == false && JSON.stringify(changes['record'].currentValue) != JSON.stringify(changes['record'].previousValue)) {
1802
+ this.record = changes['record'].currentValue;
1803
+ this.updateField();
1804
+ }
1805
+ }
1806
+ /**
1807
+ * Metodo per aggiornare il valore del campo quando questo è rappresentato da una formula.
1808
+ */
1809
+ updateField() {
1810
+ if (this.field.Formula) {
1811
+ this.record[this.field.Name] = UtilityHelperService.EvaluateFieldFormula(this.field.Formula, this.record, null);
1812
+ }
1813
+ }
1814
+ /**
1815
+ * Metodo per emettere l'evento che il valore del record è cambiato.
1816
+ */
1817
+ onRecordValueChange() {
1818
+ if (!this.field.Formula) {
1819
+ this.recordChange.emit(this.record);
1820
+ }
1821
+ }
1822
+ };
1823
+ __decorate([
1824
+ Input()
1825
+ ], TextareaFieldTemplateComponent.prototype, "field", void 0);
1826
+ __decorate([
1827
+ Input()
1828
+ ], TextareaFieldTemplateComponent.prototype, "record", void 0);
1829
+ __decorate([
1830
+ Output()
1831
+ ], TextareaFieldTemplateComponent.prototype, "recordChange", void 0);
1832
+ TextareaFieldTemplateComponent = __decorate([
1833
+ Component({
1834
+ selector: 'textarea-field-template',
1835
+ 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>",
1836
+ styles: [""]
1837
+ })
1838
+ ], TextareaFieldTemplateComponent);
1839
+
1840
+ let NumericFieldTemplateComponent = class NumericFieldTemplateComponent {
1841
+ constructor() {
1842
+ this.recordChange = new EventEmitter();
1843
+ this.eqpNumericOptions = {};
1844
+ }
1845
+ ngOnInit() {
1846
+ this.configureEqpNumericOptions();
1847
+ }
1848
+ ngOnChanges(changes) {
1849
+ // Se viene modificato il valore di "ngModelInput" allora aggiorna l'input
1850
+ if (changes['record'] != undefined && changes['record'].firstChange == false && JSON.stringify(changes['record'].currentValue) != JSON.stringify(changes['record'].previousValue)) {
1851
+ this.record = changes['record'].currentValue;
1852
+ this.updateField();
1853
+ }
1854
+ }
1855
+ /**
1856
+ * Metodo per aggiornare il valore del campo quando questo è rappresentato da una formula.
1857
+ */
1858
+ updateField() {
1859
+ if (this.field.Formula) {
1860
+ this.record[this.field.Name] = UtilityHelperService.EvaluateFieldFormula(this.field.Formula, this.record, null);
1861
+ }
1862
+ }
1863
+ /**
1864
+ * Metodo per emettere l'evento che il valore del record è cambiato.
1865
+ */
1866
+ onRecordValueChange() {
1867
+ if (!this.field.Formula) {
1868
+ this.recordChange.emit(this.record);
1869
+ }
1870
+ }
1871
+ /**
1872
+ * Metodo per configurare eqp-numeric
1873
+ */
1874
+ configureEqpNumericOptions() {
1875
+ this.eqpNumericOptions.prefix = this.field.CurrencySymbol ? this.field.CurrencySymbol : "";
1876
+ if (this.field.MinValue != null && this.field.MinValue != undefined)
1877
+ this.eqpNumericOptions.min = this.field.MinValue;
1878
+ if (this.field.MaxValue != null && this.field.MaxValue != undefined)
1879
+ this.eqpNumericOptions.max = this.field.MaxValue;
1880
+ }
1881
+ };
1882
+ __decorate([
1883
+ Input()
1884
+ ], NumericFieldTemplateComponent.prototype, "field", void 0);
1885
+ __decorate([
1886
+ Input()
1887
+ ], NumericFieldTemplateComponent.prototype, "record", void 0);
1888
+ __decorate([
1889
+ Output()
1890
+ ], NumericFieldTemplateComponent.prototype, "recordChange", void 0);
1891
+ NumericFieldTemplateComponent = __decorate([
1892
+ Component({
1893
+ selector: 'numeric-field-template',
1894
+ 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>",
1895
+ styles: [""]
1896
+ })
1897
+ ], NumericFieldTemplateComponent);
1898
+
1899
+ let ListValueFieldTemplateComponent = class ListValueFieldTemplateComponent {
1900
+ constructor() {
1901
+ this.recordChange = new EventEmitter();
1902
+ this.ListPresentationEnum = ListPresentationEnum;
1903
+ this.arrayData = [];
1904
+ }
1905
+ ngOnInit() {
1906
+ this.setArrayData();
1907
+ if (this.field.IsMultiChoiche && !this.record[this.field.Name]) {
1908
+ this.record[this.field.Name] = [];
1909
+ }
1910
+ // Nel caso in cui sono in modifica di un Record aggiorno il valore
1911
+ // e il validator del FormControl. Se non viene eseguita questa riga
1912
+ // l'utente deve modificare la selezione fatta per aggiornare la form.
1913
+ this.setFormControlValue();
1914
+ }
1915
+ ngOnChanges(changes) {
1916
+ // Se viene modificato il valore di "ngModelInput" allora aggiorna l'input
1917
+ if (changes['record'] != undefined && changes['record'].firstChange == false && JSON.stringify(changes['record'].currentValue) != JSON.stringify(changes['record'].previousValue)) {
1918
+ this.record = changes['record'].currentValue;
1919
+ this.updateField();
1920
+ }
1921
+ }
1922
+ /**
1923
+ * Metodo per aggiornare il valore del campo quando questo è rappresentato da una formula.
1924
+ */
1925
+ updateField() {
1926
+ if (this.field.Formula) {
1927
+ this.record[this.field.Name] = UtilityHelperService.EvaluateFieldFormula(this.field.Formula, this.record, null);
1928
+ }
1929
+ }
1930
+ /**
1931
+ * Metodo per recuperare la classe da applicare al button (nella relativa visualizzazione).
1932
+ * Se il pulsante è stato selezionato imposta la classe "selected-button".
1933
+ * @param data Oggetto bindato al pulsante
1934
+ * @returns Restituisce la classe da applicare tramite [ngClass]
1935
+ */
1936
+ getSelectButtonClass(data) {
1937
+ const selectedButtonClass = "selected-button";
1938
+ return data.Selected ? selectedButtonClass : null;
1939
+ }
1940
+ /**
1941
+ * Metodo invocato quando viene selezionata un'opzione nella visualizzazione a button
1942
+ * @param data Rappresenta l'oggetto selezionato
1943
+ */
1944
+ buttonSelectClick(data) {
1945
+ if (this.field.IsMultiChoiche) {
1946
+ data.Selected = !data.Selected;
1947
+ this.updateSelected(false);
1948
+ }
1949
+ else {
1950
+ this.record[this.field.Name] = data.Value;
1951
+ }
1952
+ this.onRecordValueChange();
1953
+ }
1954
+ /**
1955
+ * Metodo per aggiornare il/i valore/i selezionato/i dall'utente.
1956
+ * @param emitChange Se true scatena l'evento di output della modifica del valore di record
1957
+ */
1958
+ updateSelected(emitChange = true) {
1959
+ this.record[this.field.Name] = this.arrayData.filter(data => data.Selected).map(data => data.Value);
1960
+ this.setFormControlValue();
1961
+ if (emitChange) {
1962
+ this.onRecordValueChange();
1963
+ }
1964
+ }
1965
+ /**
1966
+ * Metodo per emettere l'evento che il valore del record è cambiato.
1967
+ */
1968
+ onRecordValueChange() {
1969
+ if (!this.field.Formula) {
1970
+ this.recordChange.emit(this.record);
1971
+ }
1972
+ }
1973
+ /**
1974
+ * Metodo per creare un array di oggetti del tipo { Key: string, Value: any } da usare come sorgente dati per la eqp-select.
1975
+ */
1976
+ setArrayData() {
1977
+ Object.keys(this.field.ValuePairs).forEach(k => {
1978
+ var isOptionSelected;
1979
+ if (this.field.IsMultiChoiche && this.record[this.field.Name] && this.record[this.field.Name].length > 0) {
1980
+ isOptionSelected = !!this.record[this.field.Name].find(v => v == this.field.ValuePairs[k]);
1981
+ }
1982
+ else {
1983
+ isOptionSelected = this.record[this.field.Name] === this.field.ValuePairs[k];
1984
+ }
1985
+ this.arrayData.push({ Key: k, Value: this.field.ValuePairs[k], Selected: isOptionSelected });
1986
+ });
1987
+ }
1988
+ /**
1989
+ * Metodo per aggiornare il valore e il validator del FormControl associato al campo.
1990
+ */
1991
+ setFormControlValue() {
1992
+ this.field.FormFormGroup.controls[this.field.Name].setValue(this.record[this.field.Name]);
1993
+ }
1994
+ };
1995
+ __decorate([
1996
+ Input()
1997
+ ], ListValueFieldTemplateComponent.prototype, "field", void 0);
1998
+ __decorate([
1999
+ Input()
2000
+ ], ListValueFieldTemplateComponent.prototype, "record", void 0);
2001
+ __decorate([
2002
+ Output()
2003
+ ], ListValueFieldTemplateComponent.prototype, "recordChange", void 0);
2004
+ ListValueFieldTemplateComponent = __decorate([
2005
+ Component({
2006
+ selector: 'list-value-field-template',
2007
+ 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>",
2008
+ styles: [".selected-button{opacity:.7}.selected-button:disabled{background-color:var(--primary)!important;opacity:.3;color:#fff}"]
2009
+ })
2010
+ ], ListValueFieldTemplateComponent);
2011
+
2012
+ let AttachmentFieldTemplateComponent = class AttachmentFieldTemplateComponent {
2013
+ //#endregion
2014
+ constructor(utilityService, cdr) {
2015
+ this.utilityService = utilityService;
2016
+ this.cdr = cdr;
2017
+ this.onlyImages = false;
2018
+ this.recordChange = new EventEmitter();
2019
+ this.metadataFormGroups = new Array();
2020
+ //#region Etichette per eqp-attachments
2021
+ this.previewLabel = "Anteprima";
2022
+ this.emptyTableMessage = "No record found";
2023
+ this.downloadTooltipPosition = "below";
2024
+ this.openLinkLabel = "Apri link";
2025
+ this.addButtonLabel = "Aggiungi";
2026
+ this.downloadLabel = "Download";
2027
+ this.deleteLabel = "Elimina";
2028
+ this.fileNameLabel = "Nome file";
2029
+ this.uploadFileLabel = "Carica file";
2030
+ this.confirmLabel = "Conferma";
2031
+ this.abortLabel = "Annulla";
2032
+ this.saveLabel = "Salva";
2033
+ this.exitLabel = "Esci";
2034
+ this.eqpTableSearchText = "Cerca...";
2035
+ this.deleteDialogTitle = "Attenzione:";
2036
+ this.deleteDialogMessage = "Sicuro di voler eliminare questo allegato?";
2037
+ this.noImageSelectedErrorMessage = "Nessuna immagine selezionata!";
2038
+ }
2039
+ ngOnInit() {
2040
+ // Nel caso in cui sono in modifica di un Record aggiorno il valore
2041
+ // e il validator del FormControl. Se non viene eseguita questa riga
2042
+ // l'utente deve modificare la selezione fatta per aggiornare la form.
2043
+ this.setFormControlValue();
2044
+ // Sempre nel caso in cui sono in modifica creo i FormGroup che rappresentano
2045
+ // gli eventuali metadata degli allegati recuperati.
2046
+ this.createMetadataFormGroups();
2047
+ if (this.field.MetadataFields) {
2048
+ this.field.MetadataFields.sort((a, b) => (a.OrdinalPosition > b.OrdinalPosition) ? 1 : ((b.OrdinalPosition > a.OrdinalPosition) ? -1 : 0));
2049
+ }
2050
+ if (!this.field.AllowedExtensions) {
2051
+ this.field.AllowedExtensions = AvailableFileExtensions.concat(AvailableImageExtensions).map(ext => ext.key);
2052
+ }
2053
+ }
2054
+ ngAfterViewInit() {
2055
+ // Dopo aver renderizzato il DOM, se il campo ammette molteplici allegati
2056
+ // configuro le colonne della eqp-table in eqp-attachments.
2057
+ if (this.field.IsMultiAttach) {
2058
+ this.configureMultiAttachmentColumns();
2059
+ }
2060
+ }
2061
+ ngOnChanges(changes) {
2062
+ // Se viene modificato il valore di "ngModelInput" allora aggiorna l'input
2063
+ if (changes['record'] != undefined && changes['record'].firstChange == false && JSON.stringify(changes['record'].currentValue) != JSON.stringify(changes['record'].previousValue)) {
2064
+ this.record = changes['record'].currentValue;
2065
+ this.updateField();
2066
+ }
2067
+ }
2068
+ /**
2069
+ * Metodo per aggiornare il valore del campo quando questo è rappresentato da una formula.
2070
+ */
2071
+ updateField() {
2072
+ if (this.field.Formula) {
2073
+ this.record[this.field.Name] = UtilityHelperService.EvaluateFieldFormula(this.field.Formula, this.record, null);
2074
+ }
2075
+ }
2076
+ /**
2077
+ * Metodo per intercettare le modifiche agli allegati caricati.
2078
+ * Se il campo prevede dei metadata allora per ogni allegato caricato crea un FormGroup
2079
+ * per gestire la validazione degli input che l'utente può/deve riempire. I FormGroup
2080
+ * seguono lo stesso ordine degli allegati caricati.
2081
+ * @param event Contiene la lista aggiornata degli Attachment caricati dall'utente.
2082
+ */
2083
+ catchAttachmentList(event) {
2084
+ this.record[this.field.Name] = event;
2085
+ this.createMetadataFormGroups();
2086
+ this.setFormControlValue();
2087
+ this.onRecordValueChange();
2088
+ this.cdr.detectChanges();
2089
+ }
2090
+ /**
2091
+ * Metodo per aggiornare lo stato di validazione del FormControl che rappresenta
2092
+ * il campo Allegato (non i metadata al suo interno). Se tra le form dei metadata
2093
+ * ne trova una invalida allora marca il controllo come invalido.
2094
+ */
2095
+ updateMetadataValidity() {
2096
+ if (this.metadataFormGroups.find(form => form.invalid)) {
2097
+ this.field.FormFormGroup.controls[this.field.Name].setErrors({ 'incorrect': true });
2098
+ }
2099
+ else {
2100
+ this.field.FormFormGroup.controls[this.field.Name].setErrors(null);
2101
+ }
2102
+ this.onRecordValueChange();
2103
+ }
2104
+ /**
2105
+ * Metodo per recuperare il BaseField che rappresenta il metadata nella riga della eqp-table
2106
+ * in base alla colonna e alla riga. Una volta trovato il BaseField gli viene associato il
2107
+ * FormGroup di cui fa parte.
2108
+ * @param col Colonna della eqp-table.
2109
+ * @param row Riga della eqp-table (in questo caso eredita da IAttachment).
2110
+ * @returns Restituisce un BaseField per renderizzare il campo nella eqp-table degli allegati multipli.
2111
+ */
2112
+ getFieldFromMetadata(col, row) {
2113
+ var baseField = JSON.parse(JSON.stringify(this.field.MetadataFields.find(metadata => metadata.Name === col.key)));
2114
+ baseField.FormFormGroup = this.metadataFormGroups[this.record[this.field.Name].indexOf(row)];
2115
+ return baseField;
2116
+ }
2117
+ /**
2118
+ * Metodo per aggiornare il valore e il validator del FormControl associato al campo.
2119
+ */
2120
+ setFormControlValue() {
2121
+ this.field.FormFormGroup.controls[this.field.Name].setValue(this.record[this.field.Name]);
2122
+ }
2123
+ /**
2124
+ * Metodo per emettere l'evento che il valore del record è cambiato.
2125
+ */
2126
+ onRecordValueChange() {
2127
+ if (!this.field.Formula) {
2128
+ this.recordChange.emit(this.record);
2129
+ }
2130
+ }
2131
+ /**
2132
+ * Metodo per aggiungere alle colonne di eqp-attachments le colonne per modificare i metadata
2133
+ * configurati per il campo Allegato o Immagine.
2134
+ */
2135
+ configureMultiAttachmentColumns() {
2136
+ if (this.eqpAttachments && this.eqpAttachments.attachmentsColumns && this.field.MetadataFields && this.field.MetadataFields.length > 0) {
2137
+ this.field.MetadataFields.forEach(metadata => {
2138
+ this.eqpAttachments.attachmentsColumns.splice(this.eqpAttachments.attachmentsColumns.length - 1, 0, { key: metadata.Name, display: metadata.Label, type: TypeColumn.ExternalTemplate, externalTemplate: this.metadataColumnTemplate });
2139
+ });
2140
+ }
2141
+ }
2142
+ /**
2143
+ * Metodo per creare i FormGroup che rappresentano i metadata degli allegati caricati.
2144
+ */
2145
+ createMetadataFormGroups() {
2146
+ if (this.field.MetadataFields && this.field.MetadataFields.length > 0) {
2147
+ this.metadataFormGroups = [];
2148
+ if (this.record[this.field.Name] && this.record[this.field.Name].length > 0) {
2149
+ this.record[this.field.Name].forEach(attachment => {
2150
+ this.metadataFormGroups.push(this.utilityService.CreateFormFormGroup(this.field.MetadataFields, attachment, this.field.FormFormGroup.disabled, !this.field.IsMultiAttach));
2151
+ });
2152
+ }
2153
+ this.updateMetadataValidity();
2154
+ }
2155
+ }
2156
+ };
2157
+ AttachmentFieldTemplateComponent.ctorParameters = () => [
2158
+ { type: UtilityHelperService },
2159
+ { type: ChangeDetectorRef }
2160
+ ];
2161
+ __decorate([
2162
+ Input()
2163
+ ], AttachmentFieldTemplateComponent.prototype, "onlyImages", void 0);
2164
+ __decorate([
2165
+ Input()
2166
+ ], AttachmentFieldTemplateComponent.prototype, "field", void 0);
2167
+ __decorate([
2168
+ Input()
2169
+ ], AttachmentFieldTemplateComponent.prototype, "record", void 0);
2170
+ __decorate([
2171
+ Output()
2172
+ ], AttachmentFieldTemplateComponent.prototype, "recordChange", void 0);
2173
+ __decorate([
2174
+ ViewChild("eqpAttachments", { static: true })
2175
+ ], AttachmentFieldTemplateComponent.prototype, "eqpAttachments", void 0);
2176
+ __decorate([
2177
+ ViewChild('metadataColumnTemplate', { static: true })
2178
+ ], AttachmentFieldTemplateComponent.prototype, "metadataColumnTemplate", void 0);
2179
+ AttachmentFieldTemplateComponent = __decorate([
2180
+ Component({
2181
+ selector: 'attachment-field-template',
2182
+ 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>",
2183
+ styles: [""]
2184
+ })
2185
+ ], AttachmentFieldTemplateComponent);
2186
+
2187
+ let ImageFieldTemplateComponent = class ImageFieldTemplateComponent {
2188
+ constructor() {
2189
+ this.recordChange = new EventEmitter();
2190
+ }
2191
+ ngOnInit() {
2192
+ this.field.AttachDefinition.FormFormGroup = this.field.FormFormGroup;
2193
+ if (!this.field.AttachDefinition.AllowedExtensions) {
2194
+ this.field.AttachDefinition.AllowedExtensions = AvailableImageExtensions.map(ext => ext.key);
2195
+ }
2196
+ this.field.AttachDefinition.Name = this.field.Name;
2197
+ this.field.AttachDefinition.Label = this.field.Label;
2198
+ this.field.AttachDefinition.Description = this.field.Description;
2199
+ this.field.AttachDefinition.Required = this.field.Required;
2200
+ this.field.AttachDefinition.Formula = this.field.Formula;
2201
+ this.field.AttachDefinition.FieldValue = this.field.FieldValue;
2202
+ }
2203
+ ngOnChanges(changes) {
2204
+ // Se viene modificato il valore di "ngModelInput" allora aggiorna l'input
2205
+ if (changes['record'] != undefined && changes['record'].firstChange == false && JSON.stringify(changes['record'].currentValue) != JSON.stringify(changes['record'].previousValue)) {
2206
+ this.record = changes['record'].currentValue;
2207
+ this.updateField();
2208
+ }
2209
+ }
2210
+ /**
2211
+ * Metodo per aggiornare il valore del campo quando questo è rappresentato da una formula.
2212
+ */
2213
+ updateField() {
2214
+ if (this.field.Formula) {
2215
+ this.record[this.field.Name] = UtilityHelperService$1.EvaluateFieldFormula(this.field.Formula, this.record, null);
2216
+ }
2217
+ }
2218
+ };
2219
+ __decorate([
2220
+ Input()
2221
+ ], ImageFieldTemplateComponent.prototype, "record", void 0);
2222
+ __decorate([
2223
+ Input()
2224
+ ], ImageFieldTemplateComponent.prototype, "field", void 0);
2225
+ __decorate([
2226
+ Output()
2227
+ ], ImageFieldTemplateComponent.prototype, "recordChange", void 0);
2228
+ ImageFieldTemplateComponent = __decorate([
2229
+ Component({
2230
+ selector: 'image-field-template',
2231
+ template: "<attachment-field-template [(record)]=\"record\" [field]=\"field.AttachDefinition\"\n [onlyImages]=\"true\">\n</attachment-field-template>",
2232
+ styles: [""]
2233
+ })
2234
+ ], ImageFieldTemplateComponent);
2235
+
2236
+ let ListFormRecordComponent = class ListFormRecordComponent {
2237
+ constructor() {
2238
+ this.columns = new Array();
2239
+ this.onAddViewEditRecord = new EventEmitter();
2240
+ }
2241
+ ngOnInit() {
2242
+ this.configureColumns();
2243
+ }
2244
+ /**
2245
+ * Metodo per configurare le colonne della eqp-table.
2246
+ */
2247
+ configureColumns() {
2248
+ this.columns = [
2249
+ {
2250
+ key: "action", display: "",
2251
+ type: TypeColumn.MenuAction, buttonMenuIcon: "more_vert", styles: { flex: "0 0 6%" },
2252
+ actions: [
2253
+ { name: "Visualizza", icon: "info", fn: (element, index, col) => this.viewOrEditRecord(element, true) },
2254
+ { name: "Modifica", icon: "edit", fn: (element, index, col) => this.viewOrEditRecord(element, false) },
2255
+ { name: "Duplica", icon: "file_copy", fn: (element, index, col) => this.duplicateRecord(element) },
2256
+ { name: "Elimina", icon: "delete", fn: (element, index, col) => this.deleteRecord(element) },
2257
+ ],
2258
+ },
2259
+ ];
2260
+ this.createAdditionalActions();
2261
+ this.createColumnsFromFormFields();
2262
+ }
2263
+ /**
2264
+ * Metodo per aggiungere nella colonna "action" della eqp-table le azioni sui record
2265
+ * definite dall'utente all'interno della Form.
2266
+ */
2267
+ createAdditionalActions() {
2268
+ if (this.form.ActionsOnRecord && this.form.ActionsOnRecord.length > 0) {
2269
+ this.form.ActionsOnRecord
2270
+ .sort((a, b) => (a.OrdinalPosition > b.OrdinalPosition) ? 1 : ((b.OrdinalPosition > a.OrdinalPosition) ? -1 : 0))
2271
+ .forEach(action => {
2272
+ this.columns.find(c => c.key === 'action')
2273
+ .actions
2274
+ .push({
2275
+ name: action.Name, icon: action.Icon, fn: (element, index, col) => {
2276
+ const rec = element;
2277
+ const ctx = UtilityHelperService$2.context;
2278
+ eval(action.Action);
2279
+ // TODO: salvare le modifiche
2280
+ }
2281
+ });
2282
+ });
2283
+ }
2284
+ }
2285
+ /**
2286
+ * Metodo che scatena l'evento di Output per mostrare o modificare il record
2287
+ * selezionato sulla eqp-table.
2288
+ * @param record Record da visualizzare o modificare selezionato sulla eqp-table.
2289
+ * @param onlyView Se TRUE viene mostrato il componente add-form-record in sola lettura.
2290
+ */
2291
+ viewOrEditRecord(record, onlyView) {
2292
+ this.onAddViewEditRecord.emit({ record, onlyView });
2293
+ }
2294
+ /**
2295
+ * Metodo per duplicare un record della form.
2296
+ * @param record Record da duplicare.
2297
+ */
2298
+ duplicateRecord(record) {
2299
+ EqpDynamicModuleDialogService$1.Confirm('Duplicare il record selezionato?', () => {
2300
+ var copiedRecord = JSON.parse(JSON.stringify(record));
2301
+ if (!isNaN(parseInt(copiedRecord.ID))) {
2302
+ copiedRecord.ID = (parseInt(copiedRecord.ID) + 1).toString();
2303
+ }
2304
+ else {
2305
+ copiedRecord.ID = "xxxxxxxxx".replace("x", (c) => { return (Math.random() + 16 | 0).toString(16); });
2306
+ }
2307
+ this.values.push(copiedRecord);
2308
+ this.reloadTables();
2309
+ }, false, 'Richiesta conferma');
2310
+ //TODO
2311
+ }
2312
+ /**
2313
+ * Metodo per eliminare un record dalla lista.
2314
+ * @param record Record da eliminare selezionato sulla eqp-table.
2315
+ */
2316
+ deleteRecord(record) {
2317
+ EqpDynamicModuleDialogService$1.Confirm('Eliminare il record selezionato?', () => {
2318
+ this.values.splice(this.values.indexOf(record), 1);
2319
+ this.reloadTables();
2320
+ }, false, 'Richiesta conferma');
2321
+ // TODO
2322
+ }
2323
+ /**
2324
+ * Metodo per creare la configurazione delle colonne per la eqp-table.
2325
+ * Individua i BaseField da mostrare e li usa per creare le ConfigColumn.
2326
+ * Le colonne vengono create per i BaseField con il flag InListView a TRUE
2327
+ * oppure, nel caso non siano stati specificati i campi da visualizzare,
2328
+ * seleziona i primi 6.
2329
+ */
2330
+ createColumnsFromFormFields() {
2331
+ var fieldsForColumns;
2332
+ if (this.form.Fields.find(f => f.InListView)) {
2333
+ fieldsForColumns = this.form.Fields.filter(f => f.InListView);
2334
+ }
2335
+ else {
2336
+ fieldsForColumns = this.form.Fields.filter(f => f.OrdinalPosition < 6);
2337
+ }
2338
+ fieldsForColumns.sort((a, b) => (a.OrdinalPosition > b.OrdinalPosition) ? 1 : ((b.OrdinalPosition > a.OrdinalPosition) ? -1 : 0))
2339
+ .forEach(field => {
2340
+ this.columns.push(this.createFieldColumn(field));
2341
+ });
2342
+ }
2343
+ /**
2344
+ * Metodo per creare l'oggetto ConfigureColumn che rappresenta il BaseField passato in input.
2345
+ * @param field BaseField per cui creare la colonna nella eqp-table
2346
+ * @returns Restituisce una ConfigColumn per la eqp-table
2347
+ */
2348
+ createFieldColumn(field) {
2349
+ var column = { key: field.Name, display: field.Label };
2350
+ switch (field.FieldType) {
2351
+ case FieldTypeEnum$1['Booleano']:
2352
+ column.type = TypeColumn.Boolean;
2353
+ column.booleanValues = { false: '<i class="fa fa-times error-color"></i>', true: '<i class="fa fa-check success-color"></i>' };
2354
+ column.styles = { flex: "0 0 7%", cellAlignment: CellAlignmentEnum.CENTER };
2355
+ break;
2356
+ case FieldTypeEnum$1['Data e/o ora']:
2357
+ if (field.IsOnlyDate != DateTimeTypeEnum$1['Solo orario']) {
2358
+ column.type = TypeColumn.Date;
2359
+ if (field.IsOnlyDate == DateTimeTypeEnum$1['Data e ora']) {
2360
+ column.format = "dd/MM/yyyy HH:mm";
2361
+ }
2362
+ else if (field.IsOnlyDate == DateTimeTypeEnum$1['Solo data']) {
2363
+ column.format = "dd/MM/yyyy";
2364
+ }
2365
+ }
2366
+ break;
2367
+ case FieldTypeEnum$1['Campo numerico']:
2368
+ if (field.CurrencySymbol) {
2369
+ column.numberPipe = NumberColumnPipe.CURRENCY;
2370
+ column.currencyPipeCode = field.CurrencySymbol;
2371
+ }
2372
+ else if (!field.IsInteger) {
2373
+ column.numberPipe = NumberColumnPipe.DECIMAL;
2374
+ }
2375
+ break;
2376
+ case FieldTypeEnum$1['Allegato']:
2377
+ case FieldTypeEnum$1['Immagine']:
2378
+ column.value = (element) => {
2379
+ if (field.IsMultiAttach || (field.AttachDefinition && field.AttachDefinition.IsMultiAttach)) {
2380
+ return element[field.Name] != null && element[field.Name].length > 0 ? element[field.Name].map(a => a.FileName).join(", ") : null;
2381
+ }
2382
+ else {
2383
+ return element[field.Name] != null && element[field.Name].length > 0 ? element[field.Name][0].FileName : null;
2384
+ }
2385
+ };
2386
+ column.isSortable = false;
2387
+ column.isSearchable = false;
2388
+ break;
2389
+ case FieldTypeEnum$1['Elenco generico']:
2390
+ column.value = (element) => {
2391
+ if (field.IsMultiChoiche) {
2392
+ if (!element[field.Name] || element[field.Name].length == 0) {
2393
+ return null;
2394
+ }
2395
+ else {
2396
+ return Object.keys(field.ValuePairs).filter(k => element[field.Name].includes(field.ValuePairs[k])).join(", ");
2397
+ }
2398
+ }
2399
+ else {
2400
+ return Object.keys(field.ValuePairs).find(k => field.ValuePairs[k] == element[field.Name]);
2401
+ }
2402
+ };
2403
+ column.isSortable = false;
2404
+ column.isSearchable = false;
2405
+ break;
2406
+ case FieldTypeEnum$1['Lookup']:
2407
+ // TODO
2408
+ break;
2409
+ }
2410
+ return column;
2411
+ }
2412
+ /**
2413
+ * Metodo per ricaricare i dati della eqp-table.
2414
+ */
2415
+ reloadTables() {
2416
+ if (this.tableRecords) {
2417
+ this.tableRecords.reloadDatatable();
2418
+ }
2419
+ }
2420
+ };
2421
+ __decorate([
2422
+ Input()
2423
+ ], ListFormRecordComponent.prototype, "form", void 0);
2424
+ __decorate([
2425
+ Input()
2426
+ ], ListFormRecordComponent.prototype, "values", void 0);
2427
+ __decorate([
2428
+ ViewChild('tableRecords', { static: true })
2429
+ ], ListFormRecordComponent.prototype, "tableRecords", void 0);
2430
+ __decorate([
2431
+ Output()
2432
+ ], ListFormRecordComponent.prototype, "onAddViewEditRecord", void 0);
2433
+ ListFormRecordComponent = __decorate([
2434
+ Component({
2435
+ selector: 'list-form-record',
2436
+ template: "<div class=\"row eqp-dynamic-module-title\">\r\n <div class=\"col-md-6\">\r\n <h4><b>Elenco {{form.Name}}</b></h4>\r\n </div>\r\n <div class=\"col-md-6 text-right\">\r\n <button class=\"btn btn-primary\" mat-raised-button color=\"primary\" type=\"button\" (click)=\"onAddViewEditRecord.emit(null)\">\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\r\n\r\n<eqp-table #tableRecords [data]=\"values\" [columns]=\"columns\"></eqp-table>",
2437
+ styles: ["::ng-deep .error-color{color:var(--danger)}::ng-deep .success-color{color:var(--success)}"]
2438
+ })
2439
+ ], ListFormRecordComponent);
2440
+
2441
+ class Record {
2442
+ }
2443
+
2444
+ let AddFormRecordComponent = class AddFormRecordComponent {
2445
+ constructor(cdr, utilityService) {
2446
+ this.cdr = cdr;
2447
+ this.utilityService = utilityService;
2448
+ this.showButtons = true;
2449
+ this.form = new Form();
2450
+ this.fieldGroups = {};
2451
+ this.FormScalarTypeEnum = FormScalarTypeEnum;
2452
+ this.FieldTypeEnum = FieldTypeEnum;
2453
+ this.saveRecordEvent = new EventEmitter();
2454
+ }
2455
+ ngOnInit() {
2456
+ if (this.record == null) {
2457
+ this.record = new Record();
2458
+ }
2459
+ this.createRecordProperties();
2460
+ this.reorderFormFields();
2461
+ this.createFormGroup();
2462
+ if (this.form.FormScalarType != FormScalarTypeEnum.Semplice) {
2463
+ this.createFieldGroups();
2464
+ }
2465
+ this.cdr.detectChanges();
2466
+ }
2467
+ /**
2468
+ * Metodo invocato al cambio del valore di ogni proprietà dell'oggetto record.
2469
+ * Serve ad aggiornare il valore di tutti i campi che hanno una formula.
2470
+ */
2471
+ onRecordChange() {
2472
+ if (this.fieldTemplate && this.fieldTemplate.length > 0) {
2473
+ this.fieldTemplate.forEach(f => f.updateField());
2474
+ }
2475
+ }
2476
+ /**
2477
+ * Metodo per salvare i dati inseriti dall'utente una volta conclusa la compilazione della form.
2478
+ */
2479
+ saveOrExitForm(exit) {
2480
+ if (exit) {
2481
+ this.saveRecordEvent.emit(null);
2482
+ }
2483
+ else {
2484
+ this.saveRecordEvent.emit(this.record);
2485
+ }
2486
+ }
2487
+ /**
2488
+ * Metodo per creare nell'oggetto Record le proprietà mancanti rispetto ai campi che compongono la form.
2489
+ */
2490
+ createRecordProperties() {
2491
+ const recordProperties = Object.keys(this.record);
2492
+ this.form.Fields.forEach(field => {
2493
+ if (!recordProperties.find(p => p === field.Name)) {
2494
+ this.record[field.Name] = null;
2495
+ }
2496
+ });
2497
+ if (this.form.InnerForms && this.form.InnerForms.length > 0) {
2498
+ this.form.InnerForms.forEach(form => {
2499
+ const arrayName = form.Name.split(" ").join("_");
2500
+ if (!recordProperties.find(p => p === arrayName)) {
2501
+ this.record[arrayName] = [];
2502
+ }
2503
+ });
2504
+ }
2505
+ }
2506
+ /**
2507
+ * Metodo per riordinare i campi che compongono la form.
2508
+ */
2509
+ reorderFormFields() {
2510
+ if (this.form.Fields && this.form.Fields.length > 0) {
2511
+ this.form.Fields.sort((a, b) => (a.OrdinalPosition > b.OrdinalPosition) ? 1 : ((b.OrdinalPosition > a.OrdinalPosition) ? -1 : 0));
2512
+ }
2513
+ }
2514
+ /**
2515
+ * Metodo per creare il FormGroup che rappresenta la form.
2516
+ */
2517
+ createFormGroup() {
2518
+ this.formForm = this.utilityService.CreateFormFormGroup(this.form.Fields, this.record, this.onlyView);
2519
+ }
2520
+ /**
2521
+ * Metodo per creare i gruppi in cui raggruppare i campi della form in base
2522
+ * a come è stata configurata dall'utente.
2523
+ */
2524
+ createFieldGroups() {
2525
+ this.form.FormFieldsGroups
2526
+ .sort((a, b) => (a.OrdinalPosition > b.OrdinalPosition) ? 1 : ((b.OrdinalPosition > a.OrdinalPosition) ? -1 : 0))
2527
+ .map(g => g.Name)
2528
+ .forEach(groupName => {
2529
+ this.fieldGroups[groupName] = this.form.Fields.filter(f => f.FieldGroup == groupName);
2530
+ });
2531
+ }
2532
+ };
2533
+ AddFormRecordComponent.ctorParameters = () => [
2534
+ { type: ChangeDetectorRef },
2535
+ { type: UtilityHelperService$2 }
2536
+ ];
2537
+ __decorate([
2538
+ Input()
2539
+ ], AddFormRecordComponent.prototype, "showButtons", void 0);
2540
+ __decorate([
2541
+ Input()
2542
+ ], AddFormRecordComponent.prototype, "form", void 0);
2543
+ __decorate([
2544
+ Input()
2545
+ ], AddFormRecordComponent.prototype, "record", void 0);
2546
+ __decorate([
2547
+ Input()
2548
+ ], AddFormRecordComponent.prototype, "onlyView", void 0);
2549
+ __decorate([
2550
+ Output()
2551
+ ], AddFormRecordComponent.prototype, "saveRecordEvent", void 0);
2552
+ __decorate([
2553
+ ViewChildren("fieldTemplate")
2554
+ ], AddFormRecordComponent.prototype, "fieldTemplate", void 0);
2555
+ AddFormRecordComponent = __decorate([
2556
+ Component({
2557
+ selector: 'add-form-record',
2558
+ template: "<div class=\"row eqp-dynamic-module-title\">\n <div class=\"col-md-12 text-center\">\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\" (recordChange)=\"onRecordChange()\"></dynamic-module-field>\n </div>\n </div>\n</ng-template>",
2559
+ styles: [""]
2560
+ })
2561
+ ], AddFormRecordComponent);
2562
+
2563
+ let DynamicModuleFieldComponent = class DynamicModuleFieldComponent {
2564
+ constructor(dialog) {
2565
+ this.dialog = dialog;
2566
+ this.recordChange = new EventEmitter();
2567
+ this.FieldTypeEnum = FieldTypeEnum;
2568
+ this.onlyViewInnerFormRecord = false;
2569
+ }
2570
+ updateField() {
2571
+ if (this.fieldTemplate && this.fieldTemplate.length > 0) {
2572
+ this.fieldTemplate.forEach(f => f.updateField());
2573
+ }
2574
+ }
2575
+ ngOnInit() {
2576
+ }
2577
+ /**
2578
+ * Metodo invocato al cambio del valore di ogni proprietà dell'oggetto record.
2579
+ * Serve ad aggiornare il valore di tutti i campi che hanno una formula.
2580
+ */
2581
+ onRecordChange() {
2582
+ this.recordChange.emit(this.record);
2583
+ }
2584
+ /**
2585
+ * Metodo per recuperare una InnerForm a partire dal Field che la rappresenta.
2586
+ * @param field Campo a partire dal quale si vuole recuperare la InnerForm.
2587
+ * @returns Restituisce un oggetto di tipo Form.
2588
+ */
2589
+ getInnerFormFromField(field) {
2590
+ if (this.form.InnerForms && this.form.InnerForms.find(f => f.Name == field.Label)) {
2591
+ return this.form.InnerForms.find(f => f.Name == field.Label);
2592
+ }
2593
+ else {
2594
+ return null;
2595
+ }
2596
+ }
2597
+ /**
2598
+ * Metodo per aprire un dialog in cui aggiungere/modificare/visualizzare un record appartenente
2599
+ * a una form di dettaglio.
2600
+ * @param record Evento di output del componente list-form-record, contiene il record selezionato e un booleno che indica
2601
+ * se l'utente vuole modificare o visualizzare l'elemento selezionato.
2602
+ * @param innerForm Contiene la Form di dettaglio dalla quale è stato richiesto il record.
2603
+ */
2604
+ onAddViewEditInnerFormRecord(record, field) {
2605
+ this.selectedInnerForm = this.getInnerFormFromField(field);
2606
+ if (record == null) {
2607
+ this.selectedInnerFormRecord = new Record();
2608
+ this.indexInnerFormRecord = null;
2609
+ this.onlyViewInnerFormRecord = false;
2610
+ }
2611
+ else {
2612
+ this.selectedInnerFormRecord = JSON.parse(JSON.stringify(record.record));
2613
+ this.indexInnerFormRecord = this.record[field.Name].indexOf(record);
2614
+ this.onlyViewInnerFormRecord = record.onlyView;
2615
+ }
2616
+ this.dialogInnerFormRecordRef = this.dialog.open(this.dialogInnerFormRecord, {
2617
+ disableClose: true,
2618
+ hasBackdrop: true,
2619
+ width: '75%'
2620
+ });
2621
+ }
2622
+ /**
2623
+ * Metodo invocato al salvataggio o alla chiusura del dialog di aggiunta/modifica/visualizzazione
2624
+ * di un record di una form di dettaglio.
2625
+ * @param record Oggetto restituito dal componente add-form-field (questo qui) contenente il Record
2626
+ * aggiornato dall'utente. Se null allora l'utente non ha modificato nulla e ha chiuso il dialog.
2627
+ */
2628
+ onSaveInnerFormRecord(record) {
2629
+ if (record != null) {
2630
+ const arrayName = this.selectedInnerForm.Name.split(' ').join('_');
2631
+ if (this.indexInnerFormRecord != null && this.indexInnerFormRecord >= 0) {
2632
+ this.record[arrayName][this.indexInnerFormRecord] = record;
2633
+ }
2634
+ else {
2635
+ if (!this.record[arrayName]) {
2636
+ this.record[arrayName] = [];
2637
+ }
2638
+ this.record[arrayName].push(record);
2639
+ }
2640
+ }
2641
+ this.dialogInnerFormRecordRef.close();
2642
+ // Ricarico la tabella dei record per visualizzare le modifiche fatte dall'utente.
2643
+ if (this.listInnerFormRecords && this.listInnerFormRecords.length > 0) {
2644
+ this.listInnerFormRecords.forEach(list => {
2645
+ if (list && list.tableRecords) {
2646
+ list.tableRecords.reloadDatatable();
2647
+ }
2648
+ });
2649
+ }
2650
+ }
2651
+ };
2652
+ DynamicModuleFieldComponent.ctorParameters = () => [
2653
+ { type: MatDialog }
2654
+ ];
2655
+ __decorate([
2656
+ Input()
2657
+ ], DynamicModuleFieldComponent.prototype, "field", void 0);
2658
+ __decorate([
2659
+ Input()
2660
+ ], DynamicModuleFieldComponent.prototype, "form", void 0);
2661
+ __decorate([
2662
+ Input()
2663
+ ], DynamicModuleFieldComponent.prototype, "record", void 0);
2664
+ __decorate([
2665
+ Output()
2666
+ ], DynamicModuleFieldComponent.prototype, "recordChange", void 0);
2667
+ __decorate([
2668
+ ViewChild('dialogInnerFormRecord', { static: true })
2669
+ ], DynamicModuleFieldComponent.prototype, "dialogInnerFormRecord", void 0);
2670
+ __decorate([
2671
+ ViewChildren("fieldTemplate")
2672
+ ], DynamicModuleFieldComponent.prototype, "fieldTemplate", void 0);
2673
+ __decorate([
2674
+ ViewChildren('listInnerFormRecords')
2675
+ ], DynamicModuleFieldComponent.prototype, "listInnerFormRecords", void 0);
2676
+ DynamicModuleFieldComponent = __decorate([
2677
+ Component({
2678
+ selector: 'dynamic-module-field',
2679
+ 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>",
2680
+ styles: [""]
2681
+ })
2682
+ ], DynamicModuleFieldComponent);
2683
+
2684
+ let EqpDynamicModuleModule = class EqpDynamicModuleModule {
2685
+ };
2686
+ EqpDynamicModuleModule = __decorate([
2687
+ NgModule({
2688
+ declarations: [
2689
+ EqpDynamicModuleComponent,
2690
+ EqpDynamicModuleConfiguratorComponent,
2691
+ AddFormFieldComponent,
2692
+ TextFieldTemplateComponent,
2693
+ BooleanFieldTemplateComponent,
2694
+ DateFieldTemplateComponent,
2695
+ TextareaFieldTemplateComponent,
2696
+ NumericFieldTemplateComponent,
2697
+ ListValueFieldTemplateComponent,
2698
+ AttachmentFieldTemplateComponent,
2699
+ ImageFieldTemplateComponent,
2700
+ ListFormRecordComponent,
2701
+ AddFormRecordComponent,
2702
+ DynamicModuleFieldComponent,
2703
+ ],
2704
+ imports: [
2705
+ BrowserModule,
2706
+ MaterialModule,
2707
+ FormsModule,
2708
+ CommonModule,
2709
+ ReactiveFormsModule,
2710
+ EqpTableModule,
2711
+ EqpAttachmentsModule,
2712
+ EqpSelectModule,
2713
+ EqpDatetimepickerModule,
2714
+ EqpFiltersModule,
2715
+ EqpNumericModule
2716
+ ],
2717
+ exports: [
2718
+ EqpDynamicModuleComponent,
2719
+ EqpDynamicModuleConfiguratorComponent
2720
+ ]
2721
+ })
2722
+ ], EqpDynamicModuleModule);
2723
+
2724
+ /**
2725
+ * Rappresenta l'entità su cui vengono eseguite le operazioni di salvataggio.
2726
+ */
2727
+ class Entity extends BaseObj {
2728
+ }
2729
+
2730
+ class ImageField extends BaseField {
2731
+ }
2732
+
2733
+ /**Questo tipo di campo rappresenta una lookup ad altri valori */
2734
+ class LookupField extends BaseField {
2735
+ }
2736
+
2737
+ /**Classe contiene la configurazione dei campi numerici */
2738
+ class NumericField extends BaseField {
2739
+ }
2740
+
2741
+ class TextareaField extends BaseField {
2742
+ }
2743
+
2744
+ /**Campo di testo */
2745
+ class TextField extends BaseField {
2746
+ }
2747
+
2748
+ /*
2749
+ * Public API Surface of eqp-dynamic-module
2750
+ */
2751
+
2752
+ /**
2753
+ * Generated bundle index. Do not edit.
2754
+ */
2755
+
2756
+ 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 };
2757
+ //# sourceMappingURL=eqproject-eqp-dynamic-module.js.map