@eqproject/eqp-dynamic-module 0.0.6 → 0.0.7

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 (194) hide show
  1. package/karma.conf.js +32 -0
  2. package/ng-package.json +18 -0
  3. package/package.json +31 -41
  4. package/src/lib/components/exported/eqp-dynamic-module/eqp-dynamic-module.component.html +10 -0
  5. package/src/lib/components/exported/eqp-dynamic-module/eqp-dynamic-module.component.scss +3 -0
  6. package/src/lib/components/exported/eqp-dynamic-module/eqp-dynamic-module.component.ts +228 -0
  7. package/src/lib/components/exported/eqp-dynamic-module-configurator/eqp-dynamic-module-configurator.component.html +212 -0
  8. package/src/lib/components/exported/eqp-dynamic-module-configurator/eqp-dynamic-module-configurator.component.scss +30 -0
  9. package/src/lib/components/exported/eqp-dynamic-module-configurator/eqp-dynamic-module-configurator.component.ts +692 -0
  10. package/src/lib/components/private/add-form-field/add-form-field.component.html +417 -0
  11. package/src/lib/components/private/add-form-field/add-form-field.component.scss +38 -0
  12. package/src/lib/components/private/add-form-field/add-form-field.component.ts +599 -0
  13. package/src/lib/components/private/dynamic-module-field/dynamic-module-field.component.html +42 -0
  14. package/src/lib/components/private/dynamic-module-field/dynamic-module-field.component.scss +0 -0
  15. package/src/lib/components/private/dynamic-module-field/dynamic-module-field.component.ts +125 -0
  16. package/src/lib/components/private/field-templates/attachment-field-template/attachment-field-template.component.html +25 -0
  17. package/src/lib/components/private/field-templates/attachment-field-template/attachment-field-template.component.scss +0 -0
  18. package/src/lib/components/private/field-templates/attachment-field-template/attachment-field-template.component.ts +172 -0
  19. package/src/lib/components/private/field-templates/boolean-field-template/boolean-field-template.component.html +32 -0
  20. package/src/lib/components/private/field-templates/boolean-field-template/boolean-field-template.component.scss +0 -0
  21. package/src/lib/components/private/field-templates/boolean-field-template/boolean-field-template.component.ts +53 -0
  22. package/src/lib/components/private/field-templates/date-field-template/date-field-template.component.html +6 -0
  23. package/src/lib/components/private/field-templates/date-field-template/date-field-template.component.scss +0 -0
  24. package/src/lib/components/private/field-templates/date-field-template/date-field-template.component.ts +70 -0
  25. package/src/lib/components/private/field-templates/image-field-template/image-field-template.component.html +57 -0
  26. package/src/lib/components/private/field-templates/image-field-template/image-field-template.component.scss +4 -0
  27. package/src/lib/components/private/field-templates/image-field-template/image-field-template.component.ts +203 -0
  28. package/src/lib/components/private/field-templates/list-value-field-template/list-value-field-template.component.html +46 -0
  29. package/src/lib/components/private/field-templates/list-value-field-template/list-value-field-template.component.scss +13 -0
  30. package/src/lib/components/private/field-templates/list-value-field-template/list-value-field-template.component.ts +114 -0
  31. package/src/lib/components/private/field-templates/numeric-field-template/numeric-field-template.component.html +6 -0
  32. package/src/lib/components/private/field-templates/numeric-field-template/numeric-field-template.component.scss +0 -0
  33. package/src/lib/components/private/field-templates/numeric-field-template/numeric-field-template.component.ts +70 -0
  34. package/src/lib/components/private/field-templates/text-field-template/text-field-template.component.html +5 -0
  35. package/src/lib/components/private/field-templates/text-field-template/text-field-template.component.scss +0 -0
  36. package/src/lib/components/private/field-templates/text-field-template/text-field-template.component.ts +65 -0
  37. package/src/lib/components/private/field-templates/textarea-field-template/textarea-field-template.component.html +5 -0
  38. package/src/lib/components/private/field-templates/textarea-field-template/textarea-field-template.component.scss +0 -0
  39. package/src/lib/components/private/field-templates/textarea-field-template/textarea-field-template.component.ts +48 -0
  40. package/src/lib/components/private/form-records/add-form-record/add-form-record.component.html +74 -0
  41. package/src/lib/components/private/form-records/add-form-record/add-form-record.component.scss +0 -0
  42. package/src/lib/components/private/form-records/add-form-record/add-form-record.component.ts +117 -0
  43. package/src/lib/components/private/form-records/list-form-record/list-form-record.component.html +14 -0
  44. package/src/lib/components/private/form-records/list-form-record/list-form-record.component.scss +7 -0
  45. package/src/lib/components/private/form-records/list-form-record/list-form-record.component.ts +213 -0
  46. package/src/lib/components/private/spinner/spinner.component.html +3 -0
  47. package/src/lib/components/private/spinner/spinner.component.scss +100 -0
  48. package/src/lib/components/private/spinner/spinner.component.ts +19 -0
  49. package/src/lib/eqp-dynamic-module.module.ts +65 -0
  50. package/{lib/interfaces/iBaseFieldComponent.interface.d.ts → src/lib/interfaces/iBaseFieldComponent.interface.ts} +1 -1
  51. package/{lib/interfaces/iRootObject.interface.d.ts → src/lib/interfaces/iRootObject.interface.ts} +1 -1
  52. package/{lib/models/baseField.model.d.ts → src/lib/models/baseField.model.ts} +14 -5
  53. package/{lib/models/baseObj.model.d.ts → src/lib/models/baseObj.model.ts} +3 -3
  54. package/src/lib/models/context.model.ts +10 -0
  55. package/{lib/models/endPointConfiguration.model.d.ts → src/lib/models/endPointConfiguration.model.ts} +16 -12
  56. package/{lib/models/entity.model.d.ts → src/lib/models/entity.model.ts} +2 -1
  57. package/src/lib/models/fields/attachmentField.model.ts +32 -0
  58. package/{lib/models/fields/booleanField.model.d.ts → src/lib/models/fields/booleanField.model.ts} +8 -4
  59. package/{lib/models/fields/dateField.model.d.ts → src/lib/models/fields/dateField.model.ts} +5 -3
  60. package/{lib/models/fields/imageField.model.d.ts → src/lib/models/fields/imageField.model.ts} +8 -3
  61. package/{lib/models/fields/listValueField.model.d.ts → src/lib/models/fields/listValueField.model.ts} +13 -8
  62. package/{lib/models/fields/lookupField.model.d.ts → src/lib/models/fields/lookupField.model.ts} +5 -2
  63. package/{lib/models/fields/numericField.model.d.ts → src/lib/models/fields/numericField.model.ts} +3 -2
  64. package/{lib/models/fields/testareaField.model.d.ts → src/lib/models/fields/testareaField.model.ts} +3 -2
  65. package/src/lib/models/fields/textField.model.ts +18 -0
  66. package/{lib/models/form.model.d.ts → src/lib/models/form.model.ts} +25 -12
  67. package/{lib/models/record.model.d.ts → src/lib/models/record.model.ts} +4 -5
  68. package/src/lib/modules/material.module.ts +104 -0
  69. package/src/lib/services/custom-form-validators.service.ts +21 -0
  70. package/src/lib/services/eqp-dynamic-module-dialog.service.ts +114 -0
  71. package/src/lib/services/spinner.service.ts +40 -0
  72. package/src/lib/services/utilityHelper.services.ts +413 -0
  73. package/{public-api.d.ts → src/public-api.ts} +3 -0
  74. package/src/test.ts +26 -0
  75. package/tsconfig.lib.json +23 -0
  76. package/tsconfig.lib.prod.json +6 -0
  77. package/tsconfig.spec.json +17 -0
  78. package/tslint.json +17 -0
  79. package/bundles/eqproject-eqp-dynamic-module.umd.js +0 -3991
  80. package/bundles/eqproject-eqp-dynamic-module.umd.js.map +0 -1
  81. package/bundles/eqproject-eqp-dynamic-module.umd.min.js +0 -17
  82. package/bundles/eqproject-eqp-dynamic-module.umd.min.js.map +0 -1
  83. package/eqproject-eqp-dynamic-module.d.ts +0 -6
  84. package/eqproject-eqp-dynamic-module.metadata.json +0 -1
  85. package/esm2015/eqproject-eqp-dynamic-module.js +0 -7
  86. package/esm2015/lib/components/exported/eqp-dynamic-module/eqp-dynamic-module.component.js +0 -262
  87. package/esm2015/lib/components/exported/eqp-dynamic-module-configurator/eqp-dynamic-module-configurator.component.js +0 -649
  88. package/esm2015/lib/components/private/add-form-field/add-form-field.component.js +0 -577
  89. package/esm2015/lib/components/private/dynamic-module-field/dynamic-module-field.component.js +0 -127
  90. package/esm2015/lib/components/private/field-templates/attachment-field-template/attachment-field-template.component.js +0 -170
  91. package/esm2015/lib/components/private/field-templates/boolean-field-template/boolean-field-template.component.js +0 -56
  92. package/esm2015/lib/components/private/field-templates/date-field-template/date-field-template.component.js +0 -71
  93. package/esm2015/lib/components/private/field-templates/image-field-template/image-field-template.component.js +0 -196
  94. package/esm2015/lib/components/private/field-templates/list-value-field-template/list-value-field-template.component.js +0 -115
  95. package/esm2015/lib/components/private/field-templates/numeric-field-template/numeric-field-template.component.js +0 -71
  96. package/esm2015/lib/components/private/field-templates/text-field-template/text-field-template.component.js +0 -67
  97. package/esm2015/lib/components/private/field-templates/textarea-field-template/textarea-field-template.component.js +0 -51
  98. package/esm2015/lib/components/private/form-records/add-form-record/add-form-record.component.js +0 -130
  99. package/esm2015/lib/components/private/form-records/list-form-record/list-form-record.component.js +0 -216
  100. package/esm2015/lib/components/private/spinner/spinner.component.js +0 -23
  101. package/esm2015/lib/eqp-dynamic-module.module.js +0 -69
  102. package/esm2015/lib/interfaces/iBaseFieldComponent.interface.js +0 -1
  103. package/esm2015/lib/interfaces/iRootObject.interface.js +0 -1
  104. package/esm2015/lib/models/baseField.model.js +0 -36
  105. package/esm2015/lib/models/baseObj.model.js +0 -9
  106. package/esm2015/lib/models/context.model.js +0 -8
  107. package/esm2015/lib/models/endPointConfiguration.model.js +0 -23
  108. package/esm2015/lib/models/entity.model.js +0 -7
  109. package/esm2015/lib/models/fields/attachmentField.model.js +0 -22
  110. package/esm2015/lib/models/fields/booleanField.model.js +0 -12
  111. package/esm2015/lib/models/fields/dateField.model.js +0 -11
  112. package/esm2015/lib/models/fields/imageField.model.js +0 -8
  113. package/esm2015/lib/models/fields/listValueField.model.js +0 -14
  114. package/esm2015/lib/models/fields/lookupField.model.js +0 -5
  115. package/esm2015/lib/models/fields/numericField.model.js +0 -5
  116. package/esm2015/lib/models/fields/testareaField.model.js +0 -4
  117. package/esm2015/lib/models/fields/textField.model.js +0 -14
  118. package/esm2015/lib/models/form.model.js +0 -24
  119. package/esm2015/lib/models/record.model.js +0 -8
  120. package/esm2015/lib/modules/material.module.js +0 -108
  121. package/esm2015/lib/services/custom-form-validators.service.js +0 -19
  122. package/esm2015/lib/services/eqp-dynamic-module-dialog.service.js +0 -113
  123. package/esm2015/lib/services/spinner.service.js +0 -43
  124. package/esm2015/lib/services/utilityHelper.services.js +0 -387
  125. package/esm2015/public-api.js +0 -39
  126. package/esm5/eqproject-eqp-dynamic-module.js +0 -7
  127. package/esm5/lib/components/exported/eqp-dynamic-module/eqp-dynamic-module.component.js +0 -269
  128. package/esm5/lib/components/exported/eqp-dynamic-module-configurator/eqp-dynamic-module-configurator.component.js +0 -664
  129. package/esm5/lib/components/private/add-form-field/add-form-field.component.js +0 -588
  130. package/esm5/lib/components/private/dynamic-module-field/dynamic-module-field.component.js +0 -128
  131. package/esm5/lib/components/private/field-templates/attachment-field-template/attachment-field-template.component.js +0 -173
  132. package/esm5/lib/components/private/field-templates/boolean-field-template/boolean-field-template.component.js +0 -57
  133. package/esm5/lib/components/private/field-templates/date-field-template/date-field-template.component.js +0 -72
  134. package/esm5/lib/components/private/field-templates/image-field-template/image-field-template.component.js +0 -206
  135. package/esm5/lib/components/private/field-templates/list-value-field-template/list-value-field-template.component.js +0 -119
  136. package/esm5/lib/components/private/field-templates/numeric-field-template/numeric-field-template.component.js +0 -72
  137. package/esm5/lib/components/private/field-templates/text-field-template/text-field-template.component.js +0 -68
  138. package/esm5/lib/components/private/field-templates/textarea-field-template/textarea-field-template.component.js +0 -52
  139. package/esm5/lib/components/private/form-records/add-form-record/add-form-record.component.js +0 -133
  140. package/esm5/lib/components/private/form-records/list-form-record/list-form-record.component.js +0 -220
  141. package/esm5/lib/components/private/spinner/spinner.component.js +0 -24
  142. package/esm5/lib/eqp-dynamic-module.module.js +0 -72
  143. package/esm5/lib/interfaces/iBaseFieldComponent.interface.js +0 -1
  144. package/esm5/lib/interfaces/iRootObject.interface.js +0 -1
  145. package/esm5/lib/models/baseField.model.js +0 -43
  146. package/esm5/lib/models/baseObj.model.js +0 -13
  147. package/esm5/lib/models/context.model.js +0 -14
  148. package/esm5/lib/models/endPointConfiguration.model.js +0 -33
  149. package/esm5/lib/models/entity.model.js +0 -14
  150. package/esm5/lib/models/fields/attachmentField.model.js +0 -29
  151. package/esm5/lib/models/fields/booleanField.model.js +0 -19
  152. package/esm5/lib/models/fields/dateField.model.js +0 -18
  153. package/esm5/lib/models/fields/imageField.model.js +0 -19
  154. package/esm5/lib/models/fields/listValueField.model.js +0 -25
  155. package/esm5/lib/models/fields/lookupField.model.js +0 -12
  156. package/esm5/lib/models/fields/numericField.model.js +0 -12
  157. package/esm5/lib/models/fields/testareaField.model.js +0 -11
  158. package/esm5/lib/models/fields/textField.model.js +0 -21
  159. package/esm5/lib/models/form.model.js +0 -39
  160. package/esm5/lib/models/record.model.js +0 -14
  161. package/esm5/lib/modules/material.module.js +0 -111
  162. package/esm5/lib/services/custom-form-validators.service.js +0 -23
  163. package/esm5/lib/services/eqp-dynamic-module-dialog.service.js +0 -123
  164. package/esm5/lib/services/spinner.service.js +0 -46
  165. package/esm5/lib/services/utilityHelper.services.js +0 -396
  166. package/esm5/public-api.js +0 -39
  167. package/fesm2015/eqproject-eqp-dynamic-module.js +0 -3580
  168. package/fesm2015/eqproject-eqp-dynamic-module.js.map +0 -1
  169. package/fesm5/eqproject-eqp-dynamic-module.js +0 -3766
  170. package/fesm5/eqproject-eqp-dynamic-module.js.map +0 -1
  171. package/lib/components/exported/eqp-dynamic-module/eqp-dynamic-module.component.d.ts +0 -101
  172. package/lib/components/exported/eqp-dynamic-module-configurator/eqp-dynamic-module-configurator.component.d.ts +0 -235
  173. package/lib/components/private/add-form-field/add-form-field.component.d.ts +0 -199
  174. package/lib/components/private/dynamic-module-field/dynamic-module-field.component.d.ts +0 -55
  175. package/lib/components/private/field-templates/attachment-field-template/attachment-field-template.component.d.ts +0 -68
  176. package/lib/components/private/field-templates/boolean-field-template/boolean-field-template.component.d.ts +0 -21
  177. package/lib/components/private/field-templates/date-field-template/date-field-template.component.d.ts +0 -27
  178. package/lib/components/private/field-templates/image-field-template/image-field-template.component.d.ts +0 -65
  179. package/lib/components/private/field-templates/list-value-field-template/list-value-field-template.component.d.ts +0 -51
  180. package/lib/components/private/field-templates/numeric-field-template/numeric-field-template.component.d.ts +0 -26
  181. package/lib/components/private/field-templates/text-field-template/text-field-template.component.d.ts +0 -22
  182. package/lib/components/private/field-templates/textarea-field-template/textarea-field-template.component.d.ts +0 -20
  183. package/lib/components/private/form-records/add-form-record/add-form-record.component.d.ts +0 -52
  184. package/lib/components/private/form-records/list-form-record/list-form-record.component.d.ts +0 -64
  185. package/lib/components/private/spinner/spinner.component.d.ts +0 -9
  186. package/lib/eqp-dynamic-module.module.d.ts +0 -2
  187. package/lib/models/context.model.d.ts +0 -9
  188. package/lib/models/fields/attachmentField.model.d.ts +0 -17
  189. package/lib/models/fields/textField.model.d.ts +0 -15
  190. package/lib/modules/material.module.d.ts +0 -2
  191. package/lib/services/custom-form-validators.service.d.ts +0 -5
  192. package/lib/services/eqp-dynamic-module-dialog.service.d.ts +0 -34
  193. package/lib/services/spinner.service.d.ts +0 -15
  194. package/lib/services/utilityHelper.services.d.ts +0 -77
