@eqproject/eqp-dynamic-module 0.0.7 → 0.0.8

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/bundles/eqproject-eqp-dynamic-module.umd.js +3991 -0
  2. package/bundles/eqproject-eqp-dynamic-module.umd.js.map +1 -0
  3. package/bundles/eqproject-eqp-dynamic-module.umd.min.js +17 -0
  4. package/bundles/eqproject-eqp-dynamic-module.umd.min.js.map +1 -0
  5. package/eqproject-eqp-dynamic-module.d.ts +6 -0
  6. package/eqproject-eqp-dynamic-module.metadata.json +1 -0
  7. package/esm2015/eqproject-eqp-dynamic-module.js +7 -0
  8. package/esm2015/lib/components/exported/eqp-dynamic-module/eqp-dynamic-module.component.js +262 -0
  9. package/esm2015/lib/components/exported/eqp-dynamic-module-configurator/eqp-dynamic-module-configurator.component.js +649 -0
  10. package/esm2015/lib/components/private/add-form-field/add-form-field.component.js +577 -0
  11. package/esm2015/lib/components/private/dynamic-module-field/dynamic-module-field.component.js +127 -0
  12. package/esm2015/lib/components/private/field-templates/attachment-field-template/attachment-field-template.component.js +170 -0
  13. package/esm2015/lib/components/private/field-templates/boolean-field-template/boolean-field-template.component.js +56 -0
  14. package/esm2015/lib/components/private/field-templates/date-field-template/date-field-template.component.js +71 -0
  15. package/esm2015/lib/components/private/field-templates/image-field-template/image-field-template.component.js +196 -0
  16. package/esm2015/lib/components/private/field-templates/list-value-field-template/list-value-field-template.component.js +115 -0
  17. package/esm2015/lib/components/private/field-templates/numeric-field-template/numeric-field-template.component.js +71 -0
  18. package/esm2015/lib/components/private/field-templates/text-field-template/text-field-template.component.js +67 -0
  19. package/esm2015/lib/components/private/field-templates/textarea-field-template/textarea-field-template.component.js +51 -0
  20. package/esm2015/lib/components/private/form-records/add-form-record/add-form-record.component.js +130 -0
  21. package/esm2015/lib/components/private/form-records/list-form-record/list-form-record.component.js +216 -0
  22. package/esm2015/lib/components/private/spinner/spinner.component.js +23 -0
  23. package/esm2015/lib/eqp-dynamic-module.module.js +69 -0
  24. package/esm2015/lib/interfaces/iBaseFieldComponent.interface.js +1 -0
  25. package/esm2015/lib/interfaces/iRootObject.interface.js +1 -0
  26. package/esm2015/lib/models/baseField.model.js +36 -0
  27. package/esm2015/lib/models/baseObj.model.js +9 -0
  28. package/esm2015/lib/models/context.model.js +8 -0
  29. package/esm2015/lib/models/endPointConfiguration.model.js +23 -0
  30. package/esm2015/lib/models/entity.model.js +7 -0
  31. package/esm2015/lib/models/fields/attachmentField.model.js +22 -0
  32. package/esm2015/lib/models/fields/booleanField.model.js +12 -0
  33. package/esm2015/lib/models/fields/dateField.model.js +11 -0
  34. package/esm2015/lib/models/fields/imageField.model.js +8 -0
  35. package/esm2015/lib/models/fields/listValueField.model.js +14 -0
  36. package/esm2015/lib/models/fields/lookupField.model.js +5 -0
  37. package/esm2015/lib/models/fields/numericField.model.js +5 -0
  38. package/esm2015/lib/models/fields/testareaField.model.js +4 -0
  39. package/esm2015/lib/models/fields/textField.model.js +14 -0
  40. package/esm2015/lib/models/form.model.js +24 -0
  41. package/esm2015/lib/models/record.model.js +8 -0
  42. package/esm2015/lib/modules/material.module.js +108 -0
  43. package/esm2015/lib/services/custom-form-validators.service.js +19 -0
  44. package/esm2015/lib/services/eqp-dynamic-module-dialog.service.js +113 -0
  45. package/esm2015/lib/services/spinner.service.js +43 -0
  46. package/esm2015/lib/services/utilityHelper.services.js +387 -0
  47. package/esm2015/public-api.js +39 -0
  48. package/esm5/eqproject-eqp-dynamic-module.js +7 -0
  49. package/esm5/lib/components/exported/eqp-dynamic-module/eqp-dynamic-module.component.js +269 -0
  50. package/esm5/lib/components/exported/eqp-dynamic-module-configurator/eqp-dynamic-module-configurator.component.js +664 -0
  51. package/esm5/lib/components/private/add-form-field/add-form-field.component.js +588 -0
  52. package/esm5/lib/components/private/dynamic-module-field/dynamic-module-field.component.js +128 -0
  53. package/esm5/lib/components/private/field-templates/attachment-field-template/attachment-field-template.component.js +173 -0
  54. package/esm5/lib/components/private/field-templates/boolean-field-template/boolean-field-template.component.js +57 -0
  55. package/esm5/lib/components/private/field-templates/date-field-template/date-field-template.component.js +72 -0
  56. package/esm5/lib/components/private/field-templates/image-field-template/image-field-template.component.js +206 -0
  57. package/esm5/lib/components/private/field-templates/list-value-field-template/list-value-field-template.component.js +119 -0
  58. package/esm5/lib/components/private/field-templates/numeric-field-template/numeric-field-template.component.js +72 -0
  59. package/esm5/lib/components/private/field-templates/text-field-template/text-field-template.component.js +68 -0
  60. package/esm5/lib/components/private/field-templates/textarea-field-template/textarea-field-template.component.js +52 -0
  61. package/esm5/lib/components/private/form-records/add-form-record/add-form-record.component.js +133 -0
  62. package/esm5/lib/components/private/form-records/list-form-record/list-form-record.component.js +220 -0
  63. package/esm5/lib/components/private/spinner/spinner.component.js +24 -0
  64. package/esm5/lib/eqp-dynamic-module.module.js +72 -0
  65. package/esm5/lib/interfaces/iBaseFieldComponent.interface.js +1 -0
  66. package/esm5/lib/interfaces/iRootObject.interface.js +1 -0
  67. package/esm5/lib/models/baseField.model.js +43 -0
  68. package/esm5/lib/models/baseObj.model.js +13 -0
  69. package/esm5/lib/models/context.model.js +14 -0
  70. package/esm5/lib/models/endPointConfiguration.model.js +33 -0
  71. package/esm5/lib/models/entity.model.js +14 -0
  72. package/esm5/lib/models/fields/attachmentField.model.js +29 -0
  73. package/esm5/lib/models/fields/booleanField.model.js +19 -0
  74. package/esm5/lib/models/fields/dateField.model.js +18 -0
  75. package/esm5/lib/models/fields/imageField.model.js +19 -0
  76. package/esm5/lib/models/fields/listValueField.model.js +25 -0
  77. package/esm5/lib/models/fields/lookupField.model.js +12 -0
  78. package/esm5/lib/models/fields/numericField.model.js +12 -0
  79. package/esm5/lib/models/fields/testareaField.model.js +11 -0
  80. package/esm5/lib/models/fields/textField.model.js +21 -0
  81. package/esm5/lib/models/form.model.js +39 -0
  82. package/esm5/lib/models/record.model.js +14 -0
  83. package/esm5/lib/modules/material.module.js +111 -0
  84. package/esm5/lib/services/custom-form-validators.service.js +23 -0
  85. package/esm5/lib/services/eqp-dynamic-module-dialog.service.js +123 -0
  86. package/esm5/lib/services/spinner.service.js +46 -0
  87. package/esm5/lib/services/utilityHelper.services.js +396 -0
  88. package/esm5/public-api.js +39 -0
  89. package/fesm2015/eqproject-eqp-dynamic-module.js +3580 -0
  90. package/fesm2015/eqproject-eqp-dynamic-module.js.map +1 -0
  91. package/fesm5/eqproject-eqp-dynamic-module.js +3766 -0
  92. package/fesm5/eqproject-eqp-dynamic-module.js.map +1 -0
  93. package/lib/components/exported/eqp-dynamic-module/eqp-dynamic-module.component.d.ts +101 -0
  94. package/lib/components/exported/eqp-dynamic-module-configurator/eqp-dynamic-module-configurator.component.d.ts +235 -0
  95. package/lib/components/private/add-form-field/add-form-field.component.d.ts +199 -0
  96. package/lib/components/private/dynamic-module-field/dynamic-module-field.component.d.ts +55 -0
  97. package/lib/components/private/field-templates/attachment-field-template/attachment-field-template.component.d.ts +68 -0
  98. package/lib/components/private/field-templates/boolean-field-template/boolean-field-template.component.d.ts +21 -0
  99. package/lib/components/private/field-templates/date-field-template/date-field-template.component.d.ts +27 -0
  100. package/lib/components/private/field-templates/image-field-template/image-field-template.component.d.ts +65 -0
  101. package/lib/components/private/field-templates/list-value-field-template/list-value-field-template.component.d.ts +51 -0
  102. package/lib/components/private/field-templates/numeric-field-template/numeric-field-template.component.d.ts +26 -0
  103. package/lib/components/private/field-templates/text-field-template/text-field-template.component.d.ts +22 -0
  104. package/lib/components/private/field-templates/textarea-field-template/textarea-field-template.component.d.ts +20 -0
  105. package/lib/components/private/form-records/add-form-record/add-form-record.component.d.ts +52 -0
  106. package/lib/components/private/form-records/list-form-record/list-form-record.component.d.ts +64 -0
  107. package/lib/components/private/spinner/spinner.component.d.ts +9 -0
  108. package/lib/eqp-dynamic-module.module.d.ts +2 -0
  109. package/{src/lib/interfaces/iBaseFieldComponent.interface.ts → lib/interfaces/iBaseFieldComponent.interface.d.ts} +1 -1
  110. package/{src/lib/interfaces/iRootObject.interface.ts → lib/interfaces/iRootObject.interface.d.ts} +1 -1
  111. package/{src/lib/models/baseField.model.ts → lib/models/baseField.model.d.ts} +5 -14
  112. package/{src/lib/models/baseObj.model.ts → lib/models/baseObj.model.d.ts} +3 -3
  113. package/lib/models/context.model.d.ts +9 -0
  114. package/{src/lib/models/endPointConfiguration.model.ts → lib/models/endPointConfiguration.model.d.ts} +12 -16
  115. package/{src/lib/models/entity.model.ts → lib/models/entity.model.d.ts} +1 -2
  116. package/lib/models/fields/attachmentField.model.d.ts +17 -0
  117. package/{src/lib/models/fields/booleanField.model.ts → lib/models/fields/booleanField.model.d.ts} +4 -8
  118. package/{src/lib/models/fields/dateField.model.ts → lib/models/fields/dateField.model.d.ts} +3 -5
  119. package/{src/lib/models/fields/imageField.model.ts → lib/models/fields/imageField.model.d.ts} +3 -8
  120. package/{src/lib/models/fields/listValueField.model.ts → lib/models/fields/listValueField.model.d.ts} +8 -13
  121. package/{src/lib/models/fields/lookupField.model.ts → lib/models/fields/lookupField.model.d.ts} +2 -5
  122. package/{src/lib/models/fields/numericField.model.ts → lib/models/fields/numericField.model.d.ts} +2 -3
  123. package/{src/lib/models/fields/testareaField.model.ts → lib/models/fields/testareaField.model.d.ts} +2 -3
  124. package/lib/models/fields/textField.model.d.ts +15 -0
  125. package/{src/lib/models/form.model.ts → lib/models/form.model.d.ts} +12 -25
  126. package/{src/lib/models/record.model.ts → lib/models/record.model.d.ts} +5 -4
  127. package/lib/modules/material.module.d.ts +2 -0
  128. package/lib/services/custom-form-validators.service.d.ts +5 -0
  129. package/lib/services/eqp-dynamic-module-dialog.service.d.ts +34 -0
  130. package/lib/services/spinner.service.d.ts +15 -0
  131. package/lib/services/utilityHelper.services.d.ts +77 -0
  132. package/package.json +41 -31
  133. package/{src/public-api.ts → public-api.d.ts} +0 -3
  134. package/karma.conf.js +0 -32
  135. package/ng-package.json +0 -18
  136. package/src/lib/components/exported/eqp-dynamic-module/eqp-dynamic-module.component.html +0 -10
  137. package/src/lib/components/exported/eqp-dynamic-module/eqp-dynamic-module.component.scss +0 -3
  138. package/src/lib/components/exported/eqp-dynamic-module/eqp-dynamic-module.component.ts +0 -228
  139. package/src/lib/components/exported/eqp-dynamic-module-configurator/eqp-dynamic-module-configurator.component.html +0 -212
  140. package/src/lib/components/exported/eqp-dynamic-module-configurator/eqp-dynamic-module-configurator.component.scss +0 -30
  141. package/src/lib/components/exported/eqp-dynamic-module-configurator/eqp-dynamic-module-configurator.component.ts +0 -692
  142. package/src/lib/components/private/add-form-field/add-form-field.component.html +0 -417
  143. package/src/lib/components/private/add-form-field/add-form-field.component.scss +0 -38
  144. package/src/lib/components/private/add-form-field/add-form-field.component.ts +0 -599
  145. package/src/lib/components/private/dynamic-module-field/dynamic-module-field.component.html +0 -42
  146. package/src/lib/components/private/dynamic-module-field/dynamic-module-field.component.scss +0 -0
  147. package/src/lib/components/private/dynamic-module-field/dynamic-module-field.component.ts +0 -125
  148. package/src/lib/components/private/field-templates/attachment-field-template/attachment-field-template.component.html +0 -25
  149. package/src/lib/components/private/field-templates/attachment-field-template/attachment-field-template.component.scss +0 -0
  150. package/src/lib/components/private/field-templates/attachment-field-template/attachment-field-template.component.ts +0 -172
  151. package/src/lib/components/private/field-templates/boolean-field-template/boolean-field-template.component.html +0 -32
  152. package/src/lib/components/private/field-templates/boolean-field-template/boolean-field-template.component.scss +0 -0
  153. package/src/lib/components/private/field-templates/boolean-field-template/boolean-field-template.component.ts +0 -53
  154. package/src/lib/components/private/field-templates/date-field-template/date-field-template.component.html +0 -6
  155. package/src/lib/components/private/field-templates/date-field-template/date-field-template.component.scss +0 -0
  156. package/src/lib/components/private/field-templates/date-field-template/date-field-template.component.ts +0 -70
  157. package/src/lib/components/private/field-templates/image-field-template/image-field-template.component.html +0 -57
  158. package/src/lib/components/private/field-templates/image-field-template/image-field-template.component.scss +0 -4
  159. package/src/lib/components/private/field-templates/image-field-template/image-field-template.component.ts +0 -203
  160. package/src/lib/components/private/field-templates/list-value-field-template/list-value-field-template.component.html +0 -46
  161. package/src/lib/components/private/field-templates/list-value-field-template/list-value-field-template.component.scss +0 -13
  162. package/src/lib/components/private/field-templates/list-value-field-template/list-value-field-template.component.ts +0 -114
  163. package/src/lib/components/private/field-templates/numeric-field-template/numeric-field-template.component.html +0 -6
  164. package/src/lib/components/private/field-templates/numeric-field-template/numeric-field-template.component.scss +0 -0
  165. package/src/lib/components/private/field-templates/numeric-field-template/numeric-field-template.component.ts +0 -70
  166. package/src/lib/components/private/field-templates/text-field-template/text-field-template.component.html +0 -5
  167. package/src/lib/components/private/field-templates/text-field-template/text-field-template.component.scss +0 -0
  168. package/src/lib/components/private/field-templates/text-field-template/text-field-template.component.ts +0 -65
  169. package/src/lib/components/private/field-templates/textarea-field-template/textarea-field-template.component.html +0 -5
  170. package/src/lib/components/private/field-templates/textarea-field-template/textarea-field-template.component.scss +0 -0
  171. package/src/lib/components/private/field-templates/textarea-field-template/textarea-field-template.component.ts +0 -48
  172. package/src/lib/components/private/form-records/add-form-record/add-form-record.component.html +0 -74
  173. package/src/lib/components/private/form-records/add-form-record/add-form-record.component.scss +0 -0
  174. package/src/lib/components/private/form-records/add-form-record/add-form-record.component.ts +0 -117
  175. package/src/lib/components/private/form-records/list-form-record/list-form-record.component.html +0 -14
  176. package/src/lib/components/private/form-records/list-form-record/list-form-record.component.scss +0 -7
  177. package/src/lib/components/private/form-records/list-form-record/list-form-record.component.ts +0 -213
  178. package/src/lib/components/private/spinner/spinner.component.html +0 -3
  179. package/src/lib/components/private/spinner/spinner.component.scss +0 -100
  180. package/src/lib/components/private/spinner/spinner.component.ts +0 -19
  181. package/src/lib/eqp-dynamic-module.module.ts +0 -65
  182. package/src/lib/models/context.model.ts +0 -10
  183. package/src/lib/models/fields/attachmentField.model.ts +0 -32
  184. package/src/lib/models/fields/textField.model.ts +0 -18
  185. package/src/lib/modules/material.module.ts +0 -104
  186. package/src/lib/services/custom-form-validators.service.ts +0 -21
  187. package/src/lib/services/eqp-dynamic-module-dialog.service.ts +0 -114
  188. package/src/lib/services/spinner.service.ts +0 -40
  189. package/src/lib/services/utilityHelper.services.ts +0 -413
  190. package/src/test.ts +0 -26
  191. package/tsconfig.lib.json +0 -23
  192. package/tsconfig.lib.prod.json +0 -6
  193. package/tsconfig.spec.json +0 -17
  194. package/tslint.json +0 -17
