@eqproject/eqp-dynamic-module 2.6.49 → 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.
@@ -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/jpeg', quality);
5345
+ let dataURL = canvas.toDataURL('image/' + match[1], quality);
5318
5346
  resolve(dataURL);
5319
5347
  };
5320
5348
  });
@@ -6524,11 +6552,11 @@ class ListViewFormRecordComponent {
6524
6552
  if (mymatch.includes("dateformat")) {
6525
6553
  let format = mymatch.split("=")[1];
6526
6554
  let token = item.split("(")[0];
6527
- out += record.AdditionalInfo[token] ? " " + this.datePipe.transform(record.AdditionalInfo[token], format) : record[token] ? " " + this.datePipe.transform(record[token], format) : " " + token;
6555
+ out += record.AdditionalInfo != null && record.AdditionalInfo[token] != null ? " " + this.datePipe.transform(record.AdditionalInfo[token], format) : record[token] ? " " + this.datePipe.transform(record[token], format) : " " + token;
6528
6556
  }
6529
6557
  }
6530
6558
  else {
6531
- out += record.AdditionalInfo[item] ? " " + record.AdditionalInfo[item] : record[item] ? " " + record[item] : " " + item;
6559
+ out += record.AdditionalInfo != null && record.AdditionalInfo[item] != null ? " " + record.AdditionalInfo[item] : record[item] ? " " + record[item] : " " + item;
6532
6560
  }
6533
6561
  });
6534
6562
  // throw new Error('Method not implemented.');