@@ -1,3766 +0,0 @@
1
- import { __extends, __decorate, __awaiter, __generator } from 'tslib';
2
- import { CommonModule } from '@angular/common';
3
- import { ɵɵdefineInjectable, Injectable, ɵɵinject, EventEmitter, Input, Output, Component, NgModule, ViewChild, ChangeDetectorRef, ViewChildren } from '@angular/core';
4
- import { Validators, FormControl, FormBuilder, FormsModule, ReactiveFormsModule } from '@angular/forms';
5
- import Swal from 'sweetalert2';
6
- import { HttpClient } from '@angular/common/http';
7
- import { Subject } from 'rxjs';
8
- import { MatCheckboxModule } from '@angular/material/checkbox';
9
- import { MatButtonModule } from '@angular/material/button';
10
- import { MatInputModule } from '@angular/material/input';
11
- import { MatAutocompleteModule } from '@angular/material/autocomplete';
12
- import { MatDatepickerModule } from '@angular/material/datepicker';
13
- import { MatFormFieldModule } from '@angular/material/form-field';
14
- import { MatRadioModule } from '@angular/material/radio';
15
- import { MatSelectModule } from '@angular/material/select';
16
- import { MatSliderModule } from '@angular/material/slider';
17
- import { MatSlideToggleModule } from '@angular/material/slide-toggle';
18
- import { MatMenuModule } from '@angular/material/menu';
19
- import { MatSidenavModule } from '@angular/material/sidenav';
20
- import { MatToolbarModule } from '@angular/material/toolbar';
21
- import { MatListModule } from '@angular/material/list';
22
- import { MatGridListModule } from '@angular/material/grid-list';
23
- import { MatCardModule } from '@angular/material/card';
24
- import { MatStepperModule } from '@angular/material/stepper';
25
- import { MatTabsModule } from '@angular/material/tabs';
26
- import { MatExpansionModule } from '@angular/material/expansion';
27
- import { MatButtonToggleModule } from '@angular/material/button-toggle';
28
- import { MatChipsModule } from '@angular/material/chips';
29
- import { MatIconModule } from '@angular/material/icon';
30
- import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
31
- import { MatProgressBarModule } from '@angular/material/progress-bar';
32
- import { MatDialogModule, MatDialog } from '@angular/material/dialog';
33
- import { MatTooltipModule } from '@angular/material/tooltip';
34
- import { MatSnackBarModule } from '@angular/material/snack-bar';
35
- import { MatTableModule } from '@angular/material/table';
36
- import { MatSortModule } from '@angular/material/sort';
37
- import { MatPaginatorModule } from '@angular/material/paginator';
38
- import { MatNativeDateModule } from '@angular/material/core';
39
- import { TypeColumn, CellAlignmentEnum, NumberColumnPipe, EqpTableModule } from '@eqproject/eqp-table';
40
- import { AttachmentType, EqpAttachmentsModule } from '@eqproject/eqp-attachments';
41
- import { EnumHelper, EqpSelectModule } from '@eqproject/eqp-select';
42
- import { PickerModeEnum, EqpDatetimepickerModule } from '@eqproject/eqp-datetimepicker';
43
- import { EqpImgDrawingModule } from '@eqproject/eqp-img-drawing';
44
- import { EqpFiltersModule } from '@eqproject/eqp-filters';
45
- import { EqpNumericInputMode, EqpNumericModule } from '@eqproject/eqp-numeric';
46
-
47
- var Context = /** @class */ (function () {
48
- function Context() {
49
- this.User = new ContextUser();
50
- }
51
- return Context;
52
- }());
53
- var ContextUser = /** @class */ (function () {
54
- function ContextUser() {
55
- }
56
- return ContextUser;
57
- }());
58
-
59
- var EndPointConfiguration = /** @class */ (function () {
60
- function EndPointConfiguration() {
61
- }
62
- return EndPointConfiguration;
63
- }());
64
- var EndPointData = /** @class */ (function () {
65
- function EndPointData() {
66
- }
67
- return EndPointData;
68
- }());
69
- var EndPointDataParams = /** @class */ (function () {
70
- function EndPointDataParams() {
71
- this.ParamValue = null;
72
- }
73
- return EndPointDataParams;
74
- }());
75
- var ParamTypeEnum;
76
- (function (ParamTypeEnum) {
77
- ParamTypeEnum[ParamTypeEnum["Query param"] = 1] = "Query param";
78
- ParamTypeEnum[ParamTypeEnum["In route"] = 2] = "In route";
79
- ParamTypeEnum[ParamTypeEnum["In Body"] = 3] = "In Body";
80
- })(ParamTypeEnum || (ParamTypeEnum = {}));
81
- var RequestMethodEnum;
82
- (function (RequestMethodEnum) {
83
- RequestMethodEnum["GET"] = "GET";
84
- RequestMethodEnum["POST"] = "POST";
85
- RequestMethodEnum["PUT"] = "PUT";
86
- RequestMethodEnum["DELETE"] = "DELETE";
87
- })(RequestMethodEnum || (RequestMethodEnum = {}));
88
-
89
- /**
90
- * Classe base che implementa la valorizzazione dell'ID (se null) con una nuova GUID
91
- * in creazione dell'oggetto.
92
- * Per scelta architetturale, visto che non possiamo assumere la persistenza su DB relazionale o su NOSQL, ogni
93
- * oggetto della configurazione viene persistito, e gestito con ID di tipo stringa creato da una GUID.
94
- */
95
- var BaseObj = /** @class */ (function () {
96
- function BaseObj() {
97
- }
98
- return BaseObj;
99
- }());
100
-
101
- /**
102
- * Classe che rappresenta una Form completa.
103
- * Si tratta dell'oggetto che viene rappresentato a video e con cui l'utente interagisce.
104
- */
105
- var Form = /** @class */ (function (_super) {
106
- __extends(Form, _super);
107
- function Form() {
108
- return _super !== null && _super.apply(this, arguments) || this;
109
- }
110
- return Form;
111
- }(BaseObj));
112
- var FormFieldGroup = /** @class */ (function () {
113
- function FormFieldGroup() {
114
- }
115
- return FormFieldGroup;
116
- }());
117
- var ActionOnRecord = /** @class */ (function () {
118
- function ActionOnRecord() {
119
- }
120
- return ActionOnRecord;
121
- }());
122
- var FormTypeEnum;
123
- (function (FormTypeEnum) {
124
- FormTypeEnum[FormTypeEnum["SCALAR"] = 1] = "SCALAR";
125
- FormTypeEnum[FormTypeEnum["LIST"] = 2] = "LIST"; /* form di tipo lista che viene rappresentata con molti record */
126
- })(FormTypeEnum || (FormTypeEnum = {}));
127
- var FormScalarTypeEnum;
128
- (function (FormScalarTypeEnum) {
129
- FormScalarTypeEnum[FormScalarTypeEnum["Semplice"] = 1] = "Semplice";
130
- FormScalarTypeEnum[FormScalarTypeEnum["A step"] = 2] = "A step";
131
- FormScalarTypeEnum[FormScalarTypeEnum["In tab"] = 3] = "In tab";
132
- FormScalarTypeEnum[FormScalarTypeEnum["In accordion"] = 4] = "In accordion"; //GROUPED_BY_ACCORDION
133
- })(FormScalarTypeEnum || (FormScalarTypeEnum = {}));
134
-
135
- var Record = /** @class */ (function () {
136
- function Record() {
137
- }
138
- return Record;
139
- }());
140
- var DynRecord = /** @class */ (function () {
141
- function DynRecord() {
142
- this.Values = {};
143
- }
144
- return DynRecord;
145
- }());
146
-
147
- var EqpDynamicModuleDialogService = /** @class */ (function () {
148
- function EqpDynamicModuleDialogService() {
149
- }
150
- /**
151
- * Mostra uno sweet alert di tipo SUCCESS con il messaggio passato come parametro.
152
- * @param message Messaggio da mostrare nello sweetalert
153
- * @param title Titolo dello sweetalert (di default mostra 'Operazione completata')
154
- */
155
- EqpDynamicModuleDialogService.Success = function (message, title) {
156
- if (title === void 0) { title = null; }
157
- var currentTitle = title != null ? title : 'Operazione completata con successo.';
158
- Swal.fire(currentTitle, message, 'success');
159
- };
160
- /**
161
- * Mostra uno sweet alert di tipo ERROR con il messaggio passato come parametro.
162
- * @param message Messaggio d'errore da mostrare nello sweetalert
163
- * @param title Titolo dello sweetalert (di default mostra 'Errore')
164
- */
165
- EqpDynamicModuleDialogService.Error = function (message, title) {
166
- if (title === void 0) { title = null; }
167
- var currentTitle = title != null ? title : 'Errore';
168
- if (Array.isArray(message)) {
169
- currentTitle = title != null ? title : 'Errore';
170
- var htmlErrors = message.join("<br>");
171
- Swal.fire({
172
- title: currentTitle,
173
- html: htmlErrors,
174
- icon: 'error'
175
- });
176
- }
177
- else {
178
- Swal.fire(currentTitle, message, 'error');
179
- }
180
- };
181
- /**
182
- * Mostra uno sweetalert di tipo CONFIRM con il messaggio passato come parametro e se viene premuto
183
- * CONFERMA lancia la funzione di callback passata come parametro
184
- * @param message Messaggio da mostrare nello sweetalert
185
- * @param title Titolo dello sweetalert (di default mostra 'Info')
186
- */
187
- EqpDynamicModuleDialogService.Confirm = function (message, confirmCallback, isWarning, title, customWidth) {
188
- if (isWarning === void 0) { isWarning = false; }
189
- if (title === void 0) { title = null; }
190
- if (customWidth === void 0) { customWidth = null; }
191
- var currentTitle = title != null ? title : 'Sei sicuro di voler procedere?';
192
- if (Array.isArray(message)) {
193
- var htmlErrors = message.join("<br>");
194
- Swal.fire({
195
- title: currentTitle,
196
- html: htmlErrors,
197
- width: customWidth ? customWidth : '32rem',
198
- icon: !isWarning ? 'question' : 'warning',
199
- showCancelButton: true,
200
- allowOutsideClick: false,
201
- allowEscapeKey: false
202
- }).then(function (result) {
203
- if (result.value && confirmCallback) {
204
- confirmCallback();
205
- }
206
- });
207
- }
208
- else {
209
- Swal.fire({
210
- title: currentTitle,
211
- text: message,
212
- width: customWidth ? customWidth : '32rem',
213
- icon: !isWarning ? 'question' : 'warning',
214
- showCancelButton: true,
215
- allowOutsideClick: false,
216
- allowEscapeKey: false
217
- }).then(function (result) {
218
- if (result.value && confirmCallback) {
219
- confirmCallback();
220
- }
221
- });
222
- }
223
- };
224
- /**
225
- * Mostra uno sweetalert di tipo INFO con il messaggio passato come parametro
226
- * @param message Messaggio da mostrare nello sweetalert
227
- * @param title Titolo dello sweetalert (di default mostra 'Info')
228
- */
229
- EqpDynamicModuleDialogService.Info = function (message, title, isToast) {
230
- if (title === void 0) { title = null; }
231
- if (isToast === void 0) { isToast = null; }
232
- var currentTitle = title != null ? title : "Informazione:";
233
- Swal.fire(currentTitle, message, 'info');
234
- };
235
- /**
236
- * Mostra uno sweetalert di tipo WARNING con il messaggio passato come parametro
237
- * @param message Messaggio da mostrare nello sweetalert
238
- * @param title Titolo dello sweetalert (di default mostra 'Attenzione!')
239
- */
240
- EqpDynamicModuleDialogService.Warning = function (message, title, isToast) {
241
- if (title === void 0) { title = null; }
242
- if (isToast === void 0) { isToast = null; }
243
- var currentTitle = title != null ? title : "Attenzione!";
244
- if (Array.isArray(message)) {
245
- var htmlWarnings = message.join("<br>");
246
- Swal.fire({
247
- title: currentTitle,
248
- html: htmlWarnings,
249
- icon: 'warning'
250
- });
251
- }
252
- else {
253
- Swal.fire(currentTitle, message, 'warning');
254
- }
255
- };
256
- EqpDynamicModuleDialogService.ɵprov = ɵɵdefineInjectable({ factory: function EqpDynamicModuleDialogService_Factory() { return new EqpDynamicModuleDialogService(); }, token: EqpDynamicModuleDialogService, providedIn: "root" });
257
- EqpDynamicModuleDialogService = __decorate([
258
- Injectable({
259
- providedIn: 'root'
260
- })
261
- ], EqpDynamicModuleDialogService);
262
- return EqpDynamicModuleDialogService;
263
- }());
264
-
265
- /**
266
- * Contiene le informazioni di base del campo, indipendentemente dal tipo.
267
- * Questa classe è volutamente astratta perché il tipo di campo è dettato dal tipo
268
- */
269
- var BaseField = /** @class */ (function (_super) {
270
- __extends(BaseField, _super);
271
- function BaseField() {
272
- return _super !== null && _super.apply(this, arguments) || this;
273
- }
274
- return BaseField;
275
- }(BaseObj));
276
- var FieldTypeEnum;
277
- (function (FieldTypeEnum) {
278
- FieldTypeEnum[FieldTypeEnum["Campo di testo"] = 1] = "Campo di testo";
279
- FieldTypeEnum[FieldTypeEnum["Area di testo"] = 2] = "Area di testo";
280
- FieldTypeEnum[FieldTypeEnum["Booleano"] = 3] = "Booleano";
281
- FieldTypeEnum[FieldTypeEnum["Data e/o ora"] = 4] = "Data e/o ora";
282
- FieldTypeEnum[FieldTypeEnum["Campo numerico"] = 5] = "Campo numerico";
283
- FieldTypeEnum[FieldTypeEnum["Allegato"] = 6] = "Allegato";
284
- FieldTypeEnum[FieldTypeEnum["Immagine"] = 7] = "Immagine";
285
- FieldTypeEnum[FieldTypeEnum["Elenco generico"] = 8] = "Elenco generico";
286
- FieldTypeEnum[FieldTypeEnum["Lookup"] = 9] = "Lookup";
287
- FieldTypeEnum[FieldTypeEnum["Form di dettaglio"] = 10] = "Form di dettaglio";
288
- })(FieldTypeEnum || (FieldTypeEnum = {}));
289
- var ColSpanSizesEnum;
290
- (function (ColSpanSizesEnum) {
291
- ColSpanSizesEnum[ColSpanSizesEnum["col-sm-3"] = 1] = "col-sm-3";
292
- ColSpanSizesEnum[ColSpanSizesEnum["col-sm-4"] = 2] = "col-sm-4";
293
- ColSpanSizesEnum[ColSpanSizesEnum["col-sm-6"] = 3] = "col-sm-6";
294
- ColSpanSizesEnum[ColSpanSizesEnum["col-sm-12"] = 4] = "col-sm-12";
295
- ColSpanSizesEnum[ColSpanSizesEnum["col-md-3"] = 5] = "col-md-3";
296
- ColSpanSizesEnum[ColSpanSizesEnum["col-md-4"] = 6] = "col-md-4";
297
- ColSpanSizesEnum[ColSpanSizesEnum["col-md-6"] = 7] = "col-md-6";
298
- ColSpanSizesEnum[ColSpanSizesEnum["col-md-12"] = 8] = "col-md-12";
299
- ColSpanSizesEnum[ColSpanSizesEnum["col-lg-3"] = 9] = "col-lg-3";
300
- ColSpanSizesEnum[ColSpanSizesEnum["col-lg-4"] = 10] = "col-lg-4";
301
- ColSpanSizesEnum[ColSpanSizesEnum["col-lg-6"] = 11] = "col-lg-6";
302
- ColSpanSizesEnum[ColSpanSizesEnum["col-lg-12"] = 12] = "col-lg-12";
303
- })(ColSpanSizesEnum || (ColSpanSizesEnum = {}));
304
-
305
- /**Campo di testo */
306
- var TextField = /** @class */ (function (_super) {
307
- __extends(TextField, _super);
308
- function TextField() {
309
- return _super !== null && _super.apply(this, arguments) || this;
310
- }
311
- return TextField;
312
- }(BaseField));
313
- var TextMaskEnum;
314
- (function (TextMaskEnum) {
315
- TextMaskEnum[TextMaskEnum["Password"] = 1] = "Password";
316
- TextMaskEnum[TextMaskEnum["Email"] = 2] = "Email";
317
- TextMaskEnum[TextMaskEnum["Telefono"] = 3] = "Telefono";
318
- TextMaskEnum[TextMaskEnum["Url"] = 4] = "Url";
319
- })(TextMaskEnum || (TextMaskEnum = {}));
320
- var UrlRegex = '(https?://)?([\\da-z.-]+)\\.([a-z.]{2,6})[/\\w .-]*/?';
321
- var TelRegex = '([+]?[0-9]{10,14})';
322
-
323
- var ArrayValidators = /** @class */ (function () {
324
- function ArrayValidators() {
325
- }
326
- ArrayValidators.minLenght = function (minLenght) {
327
- var validationFunction = function (control) {
328
- return !!control && !!control.value && Array.isArray(control.value) && control.value.length >= minLenght
329
- ? null
330
- : { hasMinLenght: false };
331
- };
332
- return validationFunction;
333
- };
334
- ArrayValidators.maxLenght = function (maxLenght) {
335
- var validationFunction = function (control) {
336
- return !!control && !!control.value && Array.isArray(control.value) && control.value.length <= maxLenght
337
- ? null
338
- : { hasMinLenght: false };
339
- };
340
- return validationFunction;
341
- };
342
- return ArrayValidators;
343
- }());
344
-
345
- var SpinnerService = /** @class */ (function () {
346
- function SpinnerService() {
347
- this.isLoading = new Subject();
348
- this.requestsCount = 0;
349
- }
350
- /**
351
- * Mostra lo spinner
352
- */
353
- SpinnerService.prototype.show = function () {
354
- var _this = this;
355
- setTimeout(function () {
356
- _this.isLoading.next(true);
357
- }, 100);
358
- };
359
- /**
360
- * Nasconde lo spinner
361
- */
362
- SpinnerService.prototype.hide = function () {
363
- var _this = this;
364
- setTimeout(function () {
365
- _this.isLoading.next(false);
366
- }, 100);
367
- };
368
- SpinnerService.prototype.addRequestCounter = function () {
369
- this.requestsCount++;
370
- this.show();
371
- };
372
- SpinnerService.prototype.removeRequestCounter = function () {
373
- this.requestsCount--;
374
- if (this.requestsCount == 0)
375
- this.hide();
376
- };
377
- SpinnerService.ɵprov = ɵɵdefineInjectable({ factory: function SpinnerService_Factory() { return new SpinnerService(); }, token: SpinnerService, providedIn: "root" });
378
- SpinnerService = __decorate([
379
- Injectable({
380
- providedIn: 'root'
381
- })
382
- ], SpinnerService);
383
- return SpinnerService;
384
- }());
385
-
386
- var UtilityHelperService = /** @class */ (function () {
387
- function UtilityHelperService(formBuilder, http, spinnerService) {
388
- this.formBuilder = formBuilder;
389
- this.http = http;
390
- this.spinnerService = spinnerService;
391
- }
392
- UtilityHelperService_1 = UtilityHelperService;
393
- UtilityHelperService.EvaluateFieldFormula = function (formula, rec, ctx) {
394
- var evaluatedValue = eval(formula);
395
- return (evaluatedValue ? evaluatedValue : null);
396
- };
397
- UtilityHelperService.SetContext = function (ctx) {
398
- this.context = ctx;
399
- };
400
- UtilityHelperService.GetFieldType = function (field) {
401
- switch (field.FieldType) {
402
- case FieldTypeEnum["Campo di testo"]: {
403
- var t = Object.assign(new TextField, field);
404
- return t;
405
- break;
406
- }
407
- default: {
408
- break;
409
- }
410
- }
411
- };
412
- /**
413
- * Metodo per impostare i valori da suggerire nell'autocomplete per i campi in cui l'utente deve scrivere comandi javascript.
414
- * In base all'ultimo carattere digitato viene impostato un elenco di oggetti o proprietà che l'utente ha a disposizione in quel momento.
415
- * @param fields Array di BaseField aggiunti alla Form
416
- * @param typedFormula Stringa digitata dall'utente
417
- * @summary Il metodo imposta i suggerimenti basandosi su 3 casi:
418
- * 1) l'utente non ha digitato nulla o la stringa digitata dall'utente finisce con uno spazio vuoto
419
- * 2) la stringa digitata dall'utente finisce con un "."
420
- * 3) la stringa digitata dall'utente non coincide con nessun altro caso sopra (finisce con un carattere qualunque)
421
- */
422
- UtilityHelperService.GetAutocompleteOptions = function (fields, typedFormula) {
423
- var autocompleteOptions = [];
424
- // Recupero i nomi di tutti i campi creati fino ad ora nella form.
425
- var availableRecProperties = fields.map(function (f) { return f.Label.split(' ').join('_'); });
426
- // Nel casi in cui l'utente non ha inserito nulla oppure la stringa finisce con uno spazio vuoto o un simbolo diverso da "."
427
- // (un carattere non alfanumerico) imposto come suggerimenti solo "rec" e "ctx", ovvero gli unici due oggetti a cui l'utente ha accesso.
428
- if (!typedFormula ||
429
- (!typedFormula.endsWith(".")
430
- && new RegExp("[^0-9a-zA-Z_]").test(typedFormula.substring(typedFormula.length - 1, typedFormula.length)))) {
431
- autocompleteOptions = [
432
- { label: "rec", value: (typedFormula ? typedFormula : '') + "rec" },
433
- { label: "ctx", value: (typedFormula ? typedFormula : '') + "ctx" }
434
- ];
435
- }
436
- // Se la stringa finisce con un "." vuol dire che l'utente sta cercando di accedere ad una proprietà di un oggetto
437
- // a sua disposizione. Recupero il nome dell'ultimo oggetto digitato dall'utente e se l'oggetto scelto è "rec" o "ctx"
438
- // allora suggerisco le proprietà che esistono all'interno di questi oggetti altrimenti non mostro nulla.
439
- else if (typedFormula.endsWith(".")) {
440
- var formulaPieces = typedFormula.split(" ")[typedFormula.split(" ").length - 1].split('.');
441
- if (formulaPieces[formulaPieces.length - 2] === "rec") {
442
- autocompleteOptions = availableRecProperties.map(function (f) { return { label: f, value: typedFormula + f }; });
443
- }
444
- else if (formulaPieces[formulaPieces.length - 2] === "ctx") {
445
- autocompleteOptions = Object.keys(UtilityHelperService_1.context).map(function (f) { return { label: f, value: typedFormula + f }; });
446
- }
447
- else if (formulaPieces.length > 2 && formulaPieces[formulaPieces.length - 3] === "ctx" && formulaPieces[formulaPieces.length - 2] === "User") {
448
- autocompleteOptions = Object.keys(UtilityHelperService_1.context.User).map(function (f) { return { label: f, value: typedFormula + f }; });
449
- }
450
- else {
451
- autocompleteOptions = [];
452
- }
453
- }
454
- // In tutti gli altri casi, ovvero quando la stringa digitata finisce con un carattere diverso da quelli
455
- // controllati finora, vuol dire che l'utente sta digitanto il nome di un oggetto, una proprietà o una
456
- // funzione javascript. Controllo la parola che l'utente sta digitando e se fa parte di uno degli oggetti a disposizione
457
- // o una proprietà di essi allora suggerisco i possibili match.
458
- else {
459
- var availableOptions_1 = [];
460
- // Prendo tutti i blocchi di caratteri digitati dall'utente
461
- var allFormulaWords = typedFormula.split(" ");
462
- // Prendo l'ultimo blocco di caratteri digitato dall'utente
463
- var lastTypedString = allFormulaWords[allFormulaWords.length - 1];
464
- // Se la l'ultima stringa digitata non contiene caratteri speciali allora splitto la stringa
465
- // sui "." e imposto i suggerimenti in base al path della prorpietà che si sta digitando.
466
- if (!new RegExp("[^0-9a-zA-Z_.]").test(lastTypedString)) {
467
- var propertyPath = lastTypedString.split(".");
468
- var lastTypedWork_1 = propertyPath[propertyPath.length - 1];
469
- var propertiesToCheck = [];
470
- if (propertyPath.length == 1) {
471
- propertiesToCheck = ["rec", "ctx"];
472
- }
473
- else if (propertyPath.length > 1 && propertyPath[propertyPath.length - 2] === "ctx") {
474
- propertiesToCheck = Object.keys(UtilityHelperService_1.context);
475
- }
476
- else if (propertyPath.length > 2 && propertyPath[propertyPath.length - 3] === "ctx" && propertyPath[propertyPath.length - 2] === "User") {
477
- propertiesToCheck = Object.keys(UtilityHelperService_1.context.User);
478
- }
479
- else if (propertyPath.length > 1 && propertyPath[propertyPath.length - 2] === "rec") {
480
- propertiesToCheck = availableRecProperties;
481
- }
482
- // Eseguo il controllo sulle proprietà recuperate, aggiungo ai suggerimenti tutti i nomi che iniziano con
483
- // quello che sta digitando l'utente.
484
- propertiesToCheck.forEach(function (prop) {
485
- if (prop.startsWith(lastTypedWork_1)) {
486
- availableOptions_1.push({ label: prop, value: typedFormula + prop.substring(lastTypedWork_1.length, prop.length) });
487
- }
488
- });
489
- }
490
- autocompleteOptions = availableOptions_1;
491
- }
492
- return autocompleteOptions;
493
- };
494
- /**
495
- * Metodo invocato dall'html per impostare le classi css per visualizzare il campo all'interno della form.
496
- * Se per il field sono state specificate delle classi allora vengono applcate quelle, altrimenti vengono usate
497
- * delle classi di default.
498
- * @param field BaseField da visualizzare.
499
- * @returns Restituisce una stringa contenente le classi css da applicare.
500
- */
501
- UtilityHelperService.prototype.getFieldSyleClass = function (field) {
502
- if (field.ColSpanSizes && field.ColSpanSizes.length > 0)
503
- return field.ColSpanSizes.map(function (size) { return ColSpanSizesEnum[size].toString(); }).join(" ");
504
- switch (field.FieldType) {
505
- case FieldTypeEnum["Campo di testo"]:
506
- return "col-sm-12 col-md-4 col-lg-4";
507
- case FieldTypeEnum["Area di testo"]:
508
- return "col-sm-12 col-md-12 col-lg-12";
509
- case FieldTypeEnum["Booleano"]:
510
- return "col-sm-12 col-md-4 col-lg-4 d-flex align-items-center";
511
- case FieldTypeEnum["Data e/o ora"]:
512
- return "col-sm-12 col-md-4 col-lg-4";
513
- case FieldTypeEnum["Campo numerico"]:
514
- return "col-sm-12 col-md-4 col-lg-4";
515
- case FieldTypeEnum["Allegato"]:
516
- if (field.IsMultiAttach ||
517
- (field.MetadataFields && field.MetadataFields.length > 0)) {
518
- return "col-sm-12 col-md-12 col-lg-12";
519
- }
520
- else {
521
- return "col-sm-12 col-md-4 col-lg-4";
522
- }
523
- case FieldTypeEnum["Immagine"]:
524
- if (field.AttachDefinition.IsMultiAttach ||
525
- (field.AttachDefinition.MetadataFields && field.AttachDefinition.MetadataFields.length > 0)) {
526
- return "col-sm-12 col-md-12 col-lg-12";
527
- }
528
- else {
529
- return "col-sm-12 col-md-4 col-lg-4";
530
- }
531
- case FieldTypeEnum["Elenco generico"]:
532
- return "col-sm-12 col-md-4 col-lg-4";
533
- case FieldTypeEnum["Lookup"]:
534
- return "col-sm-12 col-md-4 col-lg-4";
535
- case FieldTypeEnum['Form di dettaglio']:
536
- return "col-sm-12 col-md-12 col-lg-12";
537
- }
538
- };
539
- /**
540
- * Metodo per creare il FormGroup che rappresenta una Form a partire dai suoi BaseField.
541
- * @param formFields Lista dei BaseField che compongono la form.
542
- * @param record Oggetto di tipo Record che contiene i valori dei campi.
543
- * @param onlyView Se TRUE disabilita la form per renderla in sola lettura.
544
- * @param includeCurrentFormInField Se TRUE popola la proprietà FormFormGroup all'interno di ogni BaseField con il FormGroup corrente.
545
- * @returns Restituisce un FormGroup rappresentate la Form a cui appartengono i BaseField ricevuti in input.
546
- */
547
- UtilityHelperService.prototype.CreateFormFormGroup = function (formFields, record, onlyView, includeCurrentFormInField) {
548
- var _this = this;
549
- if (onlyView === void 0) { onlyView = false; }
550
- if (includeCurrentFormInField === void 0) { includeCurrentFormInField = true; }
551
- var formForm = this.formBuilder.group([]);
552
- formFields.forEach(function (field) {
553
- formForm.addControl(field.Name, _this.createFieldFormControl(field, record));
554
- if (includeCurrentFormInField) {
555
- field.FormFormGroup = formForm;
556
- }
557
- });
558
- if (onlyView) {
559
- formForm.disable();
560
- }
561
- return formForm;
562
- };
563
- /**
564
- * Funzione per creare e aggiungere al FormGroup rappresentante la form un nuovo FormControl a partire da un Field.
565
- * In nuovo FormControl avrà il nome del campo passato e verranno impostati i Validators in base al tipo del campo stesso.
566
- * @param field BaseField per cui creare il FormControl da inserire nel FormGroup dela form.
567
- */
568
- UtilityHelperService.prototype.createFieldFormControl = function (field, record) {
569
- var validators = [];
570
- if (field.Required)
571
- validators.push(Validators.required);
572
- switch (field.FieldType) {
573
- case FieldTypeEnum["Campo di testo"]:
574
- if (field.MaxLenght) {
575
- validators.push(Validators.maxLength(field.MaxLenght));
576
- }
577
- if (field.MinLenght) {
578
- validators.push(Validators.minLength(field.MinLenght));
579
- }
580
- switch (field.TextMask) {
581
- case TextMaskEnum.Url:
582
- validators.push(Validators.pattern(UrlRegex));
583
- break;
584
- case TextMaskEnum.Email:
585
- validators.push(Validators.email);
586
- break;
587
- case TextMaskEnum.Telefono:
588
- validators.push(Validators.pattern(TelRegex));
589
- break;
590
- }
591
- break;
592
- case FieldTypeEnum["Area di testo"]:
593
- if (field.MaxLenght) {
594
- validators.push(Validators.maxLength(field.MaxLenght));
595
- }
596
- if (field.MinLenght) {
597
- validators.push(Validators.minLength(field.MinLenght));
598
- }
599
- break;
600
- case FieldTypeEnum.Allegato:
601
- case FieldTypeEnum.Immagine:
602
- if (field.Required)
603
- validators.push(ArrayValidators.minLenght(1));
604
- break;
605
- case FieldTypeEnum['Elenco generico']:
606
- if (field.IsMultiChoiche)
607
- if (field.Required)
608
- validators.push(ArrayValidators.minLenght(1));
609
- break;
610
- }
611
- return new FormControl(record[field.Name], validators);
612
- };
613
- /**
614
- * Metodo per configurare gli endpoint da usare di default a partire dall'url base del server
615
- * a cui si deve connettere e al token da passare per autenticarsi.
616
- * @param baseServerUrl Stringa dell'url base del server (es: "http://localhost:5000").
617
- * @param userToken Token dell'utente loggato da usare per autenticarsi se necessario.
618
- * @returns Resituisce la configurazione completa degli endPoint da usare di default.
619
- */
620
- UtilityHelperService.prototype.ConfigureDefaultEndPoints = function (baseServerUrl, userToken) {
621
- var endPointConfiguration = new EndPointConfiguration();
622
- endPointConfiguration = new EndPointConfiguration();
623
- endPointConfiguration.Records = {
624
- GetByFormIDEndPoint: {
625
- Url: baseServerUrl + "/api/v1/getall",
626
- Token: userToken,
627
- RequestMethod: RequestMethodEnum.GET,
628
- },
629
- GetByIDEndPoint: {
630
- Url: baseServerUrl + "/api/v1/getByID",
631
- Token: userToken,
632
- RequestMethod: RequestMethodEnum.GET,
633
- },
634
- SaveEndPoint: {
635
- Url: baseServerUrl + "/api/v1/save",
636
- Token: userToken,
637
- RequestMethod: RequestMethodEnum.POST,
638
- },
639
- DuplicateEndPoint: {
640
- Url: baseServerUrl + "/api/v1/duplicate",
641
- Token: userToken,
642
- RequestMethod: RequestMethodEnum.POST,
643
- },
644
- DeleteEndPoint: {
645
- Url: baseServerUrl + "/api/v1/delete",
646
- Token: userToken,
647
- RequestMethod: RequestMethodEnum.DELETE,
648
- }
649
- };
650
- endPointConfiguration.Forms = {
651
- GetByIDEndPoint: {
652
- Url: baseServerUrl + "/api/conf/form",
653
- Token: userToken,
654
- RequestMethod: RequestMethodEnum.GET,
655
- },
656
- SaveEndPoint: {
657
- Url: baseServerUrl + "/api/conf/form",
658
- Token: userToken,
659
- RequestMethod: RequestMethodEnum.POST,
660
- }
661
- };
662
- return endPointConfiguration;
663
- };
664
- /**
665
- * Metodo che data la configurazione di un endpoint costruisce l'url da chiamare, gli eventuali parametri
666
- * da passare (nel body o nella rotta) ed effettua la chiamata. Al termine della chiamata esegue le eventuali
667
- * funzioni di callback (sia in caso di successo che in caso di errore) passate in input.
668
- * @param endPointData Cofigurazione dell'endpoint da chiamare.
669
- * @param dynamicModuleParams Array dei parametri aggiunti dal modulo dinamico a quelli già configurati
670
- * (ad esempio il record o la form da salvare oppure l'ID per recuperare una particolare entità).
671
- * @param callback Metodo da eseguire in caso di successo dopo la chiamata http.
672
- * NOTA: in input viene passata la risposta della chiamata stessa.
673
- * @param errorCallBack Metodo da eseguire in caso di errore dopo la chiamata http.
674
- * NOTA: in input viene passato l'errore generato della chiamata stessa.
675
- */
676
- UtilityHelperService.prototype.RunEndPointCall = function (endPointData, dynamicModuleParams, callback, errorCallBack) {
677
- var _this = this;
678
- if (dynamicModuleParams === void 0) { dynamicModuleParams = null; }
679
- if (callback === void 0) { callback = null; }
680
- if (errorCallBack === void 0) { errorCallBack = null; }
681
- this.spinnerService.addRequestCounter();
682
- var url = "" + endPointData.Url;
683
- var queryParams = null;
684
- var bodyParams = {
685
- AdditionalParams: {}
686
- };
687
- // Se nella configurazione sono stati definiti parametri da aggiungere alla chiamata questi vengono ciclati
688
- // e aggiunti nel punto in cui devono essere usati.
689
- if (endPointData.Params) {
690
- endPointData.Params.forEach(function (p) {
691
- switch (p.ParamType) {
692
- case ParamTypeEnum['Query param']: {
693
- var stringParam = p.ParamName + "=" + p.ParamValue;
694
- queryParams = (queryParams == null ? "" : queryParams + "&") + stringParam;
695
- break;
696
- }
697
- case ParamTypeEnum['In route']: {
698
- url = url + (url.endsWith("/") ? "" : "/") + p.ParamValue;
699
- break;
700
- }
701
- case ParamTypeEnum['In Body']: {
702
- bodyParams.AdditionalParams[p.ParamName] = p.ParamValue;
703
- break;
704
- }
705
- }
706
- });
707
- }
708
- // Se sono stati passati parametri da aggiungere alla chiamata definiti all'interno del modulo dinamico
709
- // vengono ciclati e aggiunti nel punto in cui devono essere usati dopo quelli definiti nella configurazione.
710
- if (dynamicModuleParams) {
711
- dynamicModuleParams.forEach(function (p) {
712
- switch (p.ParamType) {
713
- case ParamTypeEnum['Query param']: {
714
- var stringParam = p.ParamName + "=" + p.ParamValue;
715
- queryParams = (queryParams == null ? "" : queryParams + "&") + stringParam;
716
- break;
717
- }
718
- case ParamTypeEnum['In route']: {
719
- url = url + (url.endsWith("/") ? "" : "/") + p.ParamValue;
720
- break;
721
- }
722
- case ParamTypeEnum['In Body']: {
723
- bodyParams[p.ParamName] = p.ParamValue;
724
- break;
725
- }
726
- }
727
- });
728
- }
729
- if (queryParams != null) {
730
- url = (url.endsWith("/") ? url.substring(0, url.length - 1) : url) + "?" + queryParams;
731
- }
732
- this.http.request(endPointData.RequestMethod, url, {
733
- headers: endPointData.Token ? { Authorization: endPointData.Token } : null,
734
- body: ![RequestMethodEnum.DELETE, RequestMethodEnum.GET].includes(endPointData.RequestMethod) ? bodyParams : null
735
- })
736
- .subscribe(function (res) {
737
- _this.spinnerService.removeRequestCounter();
738
- if (callback) {
739
- callback(res);
740
- }
741
- }, function (error) {
742
- _this.spinnerService.removeRequestCounter();
743
- if (errorCallBack) {
744
- errorCallBack(error);
745
- }
746
- EqpDynamicModuleDialogService.Error(error.message);
747
- throw new Error(error.message);
748
- });
749
- };
750
- var UtilityHelperService_1;
751
- UtilityHelperService.context = new Context();
752
- UtilityHelperService.ctorParameters = function () { return [
753
- { type: FormBuilder },
754
- { type: HttpClient },
755
- { type: SpinnerService }
756
- ]; };
757
- UtilityHelperService.ɵprov = ɵɵdefineInjectable({ factory: function UtilityHelperService_Factory() { return new UtilityHelperService(ɵɵinject(FormBuilder), ɵɵinject(HttpClient), ɵɵinject(SpinnerService)); }, token: UtilityHelperService, providedIn: "root" });
758
- UtilityHelperService = UtilityHelperService_1 = __decorate([
759
- Injectable({
760
- providedIn: 'root'
761
- })
762
- ], UtilityHelperService);
763
- return UtilityHelperService;
764
- }());
765
-
766
- var EqpDynamicModuleComponent = /** @class */ (function () {
767
- function EqpDynamicModuleComponent(utilityHelperService) {
768
- this.utilityHelperService = utilityHelperService;
769
- this.context = new Context();
770
- this.showButtons = true;
771
- this.showTitle = true;
772
- /**
773
- * Url del server da chiamare per recuperare, salvare o eliminare i record.
774
- * Usato per creare la configurazione di default degli endpoint da chiamare.
775
- */
776
- this.baseServerUrl = null;
777
- /**
778
- * Token da usare negli endpoint da chiamare per recuperare o salvare i record.
779
- * Usato solo se viene popolata la proprietà "baseServerUrl".
780
- */
781
- this.userToken = null;
782
- /**
783
- * Configurazione degli endpoint da chiamare per recuperare o salvare i dati.
784
- * Può essere definita dall'utente oppure lasciata null, viene popolata con dei
785
- * valori di default se viene valorizzata la proprietà "baseServerUrl" altrimenti
786
- * viene lasciata null e non viene eseguita nessuna chiamata al server.
787
- */
788
- this.endPointConfiguration = null;
789
- /**
790
- * Eventi emessi quando si salva, elimina o duplica un record
791
- * se non è stato specificato un endpoint da chiamare.
792
- */
793
- this.saveRecord = new EventEmitter();
794
- this.deleteRecord = new EventEmitter();
795
- this.duplicateRecord = new EventEmitter();
796
- /**
797
- * Eventi emessi DOPO aver eseguito una chiamata al server per il salvataggio,
798
- * l'eliminazione o la duplicazione di un record all'endpoint specificato.
799
- */
800
- this.afterSaveRecord = new EventEmitter();
801
- this.afterDeleteRecord = new EventEmitter();
802
- this.afterDuplicateRecord = new EventEmitter();
803
- this.form = new Form();
804
- this.viewMode = FormTypeEnum.LIST;
805
- this.FormTypeEnum = FormTypeEnum;
806
- }
807
- EqpDynamicModuleComponent.prototype.ngOnInit = function () {
808
- UtilityHelperService.SetContext(this.context);
809
- this.configureDefaultEndPoints();
810
- this.getFormByID();
811
- };
812
- EqpDynamicModuleComponent.prototype.getFormByID = function () {
813
- var _this = this;
814
- var dynamicModuleParams = new Array();
815
- dynamicModuleParams.push({
816
- ParamName: "id",
817
- ParamValue: this.formID,
818
- ParamType: ParamTypeEnum['Query param']
819
- });
820
- this.utilityHelperService.RunEndPointCall(this.endPointConfiguration.Forms.GetByIDEndPoint, dynamicModuleParams, function (res) {
821
- _this.form = res;
822
- _this.getRecordsByFormID();
823
- }, function (err) {
824
- console.log(err);
825
- });
826
- };
827
- /**
828
- * Metodo per configurare gli endpoint da usare di default a partire dall'url base del server
829
- * a cui si deve connettere e al token da passare per autenticarsi.
830
- * Se la proprietà "baseServerUrl" è null e non sono stati configurati i vari endpoint allora
831
- * non viene eseguita nessuna chiamata http per recuperare/salvare i dati.
832
- */
833
- EqpDynamicModuleComponent.prototype.configureDefaultEndPoints = function () {
834
- if (!this.endPointConfiguration && this.baseServerUrl) {
835
- this.endPointConfiguration = this.utilityHelperService.ConfigureDefaultEndPoints(this.baseServerUrl, this.userToken);
836
- }
837
- };
838
- /**
839
- * Metodo per recuperare tutti i record salvati per una particolare Form.
840
- * La chiamata viene effettuata solo se è stato configurato l'endPoint da usare.
841
- * La risposta della chiamata deve essere un array di oggetti di tipo "DynRecord"
842
- * a partire dai quali vengono ricreati i Record usati nel client.
843
- */
844
- EqpDynamicModuleComponent.prototype.getRecordsByFormID = function () {
845
- var _this = this;
846
- if (this.endPointConfiguration && this.endPointConfiguration.Records && this.endPointConfiguration.Records.GetByFormIDEndPoint) {
847
- var dynamicModuleParams = [
848
- { ParamName: 'EntID', ParamValue: this.form.ID, ParamType: ParamTypeEnum['Query param'] }
849
- ];
850
- this.utilityHelperService.RunEndPointCall(this.endPointConfiguration.Records.GetByFormIDEndPoint, dynamicModuleParams, function (res) {
851
- _this.values = new Array();
852
- res.forEach(function (r) {
853
- var tmpRec = new Record();
854
- tmpRec = JSON.parse(r.SerializedValues);
855
- tmpRec.ID = r.ID;
856
- tmpRec.EntID = r.EntID;
857
- _this.values.push(tmpRec);
858
- });
859
- });
860
- }
861
- };
862
- /**
863
- * Metodo invocato quando si vuole aggiungere, visualizzare o modificare un record.
864
- * Se l'evento è null vuol dire che stiamo aggiungendo un nuovo record altrimenti siamo in modifica
865
- * o visualizzazione. In questi ultimi due casi, se è stato configurato un endpoint per il recupero
866
- * del record completo allora viene effettuata una chiamata al server, altrimenti viene usato l'oggetto selezionato.
867
- * @param event Oggetto con due proprietà:
868
- * "record" = oggetto da modificare/visualizzare,
869
- * "onlyView" = booleano (se TRUE siamo in visualizzazione altrimenti in modifica)
870
- */
871
- EqpDynamicModuleComponent.prototype.onAddViewEditRecord = function (event) {
872
- var _this = this;
873
- if (event != null) {
874
- this.onlyView = event.onlyView;
875
- if (this.endPointConfiguration && this.endPointConfiguration.Records && this.endPointConfiguration.Records.GetByIDEndPoint) {
876
- var dynamicModuleParams = [
877
- { ParamName: "id", ParamValue: event.record.ID, ParamType: ParamTypeEnum['Query param'] }
878
- ];
879
- this.utilityHelperService.RunEndPointCall(this.endPointConfiguration.Records.GetByIDEndPoint, dynamicModuleParams, function (res) {
880
- _this.selectedRecord = JSON.parse(res.SerializedValues);
881
- _this.selectedRecord.ID = res.ID;
882
- _this.selectedRecord.EntID = res.EntID;
883
- _this.viewMode = FormTypeEnum.SCALAR;
884
- });
885
- }
886
- else {
887
- this.selectedRecord = JSON.parse(JSON.stringify(event.record));
888
- this.viewMode = FormTypeEnum.SCALAR;
889
- }
890
- }
891
- else {
892
- this.selectedRecord = null;
893
- this.onlyView = false;
894
- this.viewMode = FormTypeEnum.SCALAR;
895
- }
896
- };
897
- /**
898
- * Metodo per salvare il record aggiunto o modificato.
899
- * Se è stato configurato un endPoint per il salvataggio viene effettuata una chiamata al server passando l'oggeto da salvare
900
- * nel body della chiamata, altrimenti scatena l'evento "saveRecord".
901
- * @param event Oggetto di tipo Record da salvare.
902
- */
903
- EqpDynamicModuleComponent.prototype.onSaveRecord = function (event) {
904
- var _this = this;
905
- var _a;
906
- if (event != null && this.endPointConfiguration != null && this.endPointConfiguration.Records.SaveEndPoint) {
907
- var dynRec = new DynRecord();
908
- dynRec.ID = (_a = event.ID, (_a !== null && _a !== void 0 ? _a : null));
909
- dynRec.EntID = this.form.ID;
910
- dynRec.Values = (event !== null && event !== void 0 ? event : null);
911
- var dynamicModuleParams = [
912
- { ParamName: "Record", ParamValue: dynRec, ParamType: ParamTypeEnum['In Body'] }
913
- ];
914
- this.utilityHelperService.RunEndPointCall(this.endPointConfiguration.Records.SaveEndPoint, dynamicModuleParams, function (res) {
915
- _this.getRecordsByFormID();
916
- _this.afterSaveRecord.emit(event);
917
- _this.viewMode = FormTypeEnum.LIST;
918
- });
919
- }
920
- else {
921
- this.saveRecord.emit(event);
922
- this.viewMode = FormTypeEnum.LIST;
923
- }
924
- };
925
- /**
926
- * Metodo per duplicare un record precedentemente salvato.
927
- * Se è stato configurato un endPoint per la duplicazione lato server allora effettua una chiamata passando nel body
928
- * un oggetto contenente il record da duplicare, altrimenti scatena l'evento di output "duplicateRecord".
929
- * @param record Oggetto di tipo Record da duplicare.
930
- */
931
- EqpDynamicModuleComponent.prototype.onDuplicateRecord = function (record) {
932
- var _this = this;
933
- if (this.endPointConfiguration && this.endPointConfiguration.Records.DuplicateEndPoint) {
934
- EqpDynamicModuleDialogService.Confirm('Duplicare il record selezionato?', function () {
935
- var dynamicModuleParams = [
936
- { ParamName: "id", ParamValue: record.ID, ParamType: ParamTypeEnum['Query param'] }
937
- ];
938
- _this.utilityHelperService.RunEndPointCall(_this.endPointConfiguration.Records.DuplicateEndPoint, dynamicModuleParams, function (res) {
939
- _this.getRecordsByFormID();
940
- _this.afterDuplicateRecord.emit(record);
941
- });
942
- }, false, 'Richiesta conferma');
943
- }
944
- else {
945
- this.duplicateRecord.emit(record);
946
- }
947
- };
948
- /**
949
- * Metodo per eliminare un record.
950
- * Se è stato configurato un endPoint per l'eliminazione allora effettua una chiamata passando l'ID del record da eliminare
951
- * come query param all'interno della rotta, altrimenti scatena l'evento di output "deleteRecord".
952
- * @param record Oggetto di tipo Record da duplicare.
953
- */
954
- EqpDynamicModuleComponent.prototype.onDeleteRecord = function (record) {
955
- var _this = this;
956
- if (this.endPointConfiguration && this.endPointConfiguration.Records.DeleteEndPoint) {
957
- EqpDynamicModuleDialogService.Confirm('Eliminare il record selezionato?', function () {
958
- var dynamicModuleParams = [
959
- { ParamName: "id", ParamValue: record.ID, ParamType: ParamTypeEnum['Query param'] }
960
- ];
961
- _this.utilityHelperService.RunEndPointCall(_this.endPointConfiguration.Records.DeleteEndPoint, dynamicModuleParams, function (res) {
962
- _this.getRecordsByFormID();
963
- _this.afterDeleteRecord.emit(record);
964
- });
965
- }, false, 'Richiesta conferma');
966
- }
967
- else {
968
- this.deleteRecord.emit(record);
969
- }
970
- };
971
- EqpDynamicModuleComponent.ctorParameters = function () { return [
972
- { type: UtilityHelperService }
973
- ]; };
974
- __decorate([
975
- Input()
976
- ], EqpDynamicModuleComponent.prototype, "context", void 0);
977
- __decorate([
978
- Input()
979
- ], EqpDynamicModuleComponent.prototype, "formID", void 0);
980
- __decorate([
981
- Input()
982
- ], EqpDynamicModuleComponent.prototype, "values", void 0);
983
- __decorate([
984
- Input()
985
- ], EqpDynamicModuleComponent.prototype, "showButtons", void 0);
986
- __decorate([
987
- Input()
988
- ], EqpDynamicModuleComponent.prototype, "showTitle", void 0);
989
- __decorate([
990
- Input()
991
- ], EqpDynamicModuleComponent.prototype, "baseServerUrl", void 0);
992
- __decorate([
993
- Input()
994
- ], EqpDynamicModuleComponent.prototype, "userToken", void 0);
995
- __decorate([
996
- Input()
997
- ], EqpDynamicModuleComponent.prototype, "endPointConfiguration", void 0);
998
- __decorate([
999
- Output()
1000
- ], EqpDynamicModuleComponent.prototype, "saveRecord", void 0);
1001
- __decorate([
1002
- Output()
1003
- ], EqpDynamicModuleComponent.prototype, "deleteRecord", void 0);
1004
- __decorate([
1005
- Output()
1006
- ], EqpDynamicModuleComponent.prototype, "duplicateRecord", void 0);
1007
- __decorate([
1008
- Output()
1009
- ], EqpDynamicModuleComponent.prototype, "afterSaveRecord", void 0);
1010
- __decorate([
1011
- Output()
1012
- ], EqpDynamicModuleComponent.prototype, "afterDeleteRecord", void 0);
1013
- __decorate([
1014
- Output()
1015
- ], EqpDynamicModuleComponent.prototype, "afterDuplicateRecord", void 0);
1016
- EqpDynamicModuleComponent = __decorate([
1017
- Component({
1018
- selector: 'eqp-dynamic-module',
1019
- template: "<eqp-dynamic-module-spinner></eqp-dynamic-module-spinner>\r\n\r\n<add-form-record *ngIf=\"viewMode == FormTypeEnum.SCALAR\" [form]=\"form\" [record]=\"selectedRecord\"\r\n [showButtons]=\"showButtons\" [onlyView]=\"onlyView\" (saveRecordEvent)=\"onSaveRecord($event)\" [showTitle]=\"showTitle\">\r\n</add-form-record>\r\n\r\n<list-form-record *ngIf=\"viewMode == FormTypeEnum.LIST && values\" [form]=\"form\" [values]=\"values\"\r\n (onAddViewEditRecord)=\"onAddViewEditRecord($event)\" [showTitle]=\"showTitle\"\r\n (onDeleteRecord)=\"onDeleteRecord($event)\" (onDuplicateRecord)=\"onDuplicateRecord($event)\">\r\n</list-form-record>",
1020
- styles: ["::ng-deep mat-form-field{width:100%}"]
1021
- })
1022
- ], EqpDynamicModuleComponent);
1023
- return EqpDynamicModuleComponent;
1024
- }());
1025
-
1026
- var MaterialModule = /** @class */ (function () {
1027
- function MaterialModule() {
1028
- }
1029
- MaterialModule = __decorate([
1030
- NgModule({
1031
- imports: [
1032
- MatCheckboxModule,
1033
- MatButtonModule,
1034
- MatInputModule,
1035
- MatAutocompleteModule,
1036
- MatDatepickerModule,
1037
- MatFormFieldModule,
1038
- MatRadioModule,
1039
- MatSelectModule,
1040
- MatSliderModule,
1041
- MatSlideToggleModule,
1042
- MatMenuModule,
1043
- MatSidenavModule,
1044
- MatToolbarModule,
1045
- MatListModule,
1046
- MatGridListModule,
1047
- MatCardModule,
1048
- MatStepperModule,
1049
- MatTabsModule,
1050
- MatExpansionModule,
1051
- MatButtonToggleModule,
1052
- MatChipsModule,
1053
- MatIconModule,
1054
- MatProgressSpinnerModule,
1055
- MatProgressBarModule,
1056
- MatDialogModule,
1057
- MatTooltipModule,
1058
- MatSnackBarModule,
1059
- MatTableModule,
1060
- MatSortModule,
1061
- MatPaginatorModule,
1062
- MatDatepickerModule,
1063
- MatNativeDateModule
1064
- ],
1065
- exports: [
1066
- MatCheckboxModule,
1067
- MatButtonModule,
1068
- MatInputModule,
1069
- MatAutocompleteModule,
1070
- MatDatepickerModule,
1071
- MatFormFieldModule,
1072
- MatRadioModule,
1073
- MatSelectModule,
1074
- MatSliderModule,
1075
- MatSlideToggleModule,
1076
- MatMenuModule,
1077
- MatSidenavModule,
1078
- MatToolbarModule,
1079
- MatListModule,
1080
- MatGridListModule,
1081
- MatCardModule,
1082
- MatStepperModule,
1083
- MatTabsModule,
1084
- MatExpansionModule,
1085
- MatButtonToggleModule,
1086
- MatChipsModule,
1087
- MatIconModule,
1088
- MatProgressSpinnerModule,
1089
- MatProgressBarModule,
1090
- MatDialogModule,
1091
- MatTooltipModule,
1092
- MatSnackBarModule,
1093
- MatTableModule,
1094
- MatSortModule,
1095
- MatPaginatorModule
1096
- ],
1097
- })
1098
- ], MaterialModule);
1099
- return MaterialModule;
1100
- }());
1101
-
1102
- var EqpDynamicModuleConfiguratorComponent = /** @class */ (function () {
1103
- function EqpDynamicModuleConfiguratorComponent(formBuilder, dialog, utilityHelperService) {
1104
- this.formBuilder = formBuilder;
1105
- this.dialog = dialog;
1106
- this.utilityHelperService = utilityHelperService;
1107
- this.context = new Context();
1108
- this.form = new Form();
1109
- this.formID = null;
1110
- this.innerFormManagment = false;
1111
- /**
1112
- * Url del server da chiamare per recuerare, salvare o eliminare i record.
1113
- * Usato per creare la configurazione di default degli endpoint da chiamare.
1114
- */
1115
- this.baseServerUrl = null;
1116
- /**
1117
- * Token da usare negli endpoint da chiamare per recuperare o salvare i record.
1118
- * Usato solo se viene popolata la proprietà "baseServerUrl".
1119
- */
1120
- this.userToken = null;
1121
- /**
1122
- * Configurazione degli endpoint da chiamare per recuperare o salvare i dati.
1123
- * Può essere definita dall'utente oppure lasciata null, viene popolata con dei
1124
- * valori di default se viene valorizzata la proprietà "baseServerUrl" altrimenti
1125
- * viene lasciata null e non viene eseguita nessuna chiamata al server.
1126
- */
1127
- this.endPointConfiguration = null;
1128
- this.formCompleted = false;
1129
- //#region Enumeratori usati nell'html
1130
- this.FormTypeEnum = FormTypeEnum;
1131
- this.FormScalarTypeEnum = FormScalarTypeEnum;
1132
- //#endregion
1133
- /**
1134
- * Evento emesso quando si salva una form e non è stato specificato un endpoint da chiamare.
1135
- */
1136
- this.saveFormEvent = new EventEmitter();
1137
- /**
1138
- * Evento emesso DOPO aver eseguito una chiamata al server per il salvataggiodi una form all'endpoint specificato.
1139
- */
1140
- this.afterSaveFormEvent = new EventEmitter();
1141
- }
1142
- EqpDynamicModuleConfiguratorComponent.prototype.ngOnInit = function () {
1143
- this.configureDefaultEndPoints();
1144
- this.getFormByID();
1145
- if (this.context) {
1146
- UtilityHelperService.SetContext(this.context);
1147
- }
1148
- };
1149
- /**
1150
- * Metodo per configurare gli endpoint da usare di default a partire dall'url base del server
1151
- * a cui si deve connettere e al token da passare per autenticarsi.
1152
- * Se la proprietà baseServerUrl è null e non sono stati configurati i vari endpoint allora
1153
- * non viene eseguita nessuna chiamata http per recuperare/salvare i dati.
1154
- */
1155
- EqpDynamicModuleConfiguratorComponent.prototype.configureDefaultEndPoints = function () {
1156
- if (!this.endPointConfiguration && this.baseServerUrl) {
1157
- this.endPointConfiguration = this.utilityHelperService.ConfigureDefaultEndPoints(this.baseServerUrl, this.userToken);
1158
- if (this.formID) {
1159
- this.endPointConfiguration.Forms.GetByIDEndPoint.Params = [{ ParamName: 'id', ParamValue: this.formID, ParamType: ParamTypeEnum['Query param'] }];
1160
- }
1161
- }
1162
- };
1163
- /**
1164
- * Metodo per recuperare tutti i record salvati per una particolare Form.
1165
- * La chiamata viene effettuata solo se è stato configurato l'endPoint da usare.
1166
- */
1167
- EqpDynamicModuleConfiguratorComponent.prototype.getFormByID = function () {
1168
- var _this = this;
1169
- if (this.formID && this.endPointConfiguration && this.endPointConfiguration.Forms && this.endPointConfiguration.Forms.GetByIDEndPoint) {
1170
- this.utilityHelperService.RunEndPointCall(this.endPointConfiguration.Forms.GetByIDEndPoint, null, function (res) {
1171
- _this.setFormAndConfigure(res);
1172
- }, function (err) {
1173
- _this.setFormAndConfigure(new Form());
1174
- });
1175
- }
1176
- else {
1177
- this.setFormAndConfigure();
1178
- }
1179
- };
1180
- /**
1181
- * Metodo invocato al cambio del tipo di visualizzazione della form.
1182
- * Se l'utente sceglie una visualizzazione raggruppata il metodo aggiunge al FormGroup un nuovo
1183
- * controllo per l'array dei nomi delle sezioni da creare.
1184
- */
1185
- EqpDynamicModuleConfiguratorComponent.prototype.onChangeFormScalarType = function () {
1186
- if (this.form.FormScalarType != FormScalarTypeEnum.Semplice) {
1187
- if (!this.formFormGroup.contains("FormFieldsGroups")) {
1188
- this.formFormGroup.removeControl("FormFieldsGroups");
1189
- this.formFormGroup.addControl("FormFieldsGroups", new FormControl(this.form.FormFieldsGroups, [Validators.required, ArrayValidators.minLenght(1)]));
1190
- }
1191
- }
1192
- else {
1193
- this.form.FormFieldsGroups = null;
1194
- if (this.formFormGroup.contains("FormFieldsGroups"))
1195
- this.formFormGroup.removeControl("FormFieldsGroups");
1196
- }
1197
- this.formFormGroup.updateValueAndValidity();
1198
- this.configureColumns();
1199
- };
1200
- /**
1201
- * Evento invocato al keyup nell'input per inserire i nomi delle sezioni per la visualizzazione
1202
- * raggruppata della form. Quanto l'utente preme il tasto invio viene aggiunto il nuovo nome alle
1203
- * sezioni dispobili se non ne esiste una con lo stesso nome.
1204
- * @param event Evento che rappresenta il keyup sulla tastiera.
1205
- */
1206
- EqpDynamicModuleConfiguratorComponent.prototype.onFormFieldGroupNameKeyUp = function (event) {
1207
- var _this = this;
1208
- if (event.code === 'Enter' || event.code === 'NumpadEnter') {
1209
- if (!this.form.FormFieldsGroups) {
1210
- this.form.FormFieldsGroups = new Array();
1211
- }
1212
- if (!this.form.FormFieldsGroups.find(function (n) { return n.Name == _this.formFieldGroupName; })) {
1213
- this.form.FormFieldsGroups.push({ Name: this.formFieldGroupName });
1214
- }
1215
- // Imposto il nuovo valore del FormControl per aggiornare lo stato della form.
1216
- this.formFormGroup.controls["FormFieldsGroups"].setValue(this.form.FormFieldsGroups);
1217
- this.formFieldGroupName = null;
1218
- this.setFormFieldGroupOrdinalPosition();
1219
- }
1220
- };
1221
- /**
1222
- * Metodo per rimuovere la sezione selezionata da quelle disponibili per la form.
1223
- * @param groupName Nome della sezione da eliminare.
1224
- */
1225
- EqpDynamicModuleConfiguratorComponent.prototype.onDeleteFormFieldGroupName = function (groupName) {
1226
- this.form.FormFieldsGroups.splice(this.form.FormFieldsGroups.findIndex(function (g) { return g.Name === groupName; }), 1);
1227
- // Imposto il nuovo valore del FormControl per aggiornare lo stato della form.
1228
- this.formFormGroup.controls["FormFieldsGroups"].setValue(this.form.FormFieldsGroups);
1229
- // Se esistono Field legati alla sezione che si vuole eliminare allora rompo il legame.
1230
- if (this.form.Fields.find(function (f) { return f.FieldGroup == groupName; })) {
1231
- this.form.Fields.filter(function (f) { return f.FieldGroup == groupName; }).forEach(function (f) { return f.FieldGroup = null; });
1232
- }
1233
- this.setFormFieldGroupOrdinalPosition();
1234
- };
1235
- /**
1236
- * Metodo chiamato quando si vuole aggiungere un nuovo campo o si vuole modificare uno esistente.
1237
- * Memorizza l'eventuale Field scelto one crea uno nuovo prima di aprire il dialog per modificarlo/aggiungerlo.
1238
- * @param field Oggetto BaseField da modificare. Se null ne viene creata una nuova istanza per l'aggiunta.
1239
- */
1240
- EqpDynamicModuleConfiguratorComponent.prototype.openFieldDialog = function (field) {
1241
- if (field === void 0) { field = null; }
1242
- if (field) {
1243
- this.indexSelectedField = this.form.Fields.indexOf(field);
1244
- this.selectedField = JSON.parse(JSON.stringify(field));
1245
- }
1246
- else {
1247
- this.selectedField = new BaseField();
1248
- this.indexSelectedField = null;
1249
- }
1250
- this.dialogFieldRef = this.dialog.open(this.dialogField, {
1251
- disableClose: true,
1252
- hasBackdrop: true,
1253
- width: '75%'
1254
- });
1255
- };
1256
- /**
1257
- * Metodo che salva il campo appena creato o modificato.
1258
- * Prima del salvataggio controlla se esiste un altro campo con la stessa label, in questo
1259
- * case genere un errore (i campi devono avere nomi, e quindi label, univoche - i nomi vengono
1260
- * ricavati unendo le parole che formano la label tramite "_").
1261
- * @param field Campo da salvare
1262
- */
1263
- EqpDynamicModuleConfiguratorComponent.prototype.onSaveField = function (field) {
1264
- var _this = this;
1265
- if (field) {
1266
- if (this.form.Fields
1267
- && this.form.Fields.find(function (f, i) { return f.Label === field.Label
1268
- && (_this.indexSelectedField == null ? true : _this.indexSelectedField !== i); })) {
1269
- EqpDynamicModuleDialogService.Warning('Impossibile inserire due campi con la stessa label.');
1270
- throw new Error('Impossibile inserire due campi con la stessa label.');
1271
- }
1272
- if (this.indexSelectedField != null && this.indexSelectedField >= 0) {
1273
- this.form.Fields[this.indexSelectedField] = field;
1274
- }
1275
- else {
1276
- if (!this.form.Fields) {
1277
- this.form.Fields = new Array();
1278
- }
1279
- this.form.Fields.push(field);
1280
- }
1281
- }
1282
- this.closeFieldDialog();
1283
- this.setFieldOrdinalPosition();
1284
- this.reloadFieldsTable();
1285
- };
1286
- /**
1287
- * Metodo che controlla se lo step per l'aggiunta dei campi nella form è concluso.
1288
- * @returns Se TRUE lo step viene considerato completato ed è possbile passare al successivo.
1289
- */
1290
- EqpDynamicModuleConfiguratorComponent.prototype.isFieldStepCompleted = function () {
1291
- if (!this.form.Fields) {
1292
- return false;
1293
- }
1294
- if (this.form.FormScalarType != FormScalarTypeEnum.Semplice && this.form.Fields.find(function (f) { return !f.FieldGroup; })) {
1295
- return false;
1296
- }
1297
- return this.form.Fields.length > 0;
1298
- };
1299
- /**
1300
- * Metodo per aprire il dialog di creazione/modifica delle form di dettaglio.
1301
- * Se il parametro passato è null sono in aggiunta altrimenti sono in modifica.
1302
- * @param innenrForm Form di dettaglio da modificare (se null allora vado in add).
1303
- */
1304
- EqpDynamicModuleConfiguratorComponent.prototype.openInnerFormDialog = function (innenrForm) {
1305
- if (innenrForm === void 0) { innenrForm = null; }
1306
- if (innenrForm) {
1307
- this.indexSelectedInnerForm = this.form.InnerForms.indexOf(innenrForm);
1308
- this.selectedInnerForm = JSON.parse(JSON.stringify(innenrForm));
1309
- this.selectedInnerForm.OldName = innenrForm.Name;
1310
- this.indexSelectedField = this.form.Fields.findIndex(function (f) { return f.Label === innenrForm.Name; });
1311
- }
1312
- else {
1313
- this.selectedInnerForm = new Form();
1314
- this.indexSelectedInnerForm = null;
1315
- this.indexSelectedField = null;
1316
- }
1317
- this.dialogInnerFormRef = this.dialog.open(this.dialogInnerForm, {
1318
- disableClose: true,
1319
- hasBackdrop: true,
1320
- width: '85%'
1321
- });
1322
- };
1323
- /**
1324
- * Metodo scatenato al salvataggio di una form di dettaglio.
1325
- * @param event Form creata/modificata dall'utente. Se è null allora l'utente ha abbandonato la configurazione.
1326
- */
1327
- EqpDynamicModuleConfiguratorComponent.prototype.onSaveOrExitInnerForm = function (event) {
1328
- var _this = this;
1329
- if (event != null) {
1330
- if (this.form.Name === event.Name ||
1331
- (this.form.InnerForms
1332
- && this.form.InnerForms.find(function (a, i) { return a.Name === event.Name
1333
- && (_this.indexSelectedInnerForm == null ? true : _this.indexSelectedInnerForm !== i); })) ||
1334
- (this.form.Fields
1335
- && this.indexSelectedInnerForm == null
1336
- && this.form.Fields.find(function (f, i) { return f.Label === event.Name
1337
- && (_this.indexSelectedField == null ? true : _this.indexSelectedField !== i); }))) {
1338
- EqpDynamicModuleDialogService.Warning('Impossibile inserire due form di dettaglio con lo stesso nome.');
1339
- throw new Error('Impossibile inserire due form di dettaglio con lo stesso nome.');
1340
- }
1341
- var innerFormField = new BaseField();
1342
- innerFormField.Name = event.Name.split(" ").join("_");
1343
- innerFormField.Label = event.Name;
1344
- innerFormField.FieldType = FieldTypeEnum['Form di dettaglio'];
1345
- innerFormField.FieldGroup = this.indexSelectedField != null ? this.form.Fields[this.indexSelectedField].FieldGroup : null;
1346
- if (this.indexSelectedInnerForm != null && this.indexSelectedInnerForm >= 0) {
1347
- this.form.InnerForms[this.indexSelectedInnerForm] = event;
1348
- this.form.Fields[this.indexSelectedField] = innerFormField;
1349
- }
1350
- else {
1351
- if (!this.form.InnerForms) {
1352
- this.form.InnerForms = new Array();
1353
- }
1354
- this.form.InnerForms.push(event);
1355
- this.form.Fields.push(innerFormField);
1356
- }
1357
- this.reloadFieldsTable();
1358
- }
1359
- this.dialogInnerFormRef.close();
1360
- };
1361
- /**
1362
- * Metodo per aprire il dialog di creazione/modifica delle action.
1363
- * Se il parametro passato è null sono in aggiunta altrimenti sono in modifica.
1364
- * @param action ActionOnRecord da modificare (se null allora vado in add).
1365
- */
1366
- EqpDynamicModuleConfiguratorComponent.prototype.openActionOnRecordDialog = function (action) {
1367
- if (action === void 0) { action = null; }
1368
- if (action) {
1369
- this.indexSelectedAction = this.form.ActionsOnRecord.indexOf(action);
1370
- this.selectedAction = JSON.parse(JSON.stringify(action));
1371
- }
1372
- else {
1373
- this.selectedAction = new ActionOnRecord();
1374
- this.indexSelectedAction = null;
1375
- }
1376
- this.createActionOnRecordForm();
1377
- this.dialogActionOnRecordRef = this.dialog.open(this.dialogActionOnRecord, {
1378
- disableClose: true,
1379
- hasBackdrop: true,
1380
- width: '75%'
1381
- });
1382
- };
1383
- /**
1384
- * Metodo per impostare i valori da suggerire nell'autocomplete del campo Formula.
1385
- * Viene scatenato al focus (in questo caso viene passato il parametro a null per differenziarlo
1386
- * dall'evento di click sulla tastiera) e al keyup sull'input (il parametro è diverso da null).
1387
- * @param keyboardEvent Evento scatenato al keyup sulla tastiera. Se null allora il metodo è stato invocato dal focus sull'input.
1388
- * @summary Aggiorna l'elenco dei suggerimenti per l'autocomplete se l'utente esegue il focus sull'input
1389
- * oppure al keyup sulla tastiera di un tasto diverso dalle frecce.
1390
- */
1391
- EqpDynamicModuleConfiguratorComponent.prototype.setActionAutocompleteOptions = function (keyboardEvent) {
1392
- // Creo l'array per l'autocomplete solo se sto facendo il focus sull'input o se sto premendo un tasto
1393
- // sulla tastiera diverso dalle frecce (in quest'ultimo caso, se non viene eseguito il filtro sull'evento,
1394
- // non si può selezionare un suggerimento dell'autocomplete perchè al click verrebbe ricaricato l'array e
1395
- // si prederebbe la selezione appena fatta).
1396
- if (!keyboardEvent || !keyboardEvent.code.includes("Arrow")) {
1397
- this.actionAutocompleteOptions = UtilityHelperService.GetAutocompleteOptions(this.form.Fields, this.selectedAction.Action);
1398
- }
1399
- };
1400
- /**
1401
- * Metodo per salvare l'azione creata/modificate.
1402
- */
1403
- EqpDynamicModuleConfiguratorComponent.prototype.saveActionOnRecord = function () {
1404
- var _this = this;
1405
- if (this.form.ActionsOnRecord
1406
- && this.form.ActionsOnRecord.find(function (a, i) { return a.Name === _this.selectedAction.Name
1407
- && (_this.indexSelectedAction == null ? true : _this.indexSelectedAction !== i); })) {
1408
- EqpDynamicModuleDialogService.Warning('Impossibile inserire due action con lo stesso nome.');
1409
- throw new Error('Impossibile inserire due action con lo stesso nome.');
1410
- }
1411
- if (this.indexSelectedAction != null && this.indexSelectedAction >= 0) {
1412
- this.form.ActionsOnRecord[this.indexSelectedAction] = this.selectedAction;
1413
- }
1414
- else {
1415
- if (!this.form.ActionsOnRecord) {
1416
- this.form.ActionsOnRecord = new Array();
1417
- }
1418
- this.form.ActionsOnRecord.push(this.selectedAction);
1419
- }
1420
- this.closeDialogActionOnRecord();
1421
- this.setActionOrdinalPosition();
1422
- this.reloadActionsOnRecordTable();
1423
- };
1424
- /**
1425
- * Metodo per chiudere il dialog di gestione delle action.
1426
- */
1427
- EqpDynamicModuleConfiguratorComponent.prototype.closeDialogActionOnRecord = function () {
1428
- this.dialogActionOnRecordRef.close();
1429
- };
1430
- /**
1431
- * Metodo per segnare come conclusa la creazione della form e per crearne una copia
1432
- * da visalizzare come anteprima.
1433
- * @param completed Se TRUE segna la form come conclusa e ne crea una copia da visualizzare
1434
- */
1435
- EqpDynamicModuleConfiguratorComponent.prototype.setFormStatus = function (completed) {
1436
- if (completed) {
1437
- this.formCompleted = true;
1438
- this.previewForm = JSON.parse(JSON.stringify(this.form));
1439
- // Per visualizzare correttamente l'oanteprima della form appena creata
1440
- // bisogna valorizzare la proprietà Name dei campi della form e delle InnerForms.
1441
- this.previewForm.Fields.forEach(function (field) { field.Name = field.Label.split(' ').join('_'); });
1442
- if (this.previewForm.InnerForms && this.previewForm.InnerForms.length > 0) {
1443
- this.previewForm.InnerForms.forEach(function (form) {
1444
- form.Fields.forEach(function (field) { field.Name = field.Label.split(' ').join('_'); });
1445
- });
1446
- }
1447
- }
1448
- else {
1449
- this.formCompleted = false;
1450
- this.previewForm = null;
1451
- }
1452
- };
1453
- /**
1454
- * Metodo per salvare la form creata alla fine del wizard.
1455
- * Se è stato configurato un endPoint per il salvataggio viene effettuata una chiamata al server passando l'oggeto da salvare
1456
- * nel body della chiamata, altrimenti scatena l'evento "saveFormEvent".
1457
- * NOTA: Per comunicare correttamente con la parte server del modulo dinamico bisogna modificare l'array dei Fields.
1458
- * Al posto di passare un array di BaseField bisogna passare un array di oggetti del tipo { FieldType: FieldTypeEnum, Value: BaseField }.
1459
- */
1460
- EqpDynamicModuleConfiguratorComponent.prototype.saveForm = function () {
1461
- var _this = this;
1462
- if (this.endPointConfiguration != null && this.endPointConfiguration.Forms.SaveEndPoint) {
1463
- // Copio la form da salvare per riwrappare i Fields in oggetti del tipo { FieldType: FieldTypeEnum, Value: BaseField }.
1464
- // Necessario per far funzionare correttamente il FieldConverter del server.
1465
- var formToSave_1 = JSON.parse(JSON.stringify(this.form));
1466
- /*formToSave.Fields = [];
1467
- this.form.Fields.forEach(field => {
1468
- formToSave.Fields.push({
1469
- FieldType: field.FieldType,
1470
- Value: JSON.parse(JSON.stringify(field))
1471
- });
1472
- });*/
1473
- formToSave_1.Fields = [];
1474
- this.form.Fields.forEach(function (field) {
1475
- var fld = UtilityHelperService.GetFieldType(field);
1476
- formToSave_1.Fields.push(fld);
1477
- });
1478
- var dynamicModuleParams = [
1479
- { ParamName: "Form", ParamValue: formToSave_1, ParamType: ParamTypeEnum['In Body'] }
1480
- ];
1481
- this.utilityHelperService.RunEndPointCall(this.endPointConfiguration.Forms.SaveEndPoint, dynamicModuleParams, function (res) {
1482
- EqpDynamicModuleDialogService.Success("Form salvata con successo!");
1483
- _this.afterSaveFormEvent.emit(_this.form);
1484
- });
1485
- }
1486
- else {
1487
- this.saveFormEvent.emit(this.form);
1488
- }
1489
- };
1490
- //#region FUNZIONI PRIVATE
1491
- /**
1492
- * Metodo per impostare la form e configurare colonne/FormGourp.
1493
- * @param form Form da utilizzare.
1494
- */
1495
- EqpDynamicModuleConfiguratorComponent.prototype.setFormAndConfigure = function (form) {
1496
- if (form === void 0) { form = null; }
1497
- if (form != null) {
1498
- this.form = form;
1499
- }
1500
- this.configureColumns();
1501
- this.createFormForm();
1502
- };
1503
- /**
1504
- * Configura le colonne per le tabelle necessarie alla creazione della form:
1505
- * - per la visualizzazione dei campi inseriti
1506
- * - per le form di dettaglio create
1507
- * - per le azioni configurate sui record della form
1508
- */
1509
- EqpDynamicModuleConfiguratorComponent.prototype.configureColumns = function () {
1510
- var _this = this;
1511
- this.fieldsColumns = [
1512
- {
1513
- key: 'action', display: '', type: TypeColumn.MenuAction, buttonMenuIcon: 'more_vert', styles: { flex: '0 0 6%' },
1514
- actions: [
1515
- { name: 'Modifica', icon: 'edit', fn: function (element, index, col) { return _this.editField(element); } },
1516
- { name: 'Elimina', icon: 'delete', fn: function (element, index, col) { return _this.deleteElement(element, "Fields"); } },
1517
- {
1518
- name: 'Sposta su', icon: 'arrow_upward',
1519
- fn: function (element, index, col) { return _this.moveElement(element, true, "Fields"); },
1520
- disabled: function (element) { return _this.form.Fields.indexOf(element) === 0; }
1521
- },
1522
- {
1523
- name: 'Sposta giù', icon: 'arrow_downward',
1524
- fn: function (element, index, col) { return _this.moveElement(element, false, "Fields"); },
1525
- disabled: function (element) { return _this.form.Fields.indexOf(element) >= (_this.form.Fields.length - 1); }
1526
- },
1527
- ]
1528
- },
1529
- { key: 'FieldType', display: 'Tipologia', type: TypeColumn.Enum, enumModel: FieldTypeEnum },
1530
- { key: 'Label', display: 'Label' },
1531
- { key: 'Description', display: 'Descrizione' },
1532
- {
1533
- key: 'Required', display: 'Obbligatorio',
1534
- value: function (element) { return !!element.Required; },
1535
- type: TypeColumn.Boolean,
1536
- booleanValues: {
1537
- true: '<i class="fa fa-check success-color"></i>',
1538
- false: '<i class="fa fa-close error-color"></i>'
1539
- },
1540
- styles: { flex: '0 0 7%', cellAlignment: CellAlignmentEnum.CENTER }
1541
- },
1542
- ];
1543
- if (this.form.FormScalarType && this.form.FormScalarType != FormScalarTypeEnum.Semplice) {
1544
- this.fieldsColumns.splice(this.fieldsColumns.findIndex(function (c) { return c.key == 'Description'; }), 0, { key: 'FieldGroup', display: 'Sezione', type: TypeColumn.ExternalTemplate, externalTemplate: this.fieldSectionColumnTemplate });
1545
- }
1546
- this.actionsOnRecordColumns = [
1547
- {
1548
- key: 'action', display: '', type: TypeColumn.MenuAction, buttonMenuIcon: 'more_vert', styles: { flex: '0 0 6%' },
1549
- actions: [
1550
- { name: 'Modifica', icon: 'edit', fn: function (element, index, col) { return _this.openActionOnRecordDialog(element); } },
1551
- { name: 'Elimina', icon: 'delete', fn: function (element, index, col) { return _this.deleteElement(element, "ActionsOnRecord"); } },
1552
- {
1553
- name: 'Sposta su', icon: 'arrow_upward',
1554
- fn: function (element, index, col) { return _this.moveElement(element, true, "ActionsOnRecord"); },
1555
- disabled: function (element) { return _this.form.ActionsOnRecord.indexOf(element) === 0; }
1556
- },
1557
- {
1558
- name: 'Sposta giù', icon: 'arrow_downward',
1559
- fn: function (element, index, col) { return _this.moveElement(element, false, "ActionsOnRecord"); },
1560
- disabled: function (element) { return _this.form.ActionsOnRecord.indexOf(element) >= (_this.form.ActionsOnRecord.length - 1); }
1561
- },
1562
- ]
1563
- },
1564
- { key: 'Icon', display: 'Icona', styles: { flex: ' 0 0 15%' } },
1565
- { key: 'Name', display: 'Nome', styles: { flex: ' 0 0 20%' } },
1566
- { key: 'Action', display: 'Azione' },
1567
- ];
1568
- };
1569
- /**
1570
- * Crea il FormGroup per l'oggetto Form
1571
- */
1572
- EqpDynamicModuleConfiguratorComponent.prototype.createFormForm = function () {
1573
- this.formFormGroup = this.formBuilder.group({
1574
- Name: [this.form.Name, Validators.required],
1575
- FormScalarType: [this.form.FormScalarType, Validators.required],
1576
- });
1577
- this.onChangeFormScalarType();
1578
- };
1579
- /**
1580
- * Crea il FormGroup epr l'aggiunta o la modifica di una action sui record della Form.
1581
- */
1582
- EqpDynamicModuleConfiguratorComponent.prototype.createActionOnRecordForm = function () {
1583
- this.actionOnRecordFormGroup = this.formBuilder.group({
1584
- Name: [this.selectedAction.Name, Validators.required],
1585
- Icon: [this.selectedAction.Icon, Validators.required],
1586
- Action: [this.selectedAction.Action, Validators.required],
1587
- });
1588
- };
1589
- /**
1590
- * Chiude il dialog per aggiungere/modificare un Field senza salvare
1591
- */
1592
- EqpDynamicModuleConfiguratorComponent.prototype.closeFieldDialog = function () {
1593
- this.dialogFieldRef.close();
1594
- };
1595
- /**
1596
- * Metodo per gestire l'apertura del dialog per la modifica di un Field.
1597
- * Se il field è di tipo "Form di dettaglio" apre il dialog per la modifica di una
1598
- * InnerForm altrimenti apre quello per la modifica di un Field.
1599
- * @param field Campo da modificare
1600
- */
1601
- EqpDynamicModuleConfiguratorComponent.prototype.editField = function (field) {
1602
- if (field.FieldType != FieldTypeEnum['Form di dettaglio']) {
1603
- this.openFieldDialog(field);
1604
- }
1605
- else {
1606
- this.openInnerFormDialog(this.form.InnerForms.find(function (f) { return f.Name == field.Label; }));
1607
- }
1608
- };
1609
- /**
1610
- * Metodo per rimuovere un Field all'interno di una Form.
1611
- * Richiede conferma all'utente prima di rimuoverlo.
1612
- * @param field BaseField da rimuovere
1613
- */
1614
- EqpDynamicModuleConfiguratorComponent.prototype.deleteElement = function (element, propertyName) {
1615
- var _this = this;
1616
- EqpDynamicModuleDialogService.Confirm('Eliminare l\'elemento selezionato?', function () {
1617
- _this.form[propertyName].splice(_this.form[propertyName].indexOf(element), 1);
1618
- if (propertyName === "Fields") {
1619
- _this.setFieldOrdinalPosition();
1620
- _this.reloadFieldsTable();
1621
- }
1622
- else if (propertyName === "ActionsOnRecord") {
1623
- _this.setActionOrdinalPosition();
1624
- _this.reloadActionsOnRecordTable();
1625
- }
1626
- }, false, 'Richiesta conferma');
1627
- };
1628
- /**
1629
- * Metodo per spostare un campo all'interno della form.
1630
- * @param field Oggetto di tipo BaseField da spostare.
1631
- * @param moveUp Se TRUE allora sposta verso l'alto il campo (abbassa l'indice) altrimenti il contrario.
1632
- */
1633
- EqpDynamicModuleConfiguratorComponent.prototype.moveElement = function (element, moveUp, propertyName) {
1634
- var startingIndex = this.form[propertyName].indexOf(element);
1635
- var endingIndex = startingIndex + (moveUp ? -1 : 1);
1636
- this.form[propertyName].splice(startingIndex, 1);
1637
- this.form[propertyName].splice(endingIndex, 0, element);
1638
- if (propertyName === "Fields") {
1639
- this.setFieldOrdinalPosition();
1640
- this.reloadFieldsTable();
1641
- }
1642
- else if (propertyName === "ActionsOnRecord") {
1643
- this.setActionOrdinalPosition();
1644
- this.reloadActionsOnRecordTable();
1645
- }
1646
- };
1647
- /**
1648
- * Imposta l'ordinamento delle sezioni che compongono la form.
1649
- */
1650
- EqpDynamicModuleConfiguratorComponent.prototype.setFormFieldGroupOrdinalPosition = function () {
1651
- this.form.FormFieldsGroups.forEach(function (g, i) { return g.OrdinalPosition = i; });
1652
- };
1653
- /**
1654
- * Imposta l'ordinamento dei campi all'interno della form in base all'ordine che l'utente
1655
- * ha definito nella tabella in cui sono mostrati
1656
- */
1657
- EqpDynamicModuleConfiguratorComponent.prototype.setFieldOrdinalPosition = function () {
1658
- var _this = this;
1659
- if (this.form.Fields) {
1660
- this.form.Fields.forEach(function (field) {
1661
- field.OrdinalPosition = _this.form.Fields.indexOf(field);
1662
- });
1663
- }
1664
- };
1665
- /**
1666
- * Metodo per ricaricare i dati della tabella dei campi aggiunti in una form
1667
- */
1668
- EqpDynamicModuleConfiguratorComponent.prototype.reloadFieldsTable = function () {
1669
- if (this.fieldsTable) {
1670
- this.fieldsTable.reloadDatatable();
1671
- }
1672
- };
1673
- /**
1674
- * Imposta l'ordinamento dei campi all'interno della form in base all'ordine che l'utente
1675
- * ha definito nella tabella in cui sono mostrati
1676
- */
1677
- EqpDynamicModuleConfiguratorComponent.prototype.setActionOrdinalPosition = function () {
1678
- var _this = this;
1679
- if (this.form.ActionsOnRecord) {
1680
- this.form.ActionsOnRecord.forEach(function (action) {
1681
- action.OrdinalPosition = _this.form.ActionsOnRecord.indexOf(action);
1682
- });
1683
- }
1684
- };
1685
- /**
1686
- * Metodo per ricaricare i dati della tabella delle azioni aggiuntive sui record della Form.
1687
- */
1688
- EqpDynamicModuleConfiguratorComponent.prototype.reloadActionsOnRecordTable = function () {
1689
- if (this.actionsOnRecordTable) {
1690
- this.actionsOnRecordTable.reloadDatatable();
1691
- }
1692
- };
1693
- EqpDynamicModuleConfiguratorComponent.ctorParameters = function () { return [
1694
- { type: FormBuilder },
1695
- { type: MatDialog },
1696
- { type: UtilityHelperService }
1697
- ]; };
1698
- __decorate([
1699
- Input()
1700
- ], EqpDynamicModuleConfiguratorComponent.prototype, "context", void 0);
1701
- __decorate([
1702
- Input()
1703
- ], EqpDynamicModuleConfiguratorComponent.prototype, "form", void 0);
1704
- __decorate([
1705
- Input()
1706
- ], EqpDynamicModuleConfiguratorComponent.prototype, "formID", void 0);
1707
- __decorate([
1708
- Input()
1709
- ], EqpDynamicModuleConfiguratorComponent.prototype, "innerFormManagment", void 0);
1710
- __decorate([
1711
- Input()
1712
- ], EqpDynamicModuleConfiguratorComponent.prototype, "baseServerUrl", void 0);
1713
- __decorate([
1714
- Input()
1715
- ], EqpDynamicModuleConfiguratorComponent.prototype, "userToken", void 0);
1716
- __decorate([
1717
- Input()
1718
- ], EqpDynamicModuleConfiguratorComponent.prototype, "endPointConfiguration", void 0);
1719
- __decorate([
1720
- ViewChild('fieldsTable', { static: false })
1721
- ], EqpDynamicModuleConfiguratorComponent.prototype, "fieldsTable", void 0);
1722
- __decorate([
1723
- ViewChild('dialogField', { static: true })
1724
- ], EqpDynamicModuleConfiguratorComponent.prototype, "dialogField", void 0);
1725
- __decorate([
1726
- ViewChild('fieldSectionColumnTemplate', { static: true })
1727
- ], EqpDynamicModuleConfiguratorComponent.prototype, "fieldSectionColumnTemplate", void 0);
1728
- __decorate([
1729
- ViewChild('dialogInnerForm', { static: true })
1730
- ], EqpDynamicModuleConfiguratorComponent.prototype, "dialogInnerForm", void 0);
1731
- __decorate([
1732
- ViewChild('actionsOnRecordTable', { static: false })
1733
- ], EqpDynamicModuleConfiguratorComponent.prototype, "actionsOnRecordTable", void 0);
1734
- __decorate([
1735
- ViewChild('dialogActionOnRecord', { static: true })
1736
- ], EqpDynamicModuleConfiguratorComponent.prototype, "dialogActionOnRecord", void 0);
1737
- __decorate([
1738
- Output()
1739
- ], EqpDynamicModuleConfiguratorComponent.prototype, "saveFormEvent", void 0);
1740
- __decorate([
1741
- Output()
1742
- ], EqpDynamicModuleConfiguratorComponent.prototype, "afterSaveFormEvent", void 0);
1743
- EqpDynamicModuleConfiguratorComponent = __decorate([
1744
- Component({
1745
- selector: 'eqp-dynamic-module-configurator',
1746
- template: "<eqp-dynamic-module-spinner></eqp-dynamic-module-spinner>\r\n\r\n<mat-horizontal-stepper linear #stepper>\r\n <!-- DATI GENERALI DELLA FORM -->\r\n <mat-step [stepControl]=\"formFormGroup\">\r\n <form [formGroup]=\"formFormGroup\" (keydown.enter)=\"false\">\r\n <ng-template matStepLabel>\r\n <div class=\"stepper-header-overlay\" (click)=\"setFormStatus(false)\"></div>\r\n Dati generali della form\r\n </ng-template>\r\n\r\n <div class=\"row\">\r\n <div class=\"col-md-4\">\r\n <mat-form-field>\r\n <mat-label>Nome</mat-label>\r\n <input matInput formControlName=\"Name\" [(ngModel)]=\"form.Name\" required>\r\n </mat-form-field>\r\n </div>\r\n\r\n <div class=\"col-md-4\">\r\n <eqp-select [enumData]=\"FormScalarTypeEnum\" [(ngModelInput)]=\"form.FormScalarType\"\r\n [isRequired]=\"true\" [showCancelButton]=\"false\" placeholder=\"Tipo di visualizzazione\"\r\n [formGroupInput]=\"formFormGroup\" [formControlNameInput]=\"'FormScalarType'\"\r\n (ngModelInputChange)=\"onChangeFormScalarType()\">\r\n </eqp-select>\r\n </div>\r\n </div>\r\n <div class=\"row\" *ngIf=\"form.FormScalarType && form.FormScalarType != FormScalarTypeEnum.Semplice\">\r\n <div class=\"col-md-4 d-flex align-items-center\">\r\n <mat-form-field>\r\n <mat-label> Nome sezione (invio per confermare) </mat-label>\r\n <input matInput [(ngModel)]=\"formFieldGroupName\" [ngModelOptions]=\"{standalone: true}\"\r\n (keyup)=\"onFormFieldGroupNameKeyUp($event)\">\r\n </mat-form-field>\r\n </div>\r\n <div class=\"col-md-4 d-flex align-items-center\">\r\n <span class=\"mr-3\">Sezioni inserite:</span>\r\n <ul class=\"section-list\">\r\n <li *ngFor=\"let groupName of form.FormFieldsGroups, let i=index\">\r\n <mat-icon class=\"mr-1\" (click)=\"onDeleteFormFieldGroupName(groupName.Name)\">close\r\n </mat-icon>\r\n <span> {{i+1}}) {{groupName.Name}}</span>\r\n </li>\r\n </ul>\r\n </div>\r\n </div>\r\n\r\n <div class=\"mt-2 d-flex justify-content-end\">\r\n <button mat-raised-button color=\"primary\" matStepperNext\r\n [disabled]=\"formFormGroup.invalid\">Successivo</button>\r\n </div>\r\n </form>\r\n </mat-step>\r\n\r\n <!-- AGGIUNTA DEI CAMPI DELLA FORM -->\r\n <mat-step [completed]=\"isFieldStepCompleted()\">\r\n <ng-template matStepLabel>\r\n <div class=\"stepper-header-overlay\" (click)=\"setFormStatus(false)\"></div>\r\n Campi da inserire\r\n </ng-template>\r\n\r\n <div class=\"row justify-content-end\">\r\n <button class=\"btn btn-primary\" mat-raised-button color=\"primary\" type=\"button\" (click)=\"openFieldDialog()\">\r\n <mat-icon>add</mat-icon>\r\n <span style=\"margin-left: 10px;\">Aggiungi campo</span>\r\n </button>\r\n\r\n <button class=\"btn btn-primary ml-2\" mat-raised-button color=\"primary\" type=\"button\"\r\n (click)=\"openInnerFormDialog()\" *ngIf=\"!innerFormManagment\">\r\n <mat-icon>add</mat-icon>\r\n <span style=\"margin-left: 10px;\">Aggiungi form di dettaglio</span>\r\n </button>\r\n </div>\r\n\r\n <eqp-table #fieldsTable [createMatCard]=\"false\" [columns]=\"fieldsColumns\" [data]=\"form.Fields\"\r\n [emptyTableMessage]=\"'Nessun campo inserito'\" [searchText]=\"'Cerca'\">\r\n </eqp-table>\r\n\r\n <div class=\"mt-2 d-flex justify-content-end\">\r\n <button class=\"mr-2\" mat-raised-button matStepperPrevious>Precedente</button>\r\n <button mat-raised-button color=\"primary\" matStepperNext [disabled]=\"!isFieldStepCompleted()\"\r\n (click)=\"setFormStatus(false)\">Successivo</button>\r\n </div>\r\n </mat-step>\r\n\r\n <!-- AGGIUNTA DELLE OPERAZIONI SUI RECORD -->\r\n <mat-step>\r\n <ng-template matStepLabel>\r\n <div class=\"stepper-header-overlay\" (click)=\"setFormStatus(false)\"></div>\r\n Azioni aggiuntive sui record\r\n </ng-template>\r\n\r\n <div class=\"row justify-content-end\">\r\n <button class=\"btn btn-primary\" mat-raised-button color=\"primary\" type=\"button\"\r\n (click)=\"openActionOnRecordDialog()\">\r\n <mat-icon>add</mat-icon>\r\n <span style=\"margin-left: 10px;\">Aggiungi azione</span>\r\n </button>\r\n </div>\r\n <eqp-table #actionsOnRecordTable [createMatCard]=\"false\" [columns]=\"actionsOnRecordColumns\"\r\n [data]=\"form.ActionsOnRecord\" [emptyTableMessage]=\"'Nessuna action inserita'\" [searchText]=\"'Cerca'\">\r\n </eqp-table>\r\n\r\n <div class=\"mt-2 d-flex justify-content-end\">\r\n <button class=\"mr-2\" mat-raised-button matStepperPrevious>Precedente</button>\r\n <button mat-raised-button color=\"primary\" matStepperNext (click)=\"setFormStatus(true)\">\r\n Successivo\r\n </button>\r\n </div>\r\n </mat-step>\r\n\r\n <!-- VISUALIZZAZIONE FORM CREATA -->\r\n <mat-step>\r\n <ng-template matStepLabel>\r\n <div class=\"stepper-header-overlay\"\r\n (click)=\"setFormStatus(formFormGroup.valid && form.Fields && form.Fields.length > 0)\"></div>\r\n Anteprima\r\n </ng-template>\r\n\r\n <add-form-record *ngIf=\"previewForm && formCompleted\" [form]=\"previewForm\" [showButtons]=\"false\">\r\n </add-form-record>\r\n\r\n\r\n <div class=\"mt-2 d-flex justify-content-end\">\r\n <button class=\"mr-2\" mat-raised-button matStepperPrevious (click)=\"setFormStatus(false)\">Precedente</button>\r\n <button mat-raised-button color=\"primary\" (click)=\"saveForm()\">Salva form</button>\r\n </div>\r\n </mat-step>\r\n</mat-horizontal-stepper>\r\n\r\n<div class=\"row\" *ngIf=\"innerFormManagment\">\r\n <div class=\"col-md-12 text-right\">\r\n <button mat-raised-button (click)=\"saveFormEvent.emit(null)\">Esci</button>\r\n </div>\r\n</div>\r\n\r\n<!-- DIALOG AGGIUNTA/MODIFICA CAMPO -->\r\n<ng-template #dialogField>\r\n <eqp-dynamic-module-add-form-field [field]=\"selectedField\" [indexField]=\"indexSelectedField\"\r\n (saveFieldEvent)=\"onSaveField($event)\" [availableFields]=\"form.Fields\"\r\n [formFieldsGroups]=\"form.FormScalarType != FormScalarTypeEnum.Semplice ? form.FormFieldsGroups : null\">\r\n </eqp-dynamic-module-add-form-field>\r\n</ng-template>\r\n\r\n<!-- TEMPLATE PER VISUALIZZARE LA COLONNA DELLA SEZIONE NELLA TABELLA DEI FIELDS -->\r\n<ng-template #fieldSectionColumnTemplate let-row=\"row\">\r\n <eqp-select [arrayData]=\"form.FormFieldsGroups\" [(ngModelInput)]=\"row.FieldGroup\" [arrayKeyProperty]=\"'Name'\"\r\n [arrayValueProperty]=\"'Name'\" placeholder=\"Sezione\" [isRequired]=\"true\" [includeFullObject]=\"false\">\r\n </eqp-select>\r\n</ng-template>\r\n\r\n<!-- DIALOG PER AGGIUNGERE/MODIFICARE UNA ACTION SUI RECORD DELLA FORM -->\r\n<ng-template #dialogActionOnRecord>\r\n <div class=\"container-fluid\" style=\"max-height: 70vh !important; overflow-x: hidden; overflow-y: auto;\">\r\n <form [formGroup]=\"actionOnRecordFormGroup\">\r\n <div class=\"row\">\r\n <div class=\"header-title-standard\">{{indexSelectedAction != null && indexSelectedAction >= 0 ?\r\n \"Modifica\"\r\n : \"Aggiungi\"}} azione sul record</div>\r\n </div>\r\n <div class=\"row\">\r\n <div class=\"col-sm-12 col-md-4 mt-2\">\r\n <mat-form-field>\r\n <mat-label> Nome </mat-label>\r\n <input formControlName=\"Name\" required matInput [(ngModel)]=\"selectedAction.Name\">\r\n </mat-form-field>\r\n </div>\r\n\r\n <div class=\"col-sm-12 col-md-4 mt-2\">\r\n <mat-form-field>\r\n <mat-label> Icona </mat-label>\r\n <input formControlName=\"Icon\" required matInput [(ngModel)]=\"selectedAction.Icon\">\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n <div class=\"row\">\r\n <div class=\"col-sm-12 col-md-12 mt-2\">\r\n <mat-form-field>\r\n <textarea matInput [placeholder]=\"'Azione (Javascript)'\" [rows]=\"3\" formControlName=\"Action\"\r\n required [(ngModel)]=\"selectedAction.Action\" [matAutocomplete]=\"actionAutocomplete\"\r\n (keyup)=\"setActionAutocompleteOptions($event)\"\r\n (focus)=\"setActionAutocompleteOptions(null)\"></textarea>\r\n <mat-autocomplete #actionAutocomplete=\"matAutocomplete\">\r\n <mat-option *ngFor=\"let option of actionAutocompleteOptions\" [value]=\"option.value\">\r\n {{option.label}}\r\n </mat-option>\r\n </mat-autocomplete>\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n\r\n\r\n <div class=\"row mt-2 mb-1\">\r\n <div class=\"col-sm-12 text-right\">\r\n <button class=\"mr-2\" mat-raised-button color=\"primary\" (click)=\"saveActionOnRecord()\"\r\n [disabled]=\"actionOnRecordFormGroup.invalid\" type=\"button\">\r\n Salva\r\n </button>\r\n <button class=\"btn mat-raised-button\" (click)=\"closeDialogActionOnRecord()\" type=\"button\">\r\n Esci\r\n </button>\r\n </div>\r\n </div>\r\n </form>\r\n </div>\r\n</ng-template>\r\n\r\n<!-- TEMPLATE PER CONFIGURARE LE FORM DI DETTAGLIO -->\r\n<ng-template #dialogInnerForm>\r\n <eqp-dynamic-module-configurator [form]=\"selectedInnerForm\" [innerFormManagment]=\"true\"\r\n (saveFormEvent)=\"onSaveOrExitInnerForm($event)\"></eqp-dynamic-module-configurator>\r\n</ng-template>",
1747
- 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)}"]
1748
- })
1749
- ], EqpDynamicModuleConfiguratorComponent);
1750
- return EqpDynamicModuleConfiguratorComponent;
1751
- }());
1752
-
1753
- var AttachmentField = /** @class */ (function (_super) {
1754
- __extends(AttachmentField, _super);
1755
- function AttachmentField() {
1756
- return _super !== null && _super.apply(this, arguments) || this;
1757
- }
1758
- return AttachmentField;
1759
- }(BaseField));
1760
- var AvailableFileExtensions = [
1761
- { value: '.pdf', key: 'application/pdf' },
1762
- { value: '.doc', key: 'application/msword' },
1763
- { value: '.xls', key: 'application/vnd.ms-excel' },
1764
- { value: '.ppt', key: 'application/vnd.ms-powerpoint' },
1765
- { value: '.docx', key: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' },
1766
- { value: '.xlsx', key: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' },
1767
- { value: '.pptx', key: 'application/vnd.openxmlformats-officedocument.presentationml.presentation' },
1768
- { value: '.csv', key: 'text/csv' },
1769
- { value: '.txt', key: 'text/plain' },
1770
- ];
1771
- var AvailableImageExtensions = [
1772
- { value: '.jpg/.jpeg', key: 'image/jpeg' },
1773
- { value: '.png', key: 'image/png' },
1774
- { value: '.bmp', key: 'image/bmp' },
1775
- { value: '.svg', key: 'image/svg+xml' },
1776
- { value: '.ico', key: 'image/x-icon' },
1777
- ];
1778
-
1779
- var BooleanField = /** @class */ (function (_super) {
1780
- __extends(BooleanField, _super);
1781
- function BooleanField() {
1782
- return _super !== null && _super.apply(this, arguments) || this;
1783
- }
1784
- return BooleanField;
1785
- }(BaseField));
1786
- var BoolPresentantioEnum;
1787
- (function (BoolPresentantioEnum) {
1788
- BoolPresentantioEnum[BoolPresentantioEnum["Checkbox"] = 1] = "Checkbox";
1789
- BoolPresentantioEnum[BoolPresentantioEnum["Toggle"] = 2] = "Toggle";
1790
- BoolPresentantioEnum[BoolPresentantioEnum["Radio button"] = 3] = "Radio button";
1791
- // "Stringa true o false" = 3,
1792
- // "Numerico 0 o 1" = 4
1793
- })(BoolPresentantioEnum || (BoolPresentantioEnum = {}));
1794
-
1795
- /**Rappresenta la configurazione di un campo Data o Data e ora, o solo ora */
1796
- var DateField = /** @class */ (function (_super) {
1797
- __extends(DateField, _super);
1798
- function DateField() {
1799
- return _super !== null && _super.apply(this, arguments) || this;
1800
- }
1801
- return DateField;
1802
- }(BaseField));
1803
- var DateTimeTypeEnum;
1804
- (function (DateTimeTypeEnum) {
1805
- DateTimeTypeEnum[DateTimeTypeEnum["Solo data"] = 1] = "Solo data";
1806
- DateTimeTypeEnum[DateTimeTypeEnum["Solo orario"] = 2] = "Solo orario";
1807
- DateTimeTypeEnum[DateTimeTypeEnum["Data e ora"] = 3] = "Data e ora";
1808
- })(DateTimeTypeEnum || (DateTimeTypeEnum = {}));
1809
-
1810
- /**Lista di valori */
1811
- var ListValueField = /** @class */ (function (_super) {
1812
- __extends(ListValueField, _super);
1813
- function ListValueField() {
1814
- return _super !== null && _super.apply(this, arguments) || this;
1815
- }
1816
- return ListValueField;
1817
- }(BaseField));
1818
- var ButtonImage = /** @class */ (function () {
1819
- function ButtonImage() {
1820
- }
1821
- return ButtonImage;
1822
- }());
1823
- var ListPresentationEnum;
1824
- (function (ListPresentationEnum) {
1825
- ListPresentationEnum[ListPresentationEnum["Combo box"] = 1] = "Combo box";
1826
- ListPresentationEnum[ListPresentationEnum["Radio button"] = 2] = "Radio button";
1827
- ListPresentationEnum[ListPresentationEnum["Pulsante con testo"] = 3] = "Pulsante con testo";
1828
- ListPresentationEnum[ListPresentationEnum["Immagini"] = 4] = "Immagini";
1829
- })(ListPresentationEnum || (ListPresentationEnum = {}));
1830
-
1831
- var AddFormFieldComponent = /** @class */ (function () {
1832
- //#endregion
1833
- function AddFormFieldComponent(formBuilder, enumHelper, dialog, cdr) {
1834
- this.formBuilder = formBuilder;
1835
- this.enumHelper = enumHelper;
1836
- this.dialog = dialog;
1837
- this.cdr = cdr;
1838
- this.fieldTypesToExclude = [FieldTypeEnum['Form di dettaglio']];
1839
- this.keyValueObject = { key: '', value: '' };
1840
- this.availableColSpanSizes = [];
1841
- this.AvailableFileExtensions = AvailableFileExtensions;
1842
- this.AvailableImageExtensions = AvailableImageExtensions;
1843
- this.saveFieldEvent = new EventEmitter();
1844
- //#endregion
1845
- //#region Enumeratori usati nell'html
1846
- this.FieldTypeEnum = FieldTypeEnum;
1847
- this.BoolPresentantioEnum = BoolPresentantioEnum;
1848
- this.DateTimeTypeEnum = DateTimeTypeEnum;
1849
- this.ListPresentationEnum = ListPresentationEnum;
1850
- this.TextMaskEnum = TextMaskEnum;
1851
- this.AttachmentType = AttachmentType;
1852
- }
1853
- AddFormFieldComponent.prototype.ngOnInit = function () {
1854
- var _this = this;
1855
- if (!this.fieldTypesToExclude.includes(FieldTypeEnum['Form di dettaglio'])) {
1856
- this.fieldTypesToExclude.push(FieldTypeEnum['Form di dettaglio']);
1857
- }
1858
- this.onFieldTypeChange(false);
1859
- this.availableFields = this.availableFields ? this.availableFields.filter(function (f) { return f != _this.field; }) : [];
1860
- this.configureColumns();
1861
- };
1862
- /**
1863
- * Metodo per impostare i valori da suggerire nell'autocomplete del campo Formula.
1864
- * Viene scatenato al focus (in questo caso viene passato il parametro a null per differenziarlo
1865
- * dall'evento di click sulla tastiera) e al keyup sull'input (il parametro è diverso da null).
1866
- * @param keyboardEvent Evento scatenato al keyup sulla tastiera. Se null allora il metodo è stato invocato dal focus sull'input.
1867
- * @summary Aggiorna l'elenco dei suggerimenti per l'autocomplete se l'utente esegue il focus sull'input
1868
- * oppure al keyup sulla tastiera di un tasto diverso dalle frecce.
1869
- */
1870
- AddFormFieldComponent.prototype.setFormulaAutocompleteOptions = function (keyboardEvent) {
1871
- // Creo l'array per l'autocomplete solo se sto facendo il focus sull'input o se sto premendo un tasto
1872
- // sulla tastiera diverso dalle frecce (in quest'ultimo caso, se non viene eseguito il filtro sull'evento,
1873
- // non si può selezionare un suggerimento dell'autocomplete perchè al click verrebbe ricaricato l'array e
1874
- // si prederebbe la selezione appena fatta).
1875
- if (!keyboardEvent || !keyboardEvent.code.includes("Arrow")) {
1876
- this.formulaAutocompleteOptions = UtilityHelperService.GetAutocompleteOptions(this.availableFields, this.field.Formula);
1877
- }
1878
- };
1879
- /**
1880
- * Crea il FormGroup per l'aggiunta di un nuovo campo all'interno della form.
1881
- * Metodo richiamato ogni volta che cambia il tipo del campo scelto o viene aggiunto/modificato un Field
1882
- */
1883
- AddFormFieldComponent.prototype.createFieldForm = function () {
1884
- this.fieldFormGroup = this.formBuilder.group({
1885
- Label: [this.field.Label, Validators.required],
1886
- Description: [this.field.Description],
1887
- Required: [this.field.Required],
1888
- FieldType: [this.field.FieldType, Validators.required],
1889
- Formula: [this.field.Formula],
1890
- ColSpanSizes: [this.field.ColSpanSizes],
1891
- InListView: [this.field.InListView],
1892
- });
1893
- if (this.formFieldsGroups) {
1894
- this.fieldFormGroup.addControl('FieldGroup', new FormControl(this.field.FieldGroup, Validators.required));
1895
- }
1896
- };
1897
- /**
1898
- * Metodo chiamato quando cambia il FieldType del BaseField che si sta aggiungendo/modificando.
1899
- * Ricrea l'oggetto field popolando solo le proprietà del BaseField inserite dall'utente
1900
- * (quelle comuni a tutte le tipologie di campo), ricrea la form e, in base al FieldType scelto,
1901
- * aggiunge alla form i FormControl necessari e seleziona il template corretto da usare.
1902
- * @param restoreField Se TRUE ripristina i valori base (ereditati dal modello BaseField) del campo aggiunto/modificato
1903
- */
1904
- AddFormFieldComponent.prototype.onFieldTypeChange = function (restoreField) {
1905
- if (restoreField === void 0) { restoreField = true; }
1906
- if (restoreField)
1907
- this.restoreBaseFieldProperties();
1908
- this.createFieldForm();
1909
- this.onColSpanSizeSelect();
1910
- this.fieldTypeFormTemplate = null;
1911
- switch (this.field.FieldType) {
1912
- case FieldTypeEnum['Campo di testo']:
1913
- this.fieldFormGroup.addControl('TextMask', new FormControl(this.field.TextMask));
1914
- this.fieldFormGroup.addControl('MaxLenght', new FormControl(this.field.MaxLenght));
1915
- this.fieldFormGroup.addControl('MinLenght', new FormControl(this.field.MinLenght));
1916
- this.fieldTypeFormTemplate = this.textFieldFormTemplate;
1917
- break;
1918
- case FieldTypeEnum['Area di testo']:
1919
- this.fieldFormGroup.addControl('Rows', new FormControl(this.field.Rows));
1920
- this.fieldFormGroup.addControl('MaxLenght', new FormControl(this.field.MaxLenght));
1921
- this.fieldFormGroup.addControl('MinLenght', new FormControl(this.field.MinLenght));
1922
- this.fieldTypeFormTemplate = this.textareaFieldFormTemplate;
1923
- break;
1924
- case FieldTypeEnum.Booleano:
1925
- this.fieldFormGroup.addControl('IsTristate', new FormControl(this.field.IsTristate));
1926
- this.fieldFormGroup.addControl('PresetationType', new FormControl(this.field.PresetationType, Validators.required));
1927
- this.fieldTypeFormTemplate = this.booleadFieldFormTemplate;
1928
- break;
1929
- case FieldTypeEnum['Data e/o ora']:
1930
- this.fieldFormGroup.addControl('IsOnlyDate', new FormControl(this.field.IsOnlyDate, Validators.required));
1931
- this.fieldFormGroup.addControl('MinDate', new FormControl(this.field.MinDate));
1932
- this.fieldFormGroup.addControl('MaxDate', new FormControl(this.field.MaxDate));
1933
- this.fieldFormGroup.addControl('DateFormat', new FormControl(this.field.DateFormat));
1934
- this.fieldTypeFormTemplate = this.dateFieldFormTemplate;
1935
- break;
1936
- case FieldTypeEnum['Campo numerico']:
1937
- this.fieldFormGroup.addControl('IsInteger', new FormControl(this.field.IsInteger));
1938
- this.fieldFormGroup.addControl('MinValue', new FormControl(this.field.MinValue));
1939
- this.fieldFormGroup.addControl('MaxValue', new FormControl(this.field.MaxValue));
1940
- this.fieldFormGroup.addControl('DecimalSeparator', new FormControl(this.field.DecimalSeparator));
1941
- this.fieldFormGroup.addControl('DecimalPrecision', new FormControl(this.field.DecimalPrecision));
1942
- this.fieldFormGroup.addControl('ThousandsSeparator', new FormControl(this.field.ThousandsSeparator));
1943
- this.fieldFormGroup.addControl('CurrencySymbol', new FormControl(this.field.CurrencySymbol));
1944
- this.fieldTypeFormTemplate = this.numericFieldFormTemplate;
1945
- break;
1946
- case FieldTypeEnum.Allegato:
1947
- this.fieldFormGroup.addControl("AllowedExtensions", new FormControl(this.field.AllowedExtensions));
1948
- this.fieldFormGroup.addControl('IsMultiAttach', new FormControl(this.field.IsMultiAttach));
1949
- this.fieldTypeFormTemplate = this.attachmentFieldFormTemplate;
1950
- break;
1951
- case FieldTypeEnum.Immagine:
1952
- this.field.AttachDefinition = new AttachmentField();
1953
- this.fieldFormGroup.addControl('EnableDrawing', new FormControl(this.field.EnableDrawing));
1954
- this.fieldFormGroup.addControl('ImageIsContextualAttachment', new FormControl(this.field.ImageIsContextualAttachment));
1955
- // Imposto i FormControl variabili.
1956
- this.onImageIsContextualAttachmentChange();
1957
- this.fieldTypeFormTemplate = this.imageFieldFormTemplate;
1958
- break;
1959
- case FieldTypeEnum['Elenco generico']:
1960
- this.fieldFormGroup.addControl('IsMultiChoiche', new FormControl(this.field.IsMultiChoiche));
1961
- this.fieldFormGroup.addControl('PresentationMode', new FormControl(this.field.PresentationMode, Validators.required));
1962
- this.fieldTypeFormTemplate = this.listValueFieldFormTemplate;
1963
- break;
1964
- case FieldTypeEnum.Lookup:
1965
- this.fieldFormGroup.addControl('EntitySourceName', new FormControl(this.field.EntitySourceName, Validators.required));
1966
- this.fieldFormGroup.addControl('UseAsGetOrDiscard', new FormControl(this.field.UseAsGetOrDiscard));
1967
- this.fieldTypeFormTemplate = this.lookupFieldFormTemplate;
1968
- break;
1969
- }
1970
- if ([FieldTypeEnum.Allegato, FieldTypeEnum.Immagine, FieldTypeEnum['Form di dettaglio']].includes(this.field.FieldType)) {
1971
- this.field.Formula = null;
1972
- this.fieldFormGroup.controls["Formula"].disable();
1973
- this.fieldFormGroup.controls["InListView"].disable();
1974
- }
1975
- else {
1976
- this.fieldFormGroup.controls["Formula"].enable();
1977
- this.fieldFormGroup.controls["InListView"].enable();
1978
- }
1979
- };
1980
- /**
1981
- * Metodo invocato al cambio del valore della proprietà ImageIsContextualAttachment nel caso
1982
- * di campi di tipo Immagine. Se TRUE allora rimuove i FormControl per le proprietà IsMultiAttach
1983
- * e AllowedExtensions e aggiunge i FormControl per le proprietà ImgName e ContextualAttachment,
1984
- * altrimenti il contrario.
1985
- */
1986
- AddFormFieldComponent.prototype.onImageIsContextualAttachmentChange = function () {
1987
- this.field.ImgName = null;
1988
- this.field.AttachDefinition.AllowedExtensions = [];
1989
- this.field.AttachDefinition.IsMultiAttach = false;
1990
- this.field.ContextualAttachment = null;
1991
- if (this.field.ImageIsContextualAttachment) {
1992
- this.fieldFormGroup.removeControl("IsMultiAttach");
1993
- this.fieldFormGroup.removeControl("AllowedExtensions");
1994
- this.fieldFormGroup.addControl('ImgName', new FormControl(this.field.ImgName, Validators.required));
1995
- this.fieldFormGroup.addControl('ContextualAttachment', new FormControl(this.field.ContextualAttachment, Validators.required));
1996
- }
1997
- else {
1998
- this.fieldFormGroup.removeControl("ImgName");
1999
- this.fieldFormGroup.removeControl("ContextualAttachment");
2000
- this.fieldFormGroup.addControl('IsMultiAttach', new FormControl(this.field.AttachDefinition.IsMultiAttach));
2001
- this.fieldFormGroup.addControl("AllowedExtensions", new FormControl(this.field.AttachDefinition.AllowedExtensions));
2002
- }
2003
- };
2004
- /**
2005
- * Metodo per intercettare l'aggiunta di un allegato nei campi di tipo Immagine per aggiornare
2006
- * il valore della proprietà ContextualAttachment e la validazione del relativo FormControl.
2007
- * @param event Array contenente l'elenco aggiornato degli allegati caricati (nel nostro caso ne contiene al più 1).
2008
- */
2009
- AddFormFieldComponent.prototype.catchContextualAttachmentChange = function (event) {
2010
- if (event && event.length > 0) {
2011
- this.field.ContextualAttachment = event[0];
2012
- }
2013
- else {
2014
- this.field.ContextualAttachment = null;
2015
- }
2016
- this.fieldFormGroup.controls['ContextualAttachment'].setValue(this.field.ContextualAttachment);
2017
- };
2018
- /**
2019
- * Metodo invocato alla selezione di una classe nella select per le colonne di bootstrap
2020
- * da usare nella visualizzazione del campo. Questa funzione manipola la sorgente dati per
2021
- * la eqp-select in modo da escludere i valori dell'enumeratore che fanno riferimento ad
2022
- * una larghezza di schermo già selezionata. Esempio: per gli schermi piccoli (sm) l'utente
2023
- * seleziona la classe "col-sm-6", al change del valore questo metodo rimuove dalla select
2024
- * tutti gli altri valori per la grandezza di schermo selezionata.
2025
- */
2026
- AddFormFieldComponent.prototype.onColSpanSizeSelect = function () {
2027
- // Recupero l'array degli oggetti chiave-valore che rappreseta l'enumeratore
2028
- var colSizeClassEnumArray = this.enumHelper.getEnumArray(ColSpanSizesEnum, false, null);
2029
- // Costruisco l'array delle classi selezionate dall'utente in formato stringa
2030
- var selectedDimensions = this.field.ColSpanSizes ? this.field.ColSpanSizes.map(function (col) { return ColSpanSizesEnum[col]; }) : [];
2031
- // Filtro i valori ottenuti dall'enumeratore per escludere tutti i valori per le
2032
- // grandezze di schermo già selezionatead esclusione dei valori selezionati.
2033
- this.availableColSpanSizes = colSizeClassEnumArray.filter(function (value) {
2034
- return !selectedDimensions.find(function (col) { return value.value.includes(col.substring(4, 6)) && value.value != col; });
2035
- });
2036
- };
2037
- /**
2038
- * Metodo invocato al cambio del tipo di visualizzazione scelta per i campi di tipo elenco generico.
2039
- * Se viene scelta la visualizzazione ad immagini svuota la lista delle coppie chiave-valore inserite
2040
- * in precedenza, altrimenti svuota la lista delle immagini caricate.
2041
- */
2042
- AddFormFieldComponent.prototype.onPresentationModeChange = function () {
2043
- if (this.field.PresentationMode === ListPresentationEnum.Immagini) {
2044
- this.field.ValuePairs = null;
2045
- }
2046
- else {
2047
- this.field.ButtonImageList = null;
2048
- }
2049
- };
2050
- /**
2051
- * Metodo invocato quando viene caricato il componente eqp-attachments per caricare le immagini da usare
2052
- * nella visualizzazione ad immagini dei campi di tipo "Elenco generico". Aggiunge due colonne a quelle
2053
- * configurate nel componente in cui l'utente può indicare chiave e valore della scelta.
2054
- * @param component Istanza del componente eqp-attachments in cui effettuare la modifica.
2055
- */
2056
- AddFormFieldComponent.prototype.configureButtonImagesColumns = function (component) {
2057
- component.attachmentsColumns.splice(component.attachmentsColumns.length - 1, 0, { key: "ButtonKey", display: "Label", type: TypeColumn.ExternalTemplate, externalTemplate: this.buttonImagesKeyValueInputColumn });
2058
- component.attachmentsColumns.splice(component.attachmentsColumns.length - 1, 0, { key: "ButtonValue", display: "Valore", type: TypeColumn.ExternalTemplate, externalTemplate: this.buttonImagesKeyValueInputColumn });
2059
- this.cdr.detectChanges();
2060
- };
2061
- /**
2062
- * Metodo invocato al salvataggio degli allegati quando viene configurato un campo di tipo "Elenco generico"
2063
- * con il tipo di visualizzazione ad immagini. Intercetta l'elenco aggiornato delle immagini caricate e lo
2064
- * memorizza nell'oggetto field corrente.
2065
- * @param attachments Array aggiornato degli allegati caricati.
2066
- */
2067
- AddFormFieldComponent.prototype.catchButtonImagesChange = function (attachments) {
2068
- this.field.ButtonImageList = attachments;
2069
- };
2070
- /**
2071
- * Metodo chiamato al keyup degli input testuali che prevedono l'aggiunta del valore inserito in un array.
2072
- * Se l'utente preme il tasto invio, in base al tipo di campo che sta inserendo/modificando, questo metodo
2073
- * aggiunge il valore inserito dall'utente nella lista di stringhe corretta (in input viene passato il nome
2074
- * della proprietà in cui inserire la stringa).
2075
- * @param event Evento che rappresenta il keyup dell'utente
2076
- * @param propertyName Nome della proprietà del field in cui inserire la stringa digitata.
2077
- */
2078
- AddFormFieldComponent.prototype.onMultiSelectInputKeyup = function (event, propertyName) {
2079
- if (event.code === 'Enter' || event.code === 'NumpadEnter') {
2080
- switch (this.field.FieldType) {
2081
- case FieldTypeEnum.Lookup:
2082
- case FieldTypeEnum.Allegato:
2083
- if (!this.field[propertyName]) {
2084
- this.field[propertyName] = new Array();
2085
- }
2086
- this.field[propertyName].push(event.currentTarget.value);
2087
- break;
2088
- case FieldTypeEnum.Immagine:
2089
- if (!this.field.AttachDefinition[propertyName]) {
2090
- this.field.AttachDefinition[propertyName] = new Array();
2091
- }
2092
- this.field.AttachDefinition[propertyName].push(event.currentTarget.value);
2093
- break;
2094
- case FieldTypeEnum['Elenco generico']:
2095
- if (!this.keyValueObject.key || !this.keyValueObject.value) {
2096
- return;
2097
- }
2098
- if (!this.field.ValuePairs) {
2099
- this.field.ValuePairs = {};
2100
- }
2101
- this.field.ValuePairs[this.keyValueObject.key] = this.keyValueObject.value;
2102
- this.keyValueObject = { key: '', value: '' };
2103
- break;
2104
- }
2105
- event.currentTarget.value = null;
2106
- }
2107
- };
2108
- /**
2109
- * Metodo chiamato per mostrare come elenco le opzioni aggiunte in un campo di tipo "Elenco generico".
2110
- * @returns Restituisce un array di oggetti del tipo { key: string, value: string } con i valori inseriti dall'utente.
2111
- */
2112
- AddFormFieldComponent.prototype.getDictionaryKeyValue = function () {
2113
- var _this = this;
2114
- if (this.field.ValuePairs) {
2115
- return Object.keys(this.field.ValuePairs).map(function (k) {
2116
- return {
2117
- key: k,
2118
- value: _this.field.ValuePairs[k]
2119
- };
2120
- });
2121
- }
2122
- else {
2123
- return [];
2124
- }
2125
- };
2126
- /**
2127
- * Metodo per rimuovere una opzione aggiunta al campo di tipo "Elenco generico"
2128
- * @param key Nome della chiave da rimuovere
2129
- */
2130
- AddFormFieldComponent.prototype.deleteKeyFromDictionary = function (key) {
2131
- delete this.field.ValuePairs[key];
2132
- };
2133
- /**
2134
- * Metodo per aprire il dialog per aggiungere/modificare un metadata in un campo di tipo Allegato o Immagine.
2135
- * @param metadata Metadata da modificare, se null allora ne sto creando uno nuovo.
2136
- */
2137
- AddFormFieldComponent.prototype.openMetadataDialog = function (field) {
2138
- if (field === void 0) { field = null; }
2139
- if (field) {
2140
- if (this.field.FieldType === FieldTypeEnum.Allegato) {
2141
- this.indexSelectedMetadata = this.field.MetadataFields.indexOf(field);
2142
- this.selectedMetadata = JSON.parse(JSON.stringify(field));
2143
- }
2144
- else if (this.field.FieldType === FieldTypeEnum.Immagine) {
2145
- this.indexSelectedMetadata = this.field.AttachDefinition.MetadataFields.indexOf(field);
2146
- this.selectedMetadata = JSON.parse(JSON.stringify(field));
2147
- }
2148
- }
2149
- else {
2150
- this.selectedMetadata = new BaseField();
2151
- this.indexSelectedMetadata = null;
2152
- }
2153
- this.dialogMetadataRef = this.dialog.open(this.dialogMetadata, {
2154
- disableClose: true,
2155
- hasBackdrop: true,
2156
- width: '75%'
2157
- });
2158
- };
2159
- /**
2160
- * Metodo invocato dall'output dal dialog per aggiungere/modificare un metadata
2161
- * nei campi di tipo Allegato o Immagine. Prima di aggiungere il metadata nell'elenco
2162
- * contolla se esiste un altro metadata con lo stesso nome e nel caso genera un errore
2163
- * (i metadata, come per i campi della form, devono avere un nome univoco).
2164
- * @param metadata Metadata aggiunto o modificato, se null allora il dialog è stato chiuso senza fare modifiche.
2165
- */
2166
- AddFormFieldComponent.prototype.onSaveMetadata = function (metadata) {
2167
- var _this = this;
2168
- if (metadata) {
2169
- if ((this.field.FieldType === FieldTypeEnum.Allegato
2170
- && this.field.MetadataFields
2171
- && this.field.MetadataFields.find(function (m, i) { return m.Label === metadata.Label
2172
- && (_this.indexSelectedMetadata == null ? true : _this.indexSelectedMetadata !== i); })) ||
2173
- (this.field.FieldType === FieldTypeEnum.Immagine
2174
- && this.field.AttachDefinition.MetadataFields
2175
- && this.field.AttachDefinition.MetadataFields.find(function (m, i) { return m.Label === metadata.Label
2176
- && (_this.indexSelectedMetadata == null ? true : _this.indexSelectedMetadata !== i); }))) {
2177
- EqpDynamicModuleDialogService.Warning('Impossibile inserire due metadata con la stessa label.');
2178
- throw new Error('Impossibile inserire due metadata con la stessa label.');
2179
- }
2180
- if (this.indexSelectedMetadata != null && this.indexSelectedMetadata >= 0) {
2181
- if (this.field.FieldType === FieldTypeEnum.Allegato) {
2182
- this.field.MetadataFields[this.indexSelectedMetadata] = metadata;
2183
- }
2184
- else if (this.field.FieldType === FieldTypeEnum.Immagine) {
2185
- this.field.AttachDefinition.MetadataFields[this.indexSelectedMetadata] = metadata;
2186
- }
2187
- }
2188
- else {
2189
- if (this.field.FieldType === FieldTypeEnum.Allegato) {
2190
- if (!this.field.MetadataFields) {
2191
- this.field.MetadataFields = new Array();
2192
- }
2193
- this.field.MetadataFields.push(metadata);
2194
- }
2195
- else if (this.field.FieldType === FieldTypeEnum.Immagine) {
2196
- if (!this.field.AttachDefinition.MetadataFields) {
2197
- this.field.AttachDefinition.MetadataFields = new Array();
2198
- }
2199
- this.field.AttachDefinition.MetadataFields.push(metadata);
2200
- }
2201
- }
2202
- }
2203
- this.dialogMetadataRef.close();
2204
- this.setMetadataOrdinalPosition();
2205
- this.reloadMetadataTable();
2206
- };
2207
- /**
2208
- * Metodo per disabilitare il pulsante per salvare il campo inserito/modificato.
2209
- * @returns Restituisce un booleano, se true il salvataggio viene disabilitato.
2210
- */
2211
- AddFormFieldComponent.prototype.disableSaveField = function () {
2212
- if (this.fieldFormGroup.invalid) {
2213
- return true;
2214
- }
2215
- switch (this.field.FieldType) {
2216
- case FieldTypeEnum['Elenco generico']:
2217
- if (this.field.PresentationMode != ListPresentationEnum.Immagini) {
2218
- return !this.field.ValuePairs || this.field.ValuePairs.length === 0;
2219
- }
2220
- else {
2221
- return (!this.field.ButtonImageList
2222
- || this.field.ButtonImageList.length === 0
2223
- || !!this.field.ButtonImageList.find(function (i) { return !i.ButtonKey || !i.ButtonValue; }));
2224
- }
2225
- case FieldTypeEnum.Lookup:
2226
- return !this.field.FieldNames || this.field.FieldNames.length === 0;
2227
- default:
2228
- return false;
2229
- }
2230
- };
2231
- /**
2232
- * Metodo per salvare il campo inserito/modificato.
2233
- * Se è stato inserito un field con la stessa label viene generato un errore (le label devono essere univoche).
2234
- * Una volta aggiunto/aggiornato il campo nell'elenco dei Field della Form chiude il dialog e ricarica la tabella
2235
- * che mostra l'elenco dei campi aggiunti alla form.
2236
- */
2237
- AddFormFieldComponent.prototype.saveAndExitAddField = function (save) {
2238
- if (save) {
2239
- this.saveFieldEvent.emit(this.field);
2240
- }
2241
- else {
2242
- this.saveFieldEvent.emit(null);
2243
- }
2244
- };
2245
- /**
2246
- * Metodo per ripristinare l'oggetto field al cambio del tipo selezionato.
2247
- * Lascia valorizzate solo le proprietà dell'oggetto BaseField comune a tutti i tipi di campo.
2248
- */
2249
- AddFormFieldComponent.prototype.restoreBaseFieldProperties = function () {
2250
- if (this.field) {
2251
- var tmpBaseField = JSON.parse(JSON.stringify(this.field));
2252
- this.field = new BaseField();
2253
- this.field.Label = tmpBaseField.Label;
2254
- this.field.Description = tmpBaseField.Description;
2255
- this.field.Required = tmpBaseField.Required;
2256
- this.field.FieldType = tmpBaseField.FieldType;
2257
- this.field.Formula = tmpBaseField.Formula;
2258
- this.field.ColSpanSizes = tmpBaseField.ColSpanSizes;
2259
- this.field.FieldGroup = tmpBaseField.FieldGroup;
2260
- }
2261
- };
2262
- AddFormFieldComponent.prototype.configureColumns = function () {
2263
- var _this = this;
2264
- this.metadataColumns = [
2265
- {
2266
- key: 'action', display: '', type: TypeColumn.MenuAction, buttonMenuIcon: 'more_vert', styles: { flex: '0 0 6%' },
2267
- actions: [
2268
- { name: 'Modifica', icon: 'edit', fn: function (element, index, col) { return _this.openMetadataDialog(element); } },
2269
- { name: 'Elimina', icon: 'delete', fn: function (element, index, col) { return _this.deleteMetadata(element); } },
2270
- ]
2271
- },
2272
- { key: 'FieldType', display: 'Tipologia', type: TypeColumn.Enum, enumModel: FieldTypeEnum },
2273
- { key: 'Label', display: 'Label' },
2274
- { key: 'Description', display: 'Descrizione' },
2275
- {
2276
- key: 'Required', display: 'Obbligatorio',
2277
- value: function (element) { return !!element.Required; },
2278
- type: TypeColumn.Boolean,
2279
- booleanValues: {
2280
- true: '<i class="fa fa-check success-color"></i>',
2281
- false: '<i class="fa fa-close error-color"></i>'
2282
- },
2283
- styles: { flex: '0 0 7%', cellAlignment: CellAlignmentEnum.CENTER }
2284
- },
2285
- ];
2286
- };
2287
- /**
2288
- * Metodo per eliminare un metadata aggiunto per un campo di tipo Allegato o Immagine.
2289
- * @param metadata Metadata da eliminare.
2290
- */
2291
- AddFormFieldComponent.prototype.deleteMetadata = function (metadata) {
2292
- var _this = this;
2293
- EqpDynamicModuleDialogService.Confirm('Eliminare il metadata selezionato?', function () {
2294
- if (_this.field.FieldType === FieldTypeEnum.Allegato) {
2295
- _this.field.MetadataFields.splice(_this.field.MetadataFields.indexOf(metadata), 1);
2296
- }
2297
- else if (_this.field.FieldType === FieldTypeEnum.Immagine) {
2298
- _this.field.AttachDefinition.MetadataFields.splice(_this.field.AttachDefinition.MetadataFields.indexOf(metadata), 1);
2299
- }
2300
- _this.setMetadataOrdinalPosition();
2301
- _this.reloadMetadataTable();
2302
- }, false, 'Richiesta conferma');
2303
- };
2304
- /**
2305
- * Imposta l'ordinamento dei metadata all'interno dei campi di tipo Allegato e Immagine.
2306
- */
2307
- AddFormFieldComponent.prototype.setMetadataOrdinalPosition = function () {
2308
- var _this = this;
2309
- if (this.field.FieldType === FieldTypeEnum.Allegato) {
2310
- if (this.field.MetadataFields) {
2311
- this.field.MetadataFields.forEach(function (metadata) {
2312
- metadata.OrdinalPosition = _this.field.MetadataFields.indexOf(metadata);
2313
- });
2314
- }
2315
- }
2316
- else if (this.field.FieldType === FieldTypeEnum.Immagine) {
2317
- if (this.field.AttachDefinition.MetadataFields) {
2318
- this.field.AttachDefinition.MetadataFields.forEach(function (metadata) {
2319
- metadata.OrdinalPosition = _this.field.AttachDefinition.MetadataFields.indexOf(metadata);
2320
- });
2321
- }
2322
- }
2323
- };
2324
- /**
2325
- * Metodo per ricaricare i dati della tabella dei metadata visualizzata nella creazione/modifica
2326
- * dei campi di tipo Allegato o Immagine.
2327
- */
2328
- AddFormFieldComponent.prototype.reloadMetadataTable = function () {
2329
- if (this.metadataFieldsTable) {
2330
- this.metadataFieldsTable.reloadDatatable();
2331
- }
2332
- };
2333
- AddFormFieldComponent.ctorParameters = function () { return [
2334
- { type: FormBuilder },
2335
- { type: EnumHelper },
2336
- { type: MatDialog },
2337
- { type: ChangeDetectorRef }
2338
- ]; };
2339
- __decorate([
2340
- Input()
2341
- ], AddFormFieldComponent.prototype, "field", void 0);
2342
- __decorate([
2343
- Input()
2344
- ], AddFormFieldComponent.prototype, "indexField", void 0);
2345
- __decorate([
2346
- Input()
2347
- ], AddFormFieldComponent.prototype, "formFieldsGroups", void 0);
2348
- __decorate([
2349
- Input()
2350
- ], AddFormFieldComponent.prototype, "availableFields", void 0);
2351
- __decorate([
2352
- Input()
2353
- ], AddFormFieldComponent.prototype, "fieldTypesToExclude", void 0);
2354
- __decorate([
2355
- Output()
2356
- ], AddFormFieldComponent.prototype, "saveFieldEvent", void 0);
2357
- __decorate([
2358
- ViewChild('textFieldFormTemplate', { static: true })
2359
- ], AddFormFieldComponent.prototype, "textFieldFormTemplate", void 0);
2360
- __decorate([
2361
- ViewChild('textareaFieldFormTemplate', { static: true })
2362
- ], AddFormFieldComponent.prototype, "textareaFieldFormTemplate", void 0);
2363
- __decorate([
2364
- ViewChild('booleadFieldFormTemplate', { static: true })
2365
- ], AddFormFieldComponent.prototype, "booleadFieldFormTemplate", void 0);
2366
- __decorate([
2367
- ViewChild('dateFieldFormTemplate', { static: true })
2368
- ], AddFormFieldComponent.prototype, "dateFieldFormTemplate", void 0);
2369
- __decorate([
2370
- ViewChild('numericFieldFormTemplate', { static: true })
2371
- ], AddFormFieldComponent.prototype, "numericFieldFormTemplate", void 0);
2372
- __decorate([
2373
- ViewChild('attachmentFieldFormTemplate', { static: true })
2374
- ], AddFormFieldComponent.prototype, "attachmentFieldFormTemplate", void 0);
2375
- __decorate([
2376
- ViewChild('imageFieldFormTemplate', { static: true })
2377
- ], AddFormFieldComponent.prototype, "imageFieldFormTemplate", void 0);
2378
- __decorate([
2379
- ViewChild('listValueFieldFormTemplate', { static: true })
2380
- ], AddFormFieldComponent.prototype, "listValueFieldFormTemplate", void 0);
2381
- __decorate([
2382
- ViewChild('lookupFieldFormTemplate', { static: true })
2383
- ], AddFormFieldComponent.prototype, "lookupFieldFormTemplate", void 0);
2384
- __decorate([
2385
- ViewChild('metadataFieldsTable', { static: false })
2386
- ], AddFormFieldComponent.prototype, "metadataFieldsTable", void 0);
2387
- __decorate([
2388
- ViewChild('dialogMetadata', { static: true })
2389
- ], AddFormFieldComponent.prototype, "dialogMetadata", void 0);
2390
- __decorate([
2391
- ViewChild('buttonImagesKeyValueInputColumn', { static: true })
2392
- ], AddFormFieldComponent.prototype, "buttonImagesKeyValueInputColumn", void 0);
2393
- AddFormFieldComponent = __decorate([
2394
- Component({
2395
- selector: 'eqp-dynamic-module-add-form-field',
2396
- template: "<div class=\"container-fluid\" style=\"max-height: 70vh !important; overflow-x: hidden; overflow-y: auto;\">\r\n <form [formGroup]=\"fieldFormGroup\">\r\n <div class=\"row\">\r\n <div class=\"header-title-standard\">{{indexField != null && indexField >= 0 ? \"Modifica\"\r\n : \"Aggiungi\"}} campo</div>\r\n </div>\r\n <div class=\"row\">\r\n <div class=\"col-sm-12 col-md-4 mt-2\">\r\n <eqp-select [enumData]=\"FieldTypeEnum\" [(ngModelInput)]=\"field.FieldType\" [isRequired]=\"true\"\r\n [showCancelButton]=\"false\" placeholder=\"Tipo campo\" (ngModelInputChange)=\"onFieldTypeChange()\"\r\n [formGroupInput]=\"fieldFormGroup\" [formControlNameInput]=\"'FieldType'\"\r\n [enumDataToExclude]=\"fieldTypesToExclude\">\r\n </eqp-select>\r\n </div>\r\n\r\n <div class=\"col-sm-12 col-md-4 mt-2\">\r\n <mat-form-field>\r\n <mat-label> Label </mat-label>\r\n <input formControlName=\"Label\" required matInput [(ngModel)]=\"field.Label\">\r\n </mat-form-field>\r\n </div>\r\n\r\n <div class=\"col-sm-12 col-md-4 mt-2\">\r\n <mat-form-field>\r\n <mat-label> Descrizione </mat-label>\r\n <input formControlName=\"Description\" required matInput [(ngModel)]=\"field.Description\">\r\n </mat-form-field>\r\n </div>\r\n\r\n <div class=\"col-sm-12 col-md-4 mt-2 d-flex align-items-center\">\r\n <mat-slide-toggle [(ngModel)]=\"field.Required\" formControlName=\"Required\" color=\"primary\">\r\n Obbligatorio\r\n </mat-slide-toggle>\r\n </div>\r\n\r\n <div class=\"col-sm-12 col-md-4 mt-2\">\r\n <mat-form-field>\r\n <mat-label> Formula (Javascript) </mat-label>\r\n <input formControlName=\"Formula\" matInput [(ngModel)]=\"field.Formula\"\r\n [matAutocomplete]=\"formulaAutocomplete\" (keyup)=\"setFormulaAutocompleteOptions($event)\"\r\n (focus)=\"setFormulaAutocompleteOptions(null)\">\r\n <mat-autocomplete #formulaAutocomplete=\"matAutocomplete\">\r\n <mat-option *ngFor=\"let option of formulaAutocompleteOptions\" [value]=\"option.value\">\r\n {{option.label}}\r\n </mat-option>\r\n </mat-autocomplete>\r\n </mat-form-field>\r\n </div>\r\n\r\n <div class=\"col-sm-12 col-md-4 mt-2\" *ngIf=\"formFieldsGroups\">\r\n <eqp-select [arrayData]=\"formFieldsGroups\" [(ngModelInput)]=\"field.FieldGroup\"\r\n [arrayKeyProperty]=\"'Name'\" [arrayValueProperty]=\"'Name'\" placeholder=\"Sezione\"\r\n [formGroupInput]=\"fieldFormGroup\" [formControlNameInput]=\"'FieldGroup'\" [isRequired]=\"true\"\r\n [includeFullObject]=\"false\">\r\n </eqp-select>\r\n </div>\r\n\r\n <div class=\"col-sm-12 col-md-4 mt-2\">\r\n <eqp-select [arrayData]=\"availableColSpanSizes\" [(ngModelInput)]=\"field.ColSpanSizes\"\r\n [arrayKeyProperty]=\"'key'\" [arrayValueProperty]=\"'value'\" (ngModelInputChange)=\"onColSpanSizeSelect()\"\r\n [isMultiSelect]=\"true\" placeholder=\"Larghezza campo\" [formGroupInput]=\"fieldFormGroup\"\r\n [formControlNameInput]=\"'ColSpanSizes'\" [includeFullObject]=\"false\">\r\n </eqp-select>\r\n </div>\r\n\r\n <div class=\"col-sm-12 col-md-4 mt-2 d-flex align-items-center\">\r\n <mat-slide-toggle [(ngModel)]=\"field.InListView\" formControlName=\"InListView\" color=\"primary\"\r\n [disabled]=\"fieldFormGroup.controls['InListView'].disabled\">\r\n Mostrare nella visualizzazione a lista\r\n </mat-slide-toggle>\r\n </div>\r\n\r\n <ng-container *ngTemplateOutlet=\"fieldTypeFormTemplate\">\r\n </ng-container>\r\n </div>\r\n\r\n\r\n <div class=\"row mt-2 mb-1\">\r\n <div class=\"col-sm-12 text-right\">\r\n <button class=\"mr-2\" mat-raised-button color=\"primary\" (click)=\"saveAndExitAddField(true)\"\r\n [disabled]=\"disableSaveField()\" type=\"button\">\r\n Salva\r\n </button>\r\n <button class=\"btn mat-raised-button\" (click)=\"saveAndExitAddField(false)\" type=\"button\">\r\n Esci\r\n </button>\r\n </div>\r\n </div>\r\n </form>\r\n</div>\r\n\r\n\r\n<!-- FORM PROPRIET\u00C0 CAMPI DI TESTO -->\r\n<ng-template #textFieldFormTemplate>\r\n <div class=\"col-sm-12 col-md-4\">\r\n <eqp-select [enumData]=\"TextMaskEnum\" [(ngModelInput)]=\"field.TextMask\" placeholder=\"Maschera\"\r\n [formGroupInput]=\"fieldFormGroup\" [formControlNameInput]=\"'TextMask'\">\r\n </eqp-select>\r\n </div>\r\n <div class=\"col-sm-12 col-md-4\" [formGroup]=\"fieldFormGroup\">\r\n <mat-form-field>\r\n <mat-label> Lunghezza massima </mat-label>\r\n <input formControlName=\"MaxLenght\" type=\"number\" [min]=\"0\" matInput [(ngModel)]=\"field.MaxLenght\">\r\n </mat-form-field>\r\n </div>\r\n <div class=\"col-sm-12 col-md-4\" [formGroup]=\"fieldFormGroup\">\r\n <mat-form-field>\r\n <mat-label> Lunghezza minima </mat-label>\r\n <input formControlName=\"MinLenght\" type=\"number\" [min]=\"0\" matInput [(ngModel)]=\"field.MinLenght\">\r\n </mat-form-field>\r\n </div>\r\n</ng-template>\r\n\r\n<!-- FORM PROPRIET\u00C0 CAMPI AREA DI TESTO -->\r\n<ng-template #textareaFieldFormTemplate>\r\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\r\n <mat-form-field>\r\n <mat-label> Righe </mat-label>\r\n <input formControlName=\"Rows\" type=\"number\" [min]=\"0\" matInput [(ngModel)]=\"field.Rows\">\r\n </mat-form-field>\r\n </div>\r\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\r\n <mat-form-field>\r\n <mat-label> Lunghezza massima </mat-label>\r\n <input formControlName=\"MaxLenght\" type=\"number\" [min]=\"0\" matInput [(ngModel)]=\"field.MaxLenght\">\r\n </mat-form-field>\r\n </div>\r\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\r\n <mat-form-field>\r\n <mat-label> Lunghezza minima </mat-label>\r\n <input formControlName=\"MinLenght\" type=\"number\" [min]=\"0\" matInput [(ngModel)]=\"field.MinLenght\">\r\n </mat-form-field>\r\n </div>\r\n</ng-template>\r\n\r\n<!-- FORM PROPRIET\u00C0 CAMPI BOOLEANI -->\r\n<ng-template #booleadFieldFormTemplate>\r\n <div class=\"col-sm-12 col-md-4 mt-2 d-flex align-items-center\" [formGroup]=\"fieldFormGroup\">\r\n <mat-slide-toggle [(ngModel)]=\"field.IsTristate\" formControlName=\"IsTristate\" color=\"primary\">\r\n A tre stati\r\n </mat-slide-toggle>\r\n </div>\r\n <div class=\"col-sm-12 col-md-4 mt-2\">\r\n <eqp-select [enumData]=\"BoolPresentantioEnum\" [(ngModelInput)]=\"field.PresetationType\" [isRequired]=\"true\"\r\n [showCancelButton]=\"false\" placeholder=\"Tipo di presentazione\" [formGroupInput]=\"fieldFormGroup\"\r\n [formControlNameInput]=\"'PresetationType'\">\r\n </eqp-select>\r\n </div>\r\n</ng-template>\r\n\r\n<!-- FORM PROPRIET\u00C0 CAMPI DATA -->\r\n<ng-template #dateFieldFormTemplate>\r\n <div class=\"col-sm-12 col-md-4 mt-2\">\r\n <eqp-datetimepicker [placeholder]=\"'Data minima'\" [(ngModelInput)]=\"field.MinDate\"\r\n [formGroupInput]=\"fieldFormGroup\" [formControlNameInput]=\"'MinDate'\" [UTCDate]=\"true\" [showSeconds]=\"false\">\r\n </eqp-datetimepicker>\r\n </div>\r\n <div class=\"col-sm-12 col-md-4 mt-2\">\r\n <eqp-datetimepicker [placeholder]=\"'Data massima'\" [(ngModelInput)]=\"field.MaxDate\"\r\n [formGroupInput]=\"fieldFormGroup\" [formControlNameInput]=\"'MaxDate'\" [UTCDate]=\"true\" [showSeconds]=\"false\">\r\n </eqp-datetimepicker>\r\n </div>\r\n <div class=\"col-sm-12 col-md-4 mt-2\">\r\n <eqp-select [enumData]=\"DateTimeTypeEnum\" [(ngModelInput)]=\"field.IsOnlyDate\" [isRequired]=\"true\"\r\n [showCancelButton]=\"false\" placeholder=\"Tipo di data\" [formGroupInput]=\"fieldFormGroup\"\r\n [formControlNameInput]=\"'IsOnlyDate'\">\r\n </eqp-select>\r\n </div>\r\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\r\n <mat-form-field>\r\n <mat-label> Formato </mat-label>\r\n <input formControlName=\"DateFormat\" matInput [(ngModel)]=\"field.DateFormat\"\r\n [matTooltip]=\"'Indicare il formato senguendo la guida del pacchetto momentjs.'\">\r\n </mat-form-field>\r\n </div>\r\n</ng-template>\r\n\r\n<!-- FORM PROPRIET\u00C0 CAMPI NUMERICI -->\r\n<ng-template #numericFieldFormTemplate>\r\n <div class=\"col-sm-12 col-md-4 mt-2 d-flex align-items-center\" [formGroup]=\"fieldFormGroup\">\r\n <mat-slide-toggle [(ngModel)]=\"field.IsInteger\" formControlName=\"IsInteger\" color=\"primary\">\r\n Valore intero\r\n </mat-slide-toggle>\r\n </div>\r\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\r\n <mat-form-field>\r\n <mat-label> Separatore decimali </mat-label>\r\n <input formControlName=\"DecimalSeparator\" matInput [(ngModel)]=\"field.DecimalSeparator\">\r\n </mat-form-field>\r\n </div>\r\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\r\n <mat-form-field>\r\n <mat-label> Precisione decimali </mat-label>\r\n <input formControlName=\"DecimalPrecision\" type=\"number\" [min]=\"0\" matInput\r\n [(ngModel)]=\"field.DecimalPrecision\">\r\n </mat-form-field>\r\n </div>\r\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\r\n <mat-form-field>\r\n <mat-label> Separatore migliaia </mat-label>\r\n <input formControlName=\"ThousandsSeparator\" matInput [(ngModel)]=\"field.ThousandsSeparator\">\r\n </mat-form-field>\r\n </div>\r\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\r\n <mat-form-field>\r\n <mat-label> Simbolo valuta </mat-label>\r\n <input formControlName=\"CurrencySymbol\" matInput [(ngModel)]=\"field.CurrencySymbol\">\r\n </mat-form-field>\r\n </div>\r\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\r\n <mat-form-field>\r\n <mat-label> Valore massimo </mat-label>\r\n <input formControlName=\"MinValue\" type=\"number\" [min]=\"0\" matInput [(ngModel)]=\"field.MinValue\">\r\n </mat-form-field>\r\n </div>\r\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\r\n <mat-form-field>\r\n <mat-label> Valore minimo </mat-label>\r\n <input formControlName=\"MaxValue\" type=\"number\" [min]=\"0\" matInput [(ngModel)]=\"field.MaxValue\">\r\n </mat-form-field>\r\n </div>\r\n</ng-template>\r\n\r\n<!-- FORM PROPRIET\u00C0 CAMPI ALLEGATO -->\r\n<ng-template #attachmentFieldFormTemplate>\r\n <div class=\"col-sm-12 col-md-4 mt-2 d-flex align-items-center\" [formGroup]=\"fieldFormGroup\">\r\n <mat-slide-toggle [(ngModel)]=\"field.IsMultiAttach\" formControlName=\"IsMultiAttach\" color=\"primary\">\r\n Allegati multipli\r\n </mat-slide-toggle>\r\n </div>\r\n <div class=\"col-sm-12 col-md-4 mt-2\">\r\n <eqp-select [arrayData]=\"AvailableFileExtensions.concat(AvailableImageExtensions)\"\r\n [(ngModelInput)]=\"field.AllowedExtensions\" [arrayKeyProperty]=\"'key'\" [arrayValueProperty]=\"'value'\"\r\n [isMultiSelect]=\"true\" placeholder=\"Estensioni accettate\" [formGroupInput]=\"fieldFormGroup\"\r\n [formControlNameInput]=\"'AllowedExtensions'\" [includeFullObject]=\"false\">\r\n </eqp-select>\r\n </div>\r\n <div class=\"col-sm-12 mt-2\">\r\n <div class=\"row mt-2\">\r\n <div class=\"col-sm-12 col-md-6\">\r\n <div class=\"header-title-standard\">\r\n Elenco metadata\r\n </div>\r\n </div>\r\n <div class=\"col-sm-12 col-md-6 text-right\">\r\n <button class=\"btn btn-primary\" mat-raised-button color=\"primary\" type=\"button\"\r\n (click)=\"openMetadataDialog()\">\r\n <mat-icon>add</mat-icon>\r\n <span style=\"margin-left: 10px;\">Aggiungi</span>\r\n </button>\r\n </div>\r\n </div>\r\n <eqp-table #metadataFieldsTable [createMatCard]=\"false\" [columns]=\"metadataColumns\"\r\n [data]=\"field.MetadataFields\" [emptyTableMessage]=\"'Nessun metadata inserito'\" [searchText]=\"'Cerca'\">\r\n </eqp-table>\r\n </div>\r\n</ng-template>\r\n\r\n<!-- FORM PROPRIET\u00C0 CAMPI IMMAGINE -->\r\n<ng-template #imageFieldFormTemplate>\r\n <div class=\"col-sm-12 col-md-4 mt-2 mb-2 d-flex align-items-center\" [formGroup]=\"fieldFormGroup\">\r\n <mat-slide-toggle [(ngModel)]=\"field.ImageIsContextualAttachment\" formControlName=\"ImageIsContextualAttachment\"\r\n color=\"primary\" (ngModelChange)=\"onImageIsContextualAttachmentChange()\">\r\n Immagine pre-caricata nel campo\r\n </mat-slide-toggle>\r\n </div>\r\n <div class=\"col-sm-12 col-md-4 mt-2 mb-2 d-flex align-items-center\" [formGroup]=\"fieldFormGroup\">\r\n <mat-slide-toggle [(ngModel)]=\"field.EnableDrawing\" formControlName=\"EnableDrawing\" color=\"primary\">\r\n Abilita il disegno\r\n </mat-slide-toggle>\r\n </div>\r\n <div class=\"col-sm-12 col-md-4 mt-2 d-flex align-items-center\" [formGroup]=\"fieldFormGroup\"\r\n *ngIf=\"!field.ImageIsContextualAttachment\">\r\n <mat-slide-toggle [(ngModel)]=\"field.AttachDefinition.IsMultiAttach\" formControlName=\"IsMultiAttach\"\r\n color=\"primary\">\r\n Immagini multiple\r\n </mat-slide-toggle>\r\n </div>\r\n <div class=\"col-sm-12 col-md-4 mt-2\" *ngIf=\"!field.ImageIsContextualAttachment\">\r\n <eqp-select [arrayData]=\"AvailableImageExtensions\" [(ngModelInput)]=\"field.AttachDefinition.AllowedExtensions\"\r\n [arrayKeyProperty]=\"'key'\" [arrayValueProperty]=\"'value'\" [isMultiSelect]=\"true\"\r\n placeholder=\"Estensioni accettate\" [formGroupInput]=\"fieldFormGroup\"\r\n [formControlNameInput]=\"'AllowedExtensions'\" [includeFullObject]=\"false\">\r\n </eqp-select>\r\n </div>\r\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\" *ngIf=\"field.ImageIsContextualAttachment\">\r\n <mat-form-field>\r\n <mat-label> Nome immagine </mat-label>\r\n <input formControlName=\"ImgName\" matInput [(ngModel)]=\"field.ImgName\" required>\r\n </mat-form-field>\r\n </div>\r\n <div class=\"col-sm-12 col-md-8 mt-2\" [formGroup]=\"fieldFormGroup\" *ngIf=\"field.ImageIsContextualAttachment\">\r\n <eqp-attachments [attachmentsList]=\"field._contextualAttachments\" [showMatCard]=\"false\" [allowOnlyImages]=\"true\"\r\n [isDisabled]=\"false\" [showInlinePreview]=\"true\" [multipleAttachment]=\"false\" [showHeader]=\"false\"\r\n (localEditedAttachments)=\"catchContextualAttachmentChange($event)\" #contextualAttachmentEqpAttachments>\r\n </eqp-attachments>\r\n </div>\r\n <div class=\"col-sm-12 mt-2\">\r\n <div class=\"row mt-2\">\r\n <div class=\"col-sm-12 col-md-6\">\r\n <div class=\"header-title-standard\">\r\n Elenco metadata\r\n </div>\r\n </div>\r\n <div class=\"col-sm-12 col-md-6 text-right\">\r\n <button class=\"btn btn-primary\" mat-raised-button color=\"primary\" type=\"button\"\r\n (click)=\"openMetadataDialog()\">\r\n <mat-icon>add</mat-icon>\r\n <span style=\"margin-left: 10px;\">Aggiungi</span>\r\n </button>\r\n </div>\r\n </div>\r\n <eqp-table #metadataFieldsTable [createMatCard]=\"false\" [columns]=\"metadataColumns\"\r\n [data]=\"field.AttachDefinition.MetadataFields\" [emptyTableMessage]=\"'Nessun metadata inserito'\"\r\n [searchText]=\"'Cerca'\">\r\n </eqp-table>\r\n </div>\r\n</ng-template>\r\n\r\n<!-- FORM PROPRIET\u00C0 CAMPI LISTA DI VALORI -->\r\n<ng-template #listValueFieldFormTemplate>\r\n <div class=\"col-sm-12 col-md-4 mt-2 d-flex align-items-center\" [formGroup]=\"fieldFormGroup\">\r\n <mat-slide-toggle [(ngModel)]=\"field.IsMultiChoiche\" formControlName=\"IsMultiChoiche\" color=\"primary\">\r\n Scelta multipla\r\n </mat-slide-toggle>\r\n </div>\r\n <div class=\"col-sm-12 col-md-4 mt-2\">\r\n <eqp-select [enumData]=\"ListPresentationEnum\" [(ngModelInput)]=\"field.PresentationMode\" [isRequired]=\"true\"\r\n [showCancelButton]=\"false\" placeholder=\"Tipo di presentazione\" [formGroupInput]=\"fieldFormGroup\"\r\n [formControlNameInput]=\"'PresentationMode'\" (ngModelInputChange)=\"onPresentationModeChange()\">\r\n </eqp-select>\r\n </div>\r\n <div class=\"col-sm-12 mt-2\" *ngIf=\"field.PresentationMode != ListPresentationEnum.Immagini\">\r\n <div class=\"row\">\r\n <h4 class=\"key-value-list-section-title\"> </h4>\r\n <div class=\"col-md-4 d-flex align-items-center\">\r\n <mat-form-field>\r\n <mat-label> Label opzione (invio per confermare)</mat-label>\r\n <input matInput [(ngModel)]=\"keyValueObject.key\" (keyup)=\"onMultiSelectInputKeyup($event, null)\">\r\n </mat-form-field>\r\n </div>\r\n <div class=\"col-md-4 d-flex align-items-center\">\r\n <mat-form-field>\r\n <mat-label> Valore opzione (invio per confermare)</mat-label>\r\n <input matInput [(ngModel)]=\"keyValueObject.value\" (keyup)=\"onMultiSelectInputKeyup($event, null)\">\r\n </mat-form-field>\r\n </div>\r\n <div class=\"col-md-4 d-flex align-items-center\">\r\n <span class=\"mr-3\">Opzioni inserite:</span>\r\n <ul class=\"value-pairs-list\">\r\n <li *ngFor=\"let keyValuePair of getDictionaryKeyValue()\">\r\n <mat-icon class=\"mr-1\" (click)=\"deleteKeyFromDictionary(keyValuePair.key)\">close\r\n </mat-icon>\r\n <span><b>Label: </b> {{keyValuePair.key}} - <b>Valore: </b> {{keyValuePair.value}}</span>\r\n </li>\r\n </ul>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"col-sm-12 col-md-12 mt-2\" *ngIf=\"field.PresentationMode == ListPresentationEnum.Immagini\">\r\n <eqp-attachments [attachmentsList]=\"field.ButtonImageList\" [showMatCard]=\"false\" [allowOnlyImages]=\"true\"\r\n [isDisabled]=\"false\" [showInlinePreview]=\"true\" [multipleAttachment]=\"true\" [showHeader]=\"false\"\r\n [allowedTypes]=\"[AttachmentType.FILE]\" (localEditedAttachments)=\"catchButtonImagesChange($event)\"\r\n (onComponentLoaded)=\"configureButtonImagesColumns($event)\">\r\n </eqp-attachments>\r\n </div>\r\n</ng-template>\r\n\r\n<!-- FORM PROPRIET\u00C0 CAMPI LOOKUP -->\r\n<ng-template #lookupFieldFormTemplate>\r\n <div class=\"col-sm-12 col-md-4 mt-2 d-flex align-items-center\" [formGroup]=\"fieldFormGroup\">\r\n <mat-slide-toggle [(ngModel)]=\"field.UseAsGetOrDiscard\" formControlName=\"UseAsGetOrDiscard\" color=\"primary\"\r\n matTooltip=\"Se true la lookup viene visualizzata in una modale per lo scegli scarta\">\r\n Usa per scegli o scarta\r\n </mat-slide-toggle>\r\n </div>\r\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\r\n <mat-form-field matTooltip=\"Nome dell'entit\u00E0 relazionata\">\r\n <mat-label> Nome entit\u00E0 </mat-label>\r\n <input formControlName=\"EntitySourceName\" required matInput [(ngModel)]=\"field.EntitySourceName\">\r\n </mat-form-field>\r\n </div>\r\n <div class=\"col-sm-12 mt-2\">\r\n <div class=\"row\">\r\n <div class=\"col-md-4\">\r\n <mat-form-field\r\n matTooltip=\"Elenco di campi ordinato che verr\u00E0 visualizzato nella lookup (premere invio per confermare)\">\r\n <mat-label>\r\n Nomi dei campi (invio per confermare) </mat-label>\r\n <input matInput (keyup)=\"onMultiSelectInputKeyup($event, 'FieldNames')\">\r\n </mat-form-field>\r\n </div>\r\n <div class=\"col-md-8 d-flex align-items-center\">\r\n <span class=\"mr-3\">Nomi selezionati:</span>\r\n <div class=\"extension-container\" *ngFor=\"let extension of field.FieldNames; let i = index\">\r\n <span>{{extension}}</span>\r\n <mat-icon class=\"ml-1\" (click)=\"field.FieldNames.splice(i,1)\">close\r\n </mat-icon>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</ng-template>\r\n\r\n<!-- DIALOG PER AGGIUNGERE UN METADATA NEI CAMPI DI TIPO ALLEGATO O IMMAGINE -->\r\n<ng-template #dialogMetadata>\r\n <eqp-dynamic-module-add-form-field [field]=\"selectedMetadata\" [availableFields]=\"availableFields\"\r\n [indexField]=\"indexSelectedMetadata\" (saveFieldEvent)=\"onSaveMetadata($event)\" [fieldTypesToExclude]=\"[6,7,10]\">\r\n </eqp-dynamic-module-add-form-field>\r\n</ng-template>\r\n\r\n<ng-template #buttonImagesKeyValueInputColumn let-row=\"row\" let-col=\"col\">\r\n <mat-form-field>\r\n <mat-label> {{col.display}} </mat-label>\r\n <input matInput [(ngModel)]=\"row[col.key]\" required>\r\n </mat-form-field>\r\n</ng-template>",
2397
- 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}"]
2398
- })
2399
- ], AddFormFieldComponent);
2400
- return AddFormFieldComponent;
2401
- }());
2402
-
2403
- var TextFieldTemplateComponent = /** @class */ (function () {
2404
- function TextFieldTemplateComponent() {
2405
- this.recordChange = new EventEmitter();
2406
- this.InputMaskEnum = TextMaskEnum;
2407
- }
2408
- TextFieldTemplateComponent.prototype.ngOnInit = function () {
2409
- };
2410
- TextFieldTemplateComponent.prototype.ngOnChanges = function (changes) {
2411
- // Se viene modificato il valore di "ngModelInput" allora aggiorna l'input
2412
- if (changes['record'] != undefined && changes['record'].firstChange == false && JSON.stringify(changes['record'].currentValue) != JSON.stringify(changes['record'].previousValue)) {
2413
- this.record = changes['record'].currentValue;
2414
- this.updateField();
2415
- }
2416
- };
2417
- TextFieldTemplateComponent.prototype.getInputType = function () {
2418
- switch (this.field.TextMask) {
2419
- case TextMaskEnum.Email:
2420
- return 'email';
2421
- case TextMaskEnum.Password:
2422
- return 'password';
2423
- case TextMaskEnum.Telefono:
2424
- return 'tel';
2425
- case TextMaskEnum.Url:
2426
- return 'url';
2427
- default:
2428
- return 'text';
2429
- }
2430
- };
2431
- /**
2432
- * Metodo per aggiornare il valore del campo quando questo è rappresentato da una formula.
2433
- */
2434
- TextFieldTemplateComponent.prototype.updateField = function () {
2435
- if (this.field.Formula) {
2436
- this.record[this.field.Name] = UtilityHelperService.EvaluateFieldFormula(this.field.Formula, this.record, null);
2437
- }
2438
- };
2439
- /**
2440
- * Metodo per emettere l'evento che il valore del record è cambiato.
2441
- */
2442
- TextFieldTemplateComponent.prototype.onRecordValueChange = function () {
2443
- if (!this.field.Formula) {
2444
- this.recordChange.emit(this.record);
2445
- }
2446
- };
2447
- __decorate([
2448
- Input()
2449
- ], TextFieldTemplateComponent.prototype, "field", void 0);
2450
- __decorate([
2451
- Input()
2452
- ], TextFieldTemplateComponent.prototype, "record", void 0);
2453
- __decorate([
2454
- Output()
2455
- ], TextFieldTemplateComponent.prototype, "recordChange", void 0);
2456
- TextFieldTemplateComponent = __decorate([
2457
- Component({
2458
- selector: 'text-field-template',
2459
- template: "<mat-form-field [formGroup]=\"field.FormFormGroup\">\r\n <mat-label> {{field.Label}} </mat-label>\r\n <input matInput [type]=\"getInputType()\" [formControlName]=\"field.Name\" [disabled]=\"field.FormFormGroup.disabled\"\r\n [required]=\"field.Required\" [(ngModel)]=\"record[field.Name]\" (ngModelChange)=\"onRecordValueChange()\">\r\n</mat-form-field>",
2460
- styles: [""]
2461
- })
2462
- ], TextFieldTemplateComponent);
2463
- return TextFieldTemplateComponent;
2464
- }());
2465
-
2466
- var BooleanFieldTemplateComponent = /** @class */ (function () {
2467
- function BooleanFieldTemplateComponent() {
2468
- this.recordChange = new EventEmitter();
2469
- this.BoolPresentantioEnum = BoolPresentantioEnum;
2470
- }
2471
- BooleanFieldTemplateComponent.prototype.ngOnInit = function () {
2472
- if (this.record[this.field.Name] == undefined || this.record[this.field.Name] == null) {
2473
- this.record[this.field.Name] = this.field.IsTristate ? null : false;
2474
- }
2475
- };
2476
- BooleanFieldTemplateComponent.prototype.ngOnChanges = function (changes) {
2477
- // Se viene modificato il valore di "ngModelInput" allora aggiorna l'input
2478
- if (changes['record'] != undefined && changes['record'].firstChange == false && JSON.stringify(changes['record'].currentValue) != JSON.stringify(changes['record'].previousValue)) {
2479
- this.record = changes['record'].currentValue;
2480
- this.updateField();
2481
- }
2482
- };
2483
- /**
2484
- * Metodo per aggiornare il valore del campo quando questo è rappresentato da una formula.
2485
- */
2486
- BooleanFieldTemplateComponent.prototype.updateField = function () {
2487
- if (this.field.Formula) {
2488
- this.record[this.field.Name] = UtilityHelperService.EvaluateFieldFormula(this.field.Formula, this.record, null);
2489
- }
2490
- };
2491
- /**
2492
- * Metodo per emettere l'evento che il valore del record è cambiato.
2493
- */
2494
- BooleanFieldTemplateComponent.prototype.onRecordValueChange = function () {
2495
- if (!this.field.Formula) {
2496
- this.recordChange.emit(this.record);
2497
- }
2498
- };
2499
- __decorate([
2500
- Input()
2501
- ], BooleanFieldTemplateComponent.prototype, "field", void 0);
2502
- __decorate([
2503
- Input()
2504
- ], BooleanFieldTemplateComponent.prototype, "record", void 0);
2505
- __decorate([
2506
- Output()
2507
- ], BooleanFieldTemplateComponent.prototype, "recordChange", void 0);
2508
- BooleanFieldTemplateComponent = __decorate([
2509
- Component({
2510
- selector: 'boolean-field-template',
2511
- template: "<div [formGroup]=\"field.FormFormGroup\">\r\n\r\n <!-- VISUALIZZAZIONE A TOGGLE -->\r\n <mat-slide-toggle color=\"primary\" *ngIf=\"field.PresetationType == BoolPresentantioEnum.Toggle\"\r\n [formControlName]=\"field.Name\" [disabled]=\"field.FormFormGroup.disabled\" [required]=\"field.Required\"\r\n [(ngModel)]=\"record[field.Name]\" (ngModelChange)=\"onRecordValueChange()\">\r\n {{field.Label + (field.Required ? \" *\" : \"\")}}\r\n </mat-slide-toggle>\r\n\r\n\r\n <!-- VISUALIZZAZIONE A RADIOBUTTON -->\r\n <mat-label class=\"mr-3\" *ngIf=\"field.PresetationType == BoolPresentantioEnum['Radio button']\">\r\n {{field.Label + (field.Required ? \" *\" : \"\")}}\r\n </mat-label>\r\n <mat-radio-group *ngIf=\"field.PresetationType == BoolPresentantioEnum['Radio button']\"\r\n [formControlName]=\"field.Name\" [disabled]=\"field.FormFormGroup.disabled\" [required]=\"field.Required\"\r\n [(ngModel)]=\"record[field.Name]\" (ngModelChange)=\"onRecordValueChange()\">\r\n <mat-radio-button class=\"mr-2\" [value]=\"true\" color=\"primary\"> Si </mat-radio-button>\r\n <mat-radio-button class=\"mr-2\" [value]=\"false\" color=\"primary\"> No </mat-radio-button>\r\n <mat-radio-button class=\"mr-2\" [value]=\"null\" color=\"primary\" *ngIf=\"field.IsTristate\"> ND\r\n </mat-radio-button>\r\n </mat-radio-group>\r\n\r\n <!-- VISUALIZZAZIONE A CHECKBOX -->\r\n <mat-checkbox class=\"mr-2\" *ngIf=\"field.PresetationType == BoolPresentantioEnum.Checkbox\"\r\n [disabled]=\"field.FormFormGroup.disabled\" [required]=\"field.Required\" [formControlName]=\"field.Name\"\r\n [(ngModel)]=\"record[field.Name]\" (ngModelChange)=\"onRecordValueChange()\">\r\n {{field.Label + (field.Required ? \" *\" : \"\")}}\r\n </mat-checkbox>\r\n\r\n <!-- TODO: Visualizzazione \"Stringa true o false\" e \"Numerico 0 o 1\" ?? -->\r\n</div>",
2512
- styles: [""]
2513
- })
2514
- ], BooleanFieldTemplateComponent);
2515
- return BooleanFieldTemplateComponent;
2516
- }());
2517
-
2518
- var DateFieldTemplateComponent = /** @class */ (function () {
2519
- function DateFieldTemplateComponent() {
2520
- this.recordChange = new EventEmitter();
2521
- }
2522
- DateFieldTemplateComponent.prototype.ngOnInit = function () {
2523
- this.setTimeType();
2524
- };
2525
- DateFieldTemplateComponent.prototype.ngOnChanges = function (changes) {
2526
- // Se viene modificato il valore di "ngModelInput" allora aggiorna l'input
2527
- if (changes['record'] != undefined && changes['record'].firstChange == false && JSON.stringify(changes['record'].currentValue) != JSON.stringify(changes['record'].previousValue)) {
2528
- this.record = changes['record'].currentValue;
2529
- this.updateField();
2530
- }
2531
- };
2532
- /**
2533
- * Metodo per aggiornare il valore del campo quando questo è rappresentato da una formula.
2534
- */
2535
- DateFieldTemplateComponent.prototype.updateField = function () {
2536
- if (this.field.Formula) {
2537
- this.record[this.field.Name] = UtilityHelperService.EvaluateFieldFormula(this.field.Formula, this.record, null);
2538
- }
2539
- };
2540
- /**
2541
- * Metodo per emettere l'evento che il valore del record è cambiato.
2542
- */
2543
- DateFieldTemplateComponent.prototype.onRecordValueChange = function () {
2544
- if (!this.field.Formula) {
2545
- this.recordChange.emit(this.record);
2546
- }
2547
- };
2548
- /**
2549
- * In base al formato della data richiesta nel DateField (solo data, solo orario o data e ora)
2550
- * imposta la visualizzazione corretta del componente eqp-datetimepicker.
2551
- */
2552
- DateFieldTemplateComponent.prototype.setTimeType = function () {
2553
- switch (this.field.IsOnlyDate) {
2554
- case DateTimeTypeEnum["Solo data"]:
2555
- this.pickerMode = PickerModeEnum.DATE;
2556
- break;
2557
- case DateTimeTypeEnum["Solo orario"]:
2558
- this.pickerMode = PickerModeEnum.TIME;
2559
- break;
2560
- case DateTimeTypeEnum["Data e ora"]:
2561
- this.pickerMode = PickerModeEnum.DATETIME;
2562
- break;
2563
- }
2564
- };
2565
- __decorate([
2566
- Input()
2567
- ], DateFieldTemplateComponent.prototype, "field", void 0);
2568
- __decorate([
2569
- Input()
2570
- ], DateFieldTemplateComponent.prototype, "record", void 0);
2571
- __decorate([
2572
- Output()
2573
- ], DateFieldTemplateComponent.prototype, "recordChange", void 0);
2574
- DateFieldTemplateComponent = __decorate([
2575
- Component({
2576
- selector: 'date-field-template',
2577
- template: "<eqp-datetimepicker [placeholder]=\"field.Label\" [UTCDate]=\"true\" [pickerMode]=\"pickerMode\"\r\n [formGroupInput]=\"field.FormFormGroup\" [formControlNameInput]=\"field.Name\"\r\n [minDate]=\"field.MinDate ? field.MinDate : null\" [maxDate]=\"field.MaxDate ? field.MaxDate : null\"\r\n [isRequired]=\"field.Required\" [disabled]=\"field.FormFormGroup.disabled\" [(ngModelInput)]=\"record[field.Name]\"\r\n (ngModelInputChange)=\"onRecordValueChange()\" [customDateFormat]=\"field.DateFormat ? field.DateFormat : null\">\r\n</eqp-datetimepicker>",
2578
- styles: [""]
2579
- })
2580
- ], DateFieldTemplateComponent);
2581
- return DateFieldTemplateComponent;
2582
- }());
2583
-
2584
- var TextareaFieldTemplateComponent = /** @class */ (function () {
2585
- function TextareaFieldTemplateComponent() {
2586
- this.recordChange = new EventEmitter();
2587
- }
2588
- TextareaFieldTemplateComponent.prototype.ngOnInit = function () {
2589
- };
2590
- TextareaFieldTemplateComponent.prototype.ngOnChanges = function (changes) {
2591
- // Se viene modificato il valore di "ngModelInput" allora aggiorna l'input
2592
- if (changes['record'] != undefined && changes['record'].firstChange == false && JSON.stringify(changes['record'].currentValue) != JSON.stringify(changes['record'].previousValue)) {
2593
- this.record = changes['record'].currentValue;
2594
- this.updateField();
2595
- }
2596
- };
2597
- /**
2598
- * Metodo per aggiornare il valore del campo quando questo è rappresentato da una formula.
2599
- */
2600
- TextareaFieldTemplateComponent.prototype.updateField = function () {
2601
- if (this.field.Formula) {
2602
- this.record[this.field.Name] = UtilityHelperService.EvaluateFieldFormula(this.field.Formula, this.record, null);
2603
- }
2604
- };
2605
- /**
2606
- * Metodo per emettere l'evento che il valore del record è cambiato.
2607
- */
2608
- TextareaFieldTemplateComponent.prototype.onRecordValueChange = function () {
2609
- if (!this.field.Formula) {
2610
- this.recordChange.emit(this.record);
2611
- }
2612
- };
2613
- __decorate([
2614
- Input()
2615
- ], TextareaFieldTemplateComponent.prototype, "field", void 0);
2616
- __decorate([
2617
- Input()
2618
- ], TextareaFieldTemplateComponent.prototype, "record", void 0);
2619
- __decorate([
2620
- Output()
2621
- ], TextareaFieldTemplateComponent.prototype, "recordChange", void 0);
2622
- TextareaFieldTemplateComponent = __decorate([
2623
- Component({
2624
- selector: 'textarea-field-template',
2625
- template: "<mat-form-field [formGroup]=\"field.FormFormGroup\">\r\n <textarea matInput [placeholder]=\"field.Label\" [rows]=\"field.Rows\" [formControlName]=\"field.Name\"\r\n [disabled]=\"field.FormFormGroup.disabled\" [required]=\"field.Required\" [(ngModel)]=\"record[field.Name]\"\r\n (ngModelChange)=\"onRecordValueChange()\"></textarea>\r\n</mat-form-field>",
2626
- styles: [""]
2627
- })
2628
- ], TextareaFieldTemplateComponent);
2629
- return TextareaFieldTemplateComponent;
2630
- }());
2631
-
2632
- var NumericFieldTemplateComponent = /** @class */ (function () {
2633
- function NumericFieldTemplateComponent() {
2634
- this.recordChange = new EventEmitter();
2635
- this.eqpNumericOptions = {};
2636
- }
2637
- NumericFieldTemplateComponent.prototype.ngOnInit = function () {
2638
- this.configureEqpNumericOptions();
2639
- };
2640
- NumericFieldTemplateComponent.prototype.ngOnChanges = function (changes) {
2641
- // Se viene modificato il valore di "ngModelInput" allora aggiorna l'input
2642
- if (changes['record'] != undefined && changes['record'].firstChange == false && JSON.stringify(changes['record'].currentValue) != JSON.stringify(changes['record'].previousValue)) {
2643
- this.record = changes['record'].currentValue;
2644
- this.updateField();
2645
- }
2646
- };
2647
- /**
2648
- * Metodo per aggiornare il valore del campo quando questo è rappresentato da una formula.
2649
- */
2650
- NumericFieldTemplateComponent.prototype.updateField = function () {
2651
- if (this.field.Formula) {
2652
- this.record[this.field.Name] = UtilityHelperService.EvaluateFieldFormula(this.field.Formula, this.record, null);
2653
- }
2654
- };
2655
- /**
2656
- * Metodo per emettere l'evento che il valore del record è cambiato.
2657
- */
2658
- NumericFieldTemplateComponent.prototype.onRecordValueChange = function () {
2659
- if (!this.field.Formula) {
2660
- this.recordChange.emit(this.record);
2661
- }
2662
- };
2663
- /**
2664
- * Metodo per configurare eqp-numeric
2665
- */
2666
- NumericFieldTemplateComponent.prototype.configureEqpNumericOptions = function () {
2667
- this.eqpNumericOptions.prefix = this.field.CurrencySymbol ? this.field.CurrencySymbol : "";
2668
- this.eqpNumericOptions.inputMode = this.field.CurrencySymbol ? EqpNumericInputMode.FINANCIAL : EqpNumericInputMode.NATURAL;
2669
- if (this.field.MinValue != null && this.field.MinValue != undefined)
2670
- this.eqpNumericOptions.min = this.field.MinValue;
2671
- if (this.field.MaxValue != null && this.field.MaxValue != undefined)
2672
- this.eqpNumericOptions.max = this.field.MaxValue;
2673
- if (this.field.DecimalSeparator != null && this.field.DecimalSeparator != undefined)
2674
- this.eqpNumericOptions.decimal = this.field.DecimalSeparator;
2675
- if (this.field.ThousandsSeparator != null && this.field.ThousandsSeparator != undefined)
2676
- this.eqpNumericOptions.thousands = this.field.ThousandsSeparator;
2677
- if (this.field.DecimalPrecision != null && this.field.DecimalPrecision != undefined)
2678
- this.eqpNumericOptions.precision = this.field.DecimalPrecision;
2679
- };
2680
- __decorate([
2681
- Input()
2682
- ], NumericFieldTemplateComponent.prototype, "field", void 0);
2683
- __decorate([
2684
- Input()
2685
- ], NumericFieldTemplateComponent.prototype, "record", void 0);
2686
- __decorate([
2687
- Output()
2688
- ], NumericFieldTemplateComponent.prototype, "recordChange", void 0);
2689
- NumericFieldTemplateComponent = __decorate([
2690
- Component({
2691
- selector: 'numeric-field-template',
2692
- template: "<mat-form-field [formGroup]=\"field.FormFormGroup\">\r\n <mat-label> {{field.Label}} </mat-label>\r\n <input matInput eqpNumericMask [formControlName]=\"field.Name\" [disabled]=\"field.FormFormGroup.disabled\"\r\n [required]=\"field.Required\" [(ngModel)]=\"record[field.Name]\" [options]=\"eqpNumericOptions\"\r\n [step]=\"field.IsInteger ? 1 : null\" (ngModelChange)=\"onRecordValueChange()\" />\r\n</mat-form-field>",
2693
- styles: [""]
2694
- })
2695
- ], NumericFieldTemplateComponent);
2696
- return NumericFieldTemplateComponent;
2697
- }());
2698
-
2699
- var ListValueFieldTemplateComponent = /** @class */ (function () {
2700
- function ListValueFieldTemplateComponent() {
2701
- this.recordChange = new EventEmitter();
2702
- this.ListPresentationEnum = ListPresentationEnum;
2703
- this.arrayData = [];
2704
- }
2705
- ListValueFieldTemplateComponent.prototype.ngOnInit = function () {
2706
- this.setArrayData();
2707
- if (this.field.IsMultiChoiche && !this.record[this.field.Name]) {
2708
- this.record[this.field.Name] = [];
2709
- }
2710
- // Nel caso in cui sono in modifica di un Record aggiorno il valore
2711
- // e il validator del FormControl. Se non viene eseguita questa riga
2712
- // l'utente deve modificare la selezione fatta per aggiornare la form.
2713
- this.setFormControlValue();
2714
- };
2715
- ListValueFieldTemplateComponent.prototype.ngOnChanges = function (changes) {
2716
- // Se viene modificato il valore di "ngModelInput" allora aggiorna l'input
2717
- if (changes['record'] != undefined && changes['record'].firstChange == false && JSON.stringify(changes['record'].currentValue) != JSON.stringify(changes['record'].previousValue)) {
2718
- this.record = changes['record'].currentValue;
2719
- this.updateField();
2720
- }
2721
- };
2722
- /**
2723
- * Metodo per aggiornare il valore del campo quando questo è rappresentato da una formula.
2724
- */
2725
- ListValueFieldTemplateComponent.prototype.updateField = function () {
2726
- if (this.field.Formula) {
2727
- this.record[this.field.Name] = UtilityHelperService.EvaluateFieldFormula(this.field.Formula, this.record, null);
2728
- }
2729
- };
2730
- /**
2731
- * Metodo invocato quando viene selezionata un'opzione nella visualizzazione a button
2732
- * @param data Rappresenta l'oggetto selezionato
2733
- */
2734
- ListValueFieldTemplateComponent.prototype.buttonSelectClick = function (data) {
2735
- data.Selected = !data.Selected;
2736
- if (this.field.IsMultiChoiche) {
2737
- this.updateSelected(false);
2738
- }
2739
- else {
2740
- this.arrayData.filter(function (d) { return d.Key != data.Key && d.Value != data.Value; }).forEach(function (d) { return d.Selected = false; });
2741
- this.record[this.field.Name] = data.Value;
2742
- }
2743
- this.onRecordValueChange();
2744
- };
2745
- /**
2746
- * Metodo per aggiornare il/i valore/i selezionato/i dall'utente.
2747
- * @param emitChange Se true scatena l'evento di output della modifica del valore di record
2748
- */
2749
- ListValueFieldTemplateComponent.prototype.updateSelected = function (emitChange) {
2750
- if (emitChange === void 0) { emitChange = true; }
2751
- this.record[this.field.Name] = this.arrayData.filter(function (data) { return data.Selected; }).map(function (data) { return data.Value; });
2752
- this.setFormControlValue();
2753
- if (emitChange) {
2754
- this.onRecordValueChange();
2755
- }
2756
- };
2757
- /**
2758
- * Metodo per emettere l'evento che il valore del record è cambiato.
2759
- */
2760
- ListValueFieldTemplateComponent.prototype.onRecordValueChange = function () {
2761
- if (!this.field.Formula) {
2762
- this.recordChange.emit(this.record);
2763
- }
2764
- };
2765
- /**
2766
- * Metodo per creare un array di oggetti del tipo { Key: string, Value: any } da usare come sorgente dati per la eqp-select.
2767
- */
2768
- ListValueFieldTemplateComponent.prototype.setArrayData = function () {
2769
- var _this = this;
2770
- if (this.field.PresentationMode != ListPresentationEnum.Immagini) {
2771
- Object.keys(this.field.ValuePairs).forEach(function (k) { _this.createArrayDataElement(k, _this.field.ValuePairs[k]); });
2772
- }
2773
- else {
2774
- this.field.ButtonImageList.forEach(function (i) { _this.createArrayDataElement(i.ButtonKey, i.ButtonValue, 'data:' + i.FileContentType + ';base64,' + i.FileDataBase64); });
2775
- }
2776
- };
2777
- ListValueFieldTemplateComponent.prototype.createArrayDataElement = function (key, value, imgUrl) {
2778
- if (imgUrl === void 0) { imgUrl = null; }
2779
- var isOptionSelected;
2780
- if (this.field.IsMultiChoiche && this.record[this.field.Name] && this.record[this.field.Name].length > 0) {
2781
- isOptionSelected = !!this.record[this.field.Name].find(function (v) { return v == value; });
2782
- }
2783
- else {
2784
- isOptionSelected = this.record[this.field.Name] === value;
2785
- }
2786
- this.arrayData.push({ Key: key, Value: value, Selected: isOptionSelected, ImgUrl: imgUrl });
2787
- };
2788
- /**
2789
- * Metodo per aggiornare il valore e il validator del FormControl associato al campo.
2790
- */
2791
- ListValueFieldTemplateComponent.prototype.setFormControlValue = function () {
2792
- this.field.FormFormGroup.controls[this.field.Name].setValue(this.record[this.field.Name]);
2793
- };
2794
- __decorate([
2795
- Input()
2796
- ], ListValueFieldTemplateComponent.prototype, "field", void 0);
2797
- __decorate([
2798
- Input()
2799
- ], ListValueFieldTemplateComponent.prototype, "record", void 0);
2800
- __decorate([
2801
- Output()
2802
- ], ListValueFieldTemplateComponent.prototype, "recordChange", void 0);
2803
- ListValueFieldTemplateComponent = __decorate([
2804
- Component({
2805
- selector: 'list-value-field-template',
2806
- template: "<eqp-select *ngIf=\"field.PresentationMode == ListPresentationEnum['Combo box']\" [arrayData]=\"arrayData\"\r\n [arrayKeyProperty]=\"'Value'\" [showCancelButton]=\"!field.Required\" [arrayValueProperty]=\"'Key'\"\r\n [formGroupInput]=\"field.FormFormGroup\" [formControlNameInput]=\"field.Name\" [placeholder]=\"field.Label\"\r\n [includeFullObject]=\"false\" [isRequired]=\"field.Required\" [isDisabled]=\"field.FormFormGroup.disabled\"\r\n [(ngModelInput)]=\"record[field.Name]\" [isMultiSelect]=\"field.IsMultiChoiche\"\r\n (ngModelInputChange)=\"onRecordValueChange()\">\r\n</eqp-select>\r\n\r\n<div *ngIf=\"field.PresentationMode != ListPresentationEnum['Combo box']\" [formGroup]=\"field.FormFormGroup\">\r\n\r\n <mat-label class=\"mr-3\"> {{field.Label + (field.Required ? \" *\" : \"\")}} </mat-label>\r\n\r\n <!-- VISUALIZZAZIONE A RADIO BUTTON (SENZA SELEZIONE MULTIPLA) -->\r\n <mat-radio-group *ngIf=\"field.PresentationMode == ListPresentationEnum['Radio button'] && !field.IsMultiChoiche\"\r\n [formControlName]=\"field.Name\" [disabled]=\"field.FormFormGroup.disabled\" [required]=\"field.Required\"\r\n [(ngModel)]=\"record[field.Name]\" (ngModelChange)=\"onRecordValueChange()\">\r\n <mat-radio-button class=\"mr-2\" *ngFor=\"let data of arrayData\" [value]=\"data.Value\" color=\"primary\">\r\n {{data.Key}}\r\n </mat-radio-button>\r\n </mat-radio-group>\r\n\r\n <!-- VISUALIZZAZIONE A CHECKBOX (SELEZIONE MULTIPLA) -->\r\n <div class=\"d-inline-block\"\r\n *ngIf=\"field.PresentationMode == ListPresentationEnum['Radio button'] && field.IsMultiChoiche\">\r\n <mat-checkbox class=\"mr-2\" *ngFor=\"let data of arrayData\" [disabled]=\"field.FormFormGroup.disabled\"\r\n [formControlName]=\"field.Name\" [(ngModel)]=\"data.Selected\" (ngModelChange)=\"updateSelected()\">\r\n {{data.Key}}\r\n </mat-checkbox>\r\n </div>\r\n\r\n <!-- VISUALIZZAZIONE A PULSANTI (CON TESTO O IMMAGINI) -->\r\n <div class=\"d-inline-block\"\r\n *ngIf=\"[ListPresentationEnum['Pulsante con testo'], ListPresentationEnum.Immagini].includes(field.PresentationMode)\">\r\n <button mat-raised-button color=\"primary\" class=\"btn btn-primary m-1 data-button\" *ngFor=\"let data of arrayData\"\r\n [ngClass]=\"{'selected-button': data.Selected == true, 'p-0': field.PresentationMode == ListPresentationEnum.Immagini}\"\r\n (click)=\"buttonSelectClick(data)\" [disabled]=\"field.FormFormGroup.disabled\">\r\n\r\n <!-- TESTO DEL PULSANTE -->\r\n <span *ngIf=\"field.PresentationMode == ListPresentationEnum['Pulsante con testo']\"> {{data.Key}}</span>\r\n\r\n <!-- IMMAGINE DEL PULSANTE -->\r\n <img *ngIf=\"field.PresentationMode == ListPresentationEnum.Immagini\" [src]=\"data.ImgUrl\">\r\n </button>\r\n </div>\r\n\r\n</div>",
2807
- styles: [".selected-button{opacity:.7}.selected-button:disabled{background-color:var(--primary)!important;opacity:.3;color:#fff}.data-button img{max-height:300px;max-width:300px}"]
2808
- })
2809
- ], ListValueFieldTemplateComponent);
2810
- return ListValueFieldTemplateComponent;
2811
- }());
2812
-
2813
- var AttachmentFieldTemplateComponent = /** @class */ (function () {
2814
- function AttachmentFieldTemplateComponent(utilityService, cdr) {
2815
- this.utilityService = utilityService;
2816
- this.cdr = cdr;
2817
- this.onlyImages = false;
2818
- this.recordChange = new EventEmitter();
2819
- this.onAttachmentsChange = new EventEmitter();
2820
- this.metadataFormGroups = new Array();
2821
- }
2822
- AttachmentFieldTemplateComponent.prototype.ngOnInit = function () {
2823
- // Nel caso in cui sono in modifica di un Record aggiorno il valore
2824
- // e il validator del FormControl. Se non viene eseguita questa riga
2825
- // l'utente deve modificare la selezione fatta per aggiornare la form.
2826
- this.setFormControlValue();
2827
- // Sempre nel caso in cui sono in modifica creo i FormGroup che rappresentano
2828
- // gli eventuali metadata degli allegati recuperati.
2829
- this.createMetadataFormGroups();
2830
- if (this.field.MetadataFields) {
2831
- this.field.MetadataFields.sort(function (a, b) { return (a.OrdinalPosition > b.OrdinalPosition) ? 1 : ((b.OrdinalPosition > a.OrdinalPosition) ? -1 : 0); });
2832
- }
2833
- if (!this.field.AllowedExtensions) {
2834
- this.field.AllowedExtensions = AvailableFileExtensions.concat(AvailableImageExtensions).map(function (ext) { return ext.key; });
2835
- }
2836
- };
2837
- AttachmentFieldTemplateComponent.prototype.ngAfterViewInit = function () {
2838
- // Dopo aver renderizzato il DOM, se il campo ammette molteplici allegati
2839
- // configuro le colonne della eqp-table in eqp-attachments.
2840
- if (this.field.IsMultiAttach) {
2841
- this.configureMultiAttachmentColumns();
2842
- }
2843
- };
2844
- AttachmentFieldTemplateComponent.prototype.ngOnChanges = function (changes) {
2845
- // Se viene modificato il valore di "ngModelInput" allora aggiorna l'input
2846
- if (changes['record'] != undefined && changes['record'].firstChange == false && JSON.stringify(changes['record'].currentValue) != JSON.stringify(changes['record'].previousValue)) {
2847
- this.record = changes['record'].currentValue;
2848
- this.updateField();
2849
- }
2850
- };
2851
- /**
2852
- * Metodo per aggiornare il valore del campo quando questo è rappresentato da una formula.
2853
- */
2854
- AttachmentFieldTemplateComponent.prototype.updateField = function () {
2855
- if (this.field.Formula) {
2856
- this.record[this.field.Name] = UtilityHelperService.EvaluateFieldFormula(this.field.Formula, this.record, null);
2857
- }
2858
- };
2859
- /**
2860
- * Metodo per intercettare le modifiche agli allegati caricati.
2861
- * Se il campo prevede dei metadata allora per ogni allegato caricato crea un FormGroup
2862
- * per gestire la validazione degli input che l'utente può/deve riempire. I FormGroup
2863
- * seguono lo stesso ordine degli allegati caricati.
2864
- * @param event Contiene la lista aggiornata degli Attachment caricati dall'utente.
2865
- */
2866
- AttachmentFieldTemplateComponent.prototype.catchAttachmentList = function (event) {
2867
- this.record[this.field.Name] = event;
2868
- this.createMetadataFormGroups();
2869
- this.setFormControlValue();
2870
- this.onRecordValueChange();
2871
- // Scateno un evento di output necessario al componente ImageFieldTemplate al
2872
- // variare degli allegati caricati. Viene usato per aprire il dialog per disegnare
2873
- // sull'immagine caricata in base alla configurazione del Field.
2874
- this.onAttachmentsChange.emit();
2875
- this.cdr.detectChanges();
2876
- };
2877
- /**
2878
- * Metodo per aggiornare lo stato di validazione del FormControl che rappresenta
2879
- * il campo Allegato (non i metadata al suo interno). Se tra le form dei metadata
2880
- * ne trova una invalida allora marca il controllo come invalido.
2881
- */
2882
- AttachmentFieldTemplateComponent.prototype.updateMetadataValidity = function () {
2883
- if (this.metadataFormGroups.find(function (form) { return form.invalid; })) {
2884
- this.field.FormFormGroup.controls[this.field.Name].setErrors({ 'incorrect': true });
2885
- }
2886
- else {
2887
- this.field.FormFormGroup.controls[this.field.Name].setErrors(null);
2888
- }
2889
- this.onRecordValueChange();
2890
- };
2891
- /**
2892
- * Metodo per recuperare il BaseField che rappresenta il metadata nella riga della eqp-table
2893
- * in base alla colonna e alla riga. Una volta trovato il BaseField gli viene associato il
2894
- * FormGroup di cui fa parte.
2895
- * @param col Colonna della eqp-table.
2896
- * @param row Riga della eqp-table (in questo caso eredita da IAttachment).
2897
- * @returns Restituisce un BaseField per renderizzare il campo nella eqp-table degli allegati multipli.
2898
- */
2899
- AttachmentFieldTemplateComponent.prototype.getFieldFromMetadata = function (col, row) {
2900
- var baseField = JSON.parse(JSON.stringify(this.field.MetadataFields.find(function (metadata) { return metadata.Name === col.key; })));
2901
- baseField.FormFormGroup = this.metadataFormGroups[this.record[this.field.Name].indexOf(row)];
2902
- return baseField;
2903
- };
2904
- /**
2905
- * Metodo per aggiornare il valore e il validator del FormControl associato al campo.
2906
- */
2907
- AttachmentFieldTemplateComponent.prototype.setFormControlValue = function () {
2908
- this.field.FormFormGroup.controls[this.field.Name].setValue(this.record[this.field.Name]);
2909
- };
2910
- /**
2911
- * Metodo per emettere l'evento che il valore del record è cambiato.
2912
- */
2913
- AttachmentFieldTemplateComponent.prototype.onRecordValueChange = function () {
2914
- if (!this.field.Formula) {
2915
- this.recordChange.emit(this.record);
2916
- }
2917
- };
2918
- /**
2919
- * Metodo per aggiungere alle colonne di eqp-attachments le colonne per modificare i metadata
2920
- * configurati per il campo Allegato o Immagine.
2921
- */
2922
- AttachmentFieldTemplateComponent.prototype.configureMultiAttachmentColumns = function () {
2923
- var _this = this;
2924
- if (this.eqpAttachments && this.eqpAttachments.attachmentsColumns && this.field.MetadataFields && this.field.MetadataFields.length > 0) {
2925
- this.field.MetadataFields.forEach(function (metadata) {
2926
- _this.eqpAttachments.attachmentsColumns.splice(_this.eqpAttachments.attachmentsColumns.length - 1, 0, { key: metadata.Name, display: metadata.Label, type: TypeColumn.ExternalTemplate, externalTemplate: _this.metadataColumnTemplate });
2927
- });
2928
- }
2929
- };
2930
- /**
2931
- * Metodo per creare i FormGroup che rappresentano i metadata degli allegati caricati.
2932
- */
2933
- AttachmentFieldTemplateComponent.prototype.createMetadataFormGroups = function () {
2934
- var _this = this;
2935
- if (this.field.MetadataFields && this.field.MetadataFields.length > 0) {
2936
- this.metadataFormGroups = [];
2937
- if (this.record[this.field.Name] && this.record[this.field.Name].length > 0) {
2938
- this.record[this.field.Name].forEach(function (attachment) {
2939
- _this.metadataFormGroups.push(_this.utilityService.CreateFormFormGroup(_this.field.MetadataFields, attachment, _this.field.FormFormGroup.disabled, !_this.field.IsMultiAttach));
2940
- });
2941
- }
2942
- this.updateMetadataValidity();
2943
- }
2944
- };
2945
- AttachmentFieldTemplateComponent.ctorParameters = function () { return [
2946
- { type: UtilityHelperService },
2947
- { type: ChangeDetectorRef }
2948
- ]; };
2949
- __decorate([
2950
- Input()
2951
- ], AttachmentFieldTemplateComponent.prototype, "onlyImages", void 0);
2952
- __decorate([
2953
- Input()
2954
- ], AttachmentFieldTemplateComponent.prototype, "field", void 0);
2955
- __decorate([
2956
- Input()
2957
- ], AttachmentFieldTemplateComponent.prototype, "record", void 0);
2958
- __decorate([
2959
- Output()
2960
- ], AttachmentFieldTemplateComponent.prototype, "recordChange", void 0);
2961
- __decorate([
2962
- Output()
2963
- ], AttachmentFieldTemplateComponent.prototype, "onAttachmentsChange", void 0);
2964
- __decorate([
2965
- ViewChild("eqpAttachments", { static: true })
2966
- ], AttachmentFieldTemplateComponent.prototype, "eqpAttachments", void 0);
2967
- __decorate([
2968
- ViewChild('metadataColumnTemplate', { static: true })
2969
- ], AttachmentFieldTemplateComponent.prototype, "metadataColumnTemplate", void 0);
2970
- AttachmentFieldTemplateComponent = __decorate([
2971
- Component({
2972
- selector: 'attachment-field-template',
2973
- template: "<p *ngIf=\"!field.IsMultiAttach\" class=\"mb-2\">\r\n {{field.Label + (field.Required ? \" *\" : \"\")}}\r\n</p>\r\n<div class=\"row\" *ngIf=\"!field.IsMultiAttach && record[field.Name] && record[field.Name][0]\">\r\n <div class=\"mt-2\" *ngFor=\"let metadata of field.MetadataFields\"\r\n [ngClass]=\"utilityService.getFieldSyleClass(metadata)\">\r\n <dynamic-module-field [field]=\"metadata\" [record]=\"record[field.Name][0]\"\r\n (recordChange)=\"updateMetadataValidity()\">\r\n </dynamic-module-field>\r\n </div>\r\n</div>\r\n\r\n<eqp-attachments [attachmentsList]=\"record[field.Name]\" [showMatCard]=\"true\" [allowOnlyImages]=\"onlyImages\"\r\n [isDisabled]=\"field.FormFormGroup.disabled\" [showInlinePreview]=\"true\" [multipleAttachment]=\"field.IsMultiAttach\"\r\n [disableAction]=\"field.FormFormGroup.disabled\" [acceptedFileTypes]=\"field.AllowedExtensions\" [showHeader]=\"true\"\r\n [headerTitle]=\"field.Label + (field.Required ? ' *' : '')\" (localEditedAttachments)=\"catchAttachmentList($event)\"\r\n #eqpAttachments>\r\n</eqp-attachments>\r\n\r\n<!-- TEMPLATE PER VISUALIZZARE LA COLONNA DELLA SEZIONE NELLA TABELLA DEI FIELDS -->\r\n<ng-template #metadataColumnTemplate let-row=\"row\" let-col=\"col\">\r\n <dynamic-module-field [field]=\"getFieldFromMetadata(col, row)\" [record]=\"row\"\r\n (recordChange)=\"updateMetadataValidity()\">\r\n </dynamic-module-field>\r\n</ng-template>",
2974
- styles: [""]
2975
- })
2976
- ], AttachmentFieldTemplateComponent);
2977
- return AttachmentFieldTemplateComponent;
2978
- }());
2979
-
2980
- /**
2981
- * Metodo per recuperare, a partire da un Blob, la stringa contenente il base64 del file.
2982
- * Usato per prendere il base64 dell'immagine dopo che l'utente ci ha disegnato sopra.
2983
- * @param file Blob che rappresenta l'immagine.
2984
- */
2985
- var toBase64 = function (file) { return new Promise(function (resolve, reject) {
2986
- var reader = new FileReader();
2987
- reader.readAsDataURL(file);
2988
- reader.onload = function () { return resolve(reader.result.toString()); };
2989
- reader.onerror = function (error) { return reject(error); };
2990
- }); };
2991
- var ɵ0 = toBase64;
2992
- var ImageFieldTemplateComponent = /** @class */ (function () {
2993
- //#endregion
2994
- function ImageFieldTemplateComponent(dialog, utilityService) {
2995
- this.dialog = dialog;
2996
- this.utilityService = utilityService;
2997
- this.recordChange = new EventEmitter();
2998
- //#region Proprietà per configurare il componente ngx-image-drawing e aprire il relativo dialog.
2999
- this.width = null;
3000
- this.height = null;
3001
- this.i18n = {
3002
- saveBtn: 'Salva modifiche',
3003
- cancelBtn: 'Ricarica originale'
3004
- };
3005
- }
3006
- ImageFieldTemplateComponent.prototype.ngOnInit = function () {
3007
- this.field.AttachDefinition.FormFormGroup = this.field.FormFormGroup;
3008
- if (!this.field.AttachDefinition.AllowedExtensions) {
3009
- this.field.AttachDefinition.AllowedExtensions = AvailableImageExtensions.map(function (ext) { return ext.key; });
3010
- }
3011
- this.field.AttachDefinition.Name = this.field.Name;
3012
- this.field.AttachDefinition.Label = this.field.Label;
3013
- this.field.AttachDefinition.Description = this.field.Description;
3014
- this.field.AttachDefinition.Required = this.field.Required;
3015
- this.field.AttachDefinition.Formula = this.field.Formula;
3016
- this.field.AttachDefinition.FieldValue = this.field.FieldValue;
3017
- // Se il campo prevede un'immagine pre-caricata (ImageIsContextualAttachment == true) sulla quale
3018
- // l'utente può disegnare (EnableDrawing == true) e non sono in modifica di un record (ovvero nel record
3019
- // non ho un'immagine già salvata) allora imposta l'immagine pre caricata come valore iniziale
3020
- // nel record corrente e ne recupera le dimensioni per visualizzare correttamente l'area in cui
3021
- // l'utente può disegnare. Se non effettua modifiche o non salva i disegni fatti viene salvata
3022
- // l'immagine originale.
3023
- if (this.field.ImageIsContextualAttachment && this.field.ContextualAttachment) {
3024
- if (!this.record[this.field.Name] || !Array.isArray(this.record[this.field.Name]) || !(this.record[this.field.Name].length > 0)) {
3025
- this.record[this.field.Name] = [JSON.parse(JSON.stringify(this.field.ContextualAttachment))];
3026
- }
3027
- this.preLoadedImageMetadataFormGroup = this.utilityService.CreateFormFormGroup(this.field.AttachDefinition.MetadataFields, this.record[this.field.Name][0]);
3028
- this.getImageDimensions();
3029
- }
3030
- };
3031
- ImageFieldTemplateComponent.prototype.ngOnChanges = function (changes) {
3032
- // Se viene modificato il valore di "ngModelInput" allora aggiorna l'input
3033
- if (changes['record'] != undefined && changes['record'].firstChange == false && JSON.stringify(changes['record'].currentValue) != JSON.stringify(changes['record'].previousValue)) {
3034
- this.record = changes['record'].currentValue;
3035
- this.updateField();
3036
- }
3037
- };
3038
- ImageFieldTemplateComponent.prototype.updateMetadataValidity = function () {
3039
- if (this.preLoadedImageMetadataFormGroup.invalid) {
3040
- this.field.FormFormGroup.controls[this.field.Name].setErrors({ 'incorrect': true });
3041
- }
3042
- else {
3043
- this.field.FormFormGroup.controls[this.field.Name].setErrors(null);
3044
- }
3045
- this.onRecordValueChange();
3046
- };
3047
- /**
3048
- * Metodo per aggiornare il valore del campo quando questo è rappresentato da una formula.
3049
- */
3050
- ImageFieldTemplateComponent.prototype.updateField = function () {
3051
- if (this.field.Formula) {
3052
- this.record[this.field.Name] = UtilityHelperService.EvaluateFieldFormula(this.field.Formula, this.record, null);
3053
- }
3054
- };
3055
- ImageFieldTemplateComponent.prototype.resetPreLoadedImage = function () {
3056
- this.width = null;
3057
- this.height = null;
3058
- this.record[this.field.Name] = [JSON.parse(JSON.stringify(this.field.ContextualAttachment))];
3059
- this.getImageDimensions();
3060
- };
3061
- /**
3062
- * Metodo invocato quando vengono aggiunti o eliminati gli allegati nel componente AttachmentFieldTemplate.
3063
- * Se l'ImageField è abilitato al disegno (EnableDrawing == true), non permette allegati multipli (IsMulitAttach == false)
3064
- * e nel Record corrente è presente l'immagine caricata dall'utente allora recupera le dimensioni dell'immagine e
3065
- * apre il dialog con il componente image-drawing per permettere il disegno sull'immagine appena caricata.
3066
- */
3067
- ImageFieldTemplateComponent.prototype.onAttachmentsChange = function () {
3068
- if (!this.field.AttachDefinition.IsMultiAttach && this.field.EnableDrawing && this.record[this.field.Name] && this.record[this.field.Name][0]) {
3069
- this.getImageDimensions();
3070
- this.dialogImageDrowingRef = this.dialog.open(this.dialogImageDrowing, {
3071
- disableClose: true,
3072
- hasBackdrop: true,
3073
- width: '75%'
3074
- });
3075
- }
3076
- };
3077
- /**
3078
- * Metodo invocato al salvataggio dell'immagine dal componente image-drawing.
3079
- * Trasforma il Blob ricevuto in un base64, aggiorna il FileContetType e il FileDataBase64
3080
- * dell'allegato caricato e chiude il dialog in cui disegnare.
3081
- * @param drawnPicture Blob dell'immagine disegnata.
3082
- */
3083
- ImageFieldTemplateComponent.prototype.saveDrowning = function (drawnPicture) {
3084
- return __awaiter(this, void 0, void 0, function () {
3085
- var base64File;
3086
- return __generator(this, function (_a) {
3087
- switch (_a.label) {
3088
- case 0: return [4 /*yield*/, toBase64(drawnPicture)];
3089
- case 1:
3090
- base64File = _a.sent();
3091
- if (base64File) {
3092
- this.record[this.field.Name][0].FileContentType = base64File.split(",")[0].split(":")[1].split(";")[0];
3093
- this.record[this.field.Name][0].FileDataBase64 = base64File.split(",")[1];
3094
- }
3095
- if (this.dialogImageDrowingRef) {
3096
- this.closeImageDrowingDialog();
3097
- }
3098
- return [2 /*return*/];
3099
- }
3100
- });
3101
- });
3102
- };
3103
- /**
3104
- * Metodo per chiudere il dialog in cui disegnare sull'immagine cariata e svuotare le dimensioni.
3105
- */
3106
- ImageFieldTemplateComponent.prototype.closeImageDrowingDialog = function () {
3107
- this.dialogImageDrowingRef.close();
3108
- this.width = null;
3109
- this.height = null;
3110
- };
3111
- /**
3112
- * Metodo per recuperare le dimensioni dell'immagine caricata per mostrare correttamente
3113
- * il componente image-drawing. Se non viene eseguito questo passaggio l'area in cui disegnare
3114
- * è più grande dell'immagine stessa e al salvataggio i tratti disegnati vengono spostati.
3115
- */
3116
- ImageFieldTemplateComponent.prototype.getImageDimensions = function () {
3117
- var _this = this;
3118
- var blob = this.getBlobFromBase64();
3119
- var reader = new FileReader();
3120
- reader.onload = function (e) {
3121
- var image = new Image();
3122
- image.src = e.target.result;
3123
- image.onload = function (rs) {
3124
- _this.height = rs.currentTarget['height'];
3125
- _this.width = rs.currentTarget['width'];
3126
- };
3127
- };
3128
- reader.readAsDataURL(blob);
3129
- };
3130
- /**
3131
- * Metodo per convertire il base64 di un'immagine in un Blob.
3132
- * Necessario per il recupero delle dimensioni dell'immagine caricata a partire dal suo base64.
3133
- * Viene eseguito solo nel caso in cui l'ImageField non ammette allegati multipli.
3134
- * @returns Restituisce il Blob dell'immagine caricata.
3135
- */
3136
- ImageFieldTemplateComponent.prototype.getBlobFromBase64 = function () {
3137
- var byteCharacters = atob(this.record[this.field.Name][0].FileDataBase64);
3138
- var byteNumbers = new Array(byteCharacters.length);
3139
- for (var i = 0; i < byteCharacters.length; i++) {
3140
- byteNumbers[i] = byteCharacters.charCodeAt(i);
3141
- }
3142
- var byteArray = new Uint8Array(byteNumbers);
3143
- return new Blob([byteArray], { type: this.record[this.field.Name][0].FileContentType });
3144
- };
3145
- /**
3146
- * Metodo per emettere l'evento che il valore del record è cambiato.
3147
- */
3148
- ImageFieldTemplateComponent.prototype.onRecordValueChange = function () {
3149
- if (!this.field.Formula) {
3150
- this.recordChange.emit(this.record);
3151
- }
3152
- };
3153
- ImageFieldTemplateComponent.ctorParameters = function () { return [
3154
- { type: MatDialog },
3155
- { type: UtilityHelperService }
3156
- ]; };
3157
- __decorate([
3158
- Input()
3159
- ], ImageFieldTemplateComponent.prototype, "record", void 0);
3160
- __decorate([
3161
- Input()
3162
- ], ImageFieldTemplateComponent.prototype, "field", void 0);
3163
- __decorate([
3164
- Output()
3165
- ], ImageFieldTemplateComponent.prototype, "recordChange", void 0);
3166
- __decorate([
3167
- ViewChild("dialogImageDrowing", { static: true })
3168
- ], ImageFieldTemplateComponent.prototype, "dialogImageDrowing", void 0);
3169
- ImageFieldTemplateComponent = __decorate([
3170
- Component({
3171
- selector: 'image-field-template',
3172
- template: "<!-- VISUALIZZAZIONE ALLEGATO PRE CARICATO CON POSSIBILITA' DI DISEGNO -->\r\n<div class=\"row\" *ngIf=\"field.ImageIsContextualAttachment && field.ContextualAttachment\">\r\n <div class=\"col-sm-12 col-md-6 col-lg-4\">\r\n <p class=\"mb-2\">\r\n {{ field.Label + (field.Required ? \" *\" : \"\")}}\r\n <br>\r\n Nome immagine: {{ field.ImgName}}\r\n </p>\r\n <eqp-img-drawing\r\n *ngIf=\"field.EnableDrawing && record[field.Name] && record[field.Name][0] && width != null && height != null\"\r\n [src]=\"'data:'+ record[field.Name][0].FileContentType + ';base64,'+ record[field.Name][0].FileDataBase64\"\r\n [showCancelButton]=\"false\" [enableLoadAnotherImage]=\"false\" [enableRemoveImage]=\"false\" [width]=\"width\"\r\n [height]=\"height\" [i18n]=\"i18n\" [showCancelButton]=\"true\" (save)=\"saveDrowning($event)\"\r\n (cancel)=\"resetPreLoadedImage()\">\r\n </eqp-img-drawing>\r\n\r\n <img *ngIf=\"!field.EnableDrawing\"\r\n [src]=\"'data:'+ record[field.Name][0].FileContentType+ ';base64,'+ record[field.Name][0].FileDataBase64\">\r\n </div>\r\n\r\n <div class=\"col-sm-12 col-md-6 col-lg-8\">\r\n <div class=\"row\"\r\n *ngIf=\"field.AttachDefinition && field.AttachDefinition.MetadataFields && preLoadedImageMetadataFormGroup\">\r\n <div class=\"mt-2\" *ngFor=\"let metadata of field.AttachDefinition.MetadataFields\"\r\n [ngClass]=\"utilityService.getFieldSyleClass(metadata)\">\r\n <dynamic-module-field #fieldTemplate [field]=\"metadata\" [form]=\"preLoadedImageMetadataFormGroup\"\r\n [record]=\"record[field.Name][0]\" (recordChange)=\"updateMetadataValidity()\">\r\n </dynamic-module-field>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n<!-- COMPONENTE IN CUI CARICARE NUOVI ALLEGATI -->\r\n<attachment-field-template [(record)]=\"record\" [field]=\"field.AttachDefinition\" [onlyImages]=\"true\"\r\n (onAttachmentsChange)=\"onAttachmentsChange()\" *ngIf=\"!field.ImageIsContextualAttachment\">\r\n</attachment-field-template>\r\n\r\n<!-- DIALOG PER DISEGNARE SUL NUOVO ALLEGATO CARICATO -->\r\n<ng-template #dialogImageDrowing>\r\n <div *ngIf=\"field.EnableDrawing && record[field.Name] && record[field.Name][0] && width != null && height != null\"\r\n class=\"row\">\r\n <div class=\"col-sm-12 col-md-12\">\r\n <eqp-img-drawing [showCancelButton]=\"false\" [enableLoadAnotherImage]=\"false\" [enableRemoveImage]=\"false\"\r\n [src]=\"'data:'+ record[field.Name][0].FileContentType + ';base64,'+ record[field.Name][0].FileDataBase64\"\r\n [i18n]=\"i18n\" [showCancelButton]=\"false\" (save)=\"saveDrowning($event)\">\r\n </eqp-img-drawing>\r\n </div>\r\n </div>\r\n <div class=\"row mt-2 mb-1\">\r\n <div class=\"col-sm-12 text-right\">\r\n <button class=\"btn mat-raised-button\" (click)=\"closeImageDrowingDialog()\" type=\"button\">\r\n Annulla disegno\r\n </button>\r\n </div>\r\n </div>\r\n</ng-template>",
3173
- styles: ["::ng-deep image-drawing>button{background-color:var(--primary)!important;color:#fff!important}"]
3174
- })
3175
- ], ImageFieldTemplateComponent);
3176
- return ImageFieldTemplateComponent;
3177
- }());
3178
-
3179
- var ListFormRecordComponent = /** @class */ (function () {
3180
- function ListFormRecordComponent() {
3181
- this.showTitle = true;
3182
- this.columns = new Array();
3183
- this.onAddViewEditRecord = new EventEmitter();
3184
- this.onDeleteRecord = new EventEmitter();
3185
- this.onDuplicateRecord = new EventEmitter();
3186
- }
3187
- ListFormRecordComponent.prototype.ngOnInit = function () {
3188
- this.configureColumns();
3189
- };
3190
- ListFormRecordComponent.prototype.ngOnChanges = function (changes) {
3191
- // Se viene modificato il valore di "ngModelInput" allora aggiorna l'input
3192
- if (changes['values'] != undefined && changes['values'].firstChange == false) {
3193
- this.values = changes['values'].currentValue;
3194
- this.reloadTables();
3195
- }
3196
- };
3197
- /**
3198
- * Metodo per configurare le colonne della eqp-table.
3199
- */
3200
- ListFormRecordComponent.prototype.configureColumns = function () {
3201
- var _this = this;
3202
- this.columns = [
3203
- {
3204
- key: "action", display: "",
3205
- type: TypeColumn.MenuAction, buttonMenuIcon: "more_vert", styles: { flex: "0 0 6%" },
3206
- actions: [
3207
- { name: "Visualizza", icon: "info", fn: function (element, index, col) { return _this.viewOrEditRecord(element, true); } },
3208
- { name: "Modifica", icon: "edit", fn: function (element, index, col) { return _this.viewOrEditRecord(element, false); } },
3209
- { name: "Duplica", icon: "file_copy", fn: function (element, index, col) { return _this.duplicateRecord(element); } },
3210
- { name: "Elimina", icon: "delete", fn: function (element, index, col) { return _this.deleteRecord(element); } },
3211
- ],
3212
- },
3213
- ];
3214
- this.createAdditionalActions();
3215
- this.createColumnsFromFormFields();
3216
- };
3217
- /**
3218
- * Metodo per aggiungere nella colonna "action" della eqp-table le azioni sui record
3219
- * definite dall'utente all'interno della Form.
3220
- */
3221
- ListFormRecordComponent.prototype.createAdditionalActions = function () {
3222
- var _this = this;
3223
- if (this.form.ActionsOnRecord && this.form.ActionsOnRecord.length > 0) {
3224
- this.form.ActionsOnRecord
3225
- .sort(function (a, b) { return (a.OrdinalPosition > b.OrdinalPosition) ? 1 : ((b.OrdinalPosition > a.OrdinalPosition) ? -1 : 0); })
3226
- .forEach(function (action) {
3227
- _this.columns.find(function (c) { return c.key === 'action'; })
3228
- .actions
3229
- .push({
3230
- name: action.Name, icon: action.Icon, fn: function (element, index, col) {
3231
- var rec = element;
3232
- var ctx = UtilityHelperService.context;
3233
- eval(action.Action);
3234
- // TODO: salvare le modifiche
3235
- }
3236
- });
3237
- });
3238
- }
3239
- };
3240
- /**
3241
- * Metodo che scatena l'evento di Output per mostrare o modificare il record
3242
- * selezionato sulla eqp-table.
3243
- * @param record Record da visualizzare o modificare selezionato sulla eqp-table.
3244
- * @param onlyView Se TRUE viene mostrato il componente add-form-record in sola lettura.
3245
- */
3246
- ListFormRecordComponent.prototype.viewOrEditRecord = function (record, onlyView) {
3247
- this.onAddViewEditRecord.emit({ record: record, onlyView: onlyView });
3248
- };
3249
- /**
3250
- * Metodo per duplicare un record della form.
3251
- * @param record Record da duplicare.
3252
- */
3253
- ListFormRecordComponent.prototype.duplicateRecord = function (record) {
3254
- this.onDuplicateRecord.emit(record);
3255
- };
3256
- /**
3257
- * Metodo per eliminare un record dalla lista.
3258
- * @param record Record da eliminare selezionato sulla eqp-table.
3259
- */
3260
- ListFormRecordComponent.prototype.deleteRecord = function (record) {
3261
- this.onDeleteRecord.emit(record);
3262
- };
3263
- /**
3264
- * Metodo per creare la configurazione delle colonne per la eqp-table.
3265
- * Individua i BaseField da mostrare e li usa per creare le ConfigColumn.
3266
- * Le colonne vengono create per i BaseField con il flag InListView a TRUE
3267
- * oppure, nel caso non siano stati specificati i campi da visualizzare,
3268
- * seleziona i primi 6.
3269
- */
3270
- ListFormRecordComponent.prototype.createColumnsFromFormFields = function () {
3271
- var _this = this;
3272
- var fieldsForColumns;
3273
- if (this.form.Fields.find(function (f) { return f.InListView; })) {
3274
- fieldsForColumns = this.form.Fields.filter(function (f) { return f.InListView; });
3275
- }
3276
- else {
3277
- fieldsForColumns = this.form.Fields.filter(function (f) { return f.OrdinalPosition < 6; });
3278
- }
3279
- fieldsForColumns.sort(function (a, b) { return (a.OrdinalPosition > b.OrdinalPosition) ? 1 : ((b.OrdinalPosition > a.OrdinalPosition) ? -1 : 0); })
3280
- .forEach(function (field) {
3281
- _this.columns.push(_this.createFieldColumn(field));
3282
- });
3283
- };
3284
- /**
3285
- * Metodo per creare l'oggetto ConfigureColumn che rappresenta il BaseField passato in input.
3286
- * @param field BaseField per cui creare la colonna nella eqp-table
3287
- * @returns Restituisce una ConfigColumn per la eqp-table
3288
- */
3289
- ListFormRecordComponent.prototype.createFieldColumn = function (field) {
3290
- var column = { key: field.Name, display: field.Label };
3291
- switch (field.FieldType) {
3292
- case FieldTypeEnum['Booleano']:
3293
- column.type = TypeColumn.Boolean;
3294
- column.booleanValues = { false: '<i class="fa fa-times error-color"></i>', true: '<i class="fa fa-check success-color"></i>' };
3295
- column.styles = { flex: "0 0 7%", cellAlignment: CellAlignmentEnum.CENTER };
3296
- break;
3297
- case FieldTypeEnum['Data e/o ora']:
3298
- if (field.IsOnlyDate != DateTimeTypeEnum['Solo orario']) {
3299
- column.type = TypeColumn.Date;
3300
- if (field.IsOnlyDate == DateTimeTypeEnum['Data e ora']) {
3301
- column.format = "dd/MM/yyyy HH:mm";
3302
- }
3303
- else if (field.IsOnlyDate == DateTimeTypeEnum['Solo data']) {
3304
- column.format = field.DateFormat ? field.DateFormat.replace("DD", "dd") : "dd/MM/yyyy";
3305
- }
3306
- }
3307
- break;
3308
- case FieldTypeEnum['Campo numerico']:
3309
- if (field.CurrencySymbol) {
3310
- column.numberPipe = NumberColumnPipe.CURRENCY;
3311
- column.currencyPipeCode = field.CurrencySymbol;
3312
- }
3313
- else if (!field.IsInteger) {
3314
- column.numberPipe = NumberColumnPipe.DECIMAL;
3315
- }
3316
- break;
3317
- case FieldTypeEnum['Allegato']:
3318
- case FieldTypeEnum['Immagine']:
3319
- column.value = function (element) {
3320
- if (field.IsMultiAttach || (field.AttachDefinition && field.AttachDefinition.IsMultiAttach)) {
3321
- return element[field.Name] != null && element[field.Name].length > 0 ? element[field.Name].map(function (a) { return a.FileName; }).join(", ") : null;
3322
- }
3323
- else {
3324
- return element[field.Name] != null && element[field.Name].length > 0 ? element[field.Name][0].FileName : null;
3325
- }
3326
- };
3327
- column.isSortable = false;
3328
- column.isSearchable = false;
3329
- break;
3330
- case FieldTypeEnum['Elenco generico']:
3331
- column.value = function (element) {
3332
- if (field.IsMultiChoiche) {
3333
- if (!element[field.Name] || element[field.Name].length == 0) {
3334
- return null;
3335
- }
3336
- else {
3337
- return Object.keys(field.ValuePairs).filter(function (k) { return element[field.Name].includes(field.ValuePairs[k]); }).join(", ");
3338
- }
3339
- }
3340
- else {
3341
- return Object.keys(field.ValuePairs).find(function (k) { return field.ValuePairs[k] == element[field.Name]; });
3342
- }
3343
- };
3344
- column.isSortable = false;
3345
- column.isSearchable = false;
3346
- break;
3347
- case FieldTypeEnum['Lookup']:
3348
- // TODO
3349
- break;
3350
- }
3351
- return column;
3352
- };
3353
- /**
3354
- * Metodo per ricaricare i dati della eqp-table.
3355
- */
3356
- ListFormRecordComponent.prototype.reloadTables = function () {
3357
- if (this.tableRecords) {
3358
- this.tableRecords.reloadDatatable();
3359
- }
3360
- };
3361
- __decorate([
3362
- Input()
3363
- ], ListFormRecordComponent.prototype, "showTitle", void 0);
3364
- __decorate([
3365
- Input()
3366
- ], ListFormRecordComponent.prototype, "form", void 0);
3367
- __decorate([
3368
- Input()
3369
- ], ListFormRecordComponent.prototype, "values", void 0);
3370
- __decorate([
3371
- ViewChild('tableRecords', { static: true })
3372
- ], ListFormRecordComponent.prototype, "tableRecords", void 0);
3373
- __decorate([
3374
- Output()
3375
- ], ListFormRecordComponent.prototype, "onAddViewEditRecord", void 0);
3376
- __decorate([
3377
- Output()
3378
- ], ListFormRecordComponent.prototype, "onDeleteRecord", void 0);
3379
- __decorate([
3380
- Output()
3381
- ], ListFormRecordComponent.prototype, "onDuplicateRecord", void 0);
3382
- ListFormRecordComponent = __decorate([
3383
- Component({
3384
- selector: 'list-form-record',
3385
- template: "<div class=\"row eqp-dynamic-module-title\">\r\n <div class=\"col-md-6\">\r\n <h4 *ngIf=\"showTitle\"><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>",
3386
- styles: ["::ng-deep .error-color{color:var(--danger)}::ng-deep .success-color{color:var(--success)}"]
3387
- })
3388
- ], ListFormRecordComponent);
3389
- return ListFormRecordComponent;
3390
- }());
3391
-
3392
- var AddFormRecordComponent = /** @class */ (function () {
3393
- function AddFormRecordComponent(cdr, utilityService) {
3394
- this.cdr = cdr;
3395
- this.utilityService = utilityService;
3396
- this.showTitle = true;
3397
- this.showButtons = true;
3398
- this.form = new Form();
3399
- this.fieldGroups = {};
3400
- this.FormScalarTypeEnum = FormScalarTypeEnum;
3401
- this.FieldTypeEnum = FieldTypeEnum;
3402
- this.saveRecordEvent = new EventEmitter();
3403
- }
3404
- AddFormRecordComponent.prototype.ngOnInit = function () {
3405
- if (this.record == null) {
3406
- this.record = new Record();
3407
- }
3408
- this.createRecordProperties();
3409
- this.reorderFormFields();
3410
- this.createFormGroup();
3411
- if (this.form.FormScalarType != FormScalarTypeEnum.Semplice) {
3412
- this.createFieldGroups();
3413
- }
3414
- this.cdr.detectChanges();
3415
- };
3416
- /**
3417
- * Metodo invocato al cambio del valore di ogni proprietà dell'oggetto record.
3418
- * Serve ad aggiornare il valore di tutti i campi che hanno una formula.
3419
- */
3420
- AddFormRecordComponent.prototype.onRecordChange = function () {
3421
- if (this.fieldTemplate && this.fieldTemplate.length > 0) {
3422
- this.fieldTemplate.forEach(function (f) { return f.updateField(); });
3423
- }
3424
- };
3425
- /**
3426
- * Metodo per salvare i dati inseriti dall'utente una volta conclusa la compilazione della form.
3427
- */
3428
- AddFormRecordComponent.prototype.saveOrExitForm = function (exit) {
3429
- if (exit) {
3430
- this.saveRecordEvent.emit(null);
3431
- }
3432
- else {
3433
- this.saveRecordEvent.emit(this.record);
3434
- }
3435
- };
3436
- /**
3437
- * Metodo per creare nell'oggetto Record le proprietà mancanti rispetto ai campi che compongono la form.
3438
- */
3439
- AddFormRecordComponent.prototype.createRecordProperties = function () {
3440
- var _this = this;
3441
- var recordProperties = Object.keys(this.record);
3442
- this.form.Fields.forEach(function (field) {
3443
- if (!recordProperties.find(function (p) { return p === field.Name; })) {
3444
- _this.record[field.Name] = null;
3445
- }
3446
- });
3447
- if (this.form.InnerForms && this.form.InnerForms.length > 0) {
3448
- this.form.InnerForms.forEach(function (form) {
3449
- var arrayName = form.Name.split(" ").join("_");
3450
- if (!recordProperties.find(function (p) { return p === arrayName; })) {
3451
- _this.record[arrayName] = [];
3452
- }
3453
- });
3454
- }
3455
- };
3456
- /**
3457
- * Metodo per riordinare i campi che compongono la form.
3458
- */
3459
- AddFormRecordComponent.prototype.reorderFormFields = function () {
3460
- if (this.form.Fields && this.form.Fields.length > 0) {
3461
- this.form.Fields.sort(function (a, b) { return (a.OrdinalPosition > b.OrdinalPosition) ? 1 : ((b.OrdinalPosition > a.OrdinalPosition) ? -1 : 0); });
3462
- }
3463
- };
3464
- /**
3465
- * Metodo per creare il FormGroup che rappresenta la form.
3466
- */
3467
- AddFormRecordComponent.prototype.createFormGroup = function () {
3468
- this.formForm = this.utilityService.CreateFormFormGroup(this.form.Fields, this.record, this.onlyView);
3469
- };
3470
- /**
3471
- * Metodo per creare i gruppi in cui raggruppare i campi della form in base
3472
- * a come è stata configurata dall'utente.
3473
- */
3474
- AddFormRecordComponent.prototype.createFieldGroups = function () {
3475
- var _this = this;
3476
- this.form.FormFieldsGroups
3477
- .sort(function (a, b) { return (a.OrdinalPosition > b.OrdinalPosition) ? 1 : ((b.OrdinalPosition > a.OrdinalPosition) ? -1 : 0); })
3478
- .map(function (g) { return g.Name; })
3479
- .forEach(function (groupName) {
3480
- _this.fieldGroups[groupName] = _this.form.Fields.filter(function (f) { return f.FieldGroup == groupName; });
3481
- });
3482
- };
3483
- AddFormRecordComponent.ctorParameters = function () { return [
3484
- { type: ChangeDetectorRef },
3485
- { type: UtilityHelperService }
3486
- ]; };
3487
- __decorate([
3488
- Input()
3489
- ], AddFormRecordComponent.prototype, "showTitle", void 0);
3490
- __decorate([
3491
- Input()
3492
- ], AddFormRecordComponent.prototype, "showButtons", void 0);
3493
- __decorate([
3494
- Input()
3495
- ], AddFormRecordComponent.prototype, "form", void 0);
3496
- __decorate([
3497
- Input()
3498
- ], AddFormRecordComponent.prototype, "record", void 0);
3499
- __decorate([
3500
- Input()
3501
- ], AddFormRecordComponent.prototype, "onlyView", void 0);
3502
- __decorate([
3503
- Output()
3504
- ], AddFormRecordComponent.prototype, "saveRecordEvent", void 0);
3505
- __decorate([
3506
- ViewChildren("fieldTemplate")
3507
- ], AddFormRecordComponent.prototype, "fieldTemplate", void 0);
3508
- AddFormRecordComponent = __decorate([
3509
- Component({
3510
- selector: 'add-form-record',
3511
- template: "<div class=\"row eqp-dynamic-module-title\" *ngIf=\"showTitle\">\r\n <div class=\"col-md-12\">\r\n <h4><b>{{form.Name}}</b></h4>\r\n </div>\r\n</div>\r\n\r\n<form [formGroup]=\"formForm\">\r\n\r\n <!-- VISUALIZZAZIONE SEMPLICE -->\r\n <ng-container *ngIf=\"form.FormScalarType == FormScalarTypeEnum.Semplice\" [ngTemplateOutlet]=\"fieldTemplates\"\r\n [ngTemplateOutletContext]=\"{ fields: form.Fields }\">\r\n </ng-container>\r\n\r\n <!-- VISUALIZZAZIONE A STEPPER -->\r\n <mat-horizontal-stepper linear *ngIf=\"form.FormScalarType == FormScalarTypeEnum['A step']\">\r\n <mat-step *ngFor=\"let group of form.FormFieldsGroups\">\r\n <ng-template matStepLabel>\r\n {{group.Name}}\r\n </ng-template>\r\n\r\n <ng-container [ngTemplateOutlet]=\"fieldTemplates\"\r\n [ngTemplateOutletContext]=\"{ fields: fieldGroups[group.Name] }\">\r\n </ng-container>\r\n </mat-step>\r\n </mat-horizontal-stepper>\r\n\r\n <!-- VISUALIZZAZIONE A TAB -->\r\n <mat-tab-group *ngIf=\"form.FormScalarType == FormScalarTypeEnum['In tab']\">\r\n <mat-tab *ngFor=\"let group of form.FormFieldsGroups\" [label]=\"group.Name\">\r\n <div class=\"mt-3\">\r\n <ng-container [ngTemplateOutlet]=\"fieldTemplates\"\r\n [ngTemplateOutletContext]=\"{ fields: fieldGroups[group.Name] }\">\r\n </ng-container>\r\n </div>\r\n </mat-tab>\r\n </mat-tab-group>\r\n\r\n <!-- VISUALIZZAZIONE AD ACCORDION -->\r\n <mat-accordion multi *ngIf=\"form.FormScalarType == FormScalarTypeEnum['In accordion']\">\r\n <mat-expansion-panel *ngFor=\"let group of form.FormFieldsGroups\">\r\n <mat-expansion-panel-header>\r\n <mat-panel-title>\r\n {{group.Name}}\r\n </mat-panel-title>\r\n </mat-expansion-panel-header>\r\n\r\n <ng-container [ngTemplateOutlet]=\"fieldTemplates\"\r\n [ngTemplateOutletContext]=\"{ fields: fieldGroups[group.Name] }\">\r\n </ng-container>\r\n </mat-expansion-panel>\r\n </mat-accordion>\r\n</form>\r\n\r\n<div class=\"row mt-2\" *ngIf=\"showButtons\">\r\n <div class=\"col-sm-12 text-right\">\r\n <button class=\"mr-2\" mat-raised-button (click)=\"saveOrExitForm(true)\" type=\"button\">\r\n Annulla\r\n </button>\r\n <button class=\"mr-2\" mat-raised-button color=\"primary\" (click)=\"saveOrExitForm(false)\"\r\n [disabled]=\"formForm.invalid || formForm.disabled\" type=\"button\">\r\n Salva\r\n </button>\r\n </div>\r\n</div>\r\n\r\n<!-- TEMPLATE PER LA VISUALIZZAZIONE DEI CAMPI DELLA FORM -->\r\n<ng-template #fieldTemplates let-fields='fields'>\r\n <div class=\"row\">\r\n <div class=\"mt-2\" *ngFor=\"let field of fields\" [ngClass]=\"utilityService.getFieldSyleClass(field)\">\r\n <dynamic-module-field #fieldTemplate [field]=\"field\" [form]=\"form\" [record]=\"record\"\r\n (recordChange)=\"onRecordChange()\"></dynamic-module-field>\r\n </div>\r\n </div>\r\n</ng-template>",
3512
- styles: [""]
3513
- })
3514
- ], AddFormRecordComponent);
3515
- return AddFormRecordComponent;
3516
- }());
3517
-
3518
- var DynamicModuleFieldComponent = /** @class */ (function () {
3519
- function DynamicModuleFieldComponent(dialog) {
3520
- this.dialog = dialog;
3521
- this.recordChange = new EventEmitter();
3522
- this.FieldTypeEnum = FieldTypeEnum;
3523
- this.onlyViewInnerFormRecord = false;
3524
- }
3525
- DynamicModuleFieldComponent.prototype.updateField = function () {
3526
- if (this.fieldTemplate && this.fieldTemplate.length > 0) {
3527
- this.fieldTemplate.forEach(function (f) { return f.updateField(); });
3528
- }
3529
- };
3530
- DynamicModuleFieldComponent.prototype.ngOnInit = function () {
3531
- };
3532
- /**
3533
- * Metodo invocato al cambio del valore di ogni proprietà dell'oggetto record.
3534
- * Serve ad aggiornare il valore di tutti i campi che hanno una formula.
3535
- */
3536
- DynamicModuleFieldComponent.prototype.onRecordChange = function () {
3537
- this.recordChange.emit(this.record);
3538
- };
3539
- /**
3540
- * Metodo per recuperare una InnerForm a partire dal Field che la rappresenta.
3541
- * @param field Campo a partire dal quale si vuole recuperare la InnerForm.
3542
- * @returns Restituisce un oggetto di tipo Form.
3543
- */
3544
- DynamicModuleFieldComponent.prototype.getInnerFormFromField = function (field) {
3545
- if (this.form.InnerForms && this.form.InnerForms.find(function (f) { return f.Name == field.Label; })) {
3546
- return this.form.InnerForms.find(function (f) { return f.Name == field.Label; });
3547
- }
3548
- else {
3549
- return null;
3550
- }
3551
- };
3552
- /**
3553
- * Metodo per aprire un dialog in cui aggiungere/modificare/visualizzare un record appartenente
3554
- * a una form di dettaglio.
3555
- * @param record Evento di output del componente list-form-record, contiene il record selezionato e un booleno che indica
3556
- * se l'utente vuole modificare o visualizzare l'elemento selezionato.
3557
- * @param innerForm Contiene la Form di dettaglio dalla quale è stato richiesto il record.
3558
- */
3559
- DynamicModuleFieldComponent.prototype.onAddViewEditInnerFormRecord = function (record, field) {
3560
- this.selectedInnerForm = this.getInnerFormFromField(field);
3561
- if (record == null) {
3562
- this.selectedInnerFormRecord = new Record();
3563
- this.indexInnerFormRecord = null;
3564
- this.onlyViewInnerFormRecord = false;
3565
- }
3566
- else {
3567
- this.selectedInnerFormRecord = JSON.parse(JSON.stringify(record.record));
3568
- this.indexInnerFormRecord = this.record[field.Name].indexOf(record);
3569
- this.onlyViewInnerFormRecord = record.onlyView;
3570
- }
3571
- this.dialogInnerFormRecordRef = this.dialog.open(this.dialogInnerFormRecord, {
3572
- disableClose: true,
3573
- hasBackdrop: true,
3574
- width: '75%'
3575
- });
3576
- };
3577
- /**
3578
- * Metodo invocato al salvataggio o alla chiusura del dialog di aggiunta/modifica/visualizzazione
3579
- * di un record di una form di dettaglio.
3580
- * @param record Oggetto restituito dal componente add-form-field (questo qui) contenente il Record
3581
- * aggiornato dall'utente. Se null allora l'utente non ha modificato nulla e ha chiuso il dialog.
3582
- */
3583
- DynamicModuleFieldComponent.prototype.onSaveInnerFormRecord = function (record) {
3584
- if (record != null) {
3585
- var arrayName = this.selectedInnerForm.Name.split(' ').join('_');
3586
- if (this.indexInnerFormRecord != null && this.indexInnerFormRecord >= 0) {
3587
- this.record[arrayName][this.indexInnerFormRecord] = record;
3588
- }
3589
- else {
3590
- if (!this.record[arrayName]) {
3591
- this.record[arrayName] = [];
3592
- }
3593
- this.record[arrayName].push(record);
3594
- }
3595
- }
3596
- this.dialogInnerFormRecordRef.close();
3597
- // Ricarico la tabella dei record per visualizzare le modifiche fatte dall'utente.
3598
- if (this.listInnerFormRecords && this.listInnerFormRecords.length > 0) {
3599
- this.listInnerFormRecords.forEach(function (list) {
3600
- if (list && list.tableRecords) {
3601
- list.tableRecords.reloadDatatable();
3602
- }
3603
- });
3604
- }
3605
- };
3606
- DynamicModuleFieldComponent.ctorParameters = function () { return [
3607
- { type: MatDialog }
3608
- ]; };
3609
- __decorate([
3610
- Input()
3611
- ], DynamicModuleFieldComponent.prototype, "field", void 0);
3612
- __decorate([
3613
- Input()
3614
- ], DynamicModuleFieldComponent.prototype, "form", void 0);
3615
- __decorate([
3616
- Input()
3617
- ], DynamicModuleFieldComponent.prototype, "record", void 0);
3618
- __decorate([
3619
- Output()
3620
- ], DynamicModuleFieldComponent.prototype, "recordChange", void 0);
3621
- __decorate([
3622
- ViewChild('dialogInnerFormRecord', { static: true })
3623
- ], DynamicModuleFieldComponent.prototype, "dialogInnerFormRecord", void 0);
3624
- __decorate([
3625
- ViewChildren("fieldTemplate")
3626
- ], DynamicModuleFieldComponent.prototype, "fieldTemplate", void 0);
3627
- __decorate([
3628
- ViewChildren('listInnerFormRecords')
3629
- ], DynamicModuleFieldComponent.prototype, "listInnerFormRecords", void 0);
3630
- DynamicModuleFieldComponent = __decorate([
3631
- Component({
3632
- selector: 'dynamic-module-field',
3633
- template: "<text-field-template #fieldTemplate *ngIf=\"field.FieldType == FieldTypeEnum['Campo di testo']\"\r\n [matTooltip]=\"field.Description\" [(record)]=\"record\" [field]=\"field\" (recordChange)=\"onRecordChange()\">\r\n</text-field-template>\r\n\r\n<textarea-field-template #fieldTemplate *ngIf=\"field.FieldType == FieldTypeEnum['Area di testo']\"\r\n [matTooltip]=\"field.Description\" [(record)]=\"record\" [field]=\"field\" (recordChange)=\"onRecordChange()\">\r\n</textarea-field-template>\r\n\r\n<boolean-field-template #fieldTemplate *ngIf=\"field.FieldType == FieldTypeEnum['Booleano']\"\r\n [matTooltip]=\"field.Description\" [(record)]=\"record\" [field]=\"field\" (recordChange)=\"onRecordChange()\">\r\n</boolean-field-template>\r\n\r\n<date-field-template #fieldTemplate *ngIf=\"field.FieldType == FieldTypeEnum['Data e/o ora']\"\r\n [matTooltip]=\"field.Description\" [(record)]=\"record\" [field]=\"field\" (recordChange)=\"onRecordChange()\">\r\n</date-field-template>\r\n\r\n<numeric-field-template #fieldTemplate *ngIf=\"field.FieldType == FieldTypeEnum['Campo numerico']\"\r\n [matTooltip]=\"field.Description\" [(record)]=\"record\" [field]=\"field\" (recordChange)=\"onRecordChange()\">\r\n</numeric-field-template>\r\n\r\n<list-value-field-template #fieldTemplate *ngIf=\"field.FieldType == FieldTypeEnum['Elenco generico']\"\r\n [matTooltip]=\"field.Description\" [(record)]=\"record\" [field]=\"field\" (recordChange)=\"onRecordChange()\">\r\n</list-value-field-template>\r\n\r\n<attachment-field-template #fieldTemplate *ngIf=\"field.FieldType == FieldTypeEnum['Allegato']\"\r\n [matTooltip]=\"field.Description\" [(record)]=\"record\" [field]=\"field\" (recordChange)=\"onRecordChange()\">\r\n</attachment-field-template>\r\n\r\n<image-field-template #fieldTemplate *ngIf=\"field.FieldType == FieldTypeEnum['Immagine']\"\r\n [matTooltip]=\"field.Description\" [(record)]=\"record\" [field]=\"field\" (recordChange)=\"onRecordChange()\">\r\n</image-field-template>\r\n\r\n<list-form-record #listInnerFormRecords *ngIf=\"field.FieldType == FieldTypeEnum['Form di dettaglio']\"\r\n [form]=\"getInnerFormFromField(field)\" [values]=\"record[field.Name]\"\r\n (onAddViewEditRecord)=\"onAddViewEditInnerFormRecord($event, field)\">\r\n</list-form-record>\r\n\r\n<!-- DIALOG PER AGGIUNGERE/MODIFICARE/VISUALIZZARE UN RECORD IN UNA FORM DI DETTAGLIO -->\r\n<ng-template #dialogInnerFormRecord>\r\n <add-form-record [form]=\"selectedInnerForm\" [record]=\"selectedInnerFormRecord\" [onlyView]=\"onlyViewInnerFormRecord\"\r\n (saveRecordEvent)=\"onSaveInnerFormRecord($event)\"></add-form-record>\r\n</ng-template>",
3634
- styles: [""]
3635
- })
3636
- ], DynamicModuleFieldComponent);
3637
- return DynamicModuleFieldComponent;
3638
- }());
3639
-
3640
- var SpinnerComponent = /** @class */ (function () {
3641
- function SpinnerComponent(spinnerService) {
3642
- this.spinnerService = spinnerService;
3643
- this.isLoading = this.spinnerService.isLoading;
3644
- }
3645
- SpinnerComponent.prototype.ngOnInit = function () {
3646
- };
3647
- SpinnerComponent.ctorParameters = function () { return [
3648
- { type: SpinnerService }
3649
- ]; };
3650
- SpinnerComponent = __decorate([
3651
- Component({
3652
- selector: 'eqp-dynamic-module-spinner',
3653
- template: "<div class=\"eqp-splash-screen\" *ngIf=\"isLoading | async\">\r\n <div id=\"loader\"></div>\r\n</div>",
3654
- styles: [":host #loader{display:block;position:relative;width:150px;height:150px;border-radius:50%;border:3px solid transparent;border-top-color:var(--primary);-webkit-animation:2s linear infinite spin;animation:2s linear infinite spin}:host #loader:before{content:\"\";position:absolute;top:5px;left:5px;right:5px;bottom:5px;border-radius:50%;border:3px solid transparent;border-top-color:var(--primary);-webkit-animation:3s linear infinite spin;animation:3s linear infinite spin}:host #loader:after{content:\"\";position:absolute;top:15px;left:15px;right:15px;bottom:15px;border-radius:50%;border:3px solid transparent;border-top-color:var(--primary);-webkit-animation:1.5s linear infinite spin;animation:1.5s linear infinite spin}@-webkit-keyframes spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}:host .eqp-splash-screen{background-color:#343a4040;position:fixed;display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;width:100%;z-index:9999}:host .eqp-splash-screen img{margin-left:calc(100vw - 100%);width:90px;margin-bottom:30px}:host .eqp-splash-screen span{margin-left:calc(100vw - 100%);margin-bottom:30px}:host .eqp-splash-screen ::ng-deep .mat-progress-spinner circle,:host .eqp-splash-screen ::ng-deep .mat-spinner circle{stroke:#5d78ff}"]
3655
- })
3656
- ], SpinnerComponent);
3657
- return SpinnerComponent;
3658
- }());
3659
-
3660
- var EqpDynamicModuleModule = /** @class */ (function () {
3661
- function EqpDynamicModuleModule() {
3662
- }
3663
- EqpDynamicModuleModule = __decorate([
3664
- NgModule({
3665
- declarations: [
3666
- EqpDynamicModuleComponent,
3667
- EqpDynamicModuleConfiguratorComponent,
3668
- AddFormFieldComponent,
3669
- TextFieldTemplateComponent,
3670
- BooleanFieldTemplateComponent,
3671
- DateFieldTemplateComponent,
3672
- TextareaFieldTemplateComponent,
3673
- NumericFieldTemplateComponent,
3674
- ListValueFieldTemplateComponent,
3675
- AttachmentFieldTemplateComponent,
3676
- ImageFieldTemplateComponent,
3677
- ListFormRecordComponent,
3678
- AddFormRecordComponent,
3679
- DynamicModuleFieldComponent,
3680
- SpinnerComponent,
3681
- ],
3682
- imports: [
3683
- MaterialModule,
3684
- FormsModule,
3685
- CommonModule,
3686
- ReactiveFormsModule,
3687
- EqpTableModule,
3688
- EqpAttachmentsModule,
3689
- EqpSelectModule,
3690
- EqpDatetimepickerModule,
3691
- EqpFiltersModule,
3692
- EqpNumericModule,
3693
- EqpImgDrawingModule
3694
- ],
3695
- exports: [
3696
- EqpDynamicModuleComponent,
3697
- EqpDynamicModuleConfiguratorComponent
3698
- ]
3699
- })
3700
- ], EqpDynamicModuleModule);
3701
- return EqpDynamicModuleModule;
3702
- }());
3703
-
3704
- /**
3705
- * Rappresenta l'entità su cui vengono eseguite le operazioni di salvataggio.
3706
- */
3707
- var Entity = /** @class */ (function (_super) {
3708
- __extends(Entity, _super);
3709
- function Entity() {
3710
- return _super !== null && _super.apply(this, arguments) || this;
3711
- }
3712
- return Entity;
3713
- }(BaseObj));
3714
-
3715
- var ImageField = /** @class */ (function (_super) {
3716
- __extends(ImageField, _super);
3717
- function ImageField() {
3718
- return _super !== null && _super.apply(this, arguments) || this;
3719
- }
3720
- Object.defineProperty(ImageField.prototype, "_contextualAttachments", {
3721
- /**Proprietà per recuperare l'allegato caricato come array per eqp-attachments (se ImageIsContextualAttachment == true) */
3722
- get: function () {
3723
- return this.ContextualAttachment ? [this.ContextualAttachment] : [];
3724
- },
3725
- enumerable: true,
3726
- configurable: true
3727
- });
3728
- return ImageField;
3729
- }(BaseField));
3730
-
3731
- /**Questo tipo di campo rappresenta una lookup ad altri valori */
3732
- var LookupField = /** @class */ (function (_super) {
3733
- __extends(LookupField, _super);
3734
- function LookupField() {
3735
- return _super !== null && _super.apply(this, arguments) || this;
3736
- }
3737
- return LookupField;
3738
- }(BaseField));
3739
-
3740
- /**Classe contiene la configurazione dei campi numerici */
3741
- var NumericField = /** @class */ (function (_super) {
3742
- __extends(NumericField, _super);
3743
- function NumericField() {
3744
- return _super !== null && _super.apply(this, arguments) || this;
3745
- }
3746
- return NumericField;
3747
- }(BaseField));
3748
-
3749
- var TextareaField = /** @class */ (function (_super) {
3750
- __extends(TextareaField, _super);
3751
- function TextareaField() {
3752
- return _super !== null && _super.apply(this, arguments) || this;
3753
- }
3754
- return TextareaField;
3755
- }(BaseField));
3756
-
3757
- /*
3758
- * Public API Surface of eqp-dynamic-module
3759
- */
3760
-
3761
- /**
3762
- * Generated bundle index. Do not edit.
3763
- */
3764
-
3765
- export { ActionOnRecord, AddFormFieldComponent, AddFormRecordComponent, ArrayValidators, AttachmentField, AttachmentFieldTemplateComponent, AvailableFileExtensions, AvailableImageExtensions, BaseField, BaseObj, BoolPresentantioEnum, BooleanField, BooleanFieldTemplateComponent, ButtonImage, ColSpanSizesEnum, Context, ContextUser, DateField, DateFieldTemplateComponent, DateTimeTypeEnum, DynRecord, DynamicModuleFieldComponent, EndPointConfiguration, EndPointData, EndPointDataParams, Entity, EqpDynamicModuleComponent, EqpDynamicModuleConfiguratorComponent, EqpDynamicModuleDialogService, EqpDynamicModuleModule, FieldTypeEnum, Form, FormFieldGroup, FormScalarTypeEnum, FormTypeEnum, ImageField, ImageFieldTemplateComponent, ListFormRecordComponent, ListPresentationEnum, ListValueField, ListValueFieldTemplateComponent, LookupField, NumericField, NumericFieldTemplateComponent, ParamTypeEnum, Record, RequestMethodEnum, SpinnerService, TelRegex, TextField, TextFieldTemplateComponent, TextMaskEnum, TextareaField, TextareaFieldTemplateComponent, UrlRegex, UtilityHelperService, ɵ0, SpinnerComponent as ɵa, MaterialModule as ɵb };
3766
- //# sourceMappingURL=eqproject-eqp-dynamic-module.js.map