@@ -1,117 +0,0 @@
1
- import { ChangeDetectorRef, Component, EventEmitter, Input, OnInit, Output, QueryList, ViewChildren } from '@angular/core';
2
- import { FormGroup } from '@angular/forms';
3
- import { BaseField, FieldTypeEnum } from '../../../../models/baseField.model';
4
- import { Form, FormScalarTypeEnum } from '../../../../models/form.model';
5
- import { Record } from '../../../../models/record.model';
6
- import { UtilityHelperService } from '../../../../services/utilityHelper.services';
7
- import { DynamicModuleFieldComponent } from '../../dynamic-module-field/dynamic-module-field.component';
8
-
9
- @Component({
10
- selector: 'add-form-record',
11
- templateUrl: './add-form-record.component.html',
12
- styleUrls: ['./add-form-record.component.scss']
13
- })
14
- export class AddFormRecordComponent implements OnInit {
15
-
16
- @Input() showTitle = true;
17
- @Input() showButtons = true;
18
- @Input() form: Form = new Form();
19
- @Input() record: Record;
20
- @Input() onlyView: boolean;
21
- formForm: FormGroup;
22
- fieldGroups: { [key: string]: Array<BaseField> } = {};
23
- FormScalarTypeEnum = FormScalarTypeEnum;
24
- FieldTypeEnum = FieldTypeEnum;
25
-
26
- @Output() saveRecordEvent: EventEmitter<Record> = new EventEmitter<Record>();
27
-
28
- @ViewChildren("fieldTemplate") fieldTemplate: QueryList<DynamicModuleFieldComponent>;
29
-
30
- constructor(
31
- private cdr: ChangeDetectorRef,
32
- public utilityService: UtilityHelperService
33
- ) { }
34
-
35
- ngOnInit(): void {
36
- if (this.record == null) {
37
- this.record = new Record();
38
- }
39
- this.createRecordProperties();
40
- this.reorderFormFields();
41
- this.createFormGroup();
42
- if (this.form.FormScalarType != FormScalarTypeEnum.Semplice) {
43
- this.createFieldGroups();
44
- }
45
- this.cdr.detectChanges();
46
- }
47
-
48
- /**
49
- * Metodo invocato al cambio del valore di ogni proprietà dell'oggetto record.
50
- * Serve ad aggiornare il valore di tutti i campi che hanno una formula.
51
- */
52
- onRecordChange() {
53
- if (this.fieldTemplate && this.fieldTemplate.length > 0) {
54
- this.fieldTemplate.forEach(f => f.updateField());
55
- }
56
- }
57
-
58
- /**
59
- * Metodo per salvare i dati inseriti dall'utente una volta conclusa la compilazione della form.
60
- */
61
- saveOrExitForm(exit: boolean) {
62
- if (exit) {
63
- this.saveRecordEvent.emit(null);
64
- } else {
65
- this.saveRecordEvent.emit(this.record);
66
- }
67
- }
68
-
69
- /**
70
- * Metodo per creare nell'oggetto Record le proprietà mancanti rispetto ai campi che compongono la form.
71
- */
72
- private createRecordProperties() {
73
- const recordProperties: Array<string> = Object.keys(this.record);
74
- this.form.Fields.forEach(field => {
75
- if (!recordProperties.find(p => p === field.Name)) {
76
- this.record[field.Name] = null;
77
- }
78
- });
79
- if (this.form.InnerForms && this.form.InnerForms.length > 0) {
80
- this.form.InnerForms.forEach(form => {
81
- const arrayName: string = form.Name.split(" ").join("_");
82
- if (!recordProperties.find(p => p === arrayName)) {
83
- this.record[arrayName] = [];
84
- }
85
- });
86
- }
87
- }
88
-
89
- /**
90
- * Metodo per riordinare i campi che compongono la form.
91
- */
92
- private reorderFormFields() {
93
- if (this.form.Fields && this.form.Fields.length > 0) {
94
- this.form.Fields.sort((a, b) => (a.OrdinalPosition > b.OrdinalPosition) ? 1 : ((b.OrdinalPosition > a.OrdinalPosition) ? -1 : 0));
95
- }
96
- }
97
-
98
- /**
99
- * Metodo per creare il FormGroup che rappresenta la form.
100
- */
101
- private createFormGroup() {
102
- this.formForm = this.utilityService.CreateFormFormGroup(this.form.Fields, this.record, this.onlyView);
103
- }
104
-
105
- /**
106
- * Metodo per creare i gruppi in cui raggruppare i campi della form in base
107
- * a come è stata configurata dall'utente.
108
- */
109
- private createFieldGroups() {
110
- this.form.FormFieldsGroups
111
- .sort((a, b) => (a.OrdinalPosition > b.OrdinalPosition) ? 1 : ((b.OrdinalPosition > a.OrdinalPosition) ? -1 : 0))
112
- .map(g => g.Name)
113
- .forEach(groupName => {
114
- this.fieldGroups[groupName] = this.form.Fields.filter(f => f.FieldGroup == groupName);
115
- });
116
- }
117
- }
@@ -1,14 +0,0 @@
1
- <div class="row eqp-dynamic-module-title">
2
- <div class="col-md-6">
3
- <h4 *ngIf="showTitle"><b>Elenco {{form.Name}}</b></h4>
4
- </div>
5
- <div class="col-md-6 text-right">
6
- <button class="btn btn-primary" mat-raised-button color="primary" type="button" (click)="onAddViewEditRecord.emit(null)">
7
- <mat-icon>add</mat-icon>
8
- <span style="margin-left: 10px;">Aggiungi</span>
9
- </button>
10
- </div>
11
- </div>
12
-
13
-
14
- <eqp-table #tableRecords [data]="values" [columns]="columns"></eqp-table>
@@ -1,7 +0,0 @@
1
- ::ng-deep .error-color {
2
- color: var(--danger);
3
- }
4
-
5
- ::ng-deep .success-color {
6
- color: var(--success);
7
- }
@@ -1,213 +0,0 @@
1
- import { Component, OnInit, Input, ViewChild, Output, EventEmitter, OnChanges, SimpleChanges } from '@angular/core';
2
- import { IAttachmentDTO } from '@eqproject/eqp-attachments';
3
- import { CellAlignmentEnum, ConfigColumn, EqpTableComponent, NumberColumnPipe, TypeColumn } from '@eqproject/eqp-table';
4
- import { Form } from '../../../../models/form.model';
5
- import { BaseField, FieldTypeEnum } from '../../../../models/baseField.model';
6
- import { Record } from '../../../../models/record.model';
7
- import { AttachmentField } from '../../../../models/fields/attachmentField.model';
8
- import { DateField, DateTimeTypeEnum } from '../../../../models/fields/dateField.model';
9
- import { ImageField } from '../../../../models/fields/imageField.model';
10
- import { ListValueField } from '../../../../models/fields/listValueField.model';
11
- import { NumericField } from '../../../../models/fields/numericField.model';
12
- import { UtilityHelperService } from '../../../../services/utilityHelper.services';
13
- import { EqpDynamicModuleDialogService } from '../../../../services/eqp-dynamic-module-dialog.service';
14
-
15
- @Component({
16
- selector: 'list-form-record',
17
- templateUrl: 'list-form-record.component.html',
18
- styleUrls: ['./list-form-record.component.scss']
19
- })
20
- export class ListFormRecordComponent implements OnInit, OnChanges {
21
-
22
- @Input() showTitle = true;
23
- @Input() form: Form;
24
- @Input() values: Array<Record>;
25
- @ViewChild('tableRecords', { static: true }) tableRecords: EqpTableComponent;
26
-
27
- columns = new Array<ConfigColumn>();
28
-
29
- @Output() onAddViewEditRecord: EventEmitter<{ record: Record, onlyView: boolean }> = new EventEmitter<{ record: Record, onlyView: boolean }>();
30
-
31
- @Output() onDeleteRecord: EventEmitter<Record> = new EventEmitter<Record>();
32
- @Output() onDuplicateRecord: EventEmitter<Record> = new EventEmitter<Record>();
33
-
34
-
35
-
36
- constructor() { }
37
-
38
- ngOnInit(): void {
39
- this.configureColumns();
40
- }
41
-
42
- ngOnChanges(changes: SimpleChanges) {
43
- // Se viene modificato il valore di "ngModelInput" allora aggiorna l'input
44
- if (changes['values'] != undefined && changes['values'].firstChange == false) {
45
- this.values = changes['values'].currentValue;
46
- this.reloadTables();
47
- }
48
- }
49
-
50
- /**
51
- * Metodo per configurare le colonne della eqp-table.
52
- */
53
- private configureColumns() {
54
- this.columns = [
55
- {
56
- key: "action", display: "",
57
- type: TypeColumn.MenuAction, buttonMenuIcon: "more_vert", styles: { flex: "0 0 6%" },
58
- actions: [
59
- { name: "Visualizza", icon: "info", fn: (element, index, col) => this.viewOrEditRecord(element, true) },
60
- { name: "Modifica", icon: "edit", fn: (element, index, col) => this.viewOrEditRecord(element, false) },
61
- { name: "Duplica", icon: "file_copy", fn: (element, index, col) => this.duplicateRecord(element) },
62
- { name: "Elimina", icon: "delete", fn: (element, index, col) => this.deleteRecord(element) },
63
- ],
64
- },
65
- ];
66
- this.createAdditionalActions();
67
- this.createColumnsFromFormFields();
68
- }
69
-
70
-
71
- /**
72
- * Metodo per aggiungere nella colonna "action" della eqp-table le azioni sui record
73
- * definite dall'utente all'interno della Form.
74
- */
75
- private createAdditionalActions() {
76
- if (this.form.ActionsOnRecord && this.form.ActionsOnRecord.length > 0) {
77
- this.form.ActionsOnRecord
78
- .sort((a, b) => (a.OrdinalPosition > b.OrdinalPosition) ? 1 : ((b.OrdinalPosition > a.OrdinalPosition) ? -1 : 0))
79
- .forEach(action => {
80
- this.columns.find(c => c.key === 'action')
81
- .actions
82
- .push({
83
- name: action.Name, icon: action.Icon, fn: (element, index, col) => {
84
- const rec = element;
85
- const ctx = UtilityHelperService.context;
86
- eval(action.Action);
87
- // TODO: salvare le modifiche
88
- }
89
- })
90
- })
91
- }
92
- }
93
-
94
- /**
95
- * Metodo che scatena l'evento di Output per mostrare o modificare il record
96
- * selezionato sulla eqp-table.
97
- * @param record Record da visualizzare o modificare selezionato sulla eqp-table.
98
- * @param onlyView Se TRUE viene mostrato il componente add-form-record in sola lettura.
99
- */
100
- private viewOrEditRecord(record: Record, onlyView: boolean) {
101
- this.onAddViewEditRecord.emit({ record, onlyView });
102
- }
103
-
104
- /**
105
- * Metodo per duplicare un record della form.
106
- * @param record Record da duplicare.
107
- */
108
- private duplicateRecord(record: Record) {
109
- this.onDuplicateRecord.emit(record);
110
- }
111
-
112
- /**
113
- * Metodo per eliminare un record dalla lista.
114
- * @param record Record da eliminare selezionato sulla eqp-table.
115
- */
116
- private deleteRecord(record: Record) {
117
- this.onDeleteRecord.emit(record);
118
- }
119
-
120
- /**
121
- * Metodo per creare la configurazione delle colonne per la eqp-table.
122
- * Individua i BaseField da mostrare e li usa per creare le ConfigColumn.
123
- * Le colonne vengono create per i BaseField con il flag InListView a TRUE
124
- * oppure, nel caso non siano stati specificati i campi da visualizzare,
125
- * seleziona i primi 6.
126
- */
127
- private createColumnsFromFormFields() {
128
- var fieldsForColumns: Array<BaseField>;
129
- if (this.form.Fields.find(f => f.InListView)) {
130
- fieldsForColumns = this.form.Fields.filter(f => f.InListView);
131
- } else {
132
- fieldsForColumns = this.form.Fields.filter(f => f.OrdinalPosition < 6);
133
- }
134
- fieldsForColumns.sort((a, b) => (a.OrdinalPosition > b.OrdinalPosition) ? 1 : ((b.OrdinalPosition > a.OrdinalPosition) ? -1 : 0))
135
- .forEach(field => {
136
- this.columns.push(this.createFieldColumn(field));
137
- });
138
- }
139
-
140
- /**
141
- * Metodo per creare l'oggetto ConfigureColumn che rappresenta il BaseField passato in input.
142
- * @param field BaseField per cui creare la colonna nella eqp-table
143
- * @returns Restituisce una ConfigColumn per la eqp-table
144
- */
145
- private createFieldColumn(field: BaseField): ConfigColumn {
146
- var column: ConfigColumn = { key: field.Name, display: field.Label };
147
- switch (field.FieldType) {
148
- case FieldTypeEnum['Booleano']:
149
- column.type = TypeColumn.Boolean;
150
- column.booleanValues = { false: '<i class="fa fa-times error-color"></i>', true: '<i class="fa fa-check success-color"></i>' };
151
- column.styles = { flex: "0 0 7%", cellAlignment: CellAlignmentEnum.CENTER };
152
- break;
153
- case FieldTypeEnum['Data e/o ora']:
154
- if ((field as DateField).IsOnlyDate != DateTimeTypeEnum['Solo orario']) {
155
- column.type = TypeColumn.Date;
156
- if ((field as DateField).IsOnlyDate == DateTimeTypeEnum['Data e ora']) {
157
- column.format = "dd/MM/yyyy HH:mm";
158
- } else if ((field as DateField).IsOnlyDate == DateTimeTypeEnum['Solo data']) {
159
- column.format = (field as DateField).DateFormat ? (field as DateField).DateFormat.replace("DD", "dd") : "dd/MM/yyyy";
160
- }
161
- }
162
- break;
163
- case FieldTypeEnum['Campo numerico']:
164
- if ((field as NumericField).CurrencySymbol) {
165
- column.numberPipe = NumberColumnPipe.CURRENCY;
166
- column.currencyPipeCode = (field as NumericField).CurrencySymbol;
167
- } else if (!(field as NumericField).IsInteger) {
168
- column.numberPipe = NumberColumnPipe.DECIMAL;
169
- }
170
- break;
171
- case FieldTypeEnum['Allegato']:
172
- case FieldTypeEnum['Immagine']:
173
- column.value = (element: Record) => {
174
- if ((field as AttachmentField).IsMultiAttach || ((field as ImageField).AttachDefinition && (field as ImageField).AttachDefinition.IsMultiAttach)) {
175
- return element[field.Name] != null && element[field.Name].length > 0 ? (element[field.Name] as Array<IAttachmentDTO>).map(a => a.FileName).join(", ") : null;
176
- } else {
177
- return element[field.Name] != null && element[field.Name].length > 0 ? (element[field.Name] as Array<IAttachmentDTO>)[0].FileName : null;
178
- }
179
- };
180
- column.isSortable = false;
181
- column.isSearchable = false;
182
- break;
183
- case FieldTypeEnum['Elenco generico']:
184
- column.value = (element: Record) => {
185
- if ((field as ListValueField).IsMultiChoiche) {
186
- if (!element[field.Name] || element[field.Name].length == 0) {
187
- return null;
188
- } else {
189
- return Object.keys((field as ListValueField).ValuePairs).filter(k => element[field.Name].includes((field as ListValueField).ValuePairs[k])).join(", ");
190
- }
191
- } else {
192
- return Object.keys((field as ListValueField).ValuePairs).find(k => (field as ListValueField).ValuePairs[k] == element[field.Name]);
193
- }
194
- };
195
- column.isSortable = false;
196
- column.isSearchable = false;
197
- break;
198
- case FieldTypeEnum['Lookup']:
199
- // TODO
200
- break;
201
- }
202
- return column;
203
- }
204
-
205
- /**
206
- * Metodo per ricaricare i dati della eqp-table.
207
- */
208
- private reloadTables() {
209
- if (this.tableRecords) {
210
- this.tableRecords.reloadDatatable();
211
- }
212
- }
213
- }
@@ -1,3 +0,0 @@
1
- <div class="eqp-splash-screen" *ngIf="isLoading | async">
2
- <div id="loader"></div>
3
- </div>
@@ -1,100 +0,0 @@
1
- :host {
2
- #loader {
3
- display: block;
4
- position: relative;
5
- width: 150px;
6
- height: 150px;
7
- border-radius: 50%;
8
- border: 3px solid transparent;
9
- border-top-color: var(--primary);
10
- -webkit-animation: spin 2s linear infinite;
11
- animation: spin 2s linear infinite;
12
- }
13
-
14
- #loader:before {
15
- content: "";
16
- position: absolute;
17
- top: 5px;
18
- left: 5px;
19
- right: 5px;
20
- bottom: 5px;
21
- border-radius: 50%;
22
- border: 3px solid transparent;
23
- border-top-color: var(--primary);
24
- -webkit-animation: spin 3s linear infinite;
25
- animation: spin 3s linear infinite;
26
- }
27
-
28
- #loader:after {
29
- content: "";
30
- position: absolute;
31
- top: 15px;
32
- left: 15px;
33
- right: 15px;
34
- bottom: 15px;
35
- border-radius: 50%;
36
- border: 3px solid transparent;
37
- border-top-color: var(--primary);
38
- -webkit-animation: spin 1.5s linear infinite;
39
- animation: spin 1.5s linear infinite;
40
- }
41
-
42
- @-webkit-keyframes spin {
43
- 0% {
44
- -webkit-transform: rotate(0deg);
45
- -ms-transform: rotate(0deg);
46
- transform: rotate(0deg);
47
- }
48
-
49
- 100% {
50
- -webkit-transform: rotate(360deg);
51
- -ms-transform: rotate(360deg);
52
- transform: rotate(360deg);
53
- }
54
- }
55
-
56
- @keyframes spin {
57
- 0% {
58
- -webkit-transform: rotate(0deg);
59
- -ms-transform: rotate(0deg);
60
- transform: rotate(0deg);
61
- }
62
-
63
- 100% {
64
- -webkit-transform: rotate(360deg);
65
- -ms-transform: rotate(360deg);
66
- transform: rotate(360deg);
67
- }
68
- }
69
-
70
- .eqp-splash-screen {
71
- background-color: #343a4040;
72
- position: fixed;
73
- display: flex;
74
- flex-direction: column;
75
- align-items: center;
76
- justify-content: center;
77
- height: 100%;
78
- width: 100%;
79
- z-index: 9999;
80
-
81
- img {
82
- margin-left: calc(100vw - 100%);
83
- width: 90px;
84
- margin-bottom: 30px;
85
- }
86
-
87
- span {
88
- margin-left: calc(100vw - 100%);
89
- margin-bottom: 30px;
90
- }
91
-
92
- ::ng-deep {
93
- .mat-progress-spinner circle,
94
- .mat-spinner circle {
95
- // brand color
96
- stroke: #5d78ff;
97
- }
98
- }
99
- }
100
- }
@@ -1,19 +0,0 @@
1
- import { Component, OnInit } from '@angular/core';
2
- import { Subject } from 'rxjs';
3
- import { SpinnerService } from '../../../services/spinner.service';
4
-
5
- @Component({
6
- selector: 'eqp-dynamic-module-spinner',
7
- templateUrl: './spinner.component.html',
8
- styleUrls: ['./spinner.component.scss']
9
- })
10
- export class SpinnerComponent implements OnInit {
11
-
12
- isLoading: Subject<boolean> = this.spinnerService.isLoading;
13
-
14
- constructor(private spinnerService: SpinnerService) { }
15
-
16
- ngOnInit(): void {
17
- }
18
-
19
- }
@@ -1,65 +0,0 @@
1
- import { CommonModule } from '@angular/common';
2
- import { NgModule } from '@angular/core';
3
- import { FormsModule, ReactiveFormsModule } from '@angular/forms';
4
- import { EqpDynamicModuleComponent } from './components/exported/eqp-dynamic-module/eqp-dynamic-module.component';
5
- import { MaterialModule } from './modules/material.module';
6
-
7
- import { EqpTableModule } from '@eqproject/eqp-table';
8
- import { EqpAttachmentsModule } from '@eqproject/eqp-attachments';
9
- import { EqpSelectModule } from '@eqproject/eqp-select';
10
- import { EqpDatetimepickerModule } from '@eqproject/eqp-datetimepicker';
11
- import { EqpImgDrawingModule } from '@eqproject/eqp-img-drawing';
12
- import { EqpFiltersModule } from '@eqproject/eqp-filters';
13
- import { EqpNumericModule } from '@eqproject/eqp-numeric';
14
- import { EqpDynamicModuleConfiguratorComponent } from './components/exported/eqp-dynamic-module-configurator/eqp-dynamic-module-configurator.component';
15
- import { AddFormFieldComponent } from './components/private/add-form-field/add-form-field.component';
16
- import { TextFieldTemplateComponent } from './components/private/field-templates/text-field-template/text-field-template.component';
17
- import { BooleanFieldTemplateComponent } from './components/private/field-templates/boolean-field-template/boolean-field-template.component';
18
- import { DateFieldTemplateComponent } from './components/private/field-templates/date-field-template/date-field-template.component';
19
- import { TextareaFieldTemplateComponent } from './components/private/field-templates/textarea-field-template/textarea-field-template.component';
20
- import { NumericFieldTemplateComponent } from './components/private/field-templates/numeric-field-template/numeric-field-template.component';
21
- import { ListValueFieldTemplateComponent } from './components/private/field-templates/list-value-field-template/list-value-field-template.component';
22
- import { AttachmentFieldTemplateComponent } from './components/private/field-templates/attachment-field-template/attachment-field-template.component';
23
- import { ImageFieldTemplateComponent } from './components/private/field-templates/image-field-template/image-field-template.component';
24
- import { ListFormRecordComponent } from './components/private/form-records/list-form-record/list-form-record.component';
25
- import { AddFormRecordComponent } from './components/private/form-records/add-form-record/add-form-record.component';
26
- import { DynamicModuleFieldComponent } from './components/private/dynamic-module-field/dynamic-module-field.component';
27
- import { SpinnerComponent } from './components/private/spinner/spinner.component';
28
-
29
- @NgModule({
30
- declarations: [
31
- EqpDynamicModuleComponent,
32
- EqpDynamicModuleConfiguratorComponent,
33
- AddFormFieldComponent,
34
- TextFieldTemplateComponent,
35
- BooleanFieldTemplateComponent,
36
- DateFieldTemplateComponent,
37
- TextareaFieldTemplateComponent,
38
- NumericFieldTemplateComponent,
39
- ListValueFieldTemplateComponent,
40
- AttachmentFieldTemplateComponent,
41
- ImageFieldTemplateComponent,
42
- ListFormRecordComponent,
43
- AddFormRecordComponent,
44
- DynamicModuleFieldComponent,
45
- SpinnerComponent,
46
- ],
47
- imports: [
48
- MaterialModule,
49
- FormsModule,
50
- CommonModule,
51
- ReactiveFormsModule,
52
- EqpTableModule,
53
- EqpAttachmentsModule,
54
- EqpSelectModule,
55
- EqpDatetimepickerModule,
56
- EqpFiltersModule,
57
- EqpNumericModule,
58
- EqpImgDrawingModule
59
- ],
60
- exports: [
61
- EqpDynamicModuleComponent,
62
- EqpDynamicModuleConfiguratorComponent
63
- ]
64
- })
65
- export class EqpDynamicModuleModule { }
@@ -1,10 +0,0 @@
1
- export class Context {
2
- User: ContextUser = new ContextUser();
3
- Organizzation: string;
4
- }
5
-
6
- export class ContextUser {
7
- Name: string;
8
- Surname: string;
9
- Role: string;
10
- }
@@ -1,32 +0,0 @@
1
- import { BaseField } from "../baseField.model";
2
-
3
- export class AttachmentField extends BaseField {
4
- /**Elenco delle estensioni consentite. Se vuoto usa il default (pdf) */
5
- AllowedExtensions: Array<string>;
6
-
7
- /**Se true permette l'inserimento di più allegati. In questo caso i metadati vengono rappresentati come una detail */
8
- IsMultiAttach: boolean;
9
-
10
- /**Elenco campi che possono rappresentare i metadati dell'allegato, ad esempio nome, ecc... */
11
- MetadataFields: Array<BaseField>;
12
- }
13
-
14
- export const AvailableFileExtensions: Array<{ key: string, value: string }> = [
15
- { value: '.pdf', key: 'application/pdf' },
16
- { value: '.doc', key: 'application/msword' },
17
- { value: '.xls', key: 'application/vnd.ms-excel' },
18
- { value: '.ppt', key: 'application/vnd.ms-powerpoint' },
19
- { value: '.docx', key: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' },
20
- { value: '.xlsx', key: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' },
21
- { value: '.pptx', key: 'application/vnd.openxmlformats-officedocument.presentationml.presentation' },
22
- { value: '.csv', key: 'text/csv' },
23
- { value: '.txt', key: 'text/plain' },
24
- ];
25
-
26
- export const AvailableImageExtensions: Array<{ key: string, value: string }> = [
27
- { value: '.jpg/.jpeg', key: 'image/jpeg' },
28
- { value: '.png', key: 'image/png' },
29
- { value: '.bmp', key: 'image/bmp' },
30
- { value: '.svg', key: 'image/svg+xml' },
31
- { value: '.ico', key: 'image/x-icon' },
32
- ];
@@ -1,18 +0,0 @@
1
- import { BaseField } from "../baseField.model";
2
-
3
- /**Campo di testo */
4
- export class TextField extends BaseField {
5
- TextMask: TextMaskEnum;
6
- MaxLenght: number;
7
- MinLenght: number;
8
- }
9
-
10
- export enum TextMaskEnum {
11
- 'Password' = 1,
12
- 'Email' = 2,
13
- 'Telefono' = 3,
14
- 'Url' = 4
15
- }
16
-
17
- export const UrlRegex = '(https?://)?([\\da-z.-]+)\\.([a-z.]{2,6})[/\\w .-]*/?';
18
- export const TelRegex = '([+]?[0-9]{10,14})';