@eqproject/eqp-dynamic-module 0.0.3 → 0.0.4
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 +220 -33
- package/bundles/eqproject-eqp-dynamic-module.umd.js.map +1 -1
- package/bundles/eqproject-eqp-dynamic-module.umd.min.js +2 -2
- package/bundles/eqproject-eqp-dynamic-module.umd.min.js.map +1 -1
- package/eqproject-eqp-dynamic-module.metadata.json +1 -1
- package/esm2015/lib/components/private/add-form-field/add-form-field.component.js +45 -6
- package/esm2015/lib/components/private/field-templates/attachment-field-template/attachment-field-template.component.js +10 -21
- package/esm2015/lib/components/private/field-templates/image-field-template/image-field-template.component.js +148 -6
- package/esm2015/lib/eqp-dynamic-module.module.js +4 -2
- package/esm2015/lib/models/fields/imageField.model.js +5 -1
- package/esm5/lib/components/private/add-form-field/add-form-field.component.js +45 -6
- package/esm5/lib/components/private/field-templates/attachment-field-template/attachment-field-template.component.js +10 -21
- package/esm5/lib/components/private/field-templates/image-field-template/image-field-template.component.js +157 -6
- package/esm5/lib/eqp-dynamic-module.module.js +4 -2
- package/esm5/lib/models/fields/imageField.model.js +9 -1
- package/fesm2015/eqproject-eqp-dynamic-module.js +205 -31
- package/fesm2015/eqproject-eqp-dynamic-module.js.map +1 -1
- package/fesm5/eqproject-eqp-dynamic-module.js +218 -31
- package/fesm5/eqproject-eqp-dynamic-module.js.map +1 -1
- package/lib/components/private/add-form-field/add-form-field.component.d.ts +14 -0
- package/lib/components/private/field-templates/attachment-field-template/attachment-field-template.component.d.ts +1 -17
- package/lib/components/private/field-templates/image-field-template/image-field-template.component.d.ts +51 -2
- package/lib/models/fields/imageField.model.d.ts +10 -4
- package/package.json +3 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('@angular/forms'), require('@angular/material/checkbox'), require('@angular/material/button'), require('@angular/material/input'), require('@angular/material/autocomplete'), require('@angular/material/datepicker'), require('@angular/material/form-field'), require('@angular/material/radio'), require('@angular/material/select'), require('@angular/material/slider'), require('@angular/material/slide-toggle'), require('@angular/material/menu'), require('@angular/material/sidenav'), require('@angular/material/toolbar'), require('@angular/material/list'), require('@angular/material/grid-list'), require('@angular/material/card'), require('@angular/material/stepper'), require('@angular/material/tabs'), require('@angular/material/expansion'), require('@angular/material/button-toggle'), require('@angular/material/chips'), require('@angular/material/icon'), require('@angular/material/progress-spinner'), require('@angular/material/progress-bar'), require('@angular/material/dialog'), require('@angular/material/tooltip'), require('@angular/material/snack-bar'), require('@angular/material/table'), require('@angular/material/sort'), require('@angular/material/paginator'), require('@angular/material/core'), require('@eqproject/eqp-table'), require('@eqproject/eqp-attachments'), require('@eqproject/eqp-select'), require('@eqproject/eqp-datetimepicker'), require('@eqproject/eqp-filters'), require('@eqproject/eqp-numeric'), require('sweetalert2'), require('@angular/platform-browser')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@eqproject/eqp-dynamic-module', ['exports', '@angular/common', '@angular/core', '@angular/forms', '@angular/material/checkbox', '@angular/material/button', '@angular/material/input', '@angular/material/autocomplete', '@angular/material/datepicker', '@angular/material/form-field', '@angular/material/radio', '@angular/material/select', '@angular/material/slider', '@angular/material/slide-toggle', '@angular/material/menu', '@angular/material/sidenav', '@angular/material/toolbar', '@angular/material/list', '@angular/material/grid-list', '@angular/material/card', '@angular/material/stepper', '@angular/material/tabs', '@angular/material/expansion', '@angular/material/button-toggle', '@angular/material/chips', '@angular/material/icon', '@angular/material/progress-spinner', '@angular/material/progress-bar', '@angular/material/dialog', '@angular/material/tooltip', '@angular/material/snack-bar', '@angular/material/table', '@angular/material/sort', '@angular/material/paginator', '@angular/material/core', '@eqproject/eqp-table', '@eqproject/eqp-attachments', '@eqproject/eqp-select', '@eqproject/eqp-datetimepicker', '@eqproject/eqp-filters', '@eqproject/eqp-numeric', 'sweetalert2', '@angular/platform-browser'], factory) :
|
|
4
|
-
(global = global || self, factory((global.eqproject = global.eqproject || {}, global.eqproject['eqp-dynamic-module'] = {}), global.ng.common, global.ng.core, global.ng.forms, global.ng.material.checkbox, global.ng.material.button, global.ng.material.input, global.ng.material.autocomplete, global.ng.material.datepicker, global.ng.material.formField, global.ng.material.radio, global.ng.material.select, global.ng.material.slider, global.ng.material.slideToggle, global.ng.material.menu, global.ng.material.sidenav, global.ng.material.toolbar, global.ng.material.list, global.ng.material.gridList, global.ng.material.card, global.ng.material.stepper, global.ng.material.tabs, global.ng.material.expansion, global.ng.material.buttonToggle, global.ng.material.chips, global.ng.material.icon, global.ng.material.progressSpinner, global.ng.material.progressBar, global.ng.material.dialog, global.ng.material.tooltip, global.ng.material.snackBar, global.ng.material.table, global.ng.material.sort, global.ng.material.paginator, global.ng.material.core, global.eqpTable, global.eqpAttachments, global.eqpSelect, global.eqpDatetimepicker, global.eqpFilters, global.eqpNumeric, global.Swal, global.ng.platformBrowser));
|
|
5
|
-
}(this, (function (exports, common, core, forms, checkbox, button, input, autocomplete, datepicker, formField, radio, select, slider, slideToggle, menu, sidenav, toolbar, list, gridList, card, stepper, tabs, expansion, buttonToggle, chips, icon, progressSpinner, progressBar, dialog, tooltip, snackBar, table, sort, paginator, core$1, eqpTable, eqpAttachments, eqpSelect, eqpDatetimepicker, eqpFilters, eqpNumeric, Swal, platformBrowser) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('@angular/forms'), require('@angular/material/checkbox'), require('@angular/material/button'), require('@angular/material/input'), require('@angular/material/autocomplete'), require('@angular/material/datepicker'), require('@angular/material/form-field'), require('@angular/material/radio'), require('@angular/material/select'), require('@angular/material/slider'), require('@angular/material/slide-toggle'), require('@angular/material/menu'), require('@angular/material/sidenav'), require('@angular/material/toolbar'), require('@angular/material/list'), require('@angular/material/grid-list'), require('@angular/material/card'), require('@angular/material/stepper'), require('@angular/material/tabs'), require('@angular/material/expansion'), require('@angular/material/button-toggle'), require('@angular/material/chips'), require('@angular/material/icon'), require('@angular/material/progress-spinner'), require('@angular/material/progress-bar'), require('@angular/material/dialog'), require('@angular/material/tooltip'), require('@angular/material/snack-bar'), require('@angular/material/table'), require('@angular/material/sort'), require('@angular/material/paginator'), require('@angular/material/core'), require('@eqproject/eqp-table'), require('@eqproject/eqp-attachments'), require('@eqproject/eqp-select'), require('@eqproject/eqp-datetimepicker'), require('@eqproject/eqp-img-drawing'), require('@eqproject/eqp-filters'), require('@eqproject/eqp-numeric'), require('sweetalert2'), require('@angular/platform-browser')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@eqproject/eqp-dynamic-module', ['exports', '@angular/common', '@angular/core', '@angular/forms', '@angular/material/checkbox', '@angular/material/button', '@angular/material/input', '@angular/material/autocomplete', '@angular/material/datepicker', '@angular/material/form-field', '@angular/material/radio', '@angular/material/select', '@angular/material/slider', '@angular/material/slide-toggle', '@angular/material/menu', '@angular/material/sidenav', '@angular/material/toolbar', '@angular/material/list', '@angular/material/grid-list', '@angular/material/card', '@angular/material/stepper', '@angular/material/tabs', '@angular/material/expansion', '@angular/material/button-toggle', '@angular/material/chips', '@angular/material/icon', '@angular/material/progress-spinner', '@angular/material/progress-bar', '@angular/material/dialog', '@angular/material/tooltip', '@angular/material/snack-bar', '@angular/material/table', '@angular/material/sort', '@angular/material/paginator', '@angular/material/core', '@eqproject/eqp-table', '@eqproject/eqp-attachments', '@eqproject/eqp-select', '@eqproject/eqp-datetimepicker', '@eqproject/eqp-img-drawing', '@eqproject/eqp-filters', '@eqproject/eqp-numeric', 'sweetalert2', '@angular/platform-browser'], factory) :
|
|
4
|
+
(global = global || self, factory((global.eqproject = global.eqproject || {}, global.eqproject['eqp-dynamic-module'] = {}), global.ng.common, global.ng.core, global.ng.forms, global.ng.material.checkbox, global.ng.material.button, global.ng.material.input, global.ng.material.autocomplete, global.ng.material.datepicker, global.ng.material.formField, global.ng.material.radio, global.ng.material.select, global.ng.material.slider, global.ng.material.slideToggle, global.ng.material.menu, global.ng.material.sidenav, global.ng.material.toolbar, global.ng.material.list, global.ng.material.gridList, global.ng.material.card, global.ng.material.stepper, global.ng.material.tabs, global.ng.material.expansion, global.ng.material.buttonToggle, global.ng.material.chips, global.ng.material.icon, global.ng.material.progressSpinner, global.ng.material.progressBar, global.ng.material.dialog, global.ng.material.tooltip, global.ng.material.snackBar, global.ng.material.table, global.ng.material.sort, global.ng.material.paginator, global.ng.material.core, global.eqpTable, global.eqpAttachments, global.eqpSelect, global.eqpDatetimepicker, global.eqpImgDrawing, global.eqpFilters, global.eqpNumeric, global.Swal, global.ng.platformBrowser));
|
|
5
|
+
}(this, (function (exports, common, core, forms, checkbox, button, input, autocomplete, datepicker, formField, radio, select, slider, slideToggle, menu, sidenav, toolbar, list, gridList, card, stepper, tabs, expansion, buttonToggle, chips, icon, progressSpinner, progressBar, dialog, tooltip, snackBar, table, sort, paginator, core$1, eqpTable, eqpAttachments, eqpSelect, eqpDatetimepicker, eqpImgDrawing, eqpFilters, eqpNumeric, Swal, platformBrowser) { 'use strict';
|
|
6
6
|
|
|
7
7
|
Swal = Swal && Object.prototype.hasOwnProperty.call(Swal, 'default') ? Swal['default'] : Swal;
|
|
8
8
|
|
|
@@ -1549,11 +1549,10 @@
|
|
|
1549
1549
|
break;
|
|
1550
1550
|
case exports.FieldTypeEnum.Immagine:
|
|
1551
1551
|
this.field.AttachDefinition = new AttachmentField();
|
|
1552
|
-
this.fieldFormGroup.addControl('
|
|
1553
|
-
// this.fieldFormGroup.addControl('ImgName', new FormControl((this.field as ImageField).ImgName, Validators.required));
|
|
1554
|
-
this.fieldFormGroup.addControl('IsMultiPoint', new forms.FormControl(this.field.IsMultiPoint));
|
|
1555
|
-
this.fieldFormGroup.addControl("AllowedExtensions", new forms.FormControl(this.field.AttachDefinition.AllowedExtensions));
|
|
1552
|
+
this.fieldFormGroup.addControl('EnableDrawing', new forms.FormControl(this.field.EnableDrawing));
|
|
1556
1553
|
this.fieldFormGroup.addControl('ImageIsContextualAttachment', new forms.FormControl(this.field.ImageIsContextualAttachment));
|
|
1554
|
+
// Imposto i FormControl variabili.
|
|
1555
|
+
this.onImageIsContextualAttachmentChange();
|
|
1557
1556
|
this.fieldTypeFormTemplate = this.imageFieldFormTemplate;
|
|
1558
1557
|
break;
|
|
1559
1558
|
case exports.FieldTypeEnum['Elenco generico']:
|
|
@@ -1570,11 +1569,51 @@
|
|
|
1570
1569
|
if ([exports.FieldTypeEnum.Allegato, exports.FieldTypeEnum.Immagine, exports.FieldTypeEnum['Form di dettaglio']].includes(this.field.FieldType)) {
|
|
1571
1570
|
this.field.Formula = null;
|
|
1572
1571
|
this.fieldFormGroup.controls["Formula"].disable();
|
|
1572
|
+
this.fieldFormGroup.controls["InListView"].disable();
|
|
1573
1573
|
}
|
|
1574
1574
|
else {
|
|
1575
1575
|
this.fieldFormGroup.controls["Formula"].enable();
|
|
1576
|
+
this.fieldFormGroup.controls["InListView"].enable();
|
|
1576
1577
|
}
|
|
1577
1578
|
};
|
|
1579
|
+
/**
|
|
1580
|
+
* Metodo invocato al cambio del valore della proprietà ImageIsContextualAttachment nel caso
|
|
1581
|
+
* di campi di tipo Immagine. Se TRUE allora rimuove i FormControl per le proprietà IsMultiAttach
|
|
1582
|
+
* e AllowedExtensions e aggiunge i FormControl per le proprietà ImgName e ContextualAttachment,
|
|
1583
|
+
* altrimenti il contrario.
|
|
1584
|
+
*/
|
|
1585
|
+
AddFormFieldComponent.prototype.onImageIsContextualAttachmentChange = function () {
|
|
1586
|
+
this.field.ImgName = null;
|
|
1587
|
+
this.field.AttachDefinition.AllowedExtensions = [];
|
|
1588
|
+
this.field.AttachDefinition.IsMultiAttach = false;
|
|
1589
|
+
this.field.ContextualAttachment = null;
|
|
1590
|
+
if (this.field.ImageIsContextualAttachment) {
|
|
1591
|
+
this.fieldFormGroup.removeControl("IsMultiAttach");
|
|
1592
|
+
this.fieldFormGroup.removeControl("AllowedExtensions");
|
|
1593
|
+
this.fieldFormGroup.addControl('ImgName', new forms.FormControl(this.field.ImgName, forms.Validators.required));
|
|
1594
|
+
this.fieldFormGroup.addControl('ContextualAttachment', new forms.FormControl(this.field.ContextualAttachment, forms.Validators.required));
|
|
1595
|
+
}
|
|
1596
|
+
else {
|
|
1597
|
+
this.fieldFormGroup.removeControl("ImgName");
|
|
1598
|
+
this.fieldFormGroup.removeControl("ContextualAttachment");
|
|
1599
|
+
this.fieldFormGroup.addControl('IsMultiAttach', new forms.FormControl(this.field.AttachDefinition.IsMultiAttach));
|
|
1600
|
+
this.fieldFormGroup.addControl("AllowedExtensions", new forms.FormControl(this.field.AttachDefinition.AllowedExtensions));
|
|
1601
|
+
}
|
|
1602
|
+
};
|
|
1603
|
+
/**
|
|
1604
|
+
* Metodo per intercettare l'aggiunta di un allegato nei campi di tipo Immagine per aggiornare
|
|
1605
|
+
* il valore della proprietà ContextualAttachment e la validazione del relativo FormControl.
|
|
1606
|
+
* @param event Array contenente l'elenco aggiornato degli allegati caricati (nel nostro caso ne contiene al più 1).
|
|
1607
|
+
*/
|
|
1608
|
+
AddFormFieldComponent.prototype.catchContextualAttachmentChange = function (event) {
|
|
1609
|
+
if (event && event.length > 0) {
|
|
1610
|
+
this.field.ContextualAttachment = event[0];
|
|
1611
|
+
}
|
|
1612
|
+
else {
|
|
1613
|
+
this.field.ContextualAttachment = null;
|
|
1614
|
+
}
|
|
1615
|
+
this.fieldFormGroup.controls['ContextualAttachment'].setValue(this.field.ContextualAttachment);
|
|
1616
|
+
};
|
|
1578
1617
|
/**
|
|
1579
1618
|
* Metodo invocato alla selezione di una classe nella select per le colonne di bootstrap
|
|
1580
1619
|
* da usare nella visualizzazione del campo. Questa funzione manipola la sorgente dati per
|
|
@@ -1909,7 +1948,7 @@
|
|
|
1909
1948
|
AddFormFieldComponent = __decorate([
|
|
1910
1949
|
core.Component({
|
|
1911
1950
|
selector: 'eqp-dynamic-module-add-form-field',
|
|
1912
|
-
template: "<div class=\"container-fluid\" style=\"max-height: 70vh !important; overflow-x: hidden; overflow-y: auto;\">\n <form [formGroup]=\"fieldFormGroup\">\n <div class=\"row\">\n <div class=\"header-title-standard\">{{indexField != null && indexField >= 0 ? \"Modifica\"\n : \"Aggiungi\"}} campo</div>\n </div>\n <div class=\"row\">\n <div class=\"col-sm-12 col-md-4 mt-2\">\n <eqp-select [enumData]=\"FieldTypeEnum\" [(ngModelInput)]=\"field.FieldType\" [isRequired]=\"true\"\n [showCancelButton]=\"false\" placeholder=\"Tipo campo\" (ngModelInputChange)=\"onFieldTypeChange()\"\n [formGroupInput]=\"fieldFormGroup\" [formControlNameInput]=\"'FieldType'\"\n [enumDataToExclude]=\"fieldTypesToExclude\">\n </eqp-select>\n </div>\n\n <div class=\"col-sm-12 col-md-4 mt-2\">\n <mat-form-field>\n <mat-label> Label </mat-label>\n <input formControlName=\"Label\" required matInput [(ngModel)]=\"field.Label\">\n </mat-form-field>\n </div>\n\n <div class=\"col-sm-12 col-md-4 mt-2\">\n <mat-form-field>\n <mat-label> Descrizione </mat-label>\n <input formControlName=\"Description\" required matInput [(ngModel)]=\"field.Description\">\n </mat-form-field>\n </div>\n\n <div class=\"col-sm-12 col-md-4 mt-2 d-flex align-items-center\">\n <mat-slide-toggle [(ngModel)]=\"field.Required\" formControlName=\"Required\" color=\"primary\">\n Obbligatorio\n </mat-slide-toggle>\n </div>\n\n <div class=\"col-sm-12 col-md-4 mt-2\">\n <mat-form-field>\n <mat-label> Formula (Javascript) </mat-label>\n <input formControlName=\"Formula\" matInput [(ngModel)]=\"field.Formula\"\n [matAutocomplete]=\"formulaAutocomplete\" (keyup)=\"setFormulaAutocompleteOptions($event)\"\n (focus)=\"setFormulaAutocompleteOptions(null)\">\n <mat-autocomplete #formulaAutocomplete=\"matAutocomplete\">\n <mat-option *ngFor=\"let option of formulaAutocompleteOptions\" [value]=\"option.value\">\n {{option.label}}\n </mat-option>\n </mat-autocomplete>\n </mat-form-field>\n </div>\n\n <div class=\"col-sm-12 col-md-4 mt-2\" *ngIf=\"formFieldsGroups\">\n <eqp-select [arrayData]=\"formFieldsGroups\" [(ngModelInput)]=\"field.FieldGroup\"\n [arrayKeyProperty]=\"'Name'\" [arrayValueProperty]=\"'Name'\" placeholder=\"Sezione\"\n [formGroupInput]=\"fieldFormGroup\" [formControlNameInput]=\"'FieldGroup'\" [isRequired]=\"true\"\n [includeFullObject]=\"false\">\n </eqp-select>\n </div>\n\n <div class=\"col-sm-12 col-md-4 mt-2\">\n <eqp-select [arrayData]=\"availableColSpanSizes\" [(ngModelInput)]=\"field.ColSizes\"\n [arrayKeyProperty]=\"'key'\" [arrayValueProperty]=\"'value'\" (ngModelInputChange)=\"onColSizeSelect()\"\n [isMultiSelect]=\"true\" placeholder=\"Larghezza campo\" [formGroupInput]=\"fieldFormGroup\"\n [formControlNameInput]=\"'ColSizes'\" [includeFullObject]=\"false\">\n </eqp-select>\n </div>\n\n <div class=\"col-sm-12 col-md-4 mt-2 d-flex align-items-center\">\n <mat-slide-toggle [(ngModel)]=\"field.InListView\" formControlName=\"InListView\" color=\"primary\">\n Mostrare nella visualizzazione a lista\n </mat-slide-toggle>\n </div>\n\n <ng-container *ngTemplateOutlet=\"fieldTypeFormTemplate\">\n </ng-container>\n </div>\n\n\n <div class=\"row mt-2 mb-1\">\n <div class=\"col-sm-12 text-right\">\n <button class=\"mr-2\" mat-raised-button color=\"primary\" (click)=\"saveAndExitAddField(true)\"\n [disabled]=\"disableSaveField()\" type=\"button\">\n Salva\n </button>\n <button class=\"btn mat-raised-button\" (click)=\"saveAndExitAddField(false)\" type=\"button\">\n Esci\n </button>\n </div>\n </div>\n </form>\n</div>\n\n\n<!-- FORM PROPRIET\u00C0 CAMPI DI TESTO -->\n<ng-template #textFieldFormTemplate>\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\n <mat-form-field>\n <mat-label> Maschera </mat-label>\n <input formControlName=\"TextMask\" matInput [(ngModel)]=\"field.TextMask\">\n </mat-form-field>\n </div>\n <div class=\"col-sm-12 col-md-4\" [formGroup]=\"fieldFormGroup\">\n <mat-form-field>\n <mat-label> Lunghezza massima </mat-label>\n <input formControlName=\"MaxLenght\" type=\"number\" [min]=\"0\" matInput [(ngModel)]=\"field.MaxLenght\">\n </mat-form-field>\n </div>\n <div class=\"col-sm-12 col-md-4\" [formGroup]=\"fieldFormGroup\">\n <mat-form-field>\n <mat-label> Lunghezza minima </mat-label>\n <input formControlName=\"MinLenght\" type=\"number\" [min]=\"0\" matInput [(ngModel)]=\"field.MinLenght\">\n </mat-form-field>\n </div>\n</ng-template>\n\n<!-- FORM PROPRIET\u00C0 CAMPI AREA DI TESTO -->\n<ng-template #textareaFieldFormTemplate>\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\n <mat-form-field>\n <mat-label> Righe </mat-label>\n <input formControlName=\"Rows\" type=\"number\" [min]=\"0\" matInput [(ngModel)]=\"field.Rows\">\n </mat-form-field>\n </div>\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\n <mat-form-field>\n <mat-label> Lunghezza massima </mat-label>\n <input formControlName=\"MaxLenght\" type=\"number\" [min]=\"0\" matInput [(ngModel)]=\"field.MaxLenght\">\n </mat-form-field>\n </div>\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\n <mat-form-field>\n <mat-label> Lunghezza minima </mat-label>\n <input formControlName=\"MinLenght\" type=\"number\" [min]=\"0\" matInput [(ngModel)]=\"field.MinLenght\">\n </mat-form-field>\n </div>\n</ng-template>\n\n<!-- FORM PROPRIET\u00C0 CAMPI BOOLEANI -->\n<ng-template #booleadFieldFormTemplate>\n <div class=\"col-sm-12 col-md-4 mt-2 d-flex align-items-center\" [formGroup]=\"fieldFormGroup\">\n <mat-slide-toggle [(ngModel)]=\"field.IsTristate\" formControlName=\"IsTristate\" color=\"primary\">\n A tre stati\n </mat-slide-toggle>\n </div>\n <div class=\"col-sm-12 col-md-4 mt-2\">\n <eqp-select [enumData]=\"BoolPresentantioEnum\" [(ngModelInput)]=\"field.PresetationType\" [isRequired]=\"true\"\n [showCancelButton]=\"false\" placeholder=\"Tipo di presentazione\" [formGroupInput]=\"fieldFormGroup\"\n [formControlNameInput]=\"'PresetationType'\">\n </eqp-select>\n </div>\n</ng-template>\n\n<!-- FORM PROPRIET\u00C0 CAMPI DATA -->\n<ng-template #dateFieldFormTemplate>\n <div class=\"col-sm-12 col-md-4 mt-2\">\n <eqp-datetimepicker [placeholder]=\"'Data minima'\" [(ngModelInput)]=\"field.MinDate\"\n [formGroupInput]=\"fieldFormGroup\" [formControlNameInput]=\"'MinDate'\" [UTCDate]=\"true\" [showSeconds]=\"false\">\n </eqp-datetimepicker>\n </div>\n <div class=\"col-sm-12 col-md-4 mt-2\">\n <eqp-datetimepicker [placeholder]=\"'Data massima'\" [(ngModelInput)]=\"field.MaxDate\"\n [formGroupInput]=\"fieldFormGroup\" [formControlNameInput]=\"'MaxDate'\" [UTCDate]=\"true\" [showSeconds]=\"false\">\n </eqp-datetimepicker>\n </div>\n <div class=\"col-sm-12 col-md-4 mt-2\">\n <eqp-select [enumData]=\"DateTimeTypeEnum\" [(ngModelInput)]=\"field.IsOnlyDate\" [isRequired]=\"true\"\n [showCancelButton]=\"false\" placeholder=\"Tipo di data\" [formGroupInput]=\"fieldFormGroup\"\n [formControlNameInput]=\"'IsOnlyDate'\">\n </eqp-select>\n </div>\n</ng-template>\n\n<!-- FORM PROPRIET\u00C0 CAMPI NUMERICI -->\n<ng-template #numericFieldFormTemplate>\n <div class=\"col-sm-12 col-md-4 mt-2 d-flex align-items-center\" [formGroup]=\"fieldFormGroup\">\n <mat-slide-toggle [(ngModel)]=\"field.IsInteger\" formControlName=\"IsInteger\" color=\"primary\">\n Valore intero\n </mat-slide-toggle>\n </div>\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\n <mat-form-field>\n <mat-label> Formato numerico </mat-label>\n <input formControlName=\"NumberFormat\" matInput [(ngModel)]=\"field.NumberFormat\">\n </mat-form-field>\n </div>\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\n <mat-form-field>\n <mat-label> Simbolo valuta </mat-label>\n <input formControlName=\"CurrencySymbol\" matInput [(ngModel)]=\"field.CurrencySymbol\">\n </mat-form-field>\n </div>\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\n <mat-form-field>\n <mat-label> Valore massimo </mat-label>\n <input formControlName=\"MinValue\" type=\"number\" [min]=\"0\" matInput [(ngModel)]=\"field.MinValue\">\n </mat-form-field>\n </div>\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\n <mat-form-field>\n <mat-label> Valore minimo </mat-label>\n <input formControlName=\"MaxValue\" type=\"number\" [min]=\"0\" matInput [(ngModel)]=\"field.MaxValue\">\n </mat-form-field>\n </div>\n</ng-template>\n\n<!-- FORM PROPRIET\u00C0 CAMPI ALLEGATO -->\n<ng-template #attachmentFieldFormTemplate>\n <div class=\"col-sm-12 col-md-4 mt-2 d-flex align-items-center\" [formGroup]=\"fieldFormGroup\">\n <mat-slide-toggle [(ngModel)]=\"field.IsMultiAttach\" formControlName=\"IsMultiAttach\" color=\"primary\">\n Allegati multipli\n </mat-slide-toggle>\n </div>\n <div class=\"col-sm-12 col-md-4 mt-2\">\n <eqp-select [arrayData]=\"AvailableFileExtensions.concat(AvailableImageExtensions)\"\n [(ngModelInput)]=\"field.AllowedExtensions\" [arrayKeyProperty]=\"'key'\" [arrayValueProperty]=\"'value'\"\n [isMultiSelect]=\"true\" placeholder=\"Estensioni accettate\" [formGroupInput]=\"fieldFormGroup\"\n [formControlNameInput]=\"'AllowedExtensions'\" [includeFullObject]=\"false\">\n </eqp-select>\n </div>\n <div class=\"col-sm-12 mt-2\">\n <div class=\"row mt-2\">\n <div class=\"col-sm-12 col-md-6\">\n <div class=\"header-title-standard\">\n Elenco metadata\n </div>\n </div>\n <div class=\"col-sm-12 col-md-6 text-right\">\n <button class=\"btn btn-primary\" mat-raised-button color=\"primary\" type=\"button\"\n (click)=\"openMetadataDialog()\">\n <mat-icon>add</mat-icon>\n <span style=\"margin-left: 10px;\">Aggiungi</span>\n </button>\n </div>\n </div>\n <eqp-table #metadataFieldsTable [createMatCard]=\"false\" [columns]=\"metadataColumns\"\n [data]=\"field.MetadataFields\" [emptyTableMessage]=\"'Nessun metadata inserito'\" [searchText]=\"'Cerca'\">\n </eqp-table>\n </div>\n</ng-template>\n\n<!-- FORM PROPRIET\u00C0 CAMPI IMMAGINE -->\n<ng-template #imageFieldFormTemplate>\n <!-- <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\n <mat-form-field>\n <mat-label> Nome immagine </mat-label>\n <input formControlName=\"ImgName\" matInput [(ngModel)]=\"field.ImgName\">\n </mat-form-field>\n </div> -->\n <div class=\"col-sm-12 col-md-4 mt-2 d-flex align-items-center\" [formGroup]=\"fieldFormGroup\">\n <mat-slide-toggle [(ngModel)]=\"field.IsMultiPoint\" formControlName=\"IsMultiPoint\" color=\"primary\">\n Immagine multi-point\n </mat-slide-toggle>\n </div>\n <div class=\"col-sm-12 col-md-4 mt-2 d-flex align-items-center\" [formGroup]=\"fieldFormGroup\">\n <mat-slide-toggle [(ngModel)]=\"field.ImageIsContextualAttachment\" formControlName=\"ImageIsContextualAttachment\"\n color=\"primary\">\n Carica immagine come allegato\n </mat-slide-toggle>\n </div>\n <div class=\"col-sm-12 col-md-4 mt-2 d-flex align-items-center\" [formGroup]=\"fieldFormGroup\">\n <mat-slide-toggle [(ngModel)]=\"field.AttachDefinition.IsMultiAttach\" formControlName=\"IsMultiAttach\"\n color=\"primary\">\n Immagini multiple\n </mat-slide-toggle>\n </div>\n <div class=\"col-sm-12 col-md-4 mt-2\">\n <eqp-select [arrayData]=\"AvailableImageExtensions\" [(ngModelInput)]=\"field.AttachDefinition.AllowedExtensions\"\n [arrayKeyProperty]=\"'key'\" [arrayValueProperty]=\"'value'\" [isMultiSelect]=\"true\"\n placeholder=\"Estensioni accettate\" [formGroupInput]=\"fieldFormGroup\"\n [formControlNameInput]=\"'AllowedExtensions'\" [includeFullObject]=\"false\">\n </eqp-select>\n </div>\n <div class=\"col-sm-12 mt-2\">\n <div class=\"row mt-2\">\n <div class=\"col-sm-12 col-md-6\">\n <div class=\"header-title-standard\">\n Elenco metadata\n </div>\n </div>\n <div class=\"col-sm-12 col-md-6 text-right\">\n <button class=\"btn btn-primary\" mat-raised-button color=\"primary\" type=\"button\"\n (click)=\"openMetadataDialog()\">\n <mat-icon>add</mat-icon>\n <span style=\"margin-left: 10px;\">Aggiungi</span>\n </button>\n </div>\n </div>\n <eqp-table #metadataFieldsTable [createMatCard]=\"false\" [columns]=\"metadataColumns\"\n [data]=\"field.AttachDefinition.MetadataFields\" [emptyTableMessage]=\"'Nessun metadata inserito'\"\n [searchText]=\"'Cerca'\">\n </eqp-table>\n </div>\n</ng-template>\n\n<!-- FORM PROPRIET\u00C0 CAMPI LISTA DI VALORI -->\n<ng-template #listValueFieldFormTemplate>\n <div class=\"col-sm-12 col-md-4 mt-2 d-flex align-items-center\" [formGroup]=\"fieldFormGroup\">\n <mat-slide-toggle [(ngModel)]=\"field.IsMultiChoiche\" formControlName=\"IsMultiChoiche\" color=\"primary\">\n Scelta multipla\n </mat-slide-toggle>\n </div>\n <div class=\"col-sm-12 col-md-4 mt-2\">\n <eqp-select [enumData]=\"ListPresentationEnum\" [(ngModelInput)]=\"field.PresentationMode\" [isRequired]=\"true\"\n [showCancelButton]=\"false\" placeholder=\"Tipo di presentazione\" [formGroupInput]=\"fieldFormGroup\"\n [formControlNameInput]=\"'PresentationMode'\">\n </eqp-select>\n </div>\n <div class=\"col-sm-12 mt-2\">\n <div class=\"row\">\n <h4 class=\"key-value-list-section-title\"> </h4>\n <div class=\"col-md-4 d-flex align-items-center\">\n <mat-form-field>\n <mat-label> Label opzione (invio per confermare)</mat-label>\n <input matInput [(ngModel)]=\"keyValueObject.key\" (keyup)=\"onMultiSelectInputKeyup($event, null)\">\n </mat-form-field>\n </div>\n <div class=\"col-md-4 d-flex align-items-center\">\n <mat-form-field>\n <mat-label> Valore opzione (invio per confermare)</mat-label>\n <input matInput [(ngModel)]=\"keyValueObject.value\" (keyup)=\"onMultiSelectInputKeyup($event, null)\">\n </mat-form-field>\n </div>\n <div class=\"col-md-4 d-flex align-items-center\">\n <span class=\"mr-3\">Opzioni inserite:</span>\n <ul class=\"value-pairs-list\">\n <li *ngFor=\"let keyValuePair of getDictionaryKeyValue()\">\n <mat-icon class=\"mr-1\" (click)=\"deleteKeyFromDictionary(keyValuePair.key)\">close\n </mat-icon>\n <span><b>Label: </b> {{keyValuePair.key}} - <b>Valore: </b> {{keyValuePair.value}}</span>\n </li>\n </ul>\n </div>\n </div>\n </div>\n</ng-template>\n\n<!-- FORM PROPRIET\u00C0 CAMPI LOOKUP -->\n<ng-template #lookupFieldFormTemplate>\n <div class=\"col-sm-12 col-md-4 mt-2 d-flex align-items-center\" [formGroup]=\"fieldFormGroup\">\n <mat-slide-toggle [(ngModel)]=\"field.UseAsGetOrDiscard\" formControlName=\"UseAsGetOrDiscard\" color=\"primary\"\n matTooltip=\"Se true la lookup viene visualizzata in una modale per lo scegli scarta\">\n Usa per scegli o scarta\n </mat-slide-toggle>\n </div>\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\n <mat-form-field matTooltip=\"Nome dell'entit\u00E0 relazionata\">\n <mat-label> Nome entit\u00E0 </mat-label>\n <input formControlName=\"EntitySourceName\" required matInput [(ngModel)]=\"field.EntitySourceName\">\n </mat-form-field>\n </div>\n <div class=\"col-sm-12 mt-2\">\n <div class=\"row\">\n <div class=\"col-md-4\">\n <mat-form-field\n matTooltip=\"Elenco di campi ordinato che verr\u00E0 visualizzato nella lookup (premere invio per confermare)\">\n <mat-label>\n Nomi dei campi (invio per confermare) </mat-label>\n <input matInput (keyup)=\"onMultiSelectInputKeyup($event, 'FieldNames')\">\n </mat-form-field>\n </div>\n <div class=\"col-md-8 d-flex align-items-center\">\n <span class=\"mr-3\">Nomi selezionati:</span>\n <div class=\"extension-container\" *ngFor=\"let extension of field.FieldNames; let i = index\">\n <span>{{extension}}</span>\n <mat-icon class=\"ml-1\" (click)=\"field.FieldNames.splice(i,1)\">close\n </mat-icon>\n </div>\n </div>\n </div>\n </div>\n</ng-template>\n\n<!-- DIALOG PER AGGIUNGERE UN METADATA NEI CAMPI DI TIPO ALLEGATO O IMMAGINE -->\n<ng-template #dialogMetadata>\n <eqp-dynamic-module-add-form-field [field]=\"selectedMetadata\" [availableFields]=\"availableFields\"\n [indexField]=\"indexSelectedMetadata\" (saveFieldEvent)=\"onSaveMetadata($event)\" [fieldTypesToExclude]=\"[6,7,10]\">\n </eqp-dynamic-module-add-form-field>\n</ng-template>",
|
|
1951
|
+
template: "<div class=\"container-fluid\" style=\"max-height: 70vh !important; overflow-x: hidden; overflow-y: auto;\">\n <form [formGroup]=\"fieldFormGroup\">\n <div class=\"row\">\n <div class=\"header-title-standard\">{{indexField != null && indexField >= 0 ? \"Modifica\"\n : \"Aggiungi\"}} campo</div>\n </div>\n <div class=\"row\">\n <div class=\"col-sm-12 col-md-4 mt-2\">\n <eqp-select [enumData]=\"FieldTypeEnum\" [(ngModelInput)]=\"field.FieldType\" [isRequired]=\"true\"\n [showCancelButton]=\"false\" placeholder=\"Tipo campo\" (ngModelInputChange)=\"onFieldTypeChange()\"\n [formGroupInput]=\"fieldFormGroup\" [formControlNameInput]=\"'FieldType'\"\n [enumDataToExclude]=\"fieldTypesToExclude\">\n </eqp-select>\n </div>\n\n <div class=\"col-sm-12 col-md-4 mt-2\">\n <mat-form-field>\n <mat-label> Label </mat-label>\n <input formControlName=\"Label\" required matInput [(ngModel)]=\"field.Label\">\n </mat-form-field>\n </div>\n\n <div class=\"col-sm-12 col-md-4 mt-2\">\n <mat-form-field>\n <mat-label> Descrizione </mat-label>\n <input formControlName=\"Description\" required matInput [(ngModel)]=\"field.Description\">\n </mat-form-field>\n </div>\n\n <div class=\"col-sm-12 col-md-4 mt-2 d-flex align-items-center\">\n <mat-slide-toggle [(ngModel)]=\"field.Required\" formControlName=\"Required\" color=\"primary\">\n Obbligatorio\n </mat-slide-toggle>\n </div>\n\n <div class=\"col-sm-12 col-md-4 mt-2\">\n <mat-form-field>\n <mat-label> Formula (Javascript) </mat-label>\n <input formControlName=\"Formula\" matInput [(ngModel)]=\"field.Formula\"\n [matAutocomplete]=\"formulaAutocomplete\" (keyup)=\"setFormulaAutocompleteOptions($event)\"\n (focus)=\"setFormulaAutocompleteOptions(null)\">\n <mat-autocomplete #formulaAutocomplete=\"matAutocomplete\">\n <mat-option *ngFor=\"let option of formulaAutocompleteOptions\" [value]=\"option.value\">\n {{option.label}}\n </mat-option>\n </mat-autocomplete>\n </mat-form-field>\n </div>\n\n <div class=\"col-sm-12 col-md-4 mt-2\" *ngIf=\"formFieldsGroups\">\n <eqp-select [arrayData]=\"formFieldsGroups\" [(ngModelInput)]=\"field.FieldGroup\"\n [arrayKeyProperty]=\"'Name'\" [arrayValueProperty]=\"'Name'\" placeholder=\"Sezione\"\n [formGroupInput]=\"fieldFormGroup\" [formControlNameInput]=\"'FieldGroup'\" [isRequired]=\"true\"\n [includeFullObject]=\"false\">\n </eqp-select>\n </div>\n\n <div class=\"col-sm-12 col-md-4 mt-2\">\n <eqp-select [arrayData]=\"availableColSpanSizes\" [(ngModelInput)]=\"field.ColSizes\"\n [arrayKeyProperty]=\"'key'\" [arrayValueProperty]=\"'value'\" (ngModelInputChange)=\"onColSizeSelect()\"\n [isMultiSelect]=\"true\" placeholder=\"Larghezza campo\" [formGroupInput]=\"fieldFormGroup\"\n [formControlNameInput]=\"'ColSizes'\" [includeFullObject]=\"false\">\n </eqp-select>\n </div>\n\n <div class=\"col-sm-12 col-md-4 mt-2 d-flex align-items-center\">\n <mat-slide-toggle [(ngModel)]=\"field.InListView\" formControlName=\"InListView\" color=\"primary\"\n [disabled]=\"fieldFormGroup.controls['InListView'].disabled\">\n Mostrare nella visualizzazione a lista\n </mat-slide-toggle>\n </div>\n\n <ng-container *ngTemplateOutlet=\"fieldTypeFormTemplate\">\n </ng-container>\n </div>\n\n\n <div class=\"row mt-2 mb-1\">\n <div class=\"col-sm-12 text-right\">\n <button class=\"mr-2\" mat-raised-button color=\"primary\" (click)=\"saveAndExitAddField(true)\"\n [disabled]=\"disableSaveField()\" type=\"button\">\n Salva\n </button>\n <button class=\"btn mat-raised-button\" (click)=\"saveAndExitAddField(false)\" type=\"button\">\n Esci\n </button>\n </div>\n </div>\n </form>\n</div>\n\n\n<!-- FORM PROPRIET\u00C0 CAMPI DI TESTO -->\n<ng-template #textFieldFormTemplate>\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\n <mat-form-field>\n <mat-label> Maschera </mat-label>\n <input formControlName=\"TextMask\" matInput [(ngModel)]=\"field.TextMask\">\n </mat-form-field>\n </div>\n <div class=\"col-sm-12 col-md-4\" [formGroup]=\"fieldFormGroup\">\n <mat-form-field>\n <mat-label> Lunghezza massima </mat-label>\n <input formControlName=\"MaxLenght\" type=\"number\" [min]=\"0\" matInput [(ngModel)]=\"field.MaxLenght\">\n </mat-form-field>\n </div>\n <div class=\"col-sm-12 col-md-4\" [formGroup]=\"fieldFormGroup\">\n <mat-form-field>\n <mat-label> Lunghezza minima </mat-label>\n <input formControlName=\"MinLenght\" type=\"number\" [min]=\"0\" matInput [(ngModel)]=\"field.MinLenght\">\n </mat-form-field>\n </div>\n</ng-template>\n\n<!-- FORM PROPRIET\u00C0 CAMPI AREA DI TESTO -->\n<ng-template #textareaFieldFormTemplate>\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\n <mat-form-field>\n <mat-label> Righe </mat-label>\n <input formControlName=\"Rows\" type=\"number\" [min]=\"0\" matInput [(ngModel)]=\"field.Rows\">\n </mat-form-field>\n </div>\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\n <mat-form-field>\n <mat-label> Lunghezza massima </mat-label>\n <input formControlName=\"MaxLenght\" type=\"number\" [min]=\"0\" matInput [(ngModel)]=\"field.MaxLenght\">\n </mat-form-field>\n </div>\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\n <mat-form-field>\n <mat-label> Lunghezza minima </mat-label>\n <input formControlName=\"MinLenght\" type=\"number\" [min]=\"0\" matInput [(ngModel)]=\"field.MinLenght\">\n </mat-form-field>\n </div>\n</ng-template>\n\n<!-- FORM PROPRIET\u00C0 CAMPI BOOLEANI -->\n<ng-template #booleadFieldFormTemplate>\n <div class=\"col-sm-12 col-md-4 mt-2 d-flex align-items-center\" [formGroup]=\"fieldFormGroup\">\n <mat-slide-toggle [(ngModel)]=\"field.IsTristate\" formControlName=\"IsTristate\" color=\"primary\">\n A tre stati\n </mat-slide-toggle>\n </div>\n <div class=\"col-sm-12 col-md-4 mt-2\">\n <eqp-select [enumData]=\"BoolPresentantioEnum\" [(ngModelInput)]=\"field.PresetationType\" [isRequired]=\"true\"\n [showCancelButton]=\"false\" placeholder=\"Tipo di presentazione\" [formGroupInput]=\"fieldFormGroup\"\n [formControlNameInput]=\"'PresetationType'\">\n </eqp-select>\n </div>\n</ng-template>\n\n<!-- FORM PROPRIET\u00C0 CAMPI DATA -->\n<ng-template #dateFieldFormTemplate>\n <div class=\"col-sm-12 col-md-4 mt-2\">\n <eqp-datetimepicker [placeholder]=\"'Data minima'\" [(ngModelInput)]=\"field.MinDate\"\n [formGroupInput]=\"fieldFormGroup\" [formControlNameInput]=\"'MinDate'\" [UTCDate]=\"true\" [showSeconds]=\"false\">\n </eqp-datetimepicker>\n </div>\n <div class=\"col-sm-12 col-md-4 mt-2\">\n <eqp-datetimepicker [placeholder]=\"'Data massima'\" [(ngModelInput)]=\"field.MaxDate\"\n [formGroupInput]=\"fieldFormGroup\" [formControlNameInput]=\"'MaxDate'\" [UTCDate]=\"true\" [showSeconds]=\"false\">\n </eqp-datetimepicker>\n </div>\n <div class=\"col-sm-12 col-md-4 mt-2\">\n <eqp-select [enumData]=\"DateTimeTypeEnum\" [(ngModelInput)]=\"field.IsOnlyDate\" [isRequired]=\"true\"\n [showCancelButton]=\"false\" placeholder=\"Tipo di data\" [formGroupInput]=\"fieldFormGroup\"\n [formControlNameInput]=\"'IsOnlyDate'\">\n </eqp-select>\n </div>\n</ng-template>\n\n<!-- FORM PROPRIET\u00C0 CAMPI NUMERICI -->\n<ng-template #numericFieldFormTemplate>\n <div class=\"col-sm-12 col-md-4 mt-2 d-flex align-items-center\" [formGroup]=\"fieldFormGroup\">\n <mat-slide-toggle [(ngModel)]=\"field.IsInteger\" formControlName=\"IsInteger\" color=\"primary\">\n Valore intero\n </mat-slide-toggle>\n </div>\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\n <mat-form-field>\n <mat-label> Formato numerico </mat-label>\n <input formControlName=\"NumberFormat\" matInput [(ngModel)]=\"field.NumberFormat\">\n </mat-form-field>\n </div>\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\n <mat-form-field>\n <mat-label> Simbolo valuta </mat-label>\n <input formControlName=\"CurrencySymbol\" matInput [(ngModel)]=\"field.CurrencySymbol\">\n </mat-form-field>\n </div>\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\n <mat-form-field>\n <mat-label> Valore massimo </mat-label>\n <input formControlName=\"MinValue\" type=\"number\" [min]=\"0\" matInput [(ngModel)]=\"field.MinValue\">\n </mat-form-field>\n </div>\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\n <mat-form-field>\n <mat-label> Valore minimo </mat-label>\n <input formControlName=\"MaxValue\" type=\"number\" [min]=\"0\" matInput [(ngModel)]=\"field.MaxValue\">\n </mat-form-field>\n </div>\n</ng-template>\n\n<!-- FORM PROPRIET\u00C0 CAMPI ALLEGATO -->\n<ng-template #attachmentFieldFormTemplate>\n <div class=\"col-sm-12 col-md-4 mt-2 d-flex align-items-center\" [formGroup]=\"fieldFormGroup\">\n <mat-slide-toggle [(ngModel)]=\"field.IsMultiAttach\" formControlName=\"IsMultiAttach\" color=\"primary\">\n Allegati multipli\n </mat-slide-toggle>\n </div>\n <div class=\"col-sm-12 col-md-4 mt-2\">\n <eqp-select [arrayData]=\"AvailableFileExtensions.concat(AvailableImageExtensions)\"\n [(ngModelInput)]=\"field.AllowedExtensions\" [arrayKeyProperty]=\"'key'\" [arrayValueProperty]=\"'value'\"\n [isMultiSelect]=\"true\" placeholder=\"Estensioni accettate\" [formGroupInput]=\"fieldFormGroup\"\n [formControlNameInput]=\"'AllowedExtensions'\" [includeFullObject]=\"false\">\n </eqp-select>\n </div>\n <div class=\"col-sm-12 mt-2\">\n <div class=\"row mt-2\">\n <div class=\"col-sm-12 col-md-6\">\n <div class=\"header-title-standard\">\n Elenco metadata\n </div>\n </div>\n <div class=\"col-sm-12 col-md-6 text-right\">\n <button class=\"btn btn-primary\" mat-raised-button color=\"primary\" type=\"button\"\n (click)=\"openMetadataDialog()\">\n <mat-icon>add</mat-icon>\n <span style=\"margin-left: 10px;\">Aggiungi</span>\n </button>\n </div>\n </div>\n <eqp-table #metadataFieldsTable [createMatCard]=\"false\" [columns]=\"metadataColumns\"\n [data]=\"field.MetadataFields\" [emptyTableMessage]=\"'Nessun metadata inserito'\" [searchText]=\"'Cerca'\">\n </eqp-table>\n </div>\n</ng-template>\n\n<!-- FORM PROPRIET\u00C0 CAMPI IMMAGINE -->\n<ng-template #imageFieldFormTemplate>\n <div class=\"col-sm-12 col-md-4 mt-2 mb-2 d-flex align-items-center\" [formGroup]=\"fieldFormGroup\">\n <mat-slide-toggle [(ngModel)]=\"field.ImageIsContextualAttachment\" formControlName=\"ImageIsContextualAttachment\"\n color=\"primary\" (ngModelChange)=\"onImageIsContextualAttachmentChange()\">\n Immagine pre-caricata nel campo\n </mat-slide-toggle>\n </div>\n <div class=\"col-sm-12 col-md-4 mt-2 mb-2 d-flex align-items-center\" [formGroup]=\"fieldFormGroup\">\n <mat-slide-toggle [(ngModel)]=\"field.EnableDrawing\" formControlName=\"EnableDrawing\" color=\"primary\">\n Abilita il disegno\n </mat-slide-toggle>\n </div>\n <div class=\"col-sm-12 col-md-4 mt-2 d-flex align-items-center\" [formGroup]=\"fieldFormGroup\"\n *ngIf=\"!field.ImageIsContextualAttachment\">\n <mat-slide-toggle [(ngModel)]=\"field.AttachDefinition.IsMultiAttach\" formControlName=\"IsMultiAttach\"\n color=\"primary\">\n Immagini multiple\n </mat-slide-toggle>\n </div>\n <div class=\"col-sm-12 col-md-4 mt-2\" *ngIf=\"!field.ImageIsContextualAttachment\">\n <eqp-select [arrayData]=\"AvailableImageExtensions\" [(ngModelInput)]=\"field.AttachDefinition.AllowedExtensions\"\n [arrayKeyProperty]=\"'key'\" [arrayValueProperty]=\"'value'\" [isMultiSelect]=\"true\"\n placeholder=\"Estensioni accettate\" [formGroupInput]=\"fieldFormGroup\"\n [formControlNameInput]=\"'AllowedExtensions'\" [includeFullObject]=\"false\">\n </eqp-select>\n </div>\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\" *ngIf=\"field.ImageIsContextualAttachment\">\n <mat-form-field>\n <mat-label> Nome immagine </mat-label>\n <input formControlName=\"ImgName\" matInput [(ngModel)]=\"field.ImgName\" required>\n </mat-form-field>\n </div>\n <div class=\"col-sm-12 col-md-8 mt-2\" [formGroup]=\"fieldFormGroup\" *ngIf=\"field.ImageIsContextualAttachment\">\n <eqp-attachments [attachmentsList]=\"field._contextualAttachments\" [showMatCard]=\"false\" [allowOnlyImages]=\"true\"\n [isDisabled]=\"false\" [showInlinePreview]=\"true\" [multipleAttachment]=\"false\" [showHeader]=\"false\"\n (localEditedAttachments)=\"catchContextualAttachmentChange($event)\" #contextualAttachmentEqpAttachments>\n </eqp-attachments>\n </div>\n <div class=\"col-sm-12 mt-2\">\n <div class=\"row mt-2\">\n <div class=\"col-sm-12 col-md-6\">\n <div class=\"header-title-standard\">\n Elenco metadata\n </div>\n </div>\n <div class=\"col-sm-12 col-md-6 text-right\">\n <button class=\"btn btn-primary\" mat-raised-button color=\"primary\" type=\"button\"\n (click)=\"openMetadataDialog()\">\n <mat-icon>add</mat-icon>\n <span style=\"margin-left: 10px;\">Aggiungi</span>\n </button>\n </div>\n </div>\n <eqp-table #metadataFieldsTable [createMatCard]=\"false\" [columns]=\"metadataColumns\"\n [data]=\"field.AttachDefinition.MetadataFields\" [emptyTableMessage]=\"'Nessun metadata inserito'\"\n [searchText]=\"'Cerca'\">\n </eqp-table>\n </div>\n</ng-template>\n\n<!-- FORM PROPRIET\u00C0 CAMPI LISTA DI VALORI -->\n<ng-template #listValueFieldFormTemplate>\n <div class=\"col-sm-12 col-md-4 mt-2 d-flex align-items-center\" [formGroup]=\"fieldFormGroup\">\n <mat-slide-toggle [(ngModel)]=\"field.IsMultiChoiche\" formControlName=\"IsMultiChoiche\" color=\"primary\">\n Scelta multipla\n </mat-slide-toggle>\n </div>\n <div class=\"col-sm-12 col-md-4 mt-2\">\n <eqp-select [enumData]=\"ListPresentationEnum\" [(ngModelInput)]=\"field.PresentationMode\" [isRequired]=\"true\"\n [showCancelButton]=\"false\" placeholder=\"Tipo di presentazione\" [formGroupInput]=\"fieldFormGroup\"\n [formControlNameInput]=\"'PresentationMode'\">\n </eqp-select>\n </div>\n <div class=\"col-sm-12 mt-2\">\n <div class=\"row\">\n <h4 class=\"key-value-list-section-title\"> </h4>\n <div class=\"col-md-4 d-flex align-items-center\">\n <mat-form-field>\n <mat-label> Label opzione (invio per confermare)</mat-label>\n <input matInput [(ngModel)]=\"keyValueObject.key\" (keyup)=\"onMultiSelectInputKeyup($event, null)\">\n </mat-form-field>\n </div>\n <div class=\"col-md-4 d-flex align-items-center\">\n <mat-form-field>\n <mat-label> Valore opzione (invio per confermare)</mat-label>\n <input matInput [(ngModel)]=\"keyValueObject.value\" (keyup)=\"onMultiSelectInputKeyup($event, null)\">\n </mat-form-field>\n </div>\n <div class=\"col-md-4 d-flex align-items-center\">\n <span class=\"mr-3\">Opzioni inserite:</span>\n <ul class=\"value-pairs-list\">\n <li *ngFor=\"let keyValuePair of getDictionaryKeyValue()\">\n <mat-icon class=\"mr-1\" (click)=\"deleteKeyFromDictionary(keyValuePair.key)\">close\n </mat-icon>\n <span><b>Label: </b> {{keyValuePair.key}} - <b>Valore: </b> {{keyValuePair.value}}</span>\n </li>\n </ul>\n </div>\n </div>\n </div>\n</ng-template>\n\n<!-- FORM PROPRIET\u00C0 CAMPI LOOKUP -->\n<ng-template #lookupFieldFormTemplate>\n <div class=\"col-sm-12 col-md-4 mt-2 d-flex align-items-center\" [formGroup]=\"fieldFormGroup\">\n <mat-slide-toggle [(ngModel)]=\"field.UseAsGetOrDiscard\" formControlName=\"UseAsGetOrDiscard\" color=\"primary\"\n matTooltip=\"Se true la lookup viene visualizzata in una modale per lo scegli scarta\">\n Usa per scegli o scarta\n </mat-slide-toggle>\n </div>\n <div class=\"col-sm-12 col-md-4 mt-2\" [formGroup]=\"fieldFormGroup\">\n <mat-form-field matTooltip=\"Nome dell'entit\u00E0 relazionata\">\n <mat-label> Nome entit\u00E0 </mat-label>\n <input formControlName=\"EntitySourceName\" required matInput [(ngModel)]=\"field.EntitySourceName\">\n </mat-form-field>\n </div>\n <div class=\"col-sm-12 mt-2\">\n <div class=\"row\">\n <div class=\"col-md-4\">\n <mat-form-field\n matTooltip=\"Elenco di campi ordinato che verr\u00E0 visualizzato nella lookup (premere invio per confermare)\">\n <mat-label>\n Nomi dei campi (invio per confermare) </mat-label>\n <input matInput (keyup)=\"onMultiSelectInputKeyup($event, 'FieldNames')\">\n </mat-form-field>\n </div>\n <div class=\"col-md-8 d-flex align-items-center\">\n <span class=\"mr-3\">Nomi selezionati:</span>\n <div class=\"extension-container\" *ngFor=\"let extension of field.FieldNames; let i = index\">\n <span>{{extension}}</span>\n <mat-icon class=\"ml-1\" (click)=\"field.FieldNames.splice(i,1)\">close\n </mat-icon>\n </div>\n </div>\n </div>\n </div>\n</ng-template>\n\n<!-- DIALOG PER AGGIUNGERE UN METADATA NEI CAMPI DI TIPO ALLEGATO O IMMAGINE -->\n<ng-template #dialogMetadata>\n <eqp-dynamic-module-add-form-field [field]=\"selectedMetadata\" [availableFields]=\"availableFields\"\n [indexField]=\"indexSelectedMetadata\" (saveFieldEvent)=\"onSaveMetadata($event)\" [fieldTypesToExclude]=\"[6,7,10]\">\n </eqp-dynamic-module-add-form-field>\n</ng-template>",
|
|
1913
1952
|
styles: [".extension-container{display:inline-block;font-size:15px;border:1px solid var(--primary);border-radius:15px;margin-right:10px}.extension-container mat-icon{vertical-align:middle;font-size:15px;height:15px;width:15px;color:var(--danger);margin-right:10px;cursor:pointer}.extension-container span{margin-left:10px}.key-value-list-section-title{background:linear-gradient(to right,var(--gray) 0,#fff 100%) left bottom #fff no-repeat;background-size:100% 1px}.value-pairs-list{list-style:none;padding:0}.value-pairs-list mat-icon{vertical-align:middle;font-size:15px;height:15px;width:15px;color:var(--danger);margin-right:10px;cursor:pointer}"]
|
|
1914
1953
|
})
|
|
1915
1954
|
], AddFormFieldComponent);
|
|
@@ -2307,31 +2346,13 @@
|
|
|
2307
2346
|
}());
|
|
2308
2347
|
|
|
2309
2348
|
var AttachmentFieldTemplateComponent = /** @class */ (function () {
|
|
2310
|
-
//#endregion
|
|
2311
2349
|
function AttachmentFieldTemplateComponent(utilityService, cdr) {
|
|
2312
2350
|
this.utilityService = utilityService;
|
|
2313
2351
|
this.cdr = cdr;
|
|
2314
2352
|
this.onlyImages = false;
|
|
2315
2353
|
this.recordChange = new core.EventEmitter();
|
|
2354
|
+
this.onAttachmentsChange = new core.EventEmitter();
|
|
2316
2355
|
this.metadataFormGroups = new Array();
|
|
2317
|
-
//#region Etichette per eqp-attachments
|
|
2318
|
-
this.previewLabel = "Anteprima";
|
|
2319
|
-
this.emptyTableMessage = "No record found";
|
|
2320
|
-
this.downloadTooltipPosition = "below";
|
|
2321
|
-
this.openLinkLabel = "Apri link";
|
|
2322
|
-
this.addButtonLabel = "Aggiungi";
|
|
2323
|
-
this.downloadLabel = "Download";
|
|
2324
|
-
this.deleteLabel = "Elimina";
|
|
2325
|
-
this.fileNameLabel = "Nome file";
|
|
2326
|
-
this.uploadFileLabel = "Carica file";
|
|
2327
|
-
this.confirmLabel = "Conferma";
|
|
2328
|
-
this.abortLabel = "Annulla";
|
|
2329
|
-
this.saveLabel = "Salva";
|
|
2330
|
-
this.exitLabel = "Esci";
|
|
2331
|
-
this.eqpTableSearchText = "Cerca...";
|
|
2332
|
-
this.deleteDialogTitle = "Attenzione:";
|
|
2333
|
-
this.deleteDialogMessage = "Sicuro di voler eliminare questo allegato?";
|
|
2334
|
-
this.noImageSelectedErrorMessage = "Nessuna immagine selezionata!";
|
|
2335
2356
|
}
|
|
2336
2357
|
AttachmentFieldTemplateComponent.prototype.ngOnInit = function () {
|
|
2337
2358
|
// Nel caso in cui sono in modifica di un Record aggiorno il valore
|
|
@@ -2382,6 +2403,10 @@
|
|
|
2382
2403
|
this.createMetadataFormGroups();
|
|
2383
2404
|
this.setFormControlValue();
|
|
2384
2405
|
this.onRecordValueChange();
|
|
2406
|
+
// Scateno un evento di output necessario al componente ImageFieldTemplate al
|
|
2407
|
+
// variare degli allegati caricati. Viene usato per aprire il dialog per disegnare
|
|
2408
|
+
// sull'immagine caricata in base alla configurazione del Field.
|
|
2409
|
+
this.onAttachmentsChange.emit();
|
|
2385
2410
|
this.cdr.detectChanges();
|
|
2386
2411
|
};
|
|
2387
2412
|
/**
|
|
@@ -2468,6 +2493,9 @@
|
|
|
2468
2493
|
__decorate([
|
|
2469
2494
|
core.Output()
|
|
2470
2495
|
], AttachmentFieldTemplateComponent.prototype, "recordChange", void 0);
|
|
2496
|
+
__decorate([
|
|
2497
|
+
core.Output()
|
|
2498
|
+
], AttachmentFieldTemplateComponent.prototype, "onAttachmentsChange", void 0);
|
|
2471
2499
|
__decorate([
|
|
2472
2500
|
core.ViewChild("eqpAttachments", { static: true })
|
|
2473
2501
|
], AttachmentFieldTemplateComponent.prototype, "eqpAttachments", void 0);
|
|
@@ -2477,16 +2505,38 @@
|
|
|
2477
2505
|
AttachmentFieldTemplateComponent = __decorate([
|
|
2478
2506
|
core.Component({
|
|
2479
2507
|
selector: 'attachment-field-template',
|
|
2480
|
-
template: "<p *ngIf=\"!field.IsMultiAttach\" class=\"mb-2\">\n {{field.Label + (field.Required ? \" *\" : \"\")}}\n</p>\n<div class=\"row\" *ngIf=\"!field.IsMultiAttach && record[field.Name] && record[field.Name][0]\">\n <div class=\"mt-2\" *ngFor=\"let metadata of field.MetadataFields\"
|
|
2508
|
+
template: "<p *ngIf=\"!field.IsMultiAttach\" class=\"mb-2\">\n {{field.Label + (field.Required ? \" *\" : \"\")}}\n</p>\n<div class=\"row\" *ngIf=\"!field.IsMultiAttach && record[field.Name] && record[field.Name][0]\">\n <div class=\"mt-2\" *ngFor=\"let metadata of field.MetadataFields\"\n [ngClass]=\"utilityService.getFieldSyleClass(metadata)\">\n <dynamic-module-field [field]=\"metadata\" [record]=\"record[field.Name][0]\"\n (recordChange)=\"updateMetadataValidity()\">\n </dynamic-module-field>\n </div>\n</div>\n\n<eqp-attachments [attachmentsList]=\"record[field.Name]\" [showMatCard]=\"true\" [allowOnlyImages]=\"onlyImages\"\n [isDisabled]=\"field.FormFormGroup.disabled\" [showInlinePreview]=\"true\" [multipleAttachment]=\"field.IsMultiAttach\"\n [disableAction]=\"field.FormFormGroup.disabled\" [acceptedFileTypes]=\"field.AllowedExtensions\" [showHeader]=\"true\"\n [headerTitle]=\"field.Label + (field.Required ? ' *' : '')\" (localEditedAttachments)=\"catchAttachmentList($event)\"\n #eqpAttachments>\n</eqp-attachments>\n\n<!-- TEMPLATE PER VISUALIZZARE LA COLONNA DELLA SEZIONE NELLA TABELLA DEI FIELDS -->\n<ng-template #metadataColumnTemplate let-row=\"row\" let-col=\"col\">\n <dynamic-module-field [field]=\"getFieldFromMetadata(col, row)\" [record]=\"row\"\n (recordChange)=\"updateMetadataValidity()\">\n </dynamic-module-field>\n</ng-template>",
|
|
2481
2509
|
styles: [""]
|
|
2482
2510
|
})
|
|
2483
2511
|
], AttachmentFieldTemplateComponent);
|
|
2484
2512
|
return AttachmentFieldTemplateComponent;
|
|
2485
2513
|
}());
|
|
2486
2514
|
|
|
2515
|
+
/**
|
|
2516
|
+
* Metodo per recuperare, a partire da un Blob, la stringa contenente il base64 del file.
|
|
2517
|
+
* Usato per prendere il base64 dell'immagine dopo che l'utente ci ha disegnato sopra.
|
|
2518
|
+
* @param file Blob che rappresenta l'immagine.
|
|
2519
|
+
*/
|
|
2520
|
+
var toBase64 = function (file) { return new Promise(function (resolve, reject) {
|
|
2521
|
+
var reader = new FileReader();
|
|
2522
|
+
reader.readAsDataURL(file);
|
|
2523
|
+
reader.onload = function () { return resolve(reader.result.toString()); };
|
|
2524
|
+
reader.onerror = function (error) { return reject(error); };
|
|
2525
|
+
}); };
|
|
2526
|
+
var ɵ0 = toBase64;
|
|
2487
2527
|
var ImageFieldTemplateComponent = /** @class */ (function () {
|
|
2488
|
-
|
|
2528
|
+
//#endregion
|
|
2529
|
+
function ImageFieldTemplateComponent(dialog, utilityService) {
|
|
2530
|
+
this.dialog = dialog;
|
|
2531
|
+
this.utilityService = utilityService;
|
|
2489
2532
|
this.recordChange = new core.EventEmitter();
|
|
2533
|
+
//#region Proprietà per configurare il componente ngx-image-drawing e aprire il relativo dialog.
|
|
2534
|
+
this.width = null;
|
|
2535
|
+
this.height = null;
|
|
2536
|
+
this.i18n = {
|
|
2537
|
+
saveBtn: 'Salva modifiche',
|
|
2538
|
+
cancelBtn: 'Ricarica originale'
|
|
2539
|
+
};
|
|
2490
2540
|
}
|
|
2491
2541
|
ImageFieldTemplateComponent.prototype.ngOnInit = function () {
|
|
2492
2542
|
this.field.AttachDefinition.FormFormGroup = this.field.FormFormGroup;
|
|
@@ -2499,6 +2549,19 @@
|
|
|
2499
2549
|
this.field.AttachDefinition.Required = this.field.Required;
|
|
2500
2550
|
this.field.AttachDefinition.Formula = this.field.Formula;
|
|
2501
2551
|
this.field.AttachDefinition.FieldValue = this.field.FieldValue;
|
|
2552
|
+
// Se il campo prevede un'immagine pre-caricata (ImageIsContextualAttachment == true) sulla quale
|
|
2553
|
+
// l'utente può disegnare (EnableDrawing == true) e non sono in modifica di un record (ovvero nel record
|
|
2554
|
+
// non ho un'immagine già salvata) allora imposta l'immagine pre caricata come valore iniziale
|
|
2555
|
+
// nel record corrente e ne recupera le dimensioni per visualizzare correttamente l'area in cui
|
|
2556
|
+
// l'utente può disegnare. Se non effettua modifiche o non salva i disegni fatti viene salvata
|
|
2557
|
+
// l'immagine originale.
|
|
2558
|
+
if (this.field.ImageIsContextualAttachment && this.field.ContextualAttachment) {
|
|
2559
|
+
if (!this.record[this.field.Name] || !Array.isArray(this.record[this.field.Name]) || !(this.record[this.field.Name].length > 0)) {
|
|
2560
|
+
this.record[this.field.Name] = [JSON.parse(JSON.stringify(this.field.ContextualAttachment))];
|
|
2561
|
+
}
|
|
2562
|
+
this.preLoadedImageMetadataFormGroup = this.utilityService.CreateFormFormGroup(this.field.AttachDefinition.MetadataFields, this.record[this.field.Name][0]);
|
|
2563
|
+
this.getImageDimensions();
|
|
2564
|
+
}
|
|
2502
2565
|
};
|
|
2503
2566
|
ImageFieldTemplateComponent.prototype.ngOnChanges = function (changes) {
|
|
2504
2567
|
// Se viene modificato il valore di "ngModelInput" allora aggiorna l'input
|
|
@@ -2507,6 +2570,15 @@
|
|
|
2507
2570
|
this.updateField();
|
|
2508
2571
|
}
|
|
2509
2572
|
};
|
|
2573
|
+
ImageFieldTemplateComponent.prototype.updateMetadataValidity = function () {
|
|
2574
|
+
if (this.preLoadedImageMetadataFormGroup.invalid) {
|
|
2575
|
+
this.field.FormFormGroup.controls[this.field.Name].setErrors({ 'incorrect': true });
|
|
2576
|
+
}
|
|
2577
|
+
else {
|
|
2578
|
+
this.field.FormFormGroup.controls[this.field.Name].setErrors(null);
|
|
2579
|
+
}
|
|
2580
|
+
this.onRecordValueChange();
|
|
2581
|
+
};
|
|
2510
2582
|
/**
|
|
2511
2583
|
* Metodo per aggiornare il valore del campo quando questo è rappresentato da una formula.
|
|
2512
2584
|
*/
|
|
@@ -2515,6 +2587,108 @@
|
|
|
2515
2587
|
this.record[this.field.Name] = UtilityHelperService.EvaluateFieldFormula(this.field.Formula, this.record, null);
|
|
2516
2588
|
}
|
|
2517
2589
|
};
|
|
2590
|
+
ImageFieldTemplateComponent.prototype.resetPreLoadedImage = function () {
|
|
2591
|
+
this.width = null;
|
|
2592
|
+
this.height = null;
|
|
2593
|
+
this.record[this.field.Name] = [JSON.parse(JSON.stringify(this.field.ContextualAttachment))];
|
|
2594
|
+
this.getImageDimensions();
|
|
2595
|
+
};
|
|
2596
|
+
/**
|
|
2597
|
+
* Metodo invocato quando vengono aggiunti o eliminati gli allegati nel componente AttachmentFieldTemplate.
|
|
2598
|
+
* Se l'ImageField è abilitato al disegno (EnableDrawing == true), non permette allegati multipli (IsMulitAttach == false)
|
|
2599
|
+
* e nel Record corrente è presente l'immagine caricata dall'utente allora recupera le dimensioni dell'immagine e
|
|
2600
|
+
* apre il dialog con il componente image-drawing per permettere il disegno sull'immagine appena caricata.
|
|
2601
|
+
*/
|
|
2602
|
+
ImageFieldTemplateComponent.prototype.onAttachmentsChange = function () {
|
|
2603
|
+
if (!this.field.AttachDefinition.IsMultiAttach && this.field.EnableDrawing && this.record[this.field.Name] && this.record[this.field.Name][0]) {
|
|
2604
|
+
this.getImageDimensions();
|
|
2605
|
+
this.dialogImageDrowingRef = this.dialog.open(this.dialogImageDrowing, {
|
|
2606
|
+
disableClose: true,
|
|
2607
|
+
hasBackdrop: true,
|
|
2608
|
+
width: '75%'
|
|
2609
|
+
});
|
|
2610
|
+
}
|
|
2611
|
+
};
|
|
2612
|
+
/**
|
|
2613
|
+
* Metodo invocato al salvataggio dell'immagine dal componente image-drawing.
|
|
2614
|
+
* Trasforma il Blob ricevuto in un base64, aggiorna il FileContetType e il FileDataBase64
|
|
2615
|
+
* dell'allegato caricato e chiude il dialog in cui disegnare.
|
|
2616
|
+
* @param drawnPicture Blob dell'immagine disegnata.
|
|
2617
|
+
*/
|
|
2618
|
+
ImageFieldTemplateComponent.prototype.saveDrowning = function (drawnPicture) {
|
|
2619
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2620
|
+
var base64File;
|
|
2621
|
+
return __generator(this, function (_a) {
|
|
2622
|
+
switch (_a.label) {
|
|
2623
|
+
case 0: return [4 /*yield*/, toBase64(drawnPicture)];
|
|
2624
|
+
case 1:
|
|
2625
|
+
base64File = _a.sent();
|
|
2626
|
+
if (base64File) {
|
|
2627
|
+
this.record[this.field.Name][0].FileContentType = base64File.split(",")[0].split(":")[1].split(";")[0];
|
|
2628
|
+
this.record[this.field.Name][0].FileDataBase64 = base64File.split(",")[1];
|
|
2629
|
+
}
|
|
2630
|
+
if (this.dialogImageDrowingRef) {
|
|
2631
|
+
this.closeImageDrowingDialog();
|
|
2632
|
+
}
|
|
2633
|
+
return [2 /*return*/];
|
|
2634
|
+
}
|
|
2635
|
+
});
|
|
2636
|
+
});
|
|
2637
|
+
};
|
|
2638
|
+
/**
|
|
2639
|
+
* Metodo per chiudere il dialog in cui disegnare sull'immagine cariata e svuotare le dimensioni.
|
|
2640
|
+
*/
|
|
2641
|
+
ImageFieldTemplateComponent.prototype.closeImageDrowingDialog = function () {
|
|
2642
|
+
this.dialogImageDrowingRef.close();
|
|
2643
|
+
this.width = null;
|
|
2644
|
+
this.height = null;
|
|
2645
|
+
};
|
|
2646
|
+
/**
|
|
2647
|
+
* Metodo per recuperare le dimensioni dell'immagine caricata per mostrare correttamente
|
|
2648
|
+
* il componente image-drawing. Se non viene eseguito questo passaggio l'area in cui disegnare
|
|
2649
|
+
* è più grande dell'immagine stessa e al salvataggio i tratti disegnati vengono spostati.
|
|
2650
|
+
*/
|
|
2651
|
+
ImageFieldTemplateComponent.prototype.getImageDimensions = function () {
|
|
2652
|
+
var _this = this;
|
|
2653
|
+
var blob = this.getBlobFromBase64();
|
|
2654
|
+
var reader = new FileReader();
|
|
2655
|
+
reader.onload = function (e) {
|
|
2656
|
+
var image = new Image();
|
|
2657
|
+
image.src = e.target.result;
|
|
2658
|
+
image.onload = function (rs) {
|
|
2659
|
+
_this.height = rs.currentTarget['height'];
|
|
2660
|
+
_this.width = rs.currentTarget['width'];
|
|
2661
|
+
};
|
|
2662
|
+
};
|
|
2663
|
+
reader.readAsDataURL(blob);
|
|
2664
|
+
};
|
|
2665
|
+
/**
|
|
2666
|
+
* Metodo per convertire il base64 di un'immagine in un Blob.
|
|
2667
|
+
* Necessario per il recupero delle dimensioni dell'immagine caricata a partire dal suo base64.
|
|
2668
|
+
* Viene eseguito solo nel caso in cui l'ImageField non ammette allegati multipli.
|
|
2669
|
+
* @returns Restituisce il Blob dell'immagine caricata.
|
|
2670
|
+
*/
|
|
2671
|
+
ImageFieldTemplateComponent.prototype.getBlobFromBase64 = function () {
|
|
2672
|
+
var byteCharacters = atob(this.record[this.field.Name][0].FileDataBase64);
|
|
2673
|
+
var byteNumbers = new Array(byteCharacters.length);
|
|
2674
|
+
for (var i = 0; i < byteCharacters.length; i++) {
|
|
2675
|
+
byteNumbers[i] = byteCharacters.charCodeAt(i);
|
|
2676
|
+
}
|
|
2677
|
+
var byteArray = new Uint8Array(byteNumbers);
|
|
2678
|
+
return new Blob([byteArray], { type: this.record[this.field.Name][0].FileContentType });
|
|
2679
|
+
};
|
|
2680
|
+
/**
|
|
2681
|
+
* Metodo per emettere l'evento che il valore del record è cambiato.
|
|
2682
|
+
*/
|
|
2683
|
+
ImageFieldTemplateComponent.prototype.onRecordValueChange = function () {
|
|
2684
|
+
if (!this.field.Formula) {
|
|
2685
|
+
this.recordChange.emit(this.record);
|
|
2686
|
+
}
|
|
2687
|
+
};
|
|
2688
|
+
ImageFieldTemplateComponent.ctorParameters = function () { return [
|
|
2689
|
+
{ type: dialog.MatDialog },
|
|
2690
|
+
{ type: UtilityHelperService }
|
|
2691
|
+
]; };
|
|
2518
2692
|
__decorate([
|
|
2519
2693
|
core.Input()
|
|
2520
2694
|
], ImageFieldTemplateComponent.prototype, "record", void 0);
|
|
@@ -2524,11 +2698,14 @@
|
|
|
2524
2698
|
__decorate([
|
|
2525
2699
|
core.Output()
|
|
2526
2700
|
], ImageFieldTemplateComponent.prototype, "recordChange", void 0);
|
|
2701
|
+
__decorate([
|
|
2702
|
+
core.ViewChild("dialogImageDrowing", { static: true })
|
|
2703
|
+
], ImageFieldTemplateComponent.prototype, "dialogImageDrowing", void 0);
|
|
2527
2704
|
ImageFieldTemplateComponent = __decorate([
|
|
2528
2705
|
core.Component({
|
|
2529
2706
|
selector: 'image-field-template',
|
|
2530
|
-
template: "<attachment-field-template [(record)]=\"record\" [field]=\"field.AttachDefinition\"
|
|
2531
|
-
styles: [""]
|
|
2707
|
+
template: "<!-- VISUALIZZAZIONE ALLEGATO PRE CARICATO CON POSSIBILITA' DI DISEGNO -->\n<div class=\"row\" *ngIf=\"field.ImageIsContextualAttachment && field.ContextualAttachment\">\n <div class=\"col-sm-12 col-md-6 col-lg-4\">\n <p class=\"mb-2\">\n {{ field.Label + (field.Required ? \" *\" : \"\")}}\n <br>\n Nome immagine: {{ field.ImgName}}\n </p>\n <eqp-img-drawing\n *ngIf=\"field.EnableDrawing && record[field.Name] && record[field.Name][0] && width != null && height != null\"\n [src]=\"'data:'+ record[field.Name][0].FileContentType + ';base64,'+ record[field.Name][0].FileDataBase64\"\n [showCancelButton]=\"false\" [enableLoadAnotherImage]=\"false\" [enableRemoveImage]=\"false\" [width]=\"width\"\n [height]=\"height\" [i18n]=\"i18n\" [showCancelButton]=\"true\" (save)=\"saveDrowning($event)\"\n (cancel)=\"resetPreLoadedImage()\">\n </eqp-img-drawing>\n\n <img *ngIf=\"!field.EnableDrawing\"\n [src]=\"'data:'+ record[field.Name][0].FileContentType+ ';base64,'+ record[field.Name][0].FileDataBase64\">\n </div>\n\n <div class=\"col-sm-12 col-md-6 col-lg-8\">\n <div class=\"row\"\n *ngIf=\"field.AttachDefinition && field.AttachDefinition.MetadataFields && preLoadedImageMetadataFormGroup\">\n <div class=\"mt-2\" *ngFor=\"let metadata of field.AttachDefinition.MetadataFields\"\n [ngClass]=\"utilityService.getFieldSyleClass(metadata)\">\n <dynamic-module-field #fieldTemplate [field]=\"metadata\" [form]=\"preLoadedImageMetadataFormGroup\"\n [record]=\"record[field.Name][0]\" (recordChange)=\"updateMetadataValidity()\">\n </dynamic-module-field>\n </div>\n </div>\n </div>\n</div>\n\n<!-- COMPONENTE IN CUI CARICARE NUOVI ALLEGATI -->\n<attachment-field-template [(record)]=\"record\" [field]=\"field.AttachDefinition\" [onlyImages]=\"true\"\n (onAttachmentsChange)=\"onAttachmentsChange()\" *ngIf=\"!field.ImageIsContextualAttachment\">\n</attachment-field-template>\n\n<!-- DIALOG PER DISEGNARE SUL NUOVO ALLEGATO CARICATO -->\n<ng-template #dialogImageDrowing>\n <div *ngIf=\"field.EnableDrawing && record[field.Name] && record[field.Name][0] && width != null && height != null\"\n class=\"row\">\n <div class=\"col-sm-12 col-md-12\">\n <eqp-img-drawing [showCancelButton]=\"false\" [enableLoadAnotherImage]=\"false\" [enableRemoveImage]=\"false\"\n [src]=\"'data:'+ record[field.Name][0].FileContentType + ';base64,'+ record[field.Name][0].FileDataBase64\"\n [i18n]=\"i18n\" [showCancelButton]=\"false\" (save)=\"saveDrowning($event)\">\n </eqp-img-drawing>\n </div>\n </div>\n <div class=\"row mt-2 mb-1\">\n <div class=\"col-sm-12 text-right\">\n <button class=\"btn mat-raised-button\" (click)=\"closeImageDrowingDialog()\" type=\"button\">\n Annulla disegno\n </button>\n </div>\n </div>\n</ng-template>",
|
|
2708
|
+
styles: ["::ng-deep image-drawing>button{background-color:var(--primary)!important;color:#fff!important}"]
|
|
2532
2709
|
})
|
|
2533
2710
|
], ImageFieldTemplateComponent);
|
|
2534
2711
|
return ImageFieldTemplateComponent;
|
|
@@ -3049,7 +3226,8 @@
|
|
|
3049
3226
|
eqpSelect.EqpSelectModule,
|
|
3050
3227
|
eqpDatetimepicker.EqpDatetimepickerModule,
|
|
3051
3228
|
eqpFilters.EqpFiltersModule,
|
|
3052
|
-
eqpNumeric.EqpNumericModule
|
|
3229
|
+
eqpNumeric.EqpNumericModule,
|
|
3230
|
+
eqpImgDrawing.EqpImgDrawingModule
|
|
3053
3231
|
],
|
|
3054
3232
|
exports: [
|
|
3055
3233
|
EqpDynamicModuleComponent,
|
|
@@ -3076,6 +3254,14 @@
|
|
|
3076
3254
|
function ImageField() {
|
|
3077
3255
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
3078
3256
|
}
|
|
3257
|
+
Object.defineProperty(ImageField.prototype, "_contextualAttachments", {
|
|
3258
|
+
/**Proprietà per recuperare l'allegato caricato come array per eqp-attachments (se ImageIsContextualAttachment == true) */
|
|
3259
|
+
get: function () {
|
|
3260
|
+
return this.ContextualAttachment ? [this.ContextualAttachment] : [];
|
|
3261
|
+
},
|
|
3262
|
+
enumerable: true,
|
|
3263
|
+
configurable: true
|
|
3264
|
+
});
|
|
3079
3265
|
return ImageField;
|
|
3080
3266
|
}(BaseField));
|
|
3081
3267
|
|
|
@@ -3152,6 +3338,7 @@
|
|
|
3152
3338
|
exports.TextareaField = TextareaField;
|
|
3153
3339
|
exports.TextareaFieldTemplateComponent = TextareaFieldTemplateComponent;
|
|
3154
3340
|
exports.UtilityHelperService = UtilityHelperService;
|
|
3341
|
+
exports.ɵ0 = ɵ0;
|
|
3155
3342
|
exports.ɵa = MaterialModule;
|
|
3156
3343
|
|
|
3157
3344
|
Object.defineProperty(exports, '__esModule', { value: true });
|