@eqproject/eqp-dynamic-module 2.6.50 → 2.6.52
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 +33 -4
- package/esm2020/lib/services/utilityHelper.services.mjs +16 -1
- package/fesm2015/eqproject-eqp-dynamic-module.mjs +47 -3
- package/fesm2015/eqproject-eqp-dynamic-module.mjs.map +1 -1
- package/fesm2020/eqproject-eqp-dynamic-module.mjs +47 -3
- package/fesm2020/eqproject-eqp-dynamic-module.mjs.map +1 -1
- package/lib/services/utilityHelper.services.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1248,6 +1248,21 @@ class UtilityHelperService {
|
|
|
1248
1248
|
//GlobalService.debugLog("RunEndPointCall - subscribe - end");
|
|
1249
1249
|
});
|
|
1250
1250
|
}
|
|
1251
|
+
static base64ToBlob(b64Data, contentType = '', sliceSize = 512) {
|
|
1252
|
+
let byteCharacters = atob(b64Data);
|
|
1253
|
+
let byteArrays = [];
|
|
1254
|
+
for (let offset = 0; offset < byteCharacters.length; offset += sliceSize) {
|
|
1255
|
+
let slice = byteCharacters.slice(offset, offset + sliceSize);
|
|
1256
|
+
let byteNumbers = new Array(slice.length);
|
|
1257
|
+
for (let i = 0; i < slice.length; i++) {
|
|
1258
|
+
byteNumbers[i] = slice.charCodeAt(i);
|
|
1259
|
+
}
|
|
1260
|
+
let byteArray = new Uint8Array(byteNumbers);
|
|
1261
|
+
byteArrays.push(byteArray);
|
|
1262
|
+
}
|
|
1263
|
+
let blob = new Blob(byteArrays, { type: contentType });
|
|
1264
|
+
return blob;
|
|
1265
|
+
}
|
|
1251
1266
|
}
|
|
1252
1267
|
UtilityHelperService.context = new Context();
|
|
1253
1268
|
UtilityHelperService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: UtilityHelperService, deps: [{ token: i5.UntypedFormBuilder }, { token: i1.HttpClient }, { token: SpinnerService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
@@ -4894,14 +4909,15 @@ class AddFormRecordComponent {
|
|
|
4894
4909
|
];
|
|
4895
4910
|
GlobalService.debugLog('onSaveRecord - dynamicModuleParams', dynamicModuleParams);
|
|
4896
4911
|
this.utilityService.RunEndPointCall(this.endPointConfiguration.Records.SaveEndPoint, dynamicModuleParams, (res) => {
|
|
4912
|
+
dynRec.ID = res.toString();
|
|
4897
4913
|
event.ID = res.toString();
|
|
4898
4914
|
this.checkTriggers(event);
|
|
4899
|
-
this.afterSaveRecordEvent.emit(
|
|
4915
|
+
this.afterSaveRecordEvent.emit(dynRec);
|
|
4900
4916
|
this.isSaving = false;
|
|
4901
4917
|
});
|
|
4902
4918
|
}
|
|
4903
4919
|
else {
|
|
4904
|
-
this.saveRecordEvent.emit(
|
|
4920
|
+
this.saveRecordEvent.emit(dynRec);
|
|
4905
4921
|
}
|
|
4906
4922
|
}
|
|
4907
4923
|
//#endregion onSaveRecord
|
|
@@ -5191,6 +5207,7 @@ class AddFormRecordComponent {
|
|
|
5191
5207
|
;
|
|
5192
5208
|
case FieldTypeEnum['Immagine']:
|
|
5193
5209
|
{
|
|
5210
|
+
console.log("immagine ", field.Name, record[field.Name]);
|
|
5194
5211
|
// Recupero il BASE64 dell'immagine Resized via promise client
|
|
5195
5212
|
var resizedBase64 = await this.resizeBase64Image("data:image/" + record[field.Name].FileExtension + ";base64," + record[field.Name].FileDataBase64);
|
|
5196
5213
|
// Aggiungo l'HTML con il nuovo BASE64
|
|
@@ -5198,6 +5215,31 @@ class AddFormRecordComponent {
|
|
|
5198
5215
|
break;
|
|
5199
5216
|
}
|
|
5200
5217
|
;
|
|
5218
|
+
case FieldTypeEnum['Allegato']:
|
|
5219
|
+
{
|
|
5220
|
+
console.log("Allegato ", field.Name, record[field.Name], record);
|
|
5221
|
+
if (record[field.Name] != null) {
|
|
5222
|
+
let resizedBase64;
|
|
5223
|
+
if (record[field.Name][0].IsImage) {
|
|
5224
|
+
// Recupero il BASE64 dell'immagine Resized via promise client
|
|
5225
|
+
resizedBase64 = await this.resizeBase64Image("data:image/" + record[field.Name][0].FileExtension + ";base64," + record[field.Name][0].FileDataBase64);
|
|
5226
|
+
console.log("Allegato resizedBase64", resizedBase64);
|
|
5227
|
+
// Aggiungo l'HTML con il nuovo BASE64
|
|
5228
|
+
outputValuesArray[field.Name] = '<img class="image-preview" src="' + resizedBase64 + '" style="height: ' + record[field.Name][0].ResizedImageHeightPx + 'px">';
|
|
5229
|
+
}
|
|
5230
|
+
else if (record[field.Name][0].FileContentType == "application/pdf") {
|
|
5231
|
+
outputValuesArray[field.Name] = '<iframe src="data:application/pdf;base64,' + record[field.Name][0].FileDataBase64 + '"style="min-height: 300px; height: 100%;"></iframe>';
|
|
5232
|
+
}
|
|
5233
|
+
else {
|
|
5234
|
+
outputValuesArray[field.Name] = '<iframe src="data:"' + record[field.Name][0].FileExtension + '";base64,' + record[field.Name][0].FileDataBase64 + '"style="min-height: 300px; height: 100%;"></iframe>';
|
|
5235
|
+
}
|
|
5236
|
+
// Aggiungo l'HTML con il nuovo BASE64
|
|
5237
|
+
// outputValuesArray[field.Name] = "<img src='" + resizedBase64 + "' style='height: " + record[field.Name][0].ResizedImageHeightPx + "px'>";
|
|
5238
|
+
console.log("Allegato outputValuesArray", outputValuesArray[field.Name]);
|
|
5239
|
+
}
|
|
5240
|
+
break;
|
|
5241
|
+
}
|
|
5242
|
+
;
|
|
5201
5243
|
case FieldTypeEnum['Immagine con markers']:
|
|
5202
5244
|
{
|
|
5203
5245
|
// Recupero il BASE64 dell'immagine Resized via promise client
|
|
@@ -5300,6 +5342,8 @@ class AddFormRecordComponent {
|
|
|
5300
5342
|
}
|
|
5301
5343
|
async resizeBase64Image(base64Image) {
|
|
5302
5344
|
return new Promise((resolve, reject) => {
|
|
5345
|
+
const imagetype = /data:image\/([\w]+);/;
|
|
5346
|
+
const match = base64Image.match(imagetype);
|
|
5303
5347
|
const img = new Image();
|
|
5304
5348
|
img.src = base64Image;
|
|
5305
5349
|
img.onload = function () {
|
|
@@ -5314,7 +5358,7 @@ class AddFormRecordComponent {
|
|
|
5314
5358
|
canvas.height = newHeight;
|
|
5315
5359
|
ctx.drawImage(img, 0, 0, newWidth, newHeight);
|
|
5316
5360
|
let quality = 0.8;
|
|
5317
|
-
let dataURL = canvas.toDataURL('image/
|
|
5361
|
+
let dataURL = canvas.toDataURL('image/' + match[1], quality);
|
|
5318
5362
|
resolve(dataURL);
|
|
5319
5363
|
};
|
|
5320
5364
|
});
|