@eqproject/eqp-dynamic-module 2.6.50 → 2.6.51
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/esm2020/lib/components/private/form-records/add-form-record/add-form-record.component.mjs +30 -2
- package/fesm2015/eqproject-eqp-dynamic-module.mjs +29 -1
- package/fesm2015/eqproject-eqp-dynamic-module.mjs.map +1 -1
- package/fesm2020/eqproject-eqp-dynamic-module.mjs +29 -1
- package/fesm2020/eqproject-eqp-dynamic-module.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -5191,6 +5191,7 @@ class AddFormRecordComponent {
|
|
|
5191
5191
|
;
|
|
5192
5192
|
case FieldTypeEnum['Immagine']:
|
|
5193
5193
|
{
|
|
5194
|
+
console.log("immagine ", field.Name, record[field.Name]);
|
|
5194
5195
|
// Recupero il BASE64 dell'immagine Resized via promise client
|
|
5195
5196
|
var resizedBase64 = await this.resizeBase64Image("data:image/" + record[field.Name].FileExtension + ";base64," + record[field.Name].FileDataBase64);
|
|
5196
5197
|
// Aggiungo l'HTML con il nuovo BASE64
|
|
@@ -5198,6 +5199,31 @@ class AddFormRecordComponent {
|
|
|
5198
5199
|
break;
|
|
5199
5200
|
}
|
|
5200
5201
|
;
|
|
5202
|
+
case FieldTypeEnum['Allegato']:
|
|
5203
|
+
{
|
|
5204
|
+
console.log("Allegato ", field.Name, record[field.Name], record);
|
|
5205
|
+
if (record[field.Name] != null) {
|
|
5206
|
+
let resizedBase64;
|
|
5207
|
+
if (record[field.Name][0].IsImage) {
|
|
5208
|
+
// Recupero il BASE64 dell'immagine Resized via promise client
|
|
5209
|
+
resizedBase64 = await this.resizeBase64Image("data:image/" + record[field.Name][0].FileExtension + ";base64," + record[field.Name][0].FileDataBase64);
|
|
5210
|
+
console.log("Allegato resizedBase64", resizedBase64);
|
|
5211
|
+
// Aggiungo l'HTML con il nuovo BASE64
|
|
5212
|
+
outputValuesArray[field.Name] = '<img class="image-preview" src="' + resizedBase64 + '" style="height: ' + record[field.Name][0].ResizedImageHeightPx + 'px">';
|
|
5213
|
+
}
|
|
5214
|
+
else if (record[field.Name][0].FileContentType == "application/pdf") {
|
|
5215
|
+
outputValuesArray[field.Name] = '<iframe src="data:application/pdf;base64,' + record[field.Name][0].FileDataBase64 + '"style="min-height: 300px; height: 100%;"></iframe>';
|
|
5216
|
+
}
|
|
5217
|
+
else {
|
|
5218
|
+
outputValuesArray[field.Name] = '<iframe src="data:"' + record[field.Name][0].FileExtension + '";base64,' + record[field.Name][0].FileDataBase64 + '"style="min-height: 300px; height: 100%;"></iframe>';
|
|
5219
|
+
}
|
|
5220
|
+
// Aggiungo l'HTML con il nuovo BASE64
|
|
5221
|
+
// outputValuesArray[field.Name] = "<img src='" + resizedBase64 + "' style='height: " + record[field.Name][0].ResizedImageHeightPx + "px'>";
|
|
5222
|
+
console.log("Allegato outputValuesArray", outputValuesArray[field.Name]);
|
|
5223
|
+
}
|
|
5224
|
+
break;
|
|
5225
|
+
}
|
|
5226
|
+
;
|
|
5201
5227
|
case FieldTypeEnum['Immagine con markers']:
|
|
5202
5228
|
{
|
|
5203
5229
|
// Recupero il BASE64 dell'immagine Resized via promise client
|
|
@@ -5300,6 +5326,8 @@ class AddFormRecordComponent {
|
|
|
5300
5326
|
}
|
|
5301
5327
|
async resizeBase64Image(base64Image) {
|
|
5302
5328
|
return new Promise((resolve, reject) => {
|
|
5329
|
+
const imagetype = /data:image\/([\w]+);/;
|
|
5330
|
+
const match = base64Image.match(imagetype);
|
|
5303
5331
|
const img = new Image();
|
|
5304
5332
|
img.src = base64Image;
|
|
5305
5333
|
img.onload = function () {
|
|
@@ -5314,7 +5342,7 @@ class AddFormRecordComponent {
|
|
|
5314
5342
|
canvas.height = newHeight;
|
|
5315
5343
|
ctx.drawImage(img, 0, 0, newWidth, newHeight);
|
|
5316
5344
|
let quality = 0.8;
|
|
5317
|
-
let dataURL = canvas.toDataURL('image/
|
|
5345
|
+
let dataURL = canvas.toDataURL('image/' + match[1], quality);
|
|
5318
5346
|
resolve(dataURL);
|
|
5319
5347
|
};
|
|
5320
5348
|
});
|