@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.
- package/bundles/eqproject-eqp-dynamic-module.umd.js +3991 -0
- package/bundles/eqproject-eqp-dynamic-module.umd.js.map +1 -0
- package/bundles/eqproject-eqp-dynamic-module.umd.min.js +17 -0
- package/bundles/eqproject-eqp-dynamic-module.umd.min.js.map +1 -0
- package/eqproject-eqp-dynamic-module.d.ts +6 -0
- package/eqproject-eqp-dynamic-module.metadata.json +1 -0
- package/esm2015/eqproject-eqp-dynamic-module.js +7 -0
- package/esm2015/lib/components/exported/eqp-dynamic-module/eqp-dynamic-module.component.js +262 -0
- package/esm2015/lib/components/exported/eqp-dynamic-module-configurator/eqp-dynamic-module-configurator.component.js +649 -0
- package/esm2015/lib/components/private/add-form-field/add-form-field.component.js +577 -0
- package/esm2015/lib/components/private/dynamic-module-field/dynamic-module-field.component.js +127 -0
- package/esm2015/lib/components/private/field-templates/attachment-field-template/attachment-field-template.component.js +170 -0
- package/esm2015/lib/components/private/field-templates/boolean-field-template/boolean-field-template.component.js +56 -0
- package/esm2015/lib/components/private/field-templates/date-field-template/date-field-template.component.js +71 -0
- package/esm2015/lib/components/private/field-templates/image-field-template/image-field-template.component.js +196 -0
- package/esm2015/lib/components/private/field-templates/list-value-field-template/list-value-field-template.component.js +115 -0
- package/esm2015/lib/components/private/field-templates/numeric-field-template/numeric-field-template.component.js +71 -0
- package/esm2015/lib/components/private/field-templates/text-field-template/text-field-template.component.js +67 -0
- package/esm2015/lib/components/private/field-templates/textarea-field-template/textarea-field-template.component.js +51 -0
- package/esm2015/lib/components/private/form-records/add-form-record/add-form-record.component.js +130 -0
- package/esm2015/lib/components/private/form-records/list-form-record/list-form-record.component.js +216 -0
- package/esm2015/lib/components/private/spinner/spinner.component.js +23 -0
- package/esm2015/lib/eqp-dynamic-module.module.js +69 -0
- package/esm2015/lib/interfaces/iBaseFieldComponent.interface.js +1 -0
- package/esm2015/lib/interfaces/iRootObject.interface.js +1 -0
- package/esm2015/lib/models/baseField.model.js +36 -0
- package/esm2015/lib/models/baseObj.model.js +9 -0
- package/esm2015/lib/models/context.model.js +8 -0
- package/esm2015/lib/models/endPointConfiguration.model.js +23 -0
- package/esm2015/lib/models/entity.model.js +7 -0
- package/esm2015/lib/models/fields/attachmentField.model.js +22 -0
- package/esm2015/lib/models/fields/booleanField.model.js +12 -0
- package/esm2015/lib/models/fields/dateField.model.js +11 -0
- package/esm2015/lib/models/fields/imageField.model.js +8 -0
- package/esm2015/lib/models/fields/listValueField.model.js +14 -0
- package/esm2015/lib/models/fields/lookupField.model.js +5 -0
- package/esm2015/lib/models/fields/numericField.model.js +5 -0
- package/esm2015/lib/models/fields/testareaField.model.js +4 -0
- package/esm2015/lib/models/fields/textField.model.js +14 -0
- package/esm2015/lib/models/form.model.js +24 -0
- package/esm2015/lib/models/record.model.js +8 -0
- package/esm2015/lib/modules/material.module.js +108 -0
- package/esm2015/lib/services/custom-form-validators.service.js +19 -0
- package/esm2015/lib/services/eqp-dynamic-module-dialog.service.js +113 -0
- package/esm2015/lib/services/spinner.service.js +43 -0
- package/esm2015/lib/services/utilityHelper.services.js +387 -0
- package/esm2015/public-api.js +39 -0
- package/esm5/eqproject-eqp-dynamic-module.js +7 -0
- package/esm5/lib/components/exported/eqp-dynamic-module/eqp-dynamic-module.component.js +269 -0
- package/esm5/lib/components/exported/eqp-dynamic-module-configurator/eqp-dynamic-module-configurator.component.js +664 -0
- package/esm5/lib/components/private/add-form-field/add-form-field.component.js +588 -0
- package/esm5/lib/components/private/dynamic-module-field/dynamic-module-field.component.js +128 -0
- package/esm5/lib/components/private/field-templates/attachment-field-template/attachment-field-template.component.js +173 -0
- package/esm5/lib/components/private/field-templates/boolean-field-template/boolean-field-template.component.js +57 -0
- package/esm5/lib/components/private/field-templates/date-field-template/date-field-template.component.js +72 -0
- package/esm5/lib/components/private/field-templates/image-field-template/image-field-template.component.js +206 -0
- package/esm5/lib/components/private/field-templates/list-value-field-template/list-value-field-template.component.js +119 -0
- package/esm5/lib/components/private/field-templates/numeric-field-template/numeric-field-template.component.js +72 -0
- package/esm5/lib/components/private/field-templates/text-field-template/text-field-template.component.js +68 -0
- package/esm5/lib/components/private/field-templates/textarea-field-template/textarea-field-template.component.js +52 -0
- package/esm5/lib/components/private/form-records/add-form-record/add-form-record.component.js +133 -0
- package/esm5/lib/components/private/form-records/list-form-record/list-form-record.component.js +220 -0
- package/esm5/lib/components/private/spinner/spinner.component.js +24 -0
- package/esm5/lib/eqp-dynamic-module.module.js +72 -0
- package/esm5/lib/interfaces/iBaseFieldComponent.interface.js +1 -0
- package/esm5/lib/interfaces/iRootObject.interface.js +1 -0
- package/esm5/lib/models/baseField.model.js +43 -0
- package/esm5/lib/models/baseObj.model.js +13 -0
- package/esm5/lib/models/context.model.js +14 -0
- package/esm5/lib/models/endPointConfiguration.model.js +33 -0
- package/esm5/lib/models/entity.model.js +14 -0
- package/esm5/lib/models/fields/attachmentField.model.js +29 -0
- package/esm5/lib/models/fields/booleanField.model.js +19 -0
- package/esm5/lib/models/fields/dateField.model.js +18 -0
- package/esm5/lib/models/fields/imageField.model.js +19 -0
- package/esm5/lib/models/fields/listValueField.model.js +25 -0
- package/esm5/lib/models/fields/lookupField.model.js +12 -0
- package/esm5/lib/models/fields/numericField.model.js +12 -0
- package/esm5/lib/models/fields/testareaField.model.js +11 -0
- package/esm5/lib/models/fields/textField.model.js +21 -0
- package/esm5/lib/models/form.model.js +39 -0
- package/esm5/lib/models/record.model.js +14 -0
- package/esm5/lib/modules/material.module.js +111 -0
- package/esm5/lib/services/custom-form-validators.service.js +23 -0
- package/esm5/lib/services/eqp-dynamic-module-dialog.service.js +123 -0
- package/esm5/lib/services/spinner.service.js +46 -0
- package/esm5/lib/services/utilityHelper.services.js +396 -0
- package/esm5/public-api.js +39 -0
- package/fesm2015/eqproject-eqp-dynamic-module.js +3580 -0
- package/fesm2015/eqproject-eqp-dynamic-module.js.map +1 -0
- package/fesm5/eqproject-eqp-dynamic-module.js +3766 -0
- package/fesm5/eqproject-eqp-dynamic-module.js.map +1 -0
- package/lib/components/exported/eqp-dynamic-module/eqp-dynamic-module.component.d.ts +101 -0
- package/lib/components/exported/eqp-dynamic-module-configurator/eqp-dynamic-module-configurator.component.d.ts +235 -0
- package/lib/components/private/add-form-field/add-form-field.component.d.ts +199 -0
- package/lib/components/private/dynamic-module-field/dynamic-module-field.component.d.ts +55 -0
- package/lib/components/private/field-templates/attachment-field-template/attachment-field-template.component.d.ts +68 -0
- package/lib/components/private/field-templates/boolean-field-template/boolean-field-template.component.d.ts +21 -0
- package/lib/components/private/field-templates/date-field-template/date-field-template.component.d.ts +27 -0
- package/lib/components/private/field-templates/image-field-template/image-field-template.component.d.ts +65 -0
- package/lib/components/private/field-templates/list-value-field-template/list-value-field-template.component.d.ts +51 -0
- package/lib/components/private/field-templates/numeric-field-template/numeric-field-template.component.d.ts +26 -0
- package/lib/components/private/field-templates/text-field-template/text-field-template.component.d.ts +22 -0
- package/lib/components/private/field-templates/textarea-field-template/textarea-field-template.component.d.ts +20 -0
- package/lib/components/private/form-records/add-form-record/add-form-record.component.d.ts +52 -0
- package/lib/components/private/form-records/list-form-record/list-form-record.component.d.ts +64 -0
- package/lib/components/private/spinner/spinner.component.d.ts +9 -0
- package/lib/eqp-dynamic-module.module.d.ts +2 -0
- package/{src/lib/interfaces/iBaseFieldComponent.interface.ts → lib/interfaces/iBaseFieldComponent.interface.d.ts} +1 -1
- package/{src/lib/interfaces/iRootObject.interface.ts → lib/interfaces/iRootObject.interface.d.ts} +1 -1
- package/{src/lib/models/baseField.model.ts → lib/models/baseField.model.d.ts} +5 -14
- package/{src/lib/models/baseObj.model.ts → lib/models/baseObj.model.d.ts} +3 -3
- package/lib/models/context.model.d.ts +9 -0
- package/{src/lib/models/endPointConfiguration.model.ts → lib/models/endPointConfiguration.model.d.ts} +12 -16
- package/{src/lib/models/entity.model.ts → lib/models/entity.model.d.ts} +1 -2
- package/lib/models/fields/attachmentField.model.d.ts +17 -0
- package/{src/lib/models/fields/booleanField.model.ts → lib/models/fields/booleanField.model.d.ts} +4 -8
- package/{src/lib/models/fields/dateField.model.ts → lib/models/fields/dateField.model.d.ts} +3 -5
- package/{src/lib/models/fields/imageField.model.ts → lib/models/fields/imageField.model.d.ts} +3 -8
- package/{src/lib/models/fields/listValueField.model.ts → lib/models/fields/listValueField.model.d.ts} +8 -13
- package/{src/lib/models/fields/lookupField.model.ts → lib/models/fields/lookupField.model.d.ts} +2 -5
- package/{src/lib/models/fields/numericField.model.ts → lib/models/fields/numericField.model.d.ts} +2 -3
- package/{src/lib/models/fields/testareaField.model.ts → lib/models/fields/testareaField.model.d.ts} +2 -3
- package/lib/models/fields/textField.model.d.ts +15 -0
- package/{src/lib/models/form.model.ts → lib/models/form.model.d.ts} +12 -25
- package/{src/lib/models/record.model.ts → lib/models/record.model.d.ts} +5 -4
- package/lib/modules/material.module.d.ts +2 -0
- package/lib/services/custom-form-validators.service.d.ts +5 -0
- package/lib/services/eqp-dynamic-module-dialog.service.d.ts +34 -0
- package/lib/services/spinner.service.d.ts +15 -0
- package/lib/services/utilityHelper.services.d.ts +77 -0
- package/package.json +41 -31
- package/{src/public-api.ts → public-api.d.ts} +0 -3
- package/karma.conf.js +0 -32
- package/ng-package.json +0 -18
- package/src/lib/components/exported/eqp-dynamic-module/eqp-dynamic-module.component.html +0 -10
- package/src/lib/components/exported/eqp-dynamic-module/eqp-dynamic-module.component.scss +0 -3
- package/src/lib/components/exported/eqp-dynamic-module/eqp-dynamic-module.component.ts +0 -228
- package/src/lib/components/exported/eqp-dynamic-module-configurator/eqp-dynamic-module-configurator.component.html +0 -212
- package/src/lib/components/exported/eqp-dynamic-module-configurator/eqp-dynamic-module-configurator.component.scss +0 -30
- package/src/lib/components/exported/eqp-dynamic-module-configurator/eqp-dynamic-module-configurator.component.ts +0 -692
- package/src/lib/components/private/add-form-field/add-form-field.component.html +0 -417
- package/src/lib/components/private/add-form-field/add-form-field.component.scss +0 -38
- package/src/lib/components/private/add-form-field/add-form-field.component.ts +0 -599
- package/src/lib/components/private/dynamic-module-field/dynamic-module-field.component.html +0 -42
- package/src/lib/components/private/dynamic-module-field/dynamic-module-field.component.scss +0 -0
- package/src/lib/components/private/dynamic-module-field/dynamic-module-field.component.ts +0 -125
- package/src/lib/components/private/field-templates/attachment-field-template/attachment-field-template.component.html +0 -25
- package/src/lib/components/private/field-templates/attachment-field-template/attachment-field-template.component.scss +0 -0
- package/src/lib/components/private/field-templates/attachment-field-template/attachment-field-template.component.ts +0 -172
- package/src/lib/components/private/field-templates/boolean-field-template/boolean-field-template.component.html +0 -32
- package/src/lib/components/private/field-templates/boolean-field-template/boolean-field-template.component.scss +0 -0
- package/src/lib/components/private/field-templates/boolean-field-template/boolean-field-template.component.ts +0 -53
- package/src/lib/components/private/field-templates/date-field-template/date-field-template.component.html +0 -6
- package/src/lib/components/private/field-templates/date-field-template/date-field-template.component.scss +0 -0
- package/src/lib/components/private/field-templates/date-field-template/date-field-template.component.ts +0 -70
- package/src/lib/components/private/field-templates/image-field-template/image-field-template.component.html +0 -57
- package/src/lib/components/private/field-templates/image-field-template/image-field-template.component.scss +0 -4
- package/src/lib/components/private/field-templates/image-field-template/image-field-template.component.ts +0 -203
- package/src/lib/components/private/field-templates/list-value-field-template/list-value-field-template.component.html +0 -46
- package/src/lib/components/private/field-templates/list-value-field-template/list-value-field-template.component.scss +0 -13
- package/src/lib/components/private/field-templates/list-value-field-template/list-value-field-template.component.ts +0 -114
- package/src/lib/components/private/field-templates/numeric-field-template/numeric-field-template.component.html +0 -6
- package/src/lib/components/private/field-templates/numeric-field-template/numeric-field-template.component.scss +0 -0
- package/src/lib/components/private/field-templates/numeric-field-template/numeric-field-template.component.ts +0 -70
- package/src/lib/components/private/field-templates/text-field-template/text-field-template.component.html +0 -5
- package/src/lib/components/private/field-templates/text-field-template/text-field-template.component.scss +0 -0
- package/src/lib/components/private/field-templates/text-field-template/text-field-template.component.ts +0 -65
- package/src/lib/components/private/field-templates/textarea-field-template/textarea-field-template.component.html +0 -5
- package/src/lib/components/private/field-templates/textarea-field-template/textarea-field-template.component.scss +0 -0
- package/src/lib/components/private/field-templates/textarea-field-template/textarea-field-template.component.ts +0 -48
- package/src/lib/components/private/form-records/add-form-record/add-form-record.component.html +0 -74
- package/src/lib/components/private/form-records/add-form-record/add-form-record.component.scss +0 -0
- package/src/lib/components/private/form-records/add-form-record/add-form-record.component.ts +0 -117
- package/src/lib/components/private/form-records/list-form-record/list-form-record.component.html +0 -14
- package/src/lib/components/private/form-records/list-form-record/list-form-record.component.scss +0 -7
- package/src/lib/components/private/form-records/list-form-record/list-form-record.component.ts +0 -213
- package/src/lib/components/private/spinner/spinner.component.html +0 -3
- package/src/lib/components/private/spinner/spinner.component.scss +0 -100
- package/src/lib/components/private/spinner/spinner.component.ts +0 -19
- package/src/lib/eqp-dynamic-module.module.ts +0 -65
- package/src/lib/models/context.model.ts +0 -10
- package/src/lib/models/fields/attachmentField.model.ts +0 -32
- package/src/lib/models/fields/textField.model.ts +0 -18
- package/src/lib/modules/material.module.ts +0 -104
- package/src/lib/services/custom-form-validators.service.ts +0 -21
- package/src/lib/services/eqp-dynamic-module-dialog.service.ts +0 -114
- package/src/lib/services/spinner.service.ts +0 -40
- package/src/lib/services/utilityHelper.services.ts +0 -413
- package/src/test.ts +0 -26
- package/tsconfig.lib.json +0 -23
- package/tsconfig.lib.prod.json +0 -6
- package/tsconfig.spec.json +0 -17
- package/tslint.json +0 -17
|
@@ -1,599 +0,0 @@
|
|
|
1
|
-
import { ChangeDetectorRef, Component, EventEmitter, Input, OnInit, Output, TemplateRef, ViewChild } from '@angular/core';
|
|
2
|
-
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
|
|
3
|
-
import { MatDialog, MatDialogRef } from '@angular/material/dialog';
|
|
4
|
-
import { AttachmentType, EqpAttachmentsComponent, IAttachmentDTO } from '@eqproject/eqp-attachments';
|
|
5
|
-
import { EnumHelper } from '@eqproject/eqp-select';
|
|
6
|
-
import { CellAlignmentEnum, ConfigColumn, EqpTableComponent, TypeColumn } from '@eqproject/eqp-table';
|
|
7
|
-
import { BaseField, ColSpanSizesEnum, FieldTypeEnum } from '../../../models/baseField.model';
|
|
8
|
-
import { AttachmentField, AvailableFileExtensions, AvailableImageExtensions } from '../../../models/fields/attachmentField.model';
|
|
9
|
-
import { BooleanField, BoolPresentantioEnum } from '../../../models/fields/booleanField.model';
|
|
10
|
-
import { DateField, DateTimeTypeEnum } from '../../../models/fields/dateField.model';
|
|
11
|
-
import { ImageField } from '../../../models/fields/imageField.model';
|
|
12
|
-
import { ButtonImage, ListPresentationEnum, ListValueField } from '../../../models/fields/listValueField.model';
|
|
13
|
-
import { LookupField } from '../../../models/fields/lookupField.model';
|
|
14
|
-
import { NumericField } from '../../../models/fields/numericField.model';
|
|
15
|
-
import { TextareaField } from '../../../models/fields/testareaField.model';
|
|
16
|
-
import { TextMaskEnum, TextField } from '../../../models/fields/textField.model';
|
|
17
|
-
import { FormFieldGroup } from '../../../models/form.model';
|
|
18
|
-
import { ArrayValidators } from '../../../services/custom-form-validators.service';
|
|
19
|
-
import { EqpDynamicModuleDialogService } from '../../../services/eqp-dynamic-module-dialog.service';
|
|
20
|
-
import { UtilityHelperService } from '../../../services/utilityHelper.services';
|
|
21
|
-
|
|
22
|
-
@Component({
|
|
23
|
-
selector: 'eqp-dynamic-module-add-form-field',
|
|
24
|
-
templateUrl: './add-form-field.component.html',
|
|
25
|
-
styleUrls: ['./add-form-field.component.scss']
|
|
26
|
-
})
|
|
27
|
-
export class AddFormFieldComponent implements OnInit {
|
|
28
|
-
|
|
29
|
-
@Input() field: BaseField | any;
|
|
30
|
-
@Input() indexField: number;
|
|
31
|
-
@Input() formFieldsGroups: Array<FormFieldGroup>;
|
|
32
|
-
/** Elenco dei Field creati nella form, usati per popolare l'autocomplete della proprietà Formula. */
|
|
33
|
-
@Input() availableFields: Array<BaseField>;
|
|
34
|
-
@Input() fieldTypesToExclude: Array<FieldTypeEnum> = [FieldTypeEnum['Form di dettaglio']];
|
|
35
|
-
|
|
36
|
-
fieldFormGroup: FormGroup;
|
|
37
|
-
keyValueObject: { key: string, value: string } = { key: '', value: '' };
|
|
38
|
-
availableColSpanSizes: Array<ColSpanSizesEnum> = [];
|
|
39
|
-
formulaAutocompleteOptions: Array<{ label: string, value: string }>;
|
|
40
|
-
AvailableFileExtensions = AvailableFileExtensions;
|
|
41
|
-
AvailableImageExtensions = AvailableImageExtensions;
|
|
42
|
-
|
|
43
|
-
@Output() saveFieldEvent: EventEmitter<BaseField | any> = new EventEmitter<BaseField | any>();
|
|
44
|
-
|
|
45
|
-
//#region Template dei vari pezzi di form per la creazione di un campo(in base al tipo scelto).
|
|
46
|
-
fieldTypeFormTemplate: TemplateRef<any>;
|
|
47
|
-
@ViewChild('textFieldFormTemplate', { static: true }) textFieldFormTemplate: TemplateRef<any>;
|
|
48
|
-
@ViewChild('textareaFieldFormTemplate', { static: true }) textareaFieldFormTemplate: TemplateRef<any>;
|
|
49
|
-
@ViewChild('booleadFieldFormTemplate', { static: true }) booleadFieldFormTemplate: TemplateRef<any>;
|
|
50
|
-
@ViewChild('dateFieldFormTemplate', { static: true }) dateFieldFormTemplate: TemplateRef<any>;
|
|
51
|
-
@ViewChild('numericFieldFormTemplate', { static: true }) numericFieldFormTemplate: TemplateRef<any>;
|
|
52
|
-
@ViewChild('attachmentFieldFormTemplate', { static: true }) attachmentFieldFormTemplate: TemplateRef<any>;
|
|
53
|
-
@ViewChild('imageFieldFormTemplate', { static: true }) imageFieldFormTemplate: TemplateRef<any>;
|
|
54
|
-
@ViewChild('listValueFieldFormTemplate', { static: true }) listValueFieldFormTemplate: TemplateRef<any>;
|
|
55
|
-
@ViewChild('lookupFieldFormTemplate', { static: true }) lookupFieldFormTemplate: TemplateRef<any>;
|
|
56
|
-
//#endregion
|
|
57
|
-
|
|
58
|
-
//#region Proprietà per gestire i metadata nei campi ti dipo Allegato o Immagine
|
|
59
|
-
metadataColumns: Array<ConfigColumn>;
|
|
60
|
-
@ViewChild('metadataFieldsTable', { static: false }) metadataFieldsTable: EqpTableComponent;
|
|
61
|
-
selectedMetadata: BaseField;
|
|
62
|
-
indexSelectedMetadata: number;
|
|
63
|
-
dialogMetadataRef: MatDialogRef<TemplateRef<any>>;
|
|
64
|
-
@ViewChild('dialogMetadata', { static: true }) dialogMetadata: TemplateRef<any>;
|
|
65
|
-
//#endregion
|
|
66
|
-
|
|
67
|
-
//#region Proprietà per gestire le immagini nei capi di tipo elenco generico
|
|
68
|
-
@ViewChild('buttonImagesKeyValueInputColumn', { static: true }) buttonImagesKeyValueInputColumn: TemplateRef<any>;
|
|
69
|
-
//#endregion
|
|
70
|
-
|
|
71
|
-
//#region Enumeratori usati nell'html
|
|
72
|
-
FieldTypeEnum = FieldTypeEnum;
|
|
73
|
-
BoolPresentantioEnum = BoolPresentantioEnum;
|
|
74
|
-
DateTimeTypeEnum = DateTimeTypeEnum;
|
|
75
|
-
ListPresentationEnum = ListPresentationEnum;
|
|
76
|
-
TextMaskEnum = TextMaskEnum;
|
|
77
|
-
AttachmentType = AttachmentType;
|
|
78
|
-
//#endregion
|
|
79
|
-
|
|
80
|
-
constructor(
|
|
81
|
-
private formBuilder: FormBuilder,
|
|
82
|
-
private enumHelper: EnumHelper,
|
|
83
|
-
private dialog: MatDialog,
|
|
84
|
-
private cdr: ChangeDetectorRef
|
|
85
|
-
) { }
|
|
86
|
-
|
|
87
|
-
ngOnInit(): void {
|
|
88
|
-
if (!this.fieldTypesToExclude.includes(FieldTypeEnum['Form di dettaglio'])) {
|
|
89
|
-
this.fieldTypesToExclude.push(FieldTypeEnum['Form di dettaglio']);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
this.onFieldTypeChange(false);
|
|
93
|
-
this.availableFields = this.availableFields ? this.availableFields.filter(f => f != this.field) : [];
|
|
94
|
-
this.configureColumns();
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Metodo per impostare i valori da suggerire nell'autocomplete del campo Formula.
|
|
99
|
-
* Viene scatenato al focus (in questo caso viene passato il parametro a null per differenziarlo
|
|
100
|
-
* dall'evento di click sulla tastiera) e al keyup sull'input (il parametro è diverso da null).
|
|
101
|
-
* @param keyboardEvent Evento scatenato al keyup sulla tastiera. Se null allora il metodo è stato invocato dal focus sull'input.
|
|
102
|
-
* @summary Aggiorna l'elenco dei suggerimenti per l'autocomplete se l'utente esegue il focus sull'input
|
|
103
|
-
* oppure al keyup sulla tastiera di un tasto diverso dalle frecce.
|
|
104
|
-
*/
|
|
105
|
-
setFormulaAutocompleteOptions(keyboardEvent: KeyboardEvent) {
|
|
106
|
-
// Creo l'array per l'autocomplete solo se sto facendo il focus sull'input o se sto premendo un tasto
|
|
107
|
-
// sulla tastiera diverso dalle frecce (in quest'ultimo caso, se non viene eseguito il filtro sull'evento,
|
|
108
|
-
// non si può selezionare un suggerimento dell'autocomplete perchè al click verrebbe ricaricato l'array e
|
|
109
|
-
// si prederebbe la selezione appena fatta).
|
|
110
|
-
if (!keyboardEvent || !keyboardEvent.code.includes("Arrow")) {
|
|
111
|
-
this.formulaAutocompleteOptions = UtilityHelperService.GetAutocompleteOptions(this.availableFields, this.field.Formula);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Crea il FormGroup per l'aggiunta di un nuovo campo all'interno della form.
|
|
117
|
-
* Metodo richiamato ogni volta che cambia il tipo del campo scelto o viene aggiunto/modificato un Field
|
|
118
|
-
*/
|
|
119
|
-
createFieldForm() {
|
|
120
|
-
this.fieldFormGroup = this.formBuilder.group({
|
|
121
|
-
Label: [this.field.Label, Validators.required],
|
|
122
|
-
Description: [this.field.Description],
|
|
123
|
-
Required: [this.field.Required],
|
|
124
|
-
FieldType: [this.field.FieldType, Validators.required],
|
|
125
|
-
Formula: [this.field.Formula],
|
|
126
|
-
ColSpanSizes: [this.field.ColSpanSizes],
|
|
127
|
-
InListView: [this.field.InListView],
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
if (this.formFieldsGroups) {
|
|
131
|
-
this.fieldFormGroup.addControl('FieldGroup', new FormControl(this.field.FieldGroup, Validators.required));
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Metodo chiamato quando cambia il FieldType del BaseField che si sta aggiungendo/modificando.
|
|
137
|
-
* Ricrea l'oggetto field popolando solo le proprietà del BaseField inserite dall'utente
|
|
138
|
-
* (quelle comuni a tutte le tipologie di campo), ricrea la form e, in base al FieldType scelto,
|
|
139
|
-
* aggiunge alla form i FormControl necessari e seleziona il template corretto da usare.
|
|
140
|
-
* @param restoreField Se TRUE ripristina i valori base (ereditati dal modello BaseField) del campo aggiunto/modificato
|
|
141
|
-
*/
|
|
142
|
-
onFieldTypeChange(restoreField: boolean = true) {
|
|
143
|
-
if (restoreField)
|
|
144
|
-
this.restoreBaseFieldProperties();
|
|
145
|
-
this.createFieldForm();
|
|
146
|
-
this.onColSpanSizeSelect();
|
|
147
|
-
this.fieldTypeFormTemplate = null;
|
|
148
|
-
switch (this.field.FieldType) {
|
|
149
|
-
case FieldTypeEnum['Campo di testo']:
|
|
150
|
-
this.fieldFormGroup.addControl('TextMask', new FormControl((this.field as TextField).TextMask));
|
|
151
|
-
this.fieldFormGroup.addControl('MaxLenght', new FormControl((this.field as TextField).MaxLenght));
|
|
152
|
-
this.fieldFormGroup.addControl('MinLenght', new FormControl((this.field as TextField).MinLenght));
|
|
153
|
-
this.fieldTypeFormTemplate = this.textFieldFormTemplate;
|
|
154
|
-
break;
|
|
155
|
-
case FieldTypeEnum['Area di testo']:
|
|
156
|
-
this.fieldFormGroup.addControl('Rows', new FormControl((this.field as TextareaField).Rows));
|
|
157
|
-
this.fieldFormGroup.addControl('MaxLenght', new FormControl((this.field as TextareaField).MaxLenght));
|
|
158
|
-
this.fieldFormGroup.addControl('MinLenght', new FormControl((this.field as TextareaField).MinLenght));
|
|
159
|
-
this.fieldTypeFormTemplate = this.textareaFieldFormTemplate;
|
|
160
|
-
break;
|
|
161
|
-
case FieldTypeEnum.Booleano:
|
|
162
|
-
this.fieldFormGroup.addControl('IsTristate', new FormControl((this.field as BooleanField).IsTristate));
|
|
163
|
-
this.fieldFormGroup.addControl(
|
|
164
|
-
'PresetationType',
|
|
165
|
-
new FormControl((this.field as BooleanField).PresetationType, Validators.required)
|
|
166
|
-
);
|
|
167
|
-
this.fieldTypeFormTemplate = this.booleadFieldFormTemplate;
|
|
168
|
-
break;
|
|
169
|
-
case FieldTypeEnum['Data e/o ora']:
|
|
170
|
-
this.fieldFormGroup.addControl('IsOnlyDate', new FormControl((this.field as DateField).IsOnlyDate, Validators.required));
|
|
171
|
-
this.fieldFormGroup.addControl('MinDate', new FormControl((this.field as DateField).MinDate));
|
|
172
|
-
this.fieldFormGroup.addControl('MaxDate', new FormControl((this.field as DateField).MaxDate));
|
|
173
|
-
this.fieldFormGroup.addControl('DateFormat', new FormControl((this.field as DateField).DateFormat));
|
|
174
|
-
this.fieldTypeFormTemplate = this.dateFieldFormTemplate;
|
|
175
|
-
break;
|
|
176
|
-
case FieldTypeEnum['Campo numerico']:
|
|
177
|
-
this.fieldFormGroup.addControl('IsInteger', new FormControl((this.field as NumericField).IsInteger));
|
|
178
|
-
this.fieldFormGroup.addControl('MinValue', new FormControl((this.field as NumericField).MinValue));
|
|
179
|
-
this.fieldFormGroup.addControl('MaxValue', new FormControl((this.field as NumericField).MaxValue));
|
|
180
|
-
this.fieldFormGroup.addControl('DecimalSeparator', new FormControl((this.field as NumericField).DecimalSeparator));
|
|
181
|
-
this.fieldFormGroup.addControl('DecimalPrecision', new FormControl((this.field as NumericField).DecimalPrecision));
|
|
182
|
-
this.fieldFormGroup.addControl('ThousandsSeparator', new FormControl((this.field as NumericField).ThousandsSeparator));
|
|
183
|
-
this.fieldFormGroup.addControl('CurrencySymbol', new FormControl((this.field as NumericField).CurrencySymbol));
|
|
184
|
-
this.fieldTypeFormTemplate = this.numericFieldFormTemplate;
|
|
185
|
-
break;
|
|
186
|
-
case FieldTypeEnum.Allegato:
|
|
187
|
-
this.fieldFormGroup.addControl("AllowedExtensions", new FormControl((this.field as AttachmentField).AllowedExtensions));
|
|
188
|
-
this.fieldFormGroup.addControl('IsMultiAttach', new FormControl((this.field as AttachmentField).IsMultiAttach));
|
|
189
|
-
this.fieldTypeFormTemplate = this.attachmentFieldFormTemplate;
|
|
190
|
-
break;
|
|
191
|
-
case FieldTypeEnum.Immagine:
|
|
192
|
-
(this.field as ImageField).AttachDefinition = new AttachmentField();
|
|
193
|
-
this.fieldFormGroup.addControl('EnableDrawing', new FormControl((this.field as ImageField).EnableDrawing));
|
|
194
|
-
this.fieldFormGroup.addControl('ImageIsContextualAttachment', new FormControl((this.field as ImageField).ImageIsContextualAttachment));
|
|
195
|
-
// Imposto i FormControl variabili.
|
|
196
|
-
this.onImageIsContextualAttachmentChange();
|
|
197
|
-
this.fieldTypeFormTemplate = this.imageFieldFormTemplate;
|
|
198
|
-
break;
|
|
199
|
-
case FieldTypeEnum['Elenco generico']:
|
|
200
|
-
this.fieldFormGroup.addControl('IsMultiChoiche', new FormControl((this.field as ListValueField).IsMultiChoiche));
|
|
201
|
-
this.fieldFormGroup.addControl(
|
|
202
|
-
'PresentationMode',
|
|
203
|
-
new FormControl((this.field as ListValueField).PresentationMode, Validators.required)
|
|
204
|
-
);
|
|
205
|
-
this.fieldTypeFormTemplate = this.listValueFieldFormTemplate;
|
|
206
|
-
break;
|
|
207
|
-
case FieldTypeEnum.Lookup:
|
|
208
|
-
this.fieldFormGroup.addControl(
|
|
209
|
-
'EntitySourceName',
|
|
210
|
-
new FormControl((this.field as LookupField).EntitySourceName, Validators.required)
|
|
211
|
-
);
|
|
212
|
-
this.fieldFormGroup.addControl('UseAsGetOrDiscard', new FormControl((this.field as LookupField).UseAsGetOrDiscard));
|
|
213
|
-
this.fieldTypeFormTemplate = this.lookupFieldFormTemplate;
|
|
214
|
-
break;
|
|
215
|
-
}
|
|
216
|
-
if ([FieldTypeEnum.Allegato, FieldTypeEnum.Immagine, FieldTypeEnum['Form di dettaglio']].includes(this.field.FieldType)) {
|
|
217
|
-
this.field.Formula = null;
|
|
218
|
-
this.fieldFormGroup.controls["Formula"].disable();
|
|
219
|
-
this.fieldFormGroup.controls["InListView"].disable();
|
|
220
|
-
} else {
|
|
221
|
-
this.fieldFormGroup.controls["Formula"].enable();
|
|
222
|
-
this.fieldFormGroup.controls["InListView"].enable();
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* Metodo invocato al cambio del valore della proprietà ImageIsContextualAttachment nel caso
|
|
228
|
-
* di campi di tipo Immagine. Se TRUE allora rimuove i FormControl per le proprietà IsMultiAttach
|
|
229
|
-
* e AllowedExtensions e aggiunge i FormControl per le proprietà ImgName e ContextualAttachment,
|
|
230
|
-
* altrimenti il contrario.
|
|
231
|
-
*/
|
|
232
|
-
onImageIsContextualAttachmentChange() {
|
|
233
|
-
(this.field as ImageField).ImgName = null;
|
|
234
|
-
(this.field as ImageField).AttachDefinition.AllowedExtensions = [];
|
|
235
|
-
(this.field as ImageField).AttachDefinition.IsMultiAttach = false;
|
|
236
|
-
(this.field as ImageField).ContextualAttachment = null;
|
|
237
|
-
|
|
238
|
-
if ((this.field as ImageField).ImageIsContextualAttachment) {
|
|
239
|
-
this.fieldFormGroup.removeControl("IsMultiAttach");
|
|
240
|
-
this.fieldFormGroup.removeControl("AllowedExtensions");
|
|
241
|
-
this.fieldFormGroup.addControl('ImgName', new FormControl((this.field as ImageField).ImgName, Validators.required));
|
|
242
|
-
this.fieldFormGroup.addControl('ContextualAttachment', new FormControl((this.field as ImageField).ContextualAttachment, Validators.required));
|
|
243
|
-
} else {
|
|
244
|
-
this.fieldFormGroup.removeControl("ImgName");
|
|
245
|
-
this.fieldFormGroup.removeControl("ContextualAttachment");
|
|
246
|
-
this.fieldFormGroup.addControl('IsMultiAttach', new FormControl((this.field as ImageField).AttachDefinition.IsMultiAttach));
|
|
247
|
-
this.fieldFormGroup.addControl("AllowedExtensions", new FormControl((this.field as ImageField).AttachDefinition.AllowedExtensions));
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
/**
|
|
252
|
-
* Metodo per intercettare l'aggiunta di un allegato nei campi di tipo Immagine per aggiornare
|
|
253
|
-
* il valore della proprietà ContextualAttachment e la validazione del relativo FormControl.
|
|
254
|
-
* @param event Array contenente l'elenco aggiornato degli allegati caricati (nel nostro caso ne contiene al più 1).
|
|
255
|
-
*/
|
|
256
|
-
catchContextualAttachmentChange(event: Array<IAttachmentDTO>) {
|
|
257
|
-
if (event && event.length > 0) {
|
|
258
|
-
(this.field as ImageField).ContextualAttachment = event[0];
|
|
259
|
-
} else {
|
|
260
|
-
(this.field as ImageField).ContextualAttachment = null;
|
|
261
|
-
}
|
|
262
|
-
this.fieldFormGroup.controls['ContextualAttachment'].setValue((this.field as ImageField).ContextualAttachment);
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
/**
|
|
266
|
-
* Metodo invocato alla selezione di una classe nella select per le colonne di bootstrap
|
|
267
|
-
* da usare nella visualizzazione del campo. Questa funzione manipola la sorgente dati per
|
|
268
|
-
* la eqp-select in modo da escludere i valori dell'enumeratore che fanno riferimento ad
|
|
269
|
-
* una larghezza di schermo già selezionata. Esempio: per gli schermi piccoli (sm) l'utente
|
|
270
|
-
* seleziona la classe "col-sm-6", al change del valore questo metodo rimuove dalla select
|
|
271
|
-
* tutti gli altri valori per la grandezza di schermo selezionata.
|
|
272
|
-
*/
|
|
273
|
-
onColSpanSizeSelect() {
|
|
274
|
-
// Recupero l'array degli oggetti chiave-valore che rappreseta l'enumeratore
|
|
275
|
-
let colSizeClassEnumArray = this.enumHelper.getEnumArray(ColSpanSizesEnum, false, null);
|
|
276
|
-
// Costruisco l'array delle classi selezionate dall'utente in formato stringa
|
|
277
|
-
let selectedDimensions: Array<string> = this.field.ColSpanSizes ? this.field.ColSpanSizes.map(col => ColSpanSizesEnum[col]) : [];
|
|
278
|
-
// Filtro i valori ottenuti dall'enumeratore per escludere tutti i valori per le
|
|
279
|
-
// grandezze di schermo già selezionatead esclusione dei valori selezionati.
|
|
280
|
-
this.availableColSpanSizes = colSizeClassEnumArray.filter((value: { key: number, value: string }) =>
|
|
281
|
-
!selectedDimensions.find(col => value.value.includes(col.substring(4, 6)) && value.value != col)
|
|
282
|
-
);
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
/**
|
|
286
|
-
* Metodo invocato al cambio del tipo di visualizzazione scelta per i campi di tipo elenco generico.
|
|
287
|
-
* Se viene scelta la visualizzazione ad immagini svuota la lista delle coppie chiave-valore inserite
|
|
288
|
-
* in precedenza, altrimenti svuota la lista delle immagini caricate.
|
|
289
|
-
*/
|
|
290
|
-
onPresentationModeChange() {
|
|
291
|
-
if ((this.field as ListValueField).PresentationMode === ListPresentationEnum.Immagini) {
|
|
292
|
-
(this.field as ListValueField).ValuePairs = null;
|
|
293
|
-
} else {
|
|
294
|
-
(this.field as ListValueField).ButtonImageList = null;
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
* Metodo invocato quando viene caricato il componente eqp-attachments per caricare le immagini da usare
|
|
300
|
-
* nella visualizzazione ad immagini dei campi di tipo "Elenco generico". Aggiunge due colonne a quelle
|
|
301
|
-
* configurate nel componente in cui l'utente può indicare chiave e valore della scelta.
|
|
302
|
-
* @param component Istanza del componente eqp-attachments in cui effettuare la modifica.
|
|
303
|
-
*/
|
|
304
|
-
configureButtonImagesColumns(component: EqpAttachmentsComponent) {
|
|
305
|
-
component.attachmentsColumns.splice(
|
|
306
|
-
component.attachmentsColumns.length - 1, 0,
|
|
307
|
-
{ key: "ButtonKey", display: "Label", type: TypeColumn.ExternalTemplate, externalTemplate: this.buttonImagesKeyValueInputColumn }
|
|
308
|
-
);
|
|
309
|
-
|
|
310
|
-
component.attachmentsColumns.splice(
|
|
311
|
-
component.attachmentsColumns.length - 1, 0,
|
|
312
|
-
{ key: "ButtonValue", display: "Valore", type: TypeColumn.ExternalTemplate, externalTemplate: this.buttonImagesKeyValueInputColumn }
|
|
313
|
-
);
|
|
314
|
-
|
|
315
|
-
this.cdr.detectChanges();
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
/**
|
|
319
|
-
* Metodo invocato al salvataggio degli allegati quando viene configurato un campo di tipo "Elenco generico"
|
|
320
|
-
* con il tipo di visualizzazione ad immagini. Intercetta l'elenco aggiornato delle immagini caricate e lo
|
|
321
|
-
* memorizza nell'oggetto field corrente.
|
|
322
|
-
* @param attachments Array aggiornato degli allegati caricati.
|
|
323
|
-
*/
|
|
324
|
-
catchButtonImagesChange(attachments: Array<IAttachmentDTO>) {
|
|
325
|
-
(this.field as ListValueField).ButtonImageList = (attachments as Array<ButtonImage>);
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
/**
|
|
329
|
-
* Metodo chiamato al keyup degli input testuali che prevedono l'aggiunta del valore inserito in un array.
|
|
330
|
-
* Se l'utente preme il tasto invio, in base al tipo di campo che sta inserendo/modificando, questo metodo
|
|
331
|
-
* aggiunge il valore inserito dall'utente nella lista di stringhe corretta (in input viene passato il nome
|
|
332
|
-
* della proprietà in cui inserire la stringa).
|
|
333
|
-
* @param event Evento che rappresenta il keyup dell'utente
|
|
334
|
-
* @param propertyName Nome della proprietà del field in cui inserire la stringa digitata.
|
|
335
|
-
*/
|
|
336
|
-
onMultiSelectInputKeyup(event, propertyName: string) {
|
|
337
|
-
if (event.code === 'Enter' || event.code === 'NumpadEnter') {
|
|
338
|
-
switch (this.field.FieldType) {
|
|
339
|
-
case FieldTypeEnum.Lookup:
|
|
340
|
-
case FieldTypeEnum.Allegato:
|
|
341
|
-
if (!this.field[propertyName]) {
|
|
342
|
-
this.field[propertyName] = new Array<string>();
|
|
343
|
-
}
|
|
344
|
-
this.field[propertyName].push(event.currentTarget.value);
|
|
345
|
-
break;
|
|
346
|
-
case FieldTypeEnum.Immagine:
|
|
347
|
-
if (!(this.field as ImageField).AttachDefinition[propertyName]) {
|
|
348
|
-
(this.field as ImageField).AttachDefinition[propertyName] = new Array<string>();
|
|
349
|
-
}
|
|
350
|
-
(this.field as ImageField).AttachDefinition[propertyName].push(event.currentTarget.value);
|
|
351
|
-
break;
|
|
352
|
-
case FieldTypeEnum['Elenco generico']:
|
|
353
|
-
if (!this.keyValueObject.key || !this.keyValueObject.value) {
|
|
354
|
-
return;
|
|
355
|
-
}
|
|
356
|
-
if (!(this.field as ListValueField).ValuePairs) {
|
|
357
|
-
(this.field as ListValueField).ValuePairs = {};
|
|
358
|
-
}
|
|
359
|
-
(this.field as ListValueField).ValuePairs[this.keyValueObject.key] = this.keyValueObject.value;
|
|
360
|
-
this.keyValueObject = { key: '', value: '' };
|
|
361
|
-
break;
|
|
362
|
-
}
|
|
363
|
-
event.currentTarget.value = null;
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
/**
|
|
368
|
-
* Metodo chiamato per mostrare come elenco le opzioni aggiunte in un campo di tipo "Elenco generico".
|
|
369
|
-
* @returns Restituisce un array di oggetti del tipo { key: string, value: string } con i valori inseriti dall'utente.
|
|
370
|
-
*/
|
|
371
|
-
getDictionaryKeyValue() {
|
|
372
|
-
if ((this.field as ListValueField).ValuePairs) {
|
|
373
|
-
return Object.keys((this.field as ListValueField).ValuePairs).map(k => {
|
|
374
|
-
return {
|
|
375
|
-
key: k,
|
|
376
|
-
value: (this.field as ListValueField).ValuePairs[k]
|
|
377
|
-
};
|
|
378
|
-
});
|
|
379
|
-
} else {
|
|
380
|
-
return [];
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
/**
|
|
385
|
-
* Metodo per rimuovere una opzione aggiunta al campo di tipo "Elenco generico"
|
|
386
|
-
* @param key Nome della chiave da rimuovere
|
|
387
|
-
*/
|
|
388
|
-
deleteKeyFromDictionary(key: string) {
|
|
389
|
-
delete (this.field as ListValueField).ValuePairs[key];
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
/**
|
|
393
|
-
* Metodo per aprire il dialog per aggiungere/modificare un metadata in un campo di tipo Allegato o Immagine.
|
|
394
|
-
* @param metadata Metadata da modificare, se null allora ne sto creando uno nuovo.
|
|
395
|
-
*/
|
|
396
|
-
openMetadataDialog(field: BaseField = null) {
|
|
397
|
-
if (field) {
|
|
398
|
-
if (this.field.FieldType === FieldTypeEnum.Allegato) {
|
|
399
|
-
this.indexSelectedMetadata = (this.field as AttachmentField).MetadataFields.indexOf(field);
|
|
400
|
-
this.selectedMetadata = JSON.parse(JSON.stringify(field));
|
|
401
|
-
} else if (this.field.FieldType === FieldTypeEnum.Immagine) {
|
|
402
|
-
this.indexSelectedMetadata = (this.field as ImageField).AttachDefinition.MetadataFields.indexOf(field);
|
|
403
|
-
this.selectedMetadata = JSON.parse(JSON.stringify(field));
|
|
404
|
-
}
|
|
405
|
-
} else {
|
|
406
|
-
this.selectedMetadata = new BaseField();
|
|
407
|
-
this.indexSelectedMetadata = null;
|
|
408
|
-
}
|
|
409
|
-
this.dialogMetadataRef = this.dialog.open(this.dialogMetadata, {
|
|
410
|
-
disableClose: true,
|
|
411
|
-
hasBackdrop: true,
|
|
412
|
-
width: '75%'
|
|
413
|
-
});
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
/**
|
|
417
|
-
* Metodo invocato dall'output dal dialog per aggiungere/modificare un metadata
|
|
418
|
-
* nei campi di tipo Allegato o Immagine. Prima di aggiungere il metadata nell'elenco
|
|
419
|
-
* contolla se esiste un altro metadata con lo stesso nome e nel caso genera un errore
|
|
420
|
-
* (i metadata, come per i campi della form, devono avere un nome univoco).
|
|
421
|
-
* @param metadata Metadata aggiunto o modificato, se null allora il dialog è stato chiuso senza fare modifiche.
|
|
422
|
-
*/
|
|
423
|
-
onSaveMetadata(metadata: BaseField) {
|
|
424
|
-
if (metadata) {
|
|
425
|
-
if (
|
|
426
|
-
(this.field.FieldType === FieldTypeEnum.Allegato
|
|
427
|
-
&& (this.field as AttachmentField).MetadataFields
|
|
428
|
-
&& (this.field as AttachmentField).MetadataFields.find(
|
|
429
|
-
(m, i) => m.Label === metadata.Label
|
|
430
|
-
&& (this.indexSelectedMetadata == null ? true : this.indexSelectedMetadata !== i)
|
|
431
|
-
)
|
|
432
|
-
) ||
|
|
433
|
-
(this.field.FieldType === FieldTypeEnum.Immagine
|
|
434
|
-
&& (this.field as ImageField).AttachDefinition.MetadataFields
|
|
435
|
-
&& (this.field as ImageField).AttachDefinition.MetadataFields.find(
|
|
436
|
-
(m, i) => m.Label === metadata.Label
|
|
437
|
-
&& (this.indexSelectedMetadata == null ? true : this.indexSelectedMetadata !== i)
|
|
438
|
-
)
|
|
439
|
-
)
|
|
440
|
-
) {
|
|
441
|
-
EqpDynamicModuleDialogService.Warning('Impossibile inserire due metadata con la stessa label.');
|
|
442
|
-
throw new Error('Impossibile inserire due metadata con la stessa label.');
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
if (this.indexSelectedMetadata != null && this.indexSelectedMetadata >= 0) {
|
|
446
|
-
if (this.field.FieldType === FieldTypeEnum.Allegato) {
|
|
447
|
-
(this.field as AttachmentField).MetadataFields[this.indexSelectedMetadata] = metadata;
|
|
448
|
-
} else if (this.field.FieldType === FieldTypeEnum.Immagine) {
|
|
449
|
-
(this.field as ImageField).AttachDefinition.MetadataFields[this.indexSelectedMetadata] = metadata;
|
|
450
|
-
}
|
|
451
|
-
} else {
|
|
452
|
-
if (this.field.FieldType === FieldTypeEnum.Allegato) {
|
|
453
|
-
if (!(this.field as AttachmentField).MetadataFields) {
|
|
454
|
-
(this.field as AttachmentField).MetadataFields = new Array<BaseField>();
|
|
455
|
-
}
|
|
456
|
-
(this.field as AttachmentField).MetadataFields.push(metadata);
|
|
457
|
-
} else if (this.field.FieldType === FieldTypeEnum.Immagine) {
|
|
458
|
-
if (!(this.field as ImageField).AttachDefinition.MetadataFields) {
|
|
459
|
-
(this.field as ImageField).AttachDefinition.MetadataFields = new Array<BaseField>();
|
|
460
|
-
}
|
|
461
|
-
(this.field as ImageField).AttachDefinition.MetadataFields.push(metadata);
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
this.dialogMetadataRef.close();
|
|
466
|
-
this.setMetadataOrdinalPosition();
|
|
467
|
-
this.reloadMetadataTable();
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
/**
|
|
471
|
-
* Metodo per disabilitare il pulsante per salvare il campo inserito/modificato.
|
|
472
|
-
* @returns Restituisce un booleano, se true il salvataggio viene disabilitato.
|
|
473
|
-
*/
|
|
474
|
-
disableSaveField(): boolean {
|
|
475
|
-
if (this.fieldFormGroup.invalid) {
|
|
476
|
-
return true;
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
switch (this.field.FieldType) {
|
|
480
|
-
|
|
481
|
-
case FieldTypeEnum['Elenco generico']:
|
|
482
|
-
if ((this.field as ListValueField).PresentationMode != ListPresentationEnum.Immagini) {
|
|
483
|
-
return !(this.field as ListValueField).ValuePairs || (this.field as ListValueField).ValuePairs.length === 0;
|
|
484
|
-
} else {
|
|
485
|
-
return (
|
|
486
|
-
!(this.field as ListValueField).ButtonImageList
|
|
487
|
-
|| (this.field as ListValueField).ButtonImageList.length === 0
|
|
488
|
-
|| !!(this.field as ListValueField).ButtonImageList.find(i => !i.ButtonKey || !i.ButtonValue)
|
|
489
|
-
);
|
|
490
|
-
}
|
|
491
|
-
case FieldTypeEnum.Lookup:
|
|
492
|
-
return !(this.field as LookupField).FieldNames || (this.field as LookupField).FieldNames.length === 0;
|
|
493
|
-
default:
|
|
494
|
-
return false;
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
/**
|
|
499
|
-
* Metodo per salvare il campo inserito/modificato.
|
|
500
|
-
* Se è stato inserito un field con la stessa label viene generato un errore (le label devono essere univoche).
|
|
501
|
-
* Una volta aggiunto/aggiornato il campo nell'elenco dei Field della Form chiude il dialog e ricarica la tabella
|
|
502
|
-
* che mostra l'elenco dei campi aggiunti alla form.
|
|
503
|
-
*/
|
|
504
|
-
saveAndExitAddField(save: boolean) {
|
|
505
|
-
if (save) {
|
|
506
|
-
this.saveFieldEvent.emit(this.field);
|
|
507
|
-
} else {
|
|
508
|
-
this.saveFieldEvent.emit(null);
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
/**
|
|
513
|
-
* Metodo per ripristinare l'oggetto field al cambio del tipo selezionato.
|
|
514
|
-
* Lascia valorizzate solo le proprietà dell'oggetto BaseField comune a tutti i tipi di campo.
|
|
515
|
-
*/
|
|
516
|
-
private restoreBaseFieldProperties() {
|
|
517
|
-
if (this.field) {
|
|
518
|
-
const tmpBaseField = JSON.parse(JSON.stringify(this.field));
|
|
519
|
-
this.field = new BaseField();
|
|
520
|
-
this.field.Label = tmpBaseField.Label;
|
|
521
|
-
this.field.Description = tmpBaseField.Description;
|
|
522
|
-
this.field.Required = tmpBaseField.Required;
|
|
523
|
-
this.field.FieldType = tmpBaseField.FieldType;
|
|
524
|
-
this.field.Formula = tmpBaseField.Formula;
|
|
525
|
-
this.field.ColSpanSizes = tmpBaseField.ColSpanSizes;
|
|
526
|
-
this.field.FieldGroup = tmpBaseField.FieldGroup;
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
private configureColumns() {
|
|
531
|
-
this.metadataColumns = [
|
|
532
|
-
{
|
|
533
|
-
key: 'action', display: '', type: TypeColumn.MenuAction, buttonMenuIcon: 'more_vert', styles: { flex: '0 0 6%' },
|
|
534
|
-
actions: [
|
|
535
|
-
{ name: 'Modifica', icon: 'edit', fn: (element, index, col) => this.openMetadataDialog(element) },
|
|
536
|
-
{ name: 'Elimina', icon: 'delete', fn: (element, index, col) => this.deleteMetadata(element) },
|
|
537
|
-
]
|
|
538
|
-
},
|
|
539
|
-
{ key: 'FieldType', display: 'Tipologia', type: TypeColumn.Enum, enumModel: FieldTypeEnum },
|
|
540
|
-
{ key: 'Label', display: 'Label' },
|
|
541
|
-
{ key: 'Description', display: 'Descrizione' },
|
|
542
|
-
{
|
|
543
|
-
key: 'Required', display: 'Obbligatorio',
|
|
544
|
-
value: (element) => !!element.Required,
|
|
545
|
-
type: TypeColumn.Boolean,
|
|
546
|
-
booleanValues: {
|
|
547
|
-
true: '<i class="fa fa-check success-color"></i>',
|
|
548
|
-
false: '<i class="fa fa-close error-color"></i>'
|
|
549
|
-
},
|
|
550
|
-
styles: { flex: '0 0 7%', cellAlignment: CellAlignmentEnum.CENTER }
|
|
551
|
-
},
|
|
552
|
-
];
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
/**
|
|
556
|
-
* Metodo per eliminare un metadata aggiunto per un campo di tipo Allegato o Immagine.
|
|
557
|
-
* @param metadata Metadata da eliminare.
|
|
558
|
-
*/
|
|
559
|
-
private deleteMetadata(metadata: BaseField) {
|
|
560
|
-
EqpDynamicModuleDialogService.Confirm('Eliminare il metadata selezionato?', () => {
|
|
561
|
-
if (this.field.FieldType === FieldTypeEnum.Allegato) {
|
|
562
|
-
(this.field as AttachmentField).MetadataFields.splice((this.field as AttachmentField).MetadataFields.indexOf(metadata), 1);
|
|
563
|
-
} else if (this.field.FieldType === FieldTypeEnum.Immagine) {
|
|
564
|
-
(this.field as ImageField).AttachDefinition.MetadataFields.splice((this.field as ImageField).AttachDefinition.MetadataFields.indexOf(metadata), 1);
|
|
565
|
-
}
|
|
566
|
-
this.setMetadataOrdinalPosition();
|
|
567
|
-
this.reloadMetadataTable();
|
|
568
|
-
}, false, 'Richiesta conferma');
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
/**
|
|
572
|
-
* Imposta l'ordinamento dei metadata all'interno dei campi di tipo Allegato e Immagine.
|
|
573
|
-
*/
|
|
574
|
-
private setMetadataOrdinalPosition() {
|
|
575
|
-
if (this.field.FieldType === FieldTypeEnum.Allegato) {
|
|
576
|
-
if ((this.field as AttachmentField).MetadataFields) {
|
|
577
|
-
(this.field as AttachmentField).MetadataFields.forEach(metadata => {
|
|
578
|
-
metadata.OrdinalPosition = (this.field as AttachmentField).MetadataFields.indexOf(metadata);
|
|
579
|
-
});
|
|
580
|
-
}
|
|
581
|
-
} else if (this.field.FieldType === FieldTypeEnum.Immagine) {
|
|
582
|
-
if ((this.field as ImageField).AttachDefinition.MetadataFields) {
|
|
583
|
-
(this.field as ImageField).AttachDefinition.MetadataFields.forEach(metadata => {
|
|
584
|
-
metadata.OrdinalPosition = (this.field as ImageField).AttachDefinition.MetadataFields.indexOf(metadata);
|
|
585
|
-
});
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
}
|
|
589
|
-
|
|
590
|
-
/**
|
|
591
|
-
* Metodo per ricaricare i dati della tabella dei metadata visualizzata nella creazione/modifica
|
|
592
|
-
* dei campi di tipo Allegato o Immagine.
|
|
593
|
-
*/
|
|
594
|
-
private reloadMetadataTable() {
|
|
595
|
-
if (this.metadataFieldsTable) {
|
|
596
|
-
this.metadataFieldsTable.reloadDatatable();
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
<text-field-template #fieldTemplate *ngIf="field.FieldType == FieldTypeEnum['Campo di testo']"
|
|
2
|
-
[matTooltip]="field.Description" [(record)]="record" [field]="field" (recordChange)="onRecordChange()">
|
|
3
|
-
</text-field-template>
|
|
4
|
-
|
|
5
|
-
<textarea-field-template #fieldTemplate *ngIf="field.FieldType == FieldTypeEnum['Area di testo']"
|
|
6
|
-
[matTooltip]="field.Description" [(record)]="record" [field]="field" (recordChange)="onRecordChange()">
|
|
7
|
-
</textarea-field-template>
|
|
8
|
-
|
|
9
|
-
<boolean-field-template #fieldTemplate *ngIf="field.FieldType == FieldTypeEnum['Booleano']"
|
|
10
|
-
[matTooltip]="field.Description" [(record)]="record" [field]="field" (recordChange)="onRecordChange()">
|
|
11
|
-
</boolean-field-template>
|
|
12
|
-
|
|
13
|
-
<date-field-template #fieldTemplate *ngIf="field.FieldType == FieldTypeEnum['Data e/o ora']"
|
|
14
|
-
[matTooltip]="field.Description" [(record)]="record" [field]="field" (recordChange)="onRecordChange()">
|
|
15
|
-
</date-field-template>
|
|
16
|
-
|
|
17
|
-
<numeric-field-template #fieldTemplate *ngIf="field.FieldType == FieldTypeEnum['Campo numerico']"
|
|
18
|
-
[matTooltip]="field.Description" [(record)]="record" [field]="field" (recordChange)="onRecordChange()">
|
|
19
|
-
</numeric-field-template>
|
|
20
|
-
|
|
21
|
-
<list-value-field-template #fieldTemplate *ngIf="field.FieldType == FieldTypeEnum['Elenco generico']"
|
|
22
|
-
[matTooltip]="field.Description" [(record)]="record" [field]="field" (recordChange)="onRecordChange()">
|
|
23
|
-
</list-value-field-template>
|
|
24
|
-
|
|
25
|
-
<attachment-field-template #fieldTemplate *ngIf="field.FieldType == FieldTypeEnum['Allegato']"
|
|
26
|
-
[matTooltip]="field.Description" [(record)]="record" [field]="field" (recordChange)="onRecordChange()">
|
|
27
|
-
</attachment-field-template>
|
|
28
|
-
|
|
29
|
-
<image-field-template #fieldTemplate *ngIf="field.FieldType == FieldTypeEnum['Immagine']"
|
|
30
|
-
[matTooltip]="field.Description" [(record)]="record" [field]="field" (recordChange)="onRecordChange()">
|
|
31
|
-
</image-field-template>
|
|
32
|
-
|
|
33
|
-
<list-form-record #listInnerFormRecords *ngIf="field.FieldType == FieldTypeEnum['Form di dettaglio']"
|
|
34
|
-
[form]="getInnerFormFromField(field)" [values]="record[field.Name]"
|
|
35
|
-
(onAddViewEditRecord)="onAddViewEditInnerFormRecord($event, field)">
|
|
36
|
-
</list-form-record>
|
|
37
|
-
|
|
38
|
-
<!-- DIALOG PER AGGIUNGERE/MODIFICARE/VISUALIZZARE UN RECORD IN UNA FORM DI DETTAGLIO -->
|
|
39
|
-
<ng-template #dialogInnerFormRecord>
|
|
40
|
-
<add-form-record [form]="selectedInnerForm" [record]="selectedInnerFormRecord" [onlyView]="onlyViewInnerFormRecord"
|
|
41
|
-
(saveRecordEvent)="onSaveInnerFormRecord($event)"></add-form-record>
|
|
42
|
-
</ng-template>
|
|
File without changes
|