@solidpepper/solidpepper-solidgeneration 0.2.3 → 0.2.5
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.
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import JsBarcode from 'jsbarcode';
|
|
2
2
|
import QrCodeStyling from 'qr-code-styling';
|
|
3
|
+
import * as i2 from '@solidpepper/solidpepper-service';
|
|
4
|
+
import { PublicationDataType } from '@solidpepper/solidpepper-service';
|
|
3
5
|
import { firstValueFrom } from 'rxjs';
|
|
4
6
|
import * as i0 from '@angular/core';
|
|
5
7
|
import { Injectable } from '@angular/core';
|
|
6
8
|
import * as i1 from '@angular/common/http';
|
|
7
|
-
import * as i2 from '@solidpepper/solidpepper-service';
|
|
8
9
|
import * as i3 from 'ngx-toastr';
|
|
9
10
|
import * as i4 from '@ngx-translate/core';
|
|
10
11
|
import * as i5 from '@angular/platform-browser';
|
|
@@ -60,6 +61,7 @@ class DataSheet {
|
|
|
60
61
|
this.backgrounds = [];
|
|
61
62
|
this.defaultBackgroundGuid = null;
|
|
62
63
|
this.marketing = [];
|
|
64
|
+
this.callouts = {};
|
|
63
65
|
this.preview = true;
|
|
64
66
|
this.imageFastPreview = true;
|
|
65
67
|
this.bleedMargin = false;
|
|
@@ -364,6 +366,7 @@ class DataSheetSingleton {
|
|
|
364
366
|
this.gabarits = {};
|
|
365
367
|
this.backgrounds = {};
|
|
366
368
|
this.marketing = {};
|
|
369
|
+
this.callouts = {};
|
|
367
370
|
//console.log('[DataSheetSingleton] Constructor called. instanceId:', this.instanceId);
|
|
368
371
|
}
|
|
369
372
|
static getInstance() {
|
|
@@ -393,16 +396,25 @@ class DataSheetSingleton {
|
|
|
393
396
|
setMarketing(templateGuid, list) {
|
|
394
397
|
this.marketing[templateGuid] = [...list];
|
|
395
398
|
}
|
|
399
|
+
getCallouts(templateGuid) {
|
|
400
|
+
const cached = this.callouts[templateGuid];
|
|
401
|
+
return cached ? [...cached] : null;
|
|
402
|
+
}
|
|
403
|
+
setCallouts(templateGuid, list) {
|
|
404
|
+
this.callouts[templateGuid] = [...list];
|
|
405
|
+
}
|
|
396
406
|
clearTemplatesCache(templateGuid) {
|
|
397
407
|
if (templateGuid) {
|
|
398
408
|
delete this.gabarits[templateGuid];
|
|
399
409
|
delete this.backgrounds[templateGuid];
|
|
400
410
|
delete this.marketing[templateGuid];
|
|
411
|
+
delete this.callouts[templateGuid];
|
|
401
412
|
}
|
|
402
413
|
else {
|
|
403
414
|
this.gabarits = {};
|
|
404
415
|
this.backgrounds = {};
|
|
405
416
|
this.marketing = {};
|
|
417
|
+
this.callouts = {};
|
|
406
418
|
}
|
|
407
419
|
}
|
|
408
420
|
async getAttributesByType(attributeType, attributeGroup = '') {
|
|
@@ -574,16 +586,35 @@ class DataSheetSVG {
|
|
|
574
586
|
// pour jObject dans lstSkus
|
|
575
587
|
const gabaritDimCache = new Map();
|
|
576
588
|
const getBlockDimensionsAndMarginsCached = (jObj) => {
|
|
577
|
-
let
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
589
|
+
let gabarit = null;
|
|
590
|
+
if (jObj.type === PublicationDataType.CALLOUT) {
|
|
591
|
+
const calloutGuid = jObj.publicationDataCallout;
|
|
592
|
+
const calloutsList = this.DataSheet.callouts?.[calloutGuid] ||
|
|
593
|
+
DataSheetSingleton.getInstance().getCallouts(calloutGuid) ||
|
|
594
|
+
[];
|
|
595
|
+
const gName = (jObj.gabaritName || '').endsWith('.svg')
|
|
596
|
+
? jObj.gabaritName
|
|
597
|
+
: jObj.gabaritName + '.svg';
|
|
598
|
+
gabarit = calloutsList.find((c) => c.name === gName ||
|
|
599
|
+
c.name === jObj.gabaritName ||
|
|
600
|
+
c.guid === jObj.gabaritName);
|
|
601
|
+
if (!gabarit && calloutsList.length > 0) {
|
|
602
|
+
gabarit =
|
|
603
|
+
calloutsList.find((c) => c.isDefault) || calloutsList[0];
|
|
604
|
+
}
|
|
582
605
|
}
|
|
583
|
-
|
|
584
|
-
|
|
606
|
+
else {
|
|
607
|
+
let defaultGabarit = (this.DataSheet.gabarits || []).find((gabarit) => gabarit.guid == this.DataSheet.defaultGabaritGuid);
|
|
608
|
+
let gabaritName = (jObj.gabaritName || '') + '.svg';
|
|
609
|
+
gabarit = (this.DataSheet.gabarits || []).find((gabarit) => gabarit.name == gabaritName || gabarit.name == jObj.gabaritName);
|
|
610
|
+
if (gabarit == undefined || gabarit == null) {
|
|
611
|
+
gabarit = defaultGabarit;
|
|
612
|
+
}
|
|
613
|
+
if (gabarit == null || gabarit == undefined) {
|
|
614
|
+
gabarit = (this.DataSheet.gabarits || [])[0];
|
|
615
|
+
}
|
|
585
616
|
}
|
|
586
|
-
if (!gabarit) {
|
|
617
|
+
if (!gabarit || !gabarit.svgImage) {
|
|
587
618
|
return {
|
|
588
619
|
width: 0,
|
|
589
620
|
height: 0,
|
|
@@ -593,7 +624,9 @@ class DataSheetSVG {
|
|
|
593
624
|
marginRight: 0,
|
|
594
625
|
};
|
|
595
626
|
}
|
|
596
|
-
const cacheKey =
|
|
627
|
+
const cacheKey = (jObj.type === PublicationDataType.CALLOUT
|
|
628
|
+
? 'callout_'
|
|
629
|
+
: 'gabarit_') + (gabarit.guid || gabarit.name || '');
|
|
597
630
|
if (gabaritDimCache.has(cacheKey)) {
|
|
598
631
|
return gabaritDimCache.get(cacheKey);
|
|
599
632
|
}
|
|
@@ -613,18 +646,24 @@ class DataSheetSVG {
|
|
|
613
646
|
if (!jObj ||
|
|
614
647
|
jObj === '{}' ||
|
|
615
648
|
(jObj.sku == null &&
|
|
616
|
-
jObj.type !==
|
|
617
|
-
jObj.type !==
|
|
649
|
+
jObj.type !== PublicationDataType.LINEBREAK &&
|
|
650
|
+
jObj.type !== PublicationDataType.PAGEBREAK &&
|
|
651
|
+
jObj.type !== PublicationDataType.CALLOUT)) {
|
|
618
652
|
idx++;
|
|
619
653
|
continue;
|
|
620
654
|
}
|
|
621
|
-
if (jObj.type ===
|
|
655
|
+
if (jObj.type === PublicationDataType.LINEBREAK ||
|
|
656
|
+
jObj.type === PublicationDataType.PAGEBREAK) {
|
|
622
657
|
if (blocksInRow.length === 0) {
|
|
623
658
|
idx++;
|
|
624
659
|
}
|
|
625
660
|
break;
|
|
626
661
|
}
|
|
627
662
|
let dim = getBlockDimensionsAndMarginsCached(jObj);
|
|
663
|
+
if (dim.width === 0 && dim.height === 0) {
|
|
664
|
+
idx++;
|
|
665
|
+
continue;
|
|
666
|
+
}
|
|
628
667
|
let blockWidth = dim.width;
|
|
629
668
|
let gMarginLeft = dim.marginLeft;
|
|
630
669
|
let gMarginRight = dim.marginRight;
|
|
@@ -669,9 +708,10 @@ class DataSheetSVG {
|
|
|
669
708
|
if (jObject != null &&
|
|
670
709
|
jObject != '{}' &&
|
|
671
710
|
(jObject.sku != null ||
|
|
672
|
-
jObject.type ===
|
|
673
|
-
jObject.type ===
|
|
674
|
-
|
|
711
|
+
jObject.type === PublicationDataType.LINEBREAK ||
|
|
712
|
+
jObject.type === PublicationDataType.PAGEBREAK ||
|
|
713
|
+
jObject.type === PublicationDataType.CALLOUT)) {
|
|
714
|
+
if (jObject.type === PublicationDataType.PAGEBREAK) {
|
|
675
715
|
AllTplProductsBlock += tplRowProductsBlocks;
|
|
676
716
|
tplRowProductsBlocks = '';
|
|
677
717
|
AllTplProductsBlock += this.addCuttingLine() + '</svg>';
|
|
@@ -714,7 +754,7 @@ class DataSheetSVG {
|
|
|
714
754
|
currentIdx++;
|
|
715
755
|
continue;
|
|
716
756
|
}
|
|
717
|
-
if (jObject.type ===
|
|
757
|
+
if (jObject.type === PublicationDataType.LINEBREAK) {
|
|
718
758
|
if (nbBlockInRow > 0) {
|
|
719
759
|
AllTplProductsBlock += tplRowProductsBlocks;
|
|
720
760
|
tplRowProductsBlocks = '';
|
|
@@ -739,14 +779,45 @@ class DataSheetSVG {
|
|
|
739
779
|
currentIdx++;
|
|
740
780
|
continue;
|
|
741
781
|
}
|
|
742
|
-
let
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
782
|
+
let gabarit = null;
|
|
783
|
+
if (jObject.type === PublicationDataType.CALLOUT) {
|
|
784
|
+
const calloutGuid = jObject.publicationDataCallout ||
|
|
785
|
+
jObject.PublicationDataCallout;
|
|
786
|
+
const calloutsList = this.DataSheet.callouts?.[calloutGuid] ||
|
|
787
|
+
DataSheetSingleton.getInstance().getCallouts(calloutGuid) ||
|
|
788
|
+
[];
|
|
789
|
+
const gName = (jObject.gabaritName || '').endsWith('.svg')
|
|
790
|
+
? jObject.gabaritName
|
|
791
|
+
: jObject.gabaritName + '.svg';
|
|
792
|
+
gabarit = calloutsList.find((c) => c.name === gName ||
|
|
793
|
+
c.name === jObject.gabaritName ||
|
|
794
|
+
c.guid === jObject.gabaritName);
|
|
795
|
+
if (!gabarit && calloutsList.length > 0) {
|
|
796
|
+
gabarit =
|
|
797
|
+
calloutsList.find((c) => c.isDefault) || calloutsList[0];
|
|
798
|
+
}
|
|
747
799
|
}
|
|
748
|
-
|
|
749
|
-
|
|
800
|
+
else {
|
|
801
|
+
let defaultGabarit = (this.DataSheet.gabarits || []).find((gabarit) => gabarit.guid == this.DataSheet.defaultGabaritGuid);
|
|
802
|
+
let gabaritName = (jObject.gabaritName || '') + '.svg';
|
|
803
|
+
gabarit = (this.DataSheet.gabarits || []).find((gabarit) => gabarit.name == gabaritName ||
|
|
804
|
+
gabarit.name == jObject.gabaritName);
|
|
805
|
+
if (gabarit == undefined || gabarit == null) {
|
|
806
|
+
gabarit = defaultGabarit;
|
|
807
|
+
}
|
|
808
|
+
if (gabarit == null || gabarit == undefined) {
|
|
809
|
+
gabarit = (this.DataSheet.gabarits || [])[0];
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
if (!gabarit || !gabarit.svgImage) {
|
|
813
|
+
console.warn('[SOLIDGENERATION] Skipping block with missing/invalid gabarit:', jObject);
|
|
814
|
+
this.DataSheet.progress +=
|
|
815
|
+
(50 / this.DataSheet.maxSections) *
|
|
816
|
+
0.8 *
|
|
817
|
+
(1 / this.DataSheet.maxSkusSection);
|
|
818
|
+
this.DataSheet.nbSkusSection++;
|
|
819
|
+
currentIdx++;
|
|
820
|
+
continue;
|
|
750
821
|
}
|
|
751
822
|
let firstRowTopMargin = 0;
|
|
752
823
|
let blockY = 0;
|
|
@@ -1204,16 +1275,34 @@ class DataSheetSVG {
|
|
|
1204
1275
|
}
|
|
1205
1276
|
}
|
|
1206
1277
|
getBlockDimensionsAndMargins(jObject) {
|
|
1207
|
-
let
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1278
|
+
let gabarit = null;
|
|
1279
|
+
if (jObject.type === PublicationDataType.CALLOUT) {
|
|
1280
|
+
const calloutGuid = jObject.publicationDataCallout || jObject.PublicationDataCallout;
|
|
1281
|
+
const calloutsList = this.DataSheet.callouts?.[calloutGuid] ||
|
|
1282
|
+
DataSheetSingleton.getInstance().getCallouts(calloutGuid) ||
|
|
1283
|
+
[];
|
|
1284
|
+
const gName = (jObject.gabaritName || '').endsWith('.svg')
|
|
1285
|
+
? jObject.gabaritName
|
|
1286
|
+
: jObject.gabaritName + '.svg';
|
|
1287
|
+
gabarit = calloutsList.find((c) => c.name === gName ||
|
|
1288
|
+
c.name === jObject.gabaritName ||
|
|
1289
|
+
c.guid === jObject.gabaritName);
|
|
1290
|
+
if (!gabarit && calloutsList.length > 0) {
|
|
1291
|
+
gabarit = calloutsList.find((c) => c.isDefault) || calloutsList[0];
|
|
1292
|
+
}
|
|
1212
1293
|
}
|
|
1213
|
-
|
|
1214
|
-
|
|
1294
|
+
else {
|
|
1295
|
+
let defaultGabarit = (this.DataSheet.gabarits || []).find((gabarit) => gabarit.guid == this.DataSheet.defaultGabaritGuid);
|
|
1296
|
+
let gabaritName = (jObject.gabaritName || '') + '.svg';
|
|
1297
|
+
gabarit = (this.DataSheet.gabarits || []).find((gabarit) => gabarit.name == gabaritName || gabarit.name == jObject.gabaritName);
|
|
1298
|
+
if (gabarit == undefined || gabarit == null) {
|
|
1299
|
+
gabarit = defaultGabarit;
|
|
1300
|
+
}
|
|
1301
|
+
if (gabarit == null || gabarit == undefined) {
|
|
1302
|
+
gabarit = (this.DataSheet.gabarits || [])[0];
|
|
1303
|
+
}
|
|
1215
1304
|
}
|
|
1216
|
-
if (!gabarit) {
|
|
1305
|
+
if (!gabarit || !gabarit.svgImage) {
|
|
1217
1306
|
return {
|
|
1218
1307
|
width: 0,
|
|
1219
1308
|
height: 0,
|
|
@@ -1367,27 +1456,63 @@ class DataSheetSVG {
|
|
|
1367
1456
|
if (!skuRef) {
|
|
1368
1457
|
skuRef = this.getAttributeFromSvg(gabarit?.svgImage, 'data-sku');
|
|
1369
1458
|
}
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1459
|
+
const isCallout = jObject?.type === PublicationDataType.CALLOUT ||
|
|
1460
|
+
gabarit?.type?.toLowerCase() === 'callout' ||
|
|
1461
|
+
gabarit?.assetType?.toLowerCase() === 'callout';
|
|
1462
|
+
let templateGuid = '';
|
|
1463
|
+
if (isCallout) {
|
|
1464
|
+
templateGuid =
|
|
1465
|
+
jObject?.publicationDataCallout ||
|
|
1466
|
+
gabarit?.templateGuid ||
|
|
1467
|
+
gabarit?.publicationTemplateTemplateGuid ||
|
|
1468
|
+
'';
|
|
1469
|
+
if (!templateGuid ||
|
|
1470
|
+
templateGuid === '00000000-0000-0000-0000-000000000000') {
|
|
1471
|
+
templateGuid =
|
|
1472
|
+
this.getAttributeFromSvg(gabarit?.svgImage, 'data-templateGuid') ||
|
|
1473
|
+
this.getAttributeFromSvg(gabarit?.svgImage, 'data-assetGuid');
|
|
1474
|
+
}
|
|
1374
1475
|
}
|
|
1375
|
-
|
|
1376
|
-
templateGuid
|
|
1377
|
-
|
|
1476
|
+
else {
|
|
1477
|
+
templateGuid = gabarit?.templateGuid || '';
|
|
1478
|
+
if (!templateGuid ||
|
|
1479
|
+
templateGuid === '00000000-0000-0000-0000-000000000000') {
|
|
1480
|
+
templateGuid = this.DataSheet?.publicationTemplateTemplateGuid || '';
|
|
1481
|
+
}
|
|
1482
|
+
if (!templateGuid ||
|
|
1483
|
+
templateGuid === '00000000-0000-0000-0000-000000000000') {
|
|
1484
|
+
templateGuid = this.getAttributeFromSvg(gabarit?.svgImage, 'data-templateGuid');
|
|
1485
|
+
}
|
|
1378
1486
|
}
|
|
1379
|
-
let assetGuid =
|
|
1380
|
-
if (
|
|
1381
|
-
assetGuid =
|
|
1487
|
+
let assetGuid = '';
|
|
1488
|
+
if (isCallout) {
|
|
1489
|
+
assetGuid =
|
|
1490
|
+
jObject?.publicationDataCallout || gabarit?.templateGuid || '';
|
|
1491
|
+
if (!assetGuid || assetGuid === '00000000-0000-0000-0000-000000000000') {
|
|
1492
|
+
assetGuid =
|
|
1493
|
+
this.getAttributeFromSvg(gabarit?.svgImage, 'data-assetGuid') ||
|
|
1494
|
+
this.getAttributeFromSvg(gabarit?.svgImage, 'data-templateGuid');
|
|
1495
|
+
}
|
|
1382
1496
|
}
|
|
1383
|
-
|
|
1384
|
-
assetGuid =
|
|
1497
|
+
else {
|
|
1498
|
+
assetGuid = gabarit?.templateGuid || '';
|
|
1499
|
+
if (!assetGuid || assetGuid === '00000000-0000-0000-0000-000000000000') {
|
|
1500
|
+
assetGuid = this.DataSheet?.publicationTemplateTemplateGuid || '';
|
|
1501
|
+
}
|
|
1502
|
+
if (!assetGuid || assetGuid === '00000000-0000-0000-0000-000000000000') {
|
|
1503
|
+
assetGuid = this.getAttributeFromSvg(gabarit?.svgImage, 'data-assetGuid');
|
|
1504
|
+
}
|
|
1385
1505
|
}
|
|
1386
1506
|
let blockGuid = gabarit?.guid || '';
|
|
1387
1507
|
if (!blockGuid || blockGuid === '00000000-0000-0000-0000-000000000000') {
|
|
1388
1508
|
blockGuid = this.getAttributeFromSvg(gabarit?.svgImage, 'data-blockGuid');
|
|
1389
1509
|
}
|
|
1390
|
-
|
|
1510
|
+
const sanitizedRef = (skuRef || '').toString().trim();
|
|
1511
|
+
const groupId = sanitizedRef
|
|
1512
|
+
? `group(${nbBlock + 1}) - ${sanitizedRef}`
|
|
1513
|
+
: `group(${nbBlock + 1})`;
|
|
1514
|
+
const dataType = isCallout ? 'callout' : 'template';
|
|
1515
|
+
return `<g data-type="${dataType}" id="${groupId}" data-skuGuid="${skuGuid}" data-sku="${skuRef}" data-assetGuid="${assetGuid}" data-templateGuid="${templateGuid}" data-blockGuid="${blockGuid}">${tplGroup}</g>`;
|
|
1391
1516
|
}
|
|
1392
1517
|
CleanMissingFilters(svgContent) {
|
|
1393
1518
|
const filterRegex = /filter="url\(#([^"]+)\)"/g;
|
|
@@ -2666,6 +2791,14 @@ class DataSheetSVG {
|
|
|
2666
2791
|
newValWithoutStyle += '<tbody>';
|
|
2667
2792
|
let skus = [];
|
|
2668
2793
|
skus = jRowSku['skus'] && jRowSku['skus'][0] ? jRowSku['skus'][0] : [];
|
|
2794
|
+
const variantAttr = tag?.XmlTag?.getAttribute('data-variant');
|
|
2795
|
+
if (variantAttr != null && variantAttr !== '') {
|
|
2796
|
+
const vIndex = parseInt(variantAttr, 10);
|
|
2797
|
+
if (!isNaN(vIndex) && vIndex >= 1) {
|
|
2798
|
+
const targetSku = skus[vIndex - 1];
|
|
2799
|
+
skus = targetSku ? [targetSku] : [];
|
|
2800
|
+
}
|
|
2801
|
+
}
|
|
2669
2802
|
let currentRow = '';
|
|
2670
2803
|
let currentRowWithoutStyle = '';
|
|
2671
2804
|
let startWithNewPage = jRowSku['splitVariantTable'] === false ? true : false;
|
|
@@ -3319,6 +3452,19 @@ class DataSheetSVG {
|
|
|
3319
3452
|
}
|
|
3320
3453
|
getNewVal(field, jRowSku, idVal = '', tag = null, showText = true, showPicto = false, separator = ', ', keepAttributes = false) {
|
|
3321
3454
|
let newVal = '';
|
|
3455
|
+
// Handle variant targeting if data-variant attribute is present
|
|
3456
|
+
if (jRowSku != null && tag != null && tag.XmlTag != null) {
|
|
3457
|
+
const variantAttr = tag.XmlTag.getAttribute('data-variant');
|
|
3458
|
+
if (variantAttr != null && variantAttr !== '') {
|
|
3459
|
+
const vIndex = parseInt(variantAttr, 10);
|
|
3460
|
+
if (!isNaN(vIndex) && vIndex >= 1) {
|
|
3461
|
+
const skus = jRowSku['skus'] && jRowSku['skus'][0] ? jRowSku['skus'][0] : [];
|
|
3462
|
+
if (skus[vIndex - 1]) {
|
|
3463
|
+
jRowSku = skus[vIndex - 1];
|
|
3464
|
+
}
|
|
3465
|
+
}
|
|
3466
|
+
}
|
|
3467
|
+
}
|
|
3322
3468
|
if (jRowSku == null ||
|
|
3323
3469
|
(Object.keys(jRowSku).length === 0 && keepAttributes)) {
|
|
3324
3470
|
if (keepAttributes) {
|
|
@@ -4326,7 +4472,20 @@ class DataSheetSVG {
|
|
|
4326
4472
|
const showPicto = tspan.getAttribute('data-show-picto') || 'false';
|
|
4327
4473
|
const separator = tspan.getAttribute('data-separator') || ', ';
|
|
4328
4474
|
const textTransform = tspan.getAttribute('data-text-transform');
|
|
4329
|
-
let
|
|
4475
|
+
let rowToUse = jRowSku;
|
|
4476
|
+
const tspanVariant = tspan.getAttribute('data-variant');
|
|
4477
|
+
if (tspanVariant != null && tspanVariant !== '') {
|
|
4478
|
+
const vIndex = parseInt(tspanVariant, 10);
|
|
4479
|
+
if (!isNaN(vIndex) && vIndex >= 1) {
|
|
4480
|
+
const skus = jRowSku['skus'] && jRowSku['skus'][0]
|
|
4481
|
+
? jRowSku['skus'][0]
|
|
4482
|
+
: [];
|
|
4483
|
+
if (skus[vIndex - 1]) {
|
|
4484
|
+
rowToUse = skus[vIndex - 1];
|
|
4485
|
+
}
|
|
4486
|
+
}
|
|
4487
|
+
}
|
|
4488
|
+
let valueToInsert = this.getNewVal(field, rowToUse, idVal, tag, showText === 'true', showPicto === 'true', separator, keepAttributes);
|
|
4330
4489
|
valueToInsert = this.applyTextTransform(valueToInsert, textTransform);
|
|
4331
4490
|
if (valueToInsert != null &&
|
|
4332
4491
|
innerHTML.includes(placeholder)) {
|
|
@@ -4380,10 +4539,13 @@ class DataSheetSVG {
|
|
|
4380
4539
|
return false;
|
|
4381
4540
|
if (image.assetName === newVal || image.assetGuid === newVal)
|
|
4382
4541
|
return true;
|
|
4383
|
-
if (image.assetName &&
|
|
4542
|
+
if (image.assetName &&
|
|
4543
|
+
this.getCleanFilename(image.assetName).toLowerCase() ===
|
|
4544
|
+
cleanNewVal.toLowerCase()) {
|
|
4384
4545
|
return true;
|
|
4385
4546
|
}
|
|
4386
|
-
if (image.assetName &&
|
|
4547
|
+
if (image.assetName &&
|
|
4548
|
+
this.getFileNameWithoutExt(image.assetName).toLowerCase() === cleanNewValNoExt) {
|
|
4387
4549
|
return true;
|
|
4388
4550
|
}
|
|
4389
4551
|
const urls = [
|
|
@@ -4395,19 +4557,25 @@ class DataSheetSVG {
|
|
|
4395
4557
|
for (const url of urls) {
|
|
4396
4558
|
if (url === newVal)
|
|
4397
4559
|
return true;
|
|
4398
|
-
if (this.getCleanFilename(url).toLowerCase() ===
|
|
4560
|
+
if (this.getCleanFilename(url).toLowerCase() ===
|
|
4561
|
+
cleanNewVal.toLowerCase())
|
|
4399
4562
|
return true;
|
|
4400
|
-
if (this.getFileNameWithoutExt(url).toLowerCase() ===
|
|
4563
|
+
if (this.getFileNameWithoutExt(url).toLowerCase() ===
|
|
4564
|
+
cleanNewValNoExt)
|
|
4401
4565
|
return true;
|
|
4402
4566
|
}
|
|
4403
4567
|
return false;
|
|
4404
4568
|
});
|
|
4405
4569
|
}
|
|
4406
|
-
if (skuImagesDetail.length === 0 &&
|
|
4570
|
+
if (skuImagesDetail.length === 0 &&
|
|
4571
|
+
jRowSku &&
|
|
4572
|
+
jRowSku['skuDefaultImage']) {
|
|
4407
4573
|
const defaultImg = jRowSku['skuDefaultImage'];
|
|
4408
4574
|
const cleanNewValNoExt = this.getFileNameWithoutExt(newVal).toLowerCase();
|
|
4409
4575
|
const defaultNameNoExt = this.getFileNameWithoutExt(defaultImg.assetName || defaultImg.assetUrlOriginal || '').toLowerCase();
|
|
4410
|
-
if (!cleanNewValNoExt ||
|
|
4576
|
+
if (!cleanNewValNoExt ||
|
|
4577
|
+
cleanNewValNoExt === defaultNameNoExt ||
|
|
4578
|
+
defaultImg.assetGuid === newVal) {
|
|
4411
4579
|
skuImagesDetail = [defaultImg];
|
|
4412
4580
|
}
|
|
4413
4581
|
}
|
|
@@ -4415,27 +4583,65 @@ class DataSheetSVG {
|
|
|
4415
4583
|
const matchedAsset = skuImagesDetail[0];
|
|
4416
4584
|
if (this.DataSheet.preview &&
|
|
4417
4585
|
this.DataSheet.imageFastPreview == true) {
|
|
4418
|
-
newVal =
|
|
4419
|
-
|
|
4586
|
+
newVal =
|
|
4587
|
+
matchedAsset.assetUrlSmall ||
|
|
4588
|
+
matchedAsset.assetUrlMedium ||
|
|
4589
|
+
matchedAsset.assetUrlBig ||
|
|
4590
|
+
matchedAsset.assetUrlOriginal ||
|
|
4591
|
+
newVal;
|
|
4592
|
+
urlHD =
|
|
4593
|
+
matchedAsset.assetUrlOriginal ||
|
|
4594
|
+
matchedAsset.assetUrlBig ||
|
|
4595
|
+
matchedAsset.assetUrlMedium ||
|
|
4596
|
+
matchedAsset.assetUrlSmall ||
|
|
4597
|
+
newVal;
|
|
4420
4598
|
}
|
|
4421
4599
|
else if (this.DataSheet.highDefinition == false) {
|
|
4422
|
-
newVal =
|
|
4423
|
-
|
|
4600
|
+
newVal =
|
|
4601
|
+
matchedAsset.assetUrlMedium ||
|
|
4602
|
+
matchedAsset.assetUrlSmall ||
|
|
4603
|
+
matchedAsset.assetUrlBig ||
|
|
4604
|
+
matchedAsset.assetUrlOriginal ||
|
|
4605
|
+
newVal;
|
|
4606
|
+
urlHD =
|
|
4607
|
+
matchedAsset.assetUrlOriginal ||
|
|
4608
|
+
matchedAsset.assetUrlBig ||
|
|
4609
|
+
matchedAsset.assetUrlMedium ||
|
|
4610
|
+
matchedAsset.assetUrlSmall ||
|
|
4611
|
+
newVal;
|
|
4424
4612
|
}
|
|
4425
4613
|
else {
|
|
4426
|
-
newVal =
|
|
4427
|
-
|
|
4614
|
+
newVal =
|
|
4615
|
+
matchedAsset.assetUrlOriginal ||
|
|
4616
|
+
matchedAsset.assetUrlBig ||
|
|
4617
|
+
matchedAsset.assetUrlMedium ||
|
|
4618
|
+
matchedAsset.assetUrlSmall ||
|
|
4619
|
+
newVal;
|
|
4620
|
+
urlHD =
|
|
4621
|
+
matchedAsset.assetUrlOriginal ||
|
|
4622
|
+
matchedAsset.assetUrlBig ||
|
|
4623
|
+
matchedAsset.assetUrlMedium ||
|
|
4624
|
+
matchedAsset.assetUrlSmall ||
|
|
4625
|
+
newVal;
|
|
4428
4626
|
}
|
|
4429
4627
|
}
|
|
4430
4628
|
else {
|
|
4431
4629
|
let urlBase = this.getUrlBase(jRowSku);
|
|
4432
|
-
if (urlBase &&
|
|
4630
|
+
if (urlBase &&
|
|
4631
|
+
typeof newVal === 'string' &&
|
|
4632
|
+
!newVal.startsWith('http://') &&
|
|
4633
|
+
!newVal.startsWith('https://') &&
|
|
4634
|
+
!newVal.startsWith('data:') &&
|
|
4635
|
+
!newVal.startsWith('/')) {
|
|
4433
4636
|
newVal = urlBase + newVal;
|
|
4434
4637
|
}
|
|
4435
4638
|
urlHD = newVal;
|
|
4436
4639
|
if (typeof newVal === 'string' &&
|
|
4437
|
-
(this.DataSheet.highDefinition == false ||
|
|
4438
|
-
|
|
4640
|
+
(this.DataSheet.highDefinition == false ||
|
|
4641
|
+
(this.DataSheet.preview &&
|
|
4642
|
+
this.DataSheet.imageFastPreview == true))) {
|
|
4643
|
+
if (this.DataSheet.preview &&
|
|
4644
|
+
this.DataSheet.imageFastPreview == true) {
|
|
4439
4645
|
newVal = newVal
|
|
4440
4646
|
.replace(/\/original\//i, '/small/')
|
|
4441
4647
|
.replace(/\.[a-zA-Z0-9]+(?=\?|#|$)/i, '.webp');
|
|
@@ -4724,7 +4930,8 @@ class DataSheetSVG {
|
|
|
4724
4930
|
newVal = await this.deleteBlock(newVal);
|
|
4725
4931
|
newVal = await this.deleteLine(newVal);
|
|
4726
4932
|
tag.XmlTag.innerHTML = newVal;
|
|
4727
|
-
if (tag.XmlTag.getAttribute('data-type') === 'text'
|
|
4933
|
+
if (tag.XmlTag.getAttribute('data-type') === 'text' ||
|
|
4934
|
+
tag.XmlTag.querySelector('.fake-textarea')) {
|
|
4728
4935
|
this.optimizeTextElement(tag.XmlTag, tpl);
|
|
4729
4936
|
}
|
|
4730
4937
|
if (tag.XmlTag.hasAttribute('data-type') &&
|
|
@@ -4996,6 +5203,55 @@ class DataSheetSVG {
|
|
|
4996
5203
|
}
|
|
4997
5204
|
}
|
|
4998
5205
|
}
|
|
5206
|
+
else if (element.nodeName.toLowerCase() === 'foreignobject') {
|
|
5207
|
+
let tag = this.SetAllInfos(element);
|
|
5208
|
+
let tagToUpdate = allTags.find((tagToUpdate) => tagToUpdate.IdTag == tag.IdTag);
|
|
5209
|
+
if (tagToUpdate != null) {
|
|
5210
|
+
if (tagToUpdate.XmlTag == null) {
|
|
5211
|
+
element.remove();
|
|
5212
|
+
}
|
|
5213
|
+
else if (tagToUpdate.VariantsTable == true) {
|
|
5214
|
+
element.outerHTML = tagToUpdate.XmlTag.outerHTML;
|
|
5215
|
+
}
|
|
5216
|
+
else if (tagToUpdate.ProductTable == true) {
|
|
5217
|
+
element.outerHTML = tagToUpdate.XmlTag.outerHTML;
|
|
5218
|
+
}
|
|
5219
|
+
else if (tagToUpdate.Image == true) {
|
|
5220
|
+
element.innerHTML = tagToUpdate.XmlTag.innerHTML;
|
|
5221
|
+
if (element.getAttribute('data-type') === 'dynamicImage') {
|
|
5222
|
+
element.setAttribute('data-type', 'image');
|
|
5223
|
+
}
|
|
5224
|
+
}
|
|
5225
|
+
else {
|
|
5226
|
+
element.innerHTML = tagToUpdate.XmlTag.innerHTML;
|
|
5227
|
+
if (tagToUpdate.XmlTag.getAttribute('data-type') === 'text' ||
|
|
5228
|
+
tagToUpdate.XmlTag.querySelector('.fake-textarea')) {
|
|
5229
|
+
if (tagToUpdate.XmlTag.hasAttribute('x')) {
|
|
5230
|
+
element.setAttribute('x', tagToUpdate.XmlTag.getAttribute('x'));
|
|
5231
|
+
element.removeAttribute('transform');
|
|
5232
|
+
}
|
|
5233
|
+
if (tagToUpdate.XmlTag.hasAttribute('y')) {
|
|
5234
|
+
element.setAttribute('y', tagToUpdate.XmlTag.getAttribute('y'));
|
|
5235
|
+
element.removeAttribute('transform');
|
|
5236
|
+
}
|
|
5237
|
+
if (tagToUpdate.XmlTag.hasAttribute('width')) {
|
|
5238
|
+
const w = tagToUpdate.XmlTag.getAttribute('width');
|
|
5239
|
+
element.setAttribute('width', w);
|
|
5240
|
+
if (element.style && element.style.width) {
|
|
5241
|
+
element.style.width = w + 'px';
|
|
5242
|
+
}
|
|
5243
|
+
}
|
|
5244
|
+
if (tagToUpdate.XmlTag.hasAttribute('height')) {
|
|
5245
|
+
const h = tagToUpdate.XmlTag.getAttribute('height');
|
|
5246
|
+
element.setAttribute('height', h);
|
|
5247
|
+
if (element.style && element.style.height) {
|
|
5248
|
+
element.style.height = h + 'px';
|
|
5249
|
+
}
|
|
5250
|
+
}
|
|
5251
|
+
}
|
|
5252
|
+
}
|
|
5253
|
+
}
|
|
5254
|
+
}
|
|
4999
5255
|
else if (group == true) {
|
|
5000
5256
|
if (element.parentNode ? element.parentNode.nodeName == 'g' : false) {
|
|
5001
5257
|
let tag = this.SetAllInfos(element);
|
|
@@ -5018,12 +5274,29 @@ class DataSheetSVG {
|
|
|
5018
5274
|
}
|
|
5019
5275
|
else {
|
|
5020
5276
|
element.innerHTML = tagToUpdate.XmlTag.innerHTML;
|
|
5021
|
-
if (tagToUpdate.XmlTag.getAttribute('data-type') === 'text'
|
|
5277
|
+
if (tagToUpdate.XmlTag.getAttribute('data-type') === 'text' ||
|
|
5278
|
+
tagToUpdate.XmlTag.querySelector('.fake-textarea')) {
|
|
5279
|
+
if (tagToUpdate.XmlTag.hasAttribute('x')) {
|
|
5280
|
+
element.setAttribute('x', tagToUpdate.XmlTag.getAttribute('x'));
|
|
5281
|
+
element.removeAttribute('transform');
|
|
5282
|
+
}
|
|
5283
|
+
if (tagToUpdate.XmlTag.hasAttribute('y')) {
|
|
5284
|
+
element.setAttribute('y', tagToUpdate.XmlTag.getAttribute('y'));
|
|
5285
|
+
element.removeAttribute('transform');
|
|
5286
|
+
}
|
|
5022
5287
|
if (tagToUpdate.XmlTag.hasAttribute('width')) {
|
|
5023
|
-
|
|
5288
|
+
const w = tagToUpdate.XmlTag.getAttribute('width');
|
|
5289
|
+
element.setAttribute('width', w);
|
|
5290
|
+
if (element.style && element.style.width) {
|
|
5291
|
+
element.style.width = w + 'px';
|
|
5292
|
+
}
|
|
5024
5293
|
}
|
|
5025
5294
|
if (tagToUpdate.XmlTag.hasAttribute('height')) {
|
|
5026
|
-
|
|
5295
|
+
const h = tagToUpdate.XmlTag.getAttribute('height');
|
|
5296
|
+
element.setAttribute('height', h);
|
|
5297
|
+
if (element.style && element.style.height) {
|
|
5298
|
+
element.style.height = h + 'px';
|
|
5299
|
+
}
|
|
5027
5300
|
}
|
|
5028
5301
|
}
|
|
5029
5302
|
}
|
|
@@ -5061,8 +5334,8 @@ class DataSheetSVG {
|
|
|
5061
5334
|
}
|
|
5062
5335
|
}
|
|
5063
5336
|
});
|
|
5064
|
-
// Traiter le masquage conditionnel (data-hide-if-attribute)
|
|
5065
|
-
let hideIfElements = domSVG.querySelectorAll('[data-hide-if-attribute]');
|
|
5337
|
+
// Traiter le masquage conditionnel (data-hide-if-attribute ou data-hide-if-operator)
|
|
5338
|
+
let hideIfElements = domSVG.querySelectorAll('[data-hide-if-attribute], [data-hide-if-operator]');
|
|
5066
5339
|
const cleanValueForHide = (val) => {
|
|
5067
5340
|
if (val === null || val === undefined)
|
|
5068
5341
|
return '';
|
|
@@ -5091,64 +5364,99 @@ class DataSheetSVG {
|
|
|
5091
5364
|
let attrName = element.getAttribute('data-hide-if-attribute') || '';
|
|
5092
5365
|
let op = element.getAttribute('data-hide-if-operator') || 'is_null';
|
|
5093
5366
|
let compareVal = element.getAttribute('data-hide-if-value') || '';
|
|
5094
|
-
let
|
|
5095
|
-
|
|
5096
|
-
let
|
|
5097
|
-
let
|
|
5098
|
-
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
};
|
|
5111
|
-
const matchedAttr = allAttrs.find((a) => (a && a.id && getAttrString(a.id) === normAttr) ||
|
|
5112
|
-
(a && a.attributeId && getAttrString(a.attributeId) === normAttr) ||
|
|
5113
|
-
(a && a.guid && getAttrString(a.guid) === normAttr) ||
|
|
5114
|
-
(a && a.attributeGuid && getAttrString(a.attributeGuid) === normAttr) ||
|
|
5115
|
-
(a && a.attributeName && getAttrString(a.attributeName) === normAttr) ||
|
|
5116
|
-
(a && a.code && getAttrString(a.code) === normAttr) ||
|
|
5117
|
-
(a && a.attributeCode && getAttrString(a.attributeCode) === normAttr));
|
|
5118
|
-
const isMultiSelectAttr = !!(matchedAttr &&
|
|
5119
|
-
(matchedAttr.attributeType === 'multiSelect' || matchedAttr.type === 'multiSelect'));
|
|
5120
|
-
let actualValues = [];
|
|
5121
|
-
if (isMultiSelectAttr) {
|
|
5122
|
-
if (Array.isArray(actualValue)) {
|
|
5123
|
-
actualValues = actualValue.map((v) => cleanValueForHide(v).toLowerCase().trim());
|
|
5124
|
-
}
|
|
5125
|
-
else if (cleanActual) {
|
|
5126
|
-
actualValues = cleanActual
|
|
5127
|
-
.split(/[#;,\n|]+/)
|
|
5128
|
-
.map((item) => item.trim())
|
|
5129
|
-
.filter((item) => item.length > 0);
|
|
5367
|
+
let variantAttr = element.getAttribute('data-hide-if-variant') ||
|
|
5368
|
+
element.getAttribute('data-variant');
|
|
5369
|
+
let rowToUse = jRowSku;
|
|
5370
|
+
let variantExists = false;
|
|
5371
|
+
if (variantAttr != null && variantAttr !== '') {
|
|
5372
|
+
const vIndex = parseInt(variantAttr, 10);
|
|
5373
|
+
if (!isNaN(vIndex) && vIndex >= 1) {
|
|
5374
|
+
const skus = jRowSku['skus'] && jRowSku['skus'][0] ? jRowSku['skus'][0] : [];
|
|
5375
|
+
if (skus[vIndex - 1] != null) {
|
|
5376
|
+
rowToUse = skus[vIndex - 1];
|
|
5377
|
+
variantExists = true;
|
|
5378
|
+
}
|
|
5379
|
+
else {
|
|
5380
|
+
rowToUse = null;
|
|
5381
|
+
variantExists = false;
|
|
5382
|
+
}
|
|
5130
5383
|
}
|
|
5131
5384
|
}
|
|
5385
|
+
let shouldHide = false;
|
|
5386
|
+
if (op === 'variant_exists') {
|
|
5387
|
+
shouldHide = variantExists;
|
|
5388
|
+
}
|
|
5389
|
+
else if (op === 'variant_not_exists') {
|
|
5390
|
+
shouldHide = !variantExists;
|
|
5391
|
+
}
|
|
5132
5392
|
else {
|
|
5133
|
-
|
|
5134
|
-
|
|
5135
|
-
|
|
5136
|
-
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
|
|
5143
|
-
|
|
5144
|
-
|
|
5145
|
-
|
|
5146
|
-
|
|
5147
|
-
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
|
|
5151
|
-
|
|
5393
|
+
let field = this.getPropertyOfField(attrName) || '';
|
|
5394
|
+
let actualValue = this.getNewVal(field, rowToUse, attrName);
|
|
5395
|
+
let cleanActual = cleanValueForHide(actualValue).toLowerCase();
|
|
5396
|
+
let cleanCompare = cleanValueForHide(compareVal).toLowerCase();
|
|
5397
|
+
// Vérifier si l'attribut est de type multiSelect
|
|
5398
|
+
const normAttr = attrName.toLowerCase().trim();
|
|
5399
|
+
const allAttrs = (this.DataSheet && this.DataSheet.attributes) ||
|
|
5400
|
+
DataSheetSingleton.getInstance().attributes ||
|
|
5401
|
+
[];
|
|
5402
|
+
const getAttrString = (val) => {
|
|
5403
|
+
if (!val)
|
|
5404
|
+
return '';
|
|
5405
|
+
if (typeof val === 'string')
|
|
5406
|
+
return val.toLowerCase().trim();
|
|
5407
|
+
if (typeof val === 'object' && val.fr)
|
|
5408
|
+
return String(val.fr).toLowerCase().trim();
|
|
5409
|
+
return String(val).toLowerCase().trim();
|
|
5410
|
+
};
|
|
5411
|
+
const matchedAttr = allAttrs.find((a) => (a && a.id && getAttrString(a.id) === normAttr) ||
|
|
5412
|
+
(a && a.attributeId && getAttrString(a.attributeId) === normAttr) ||
|
|
5413
|
+
(a && a.guid && getAttrString(a.guid) === normAttr) ||
|
|
5414
|
+
(a &&
|
|
5415
|
+
a.attributeGuid &&
|
|
5416
|
+
getAttrString(a.attributeGuid) === normAttr) ||
|
|
5417
|
+
(a &&
|
|
5418
|
+
a.attributeName &&
|
|
5419
|
+
getAttrString(a.attributeName) === normAttr) ||
|
|
5420
|
+
(a && a.code && getAttrString(a.code) === normAttr) ||
|
|
5421
|
+
(a &&
|
|
5422
|
+
a.attributeCode &&
|
|
5423
|
+
getAttrString(a.attributeCode) === normAttr));
|
|
5424
|
+
const isMultiSelectAttr = !!(matchedAttr &&
|
|
5425
|
+
(matchedAttr.attributeType === 'multiSelect' ||
|
|
5426
|
+
matchedAttr.type === 'multiSelect'));
|
|
5427
|
+
let actualValues = [];
|
|
5428
|
+
if (isMultiSelectAttr) {
|
|
5429
|
+
if (Array.isArray(actualValue)) {
|
|
5430
|
+
actualValues = actualValue.map((v) => cleanValueForHide(v).toLowerCase().trim());
|
|
5431
|
+
}
|
|
5432
|
+
else if (cleanActual) {
|
|
5433
|
+
actualValues = cleanActual
|
|
5434
|
+
.split(/[#;,\n|]+/)
|
|
5435
|
+
.map((item) => item.trim())
|
|
5436
|
+
.filter((item) => item.length > 0);
|
|
5437
|
+
}
|
|
5438
|
+
}
|
|
5439
|
+
else {
|
|
5440
|
+
actualValues = [cleanActual];
|
|
5441
|
+
}
|
|
5442
|
+
switch (op) {
|
|
5443
|
+
case 'is_null':
|
|
5444
|
+
shouldHide = cleanActual === '';
|
|
5445
|
+
break;
|
|
5446
|
+
case 'is_not_null':
|
|
5447
|
+
shouldHide = cleanActual !== '';
|
|
5448
|
+
break;
|
|
5449
|
+
case 'equals':
|
|
5450
|
+
shouldHide = isMultiSelectAttr
|
|
5451
|
+
? actualValues.includes(cleanCompare)
|
|
5452
|
+
: cleanActual === cleanCompare;
|
|
5453
|
+
break;
|
|
5454
|
+
case 'not_equals':
|
|
5455
|
+
shouldHide = isMultiSelectAttr
|
|
5456
|
+
? !actualValues.includes(cleanCompare)
|
|
5457
|
+
: cleanActual !== cleanCompare;
|
|
5458
|
+
break;
|
|
5459
|
+
}
|
|
5152
5460
|
}
|
|
5153
5461
|
if (shouldHide) {
|
|
5154
5462
|
element.remove();
|
|
@@ -5174,7 +5482,9 @@ class DataSheetSVG {
|
|
|
5174
5482
|
const isFixed = locked === 'true';
|
|
5175
5483
|
const isWidth = locked === 'width';
|
|
5176
5484
|
const isHeight = locked !== 'true' && locked !== 'width';
|
|
5177
|
-
|
|
5485
|
+
const isMinimize = textarea.getAttribute('data-minimize') === 'true' ||
|
|
5486
|
+
foEl.getAttribute('data-minimize') === 'true';
|
|
5487
|
+
if (isFixed && !isMinimize) {
|
|
5178
5488
|
return;
|
|
5179
5489
|
}
|
|
5180
5490
|
const foWidth = parseFloat(foEl.getAttribute('width')) || 0;
|
|
@@ -5208,151 +5518,129 @@ class DataSheetSVG {
|
|
|
5208
5518
|
const textareaElement = tempDiv.querySelector(`#${textareaId}`);
|
|
5209
5519
|
if (textareaElement) {
|
|
5210
5520
|
let parentFo = textareaElement.closest('foreignObject');
|
|
5211
|
-
const
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
currInDiv = parent;
|
|
5226
|
-
if (toRemove.nodeName.toLowerCase() === 'br') {
|
|
5227
|
-
parent.removeChild(toRemove);
|
|
5228
|
-
}
|
|
5521
|
+
const direction = textarea.getAttribute('data-direction') ||
|
|
5522
|
+
foEl.getAttribute('data-direction') ||
|
|
5523
|
+
(isWidth ? 'ltr' : 'ttb');
|
|
5524
|
+
const [initialYStr, initialXStr] = this.GetXY(foEl);
|
|
5525
|
+
const initialX = initialXStr !== '' && initialXStr !== null
|
|
5526
|
+
? parseFloat(initialXStr)
|
|
5527
|
+
: parseFloat(foEl.getAttribute('x')) || 0;
|
|
5528
|
+
const initialY = initialYStr !== '' && initialYStr !== null
|
|
5529
|
+
? parseFloat(initialYStr)
|
|
5530
|
+
: parseFloat(foEl.getAttribute('y')) || 0;
|
|
5531
|
+
if (isWidth) {
|
|
5532
|
+
if (parentFo) {
|
|
5533
|
+
parentFo.setAttribute('width', '99999');
|
|
5534
|
+
parentFo.setAttribute('height', foHeight.toString());
|
|
5229
5535
|
}
|
|
5230
|
-
|
|
5231
|
-
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
|
|
5235
|
-
|
|
5236
|
-
|
|
5237
|
-
|
|
5238
|
-
|
|
5239
|
-
|
|
5240
|
-
|
|
5241
|
-
|
|
5242
|
-
|
|
5536
|
+
textareaElement.style.setProperty('width', 'max-content', 'important');
|
|
5537
|
+
textareaElement.style.setProperty('max-width', 'none', 'important');
|
|
5538
|
+
textareaElement.style.setProperty('height', 'auto', 'important');
|
|
5539
|
+
textareaElement.style.setProperty('min-height', '0', 'important');
|
|
5540
|
+
textareaElement.style.display = 'inline-block';
|
|
5541
|
+
const rect = textareaElement.getBoundingClientRect();
|
|
5542
|
+
const naturalWidth = Math.ceil(rect.width);
|
|
5543
|
+
const naturalHeight = Math.ceil(rect.height);
|
|
5544
|
+
const newWidth = naturalWidth + 4;
|
|
5545
|
+
if (direction === 'rtl') {
|
|
5546
|
+
const deltaW = newWidth - foWidth;
|
|
5547
|
+
const newX = initialX - deltaW;
|
|
5548
|
+
foEl.setAttribute('x', newX.toString());
|
|
5549
|
+
foEl.removeAttribute('transform');
|
|
5243
5550
|
}
|
|
5244
|
-
|
|
5245
|
-
if (
|
|
5246
|
-
|
|
5551
|
+
foEl.setAttribute('width', newWidth.toString());
|
|
5552
|
+
if (isMinimize) {
|
|
5553
|
+
foEl.setAttribute('height', Math.min(foHeight, naturalHeight + 4).toString());
|
|
5247
5554
|
}
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
let hasBr = true;
|
|
5251
|
-
while (hasBr) {
|
|
5252
|
-
hasBr = false;
|
|
5253
|
-
const divsWithBr = Array.from(textareaElement.querySelectorAll('div')).filter((d) => d.querySelector('br') !== null);
|
|
5254
|
-
for (const d of divsWithBr) {
|
|
5255
|
-
if (splitDivAtBr(d)) {
|
|
5256
|
-
hasBr = true;
|
|
5257
|
-
break;
|
|
5258
|
-
}
|
|
5555
|
+
else {
|
|
5556
|
+
foEl.setAttribute('height', Math.max(foHeight, naturalHeight + 4).toString());
|
|
5259
5557
|
}
|
|
5260
5558
|
}
|
|
5261
|
-
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
|
|
5265
|
-
const findTextNode = (node) => {
|
|
5266
|
-
if (node.nodeType === Node.TEXT_NODE &&
|
|
5267
|
-
node.textContent?.trim() !== '') {
|
|
5268
|
-
return node;
|
|
5269
|
-
}
|
|
5270
|
-
for (let child of Array.from(node.childNodes)) {
|
|
5271
|
-
const found = findTextNode(child);
|
|
5272
|
-
if (found)
|
|
5273
|
-
return found;
|
|
5274
|
-
}
|
|
5275
|
-
return null;
|
|
5276
|
-
};
|
|
5277
|
-
let domChanged = false;
|
|
5278
|
-
lineDivs.forEach((lineDiv) => {
|
|
5279
|
-
const text = lineDiv.textContent || '';
|
|
5280
|
-
if (!text.trim())
|
|
5281
|
-
return;
|
|
5282
|
-
const computedStyle = window.getComputedStyle(lineDiv);
|
|
5283
|
-
const fontFamily = computedStyle.fontFamily || 'sans-serif';
|
|
5284
|
-
const fontSize = computedStyle.fontSize || '24px';
|
|
5285
|
-
const canvas = document.createElement('canvas');
|
|
5286
|
-
const ctx = canvas.getContext('2d');
|
|
5287
|
-
if (!ctx)
|
|
5288
|
-
return;
|
|
5289
|
-
ctx.font = `${fontSize} ${fontFamily}`;
|
|
5290
|
-
const textWidth = ctx.measureText(text).width;
|
|
5291
|
-
if (foWidth > 0 && textWidth > foWidth) {
|
|
5292
|
-
const words = text.split(' ');
|
|
5293
|
-
const linesOfText = [];
|
|
5294
|
-
let currentLine = '';
|
|
5295
|
-
for (let word of words) {
|
|
5296
|
-
const testLine = currentLine ? currentLine + ' ' + word : word;
|
|
5297
|
-
const testWidth = ctx.measureText(testLine).width;
|
|
5298
|
-
if (testWidth > foWidth && currentLine) {
|
|
5299
|
-
linesOfText.push(currentLine);
|
|
5300
|
-
currentLine = word;
|
|
5301
|
-
}
|
|
5302
|
-
else {
|
|
5303
|
-
currentLine = testLine;
|
|
5304
|
-
}
|
|
5305
|
-
}
|
|
5306
|
-
if (currentLine) {
|
|
5307
|
-
linesOfText.push(currentLine);
|
|
5308
|
-
}
|
|
5309
|
-
if (linesOfText.length > 1) {
|
|
5310
|
-
domChanged = true;
|
|
5311
|
-
let previousLine = lineDiv;
|
|
5312
|
-
for (let i = 0; i < linesOfText.length; i++) {
|
|
5313
|
-
if (i === 0) {
|
|
5314
|
-
const textNode = findTextNode(lineDiv);
|
|
5315
|
-
if (textNode) {
|
|
5316
|
-
textNode.textContent = linesOfText[0];
|
|
5317
|
-
}
|
|
5318
|
-
}
|
|
5319
|
-
else {
|
|
5320
|
-
const clone = lineDiv.cloneNode(true);
|
|
5321
|
-
const textNode = findTextNode(clone);
|
|
5322
|
-
if (textNode) {
|
|
5323
|
-
textNode.textContent = linesOfText[i];
|
|
5324
|
-
}
|
|
5325
|
-
lineDiv.parentNode.insertBefore(clone, previousLine.nextSibling);
|
|
5326
|
-
previousLine = clone;
|
|
5327
|
-
}
|
|
5328
|
-
}
|
|
5329
|
-
}
|
|
5330
|
-
}
|
|
5331
|
-
});
|
|
5332
|
-
if (domChanged) {
|
|
5333
|
-
const originalTextarea = foEl.querySelector('.fake-textarea');
|
|
5334
|
-
if (originalTextarea) {
|
|
5335
|
-
originalTextarea.innerHTML = textareaElement.innerHTML;
|
|
5559
|
+
else if (isHeight) {
|
|
5560
|
+
if (parentFo) {
|
|
5561
|
+
parentFo.setAttribute('width', foWidth.toString());
|
|
5562
|
+
parentFo.setAttribute('height', 'auto');
|
|
5336
5563
|
}
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
textareaElement.style.
|
|
5340
|
-
textareaElement.style.
|
|
5564
|
+
textareaElement.style.setProperty('width', 'max-content', 'important');
|
|
5565
|
+
textareaElement.style.setProperty('max-width', foWidth + 'px', 'important');
|
|
5566
|
+
textareaElement.style.setProperty('height', 'auto', 'important');
|
|
5567
|
+
textareaElement.style.setProperty('min-height', '0', 'important');
|
|
5568
|
+
textareaElement.style.setProperty('max-height', 'none', 'important');
|
|
5341
5569
|
textareaElement.style.display = 'inline-block';
|
|
5570
|
+
textareaElement.style.wordBreak = 'break-word';
|
|
5571
|
+
textareaElement.style.overflowWrap = 'break-word';
|
|
5572
|
+
if (textarea) {
|
|
5573
|
+
textarea.style.wordBreak = 'break-word';
|
|
5574
|
+
textarea.style.overflowWrap = 'break-word';
|
|
5575
|
+
}
|
|
5342
5576
|
const rect = textareaElement.getBoundingClientRect();
|
|
5343
5577
|
const naturalWidth = Math.ceil(rect.width);
|
|
5344
|
-
|
|
5345
|
-
|
|
5346
|
-
|
|
5578
|
+
const naturalHeight = Math.ceil(rect.height);
|
|
5579
|
+
const newHeight = naturalHeight + 4;
|
|
5580
|
+
if (direction === 'btt') {
|
|
5581
|
+
const deltaH = newHeight - foHeight;
|
|
5582
|
+
const newY = initialY - deltaH;
|
|
5583
|
+
foEl.setAttribute('y', newY.toString());
|
|
5584
|
+
foEl.removeAttribute('transform');
|
|
5585
|
+
}
|
|
5586
|
+
foEl.setAttribute('height', newHeight.toString());
|
|
5587
|
+
if (isMinimize) {
|
|
5588
|
+
const newWidth = Math.min(foWidth, naturalWidth + 4);
|
|
5589
|
+
if (direction === 'rtl') {
|
|
5590
|
+
const deltaW = newWidth - foWidth;
|
|
5591
|
+
const newX = initialX - deltaW;
|
|
5592
|
+
foEl.setAttribute('x', newX.toString());
|
|
5593
|
+
foEl.removeAttribute('transform');
|
|
5594
|
+
}
|
|
5595
|
+
foEl.setAttribute('width', newWidth.toString());
|
|
5596
|
+
}
|
|
5597
|
+
}
|
|
5598
|
+
else if (isFixed && isMinimize) {
|
|
5347
5599
|
if (parentFo) {
|
|
5348
5600
|
parentFo.setAttribute('width', foWidth.toString());
|
|
5349
|
-
parentFo.
|
|
5601
|
+
parentFo.setAttribute('height', foHeight.toString());
|
|
5602
|
+
}
|
|
5603
|
+
textareaElement.style.setProperty('width', 'max-content', 'important');
|
|
5604
|
+
textareaElement.style.setProperty('max-width', foWidth + 'px', 'important');
|
|
5605
|
+
textareaElement.style.setProperty('height', 'auto', 'important');
|
|
5606
|
+
textareaElement.style.setProperty('min-height', '0', 'important');
|
|
5607
|
+
textareaElement.style.setProperty('max-height', foHeight + 'px', 'important');
|
|
5608
|
+
textareaElement.style.display = 'inline-block';
|
|
5609
|
+
textareaElement.style.wordBreak = 'break-word';
|
|
5610
|
+
textareaElement.style.overflowWrap = 'break-word';
|
|
5611
|
+
if (textarea) {
|
|
5612
|
+
textarea.style.wordBreak = 'break-word';
|
|
5613
|
+
textarea.style.overflowWrap = 'break-word';
|
|
5350
5614
|
}
|
|
5351
|
-
textareaElement.style.width = foWidth + 'px';
|
|
5352
|
-
textareaElement.style.height = 'auto';
|
|
5353
5615
|
const rect = textareaElement.getBoundingClientRect();
|
|
5616
|
+
const naturalWidth = Math.ceil(rect.width);
|
|
5354
5617
|
const naturalHeight = Math.ceil(rect.height);
|
|
5355
|
-
|
|
5618
|
+
const newWidth = Math.min(foWidth, naturalWidth + 4);
|
|
5619
|
+
const newHeight = Math.min(foHeight, naturalHeight + 4);
|
|
5620
|
+
if (direction === 'rtl') {
|
|
5621
|
+
const deltaW = newWidth - foWidth;
|
|
5622
|
+
const newX = initialX - deltaW;
|
|
5623
|
+
foEl.setAttribute('x', newX.toString());
|
|
5624
|
+
foEl.removeAttribute('transform');
|
|
5625
|
+
}
|
|
5626
|
+
if (direction === 'btt') {
|
|
5627
|
+
const deltaH = newHeight - foHeight;
|
|
5628
|
+
const newY = initialY - deltaH;
|
|
5629
|
+
foEl.setAttribute('y', newY.toString());
|
|
5630
|
+
foEl.removeAttribute('transform');
|
|
5631
|
+
}
|
|
5632
|
+
foEl.setAttribute('width', newWidth.toString());
|
|
5633
|
+
foEl.setAttribute('height', newHeight.toString());
|
|
5634
|
+
}
|
|
5635
|
+
if (textarea) {
|
|
5636
|
+
textarea.setAttribute('locked', 'true');
|
|
5637
|
+
textarea.style.width = '100%';
|
|
5638
|
+
textarea.style.height = '100%';
|
|
5639
|
+
textarea.style.wordBreak = 'break-word';
|
|
5640
|
+
textarea.style.overflowWrap = 'break-word';
|
|
5641
|
+
textarea.style.whiteSpace = 'normal';
|
|
5642
|
+
textarea.style.maxHeight = 'none';
|
|
5643
|
+
textarea.style.maxWidth = 'none';
|
|
5356
5644
|
}
|
|
5357
5645
|
}
|
|
5358
5646
|
}
|
|
@@ -5623,54 +5911,154 @@ class DataSheetSVG {
|
|
|
5623
5911
|
}
|
|
5624
5912
|
}
|
|
5625
5913
|
getBackgroundSectionForPreview(section) {
|
|
5914
|
+
if (!this.DataSheet.backgrounds ||
|
|
5915
|
+
this.DataSheet.backgrounds.length === 0) {
|
|
5916
|
+
return null;
|
|
5917
|
+
}
|
|
5626
5918
|
let defaultBackground = this.DataSheet.backgrounds.find((background) => background.guid == this.DataSheet.defaultBackgroundGuid);
|
|
5627
|
-
|
|
5628
|
-
|
|
5629
|
-
|
|
5919
|
+
if (!defaultBackground) {
|
|
5920
|
+
defaultBackground = this.DataSheet.backgrounds[0];
|
|
5921
|
+
}
|
|
5922
|
+
let background = null;
|
|
5923
|
+
if (section) {
|
|
5924
|
+
const bgIdentifier = section.background ||
|
|
5925
|
+
section.backgroundGuid ||
|
|
5926
|
+
section.spreadName ||
|
|
5927
|
+
section.spreadGuid ||
|
|
5928
|
+
section.publicationPageBackground ||
|
|
5929
|
+
section.pageBackground ||
|
|
5930
|
+
section.publicationTemplateGuid ||
|
|
5931
|
+
section.templateGuid;
|
|
5932
|
+
if (bgIdentifier &&
|
|
5933
|
+
typeof bgIdentifier === 'string' &&
|
|
5934
|
+
bgIdentifier.trim() !== '' &&
|
|
5935
|
+
bgIdentifier !== '00000000-0000-0000-0000-000000000000') {
|
|
5936
|
+
const idLower = bgIdentifier.trim().toLowerCase();
|
|
5937
|
+
const idClean = idLower.replace(/\.svg$/i, '');
|
|
5938
|
+
background = this.DataSheet.backgrounds.find((bg) => {
|
|
5939
|
+
if (!bg)
|
|
5940
|
+
return false;
|
|
5941
|
+
const guidLower = (bg.guid || bg.backgroundGuid || '')
|
|
5942
|
+
.toString()
|
|
5943
|
+
.toLowerCase();
|
|
5944
|
+
if (guidLower && (guidLower === idLower || guidLower === idClean)) {
|
|
5945
|
+
return true;
|
|
5946
|
+
}
|
|
5947
|
+
const nameLower = (bg.name || bg.backgroundName || '')
|
|
5948
|
+
.toString()
|
|
5949
|
+
.toLowerCase();
|
|
5950
|
+
const nameClean = nameLower.replace(/\.svg$/i, '');
|
|
5951
|
+
if (nameLower &&
|
|
5952
|
+
(nameLower === idLower ||
|
|
5953
|
+
nameClean === idClean ||
|
|
5954
|
+
nameLower === idClean + '.svg')) {
|
|
5955
|
+
return true;
|
|
5956
|
+
}
|
|
5957
|
+
const nameNoSvgLower = (bg.nameNoSvg || '').toString().toLowerCase();
|
|
5958
|
+
if (nameNoSvgLower && nameNoSvgLower === idClean) {
|
|
5959
|
+
return true;
|
|
5960
|
+
}
|
|
5961
|
+
const formatNameLower = (bg.formatName ||
|
|
5962
|
+
bg.backgroundFormatName ||
|
|
5963
|
+
'')
|
|
5964
|
+
.toString()
|
|
5965
|
+
.toLowerCase();
|
|
5966
|
+
if (formatNameLower && formatNameLower === idClean) {
|
|
5967
|
+
return true;
|
|
5968
|
+
}
|
|
5969
|
+
return false;
|
|
5970
|
+
});
|
|
5971
|
+
}
|
|
5972
|
+
}
|
|
5973
|
+
if (background == null || background == undefined) {
|
|
5630
5974
|
background = defaultBackground;
|
|
5631
5975
|
}
|
|
5632
5976
|
if (background == null || background == undefined) {
|
|
5633
5977
|
background = this.DataSheet.backgrounds[0];
|
|
5634
5978
|
}
|
|
5635
|
-
|
|
5636
|
-
|
|
5637
|
-
|
|
5638
|
-
|
|
5639
|
-
|
|
5640
|
-
|
|
5641
|
-
|
|
5642
|
-
|
|
5643
|
-
|
|
5644
|
-
|
|
5645
|
-
|
|
5646
|
-
|
|
5647
|
-
|
|
5648
|
-
|
|
5649
|
-
|
|
5650
|
-
|
|
5651
|
-
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
5658
|
-
|
|
5659
|
-
|
|
5660
|
-
|
|
5661
|
-
|
|
5662
|
-
this.DataSheet.
|
|
5663
|
-
|
|
5664
|
-
|
|
5665
|
-
|
|
5666
|
-
|
|
5667
|
-
|
|
5668
|
-
this.DataSheet.
|
|
5979
|
+
if (background) {
|
|
5980
|
+
// Update data for the background (remove later)
|
|
5981
|
+
this.DataSheet.backgroundWidth = background.width;
|
|
5982
|
+
this.DataSheet.backgroundHeight = background.height;
|
|
5983
|
+
this.DataSheet.backgroundMarginTop = background.headerHeight;
|
|
5984
|
+
this.DataSheet.backgroundMarginLeft = background.leftMargin;
|
|
5985
|
+
this.DataSheet.backgroundMarginRight = background.rightMargin;
|
|
5986
|
+
this.DataSheet.backgroundMarginBottom = background.footerHeight;
|
|
5987
|
+
this.DataSheet.backgroundBleedMarginTop = background.bleedMarginTop
|
|
5988
|
+
? background.bleedMarginTop
|
|
5989
|
+
: 0;
|
|
5990
|
+
this.DataSheet.backgroundBleedMarginBottom = background.bleedMarginBottom
|
|
5991
|
+
? background.bleedMarginBottom
|
|
5992
|
+
: 0;
|
|
5993
|
+
this.DataSheet.backgroundBleedMarginLeft = background.bleedMarginLeft
|
|
5994
|
+
? background.bleedMarginLeft
|
|
5995
|
+
: 0;
|
|
5996
|
+
this.DataSheet.backgroundBleedMarginRight = background.bleedMarginRight
|
|
5997
|
+
? background.bleedMarginRight
|
|
5998
|
+
: 0;
|
|
5999
|
+
// new
|
|
6000
|
+
this.DataSheet.publicationTemplateWidth = background.width;
|
|
6001
|
+
this.DataSheet.publicationTemplateHeight = background.height;
|
|
6002
|
+
this.DataSheet.publicationTemplateBackgroundHeightHeader =
|
|
6003
|
+
background.headerHeight;
|
|
6004
|
+
this.DataSheet.publicationTemplateBackgroundHeightFooter =
|
|
6005
|
+
background.footerHeight;
|
|
6006
|
+
this.DataSheet.publicationTemplateBackgroundFooterY =
|
|
6007
|
+
this.DataSheet.publicationTemplateHeight - background.footerHeight;
|
|
6008
|
+
this.DataSheet.publicationTemplateBackgroundLeftMargin =
|
|
6009
|
+
background.leftMargin;
|
|
6010
|
+
this.DataSheet.publicationTemplateBackgroundRightMargin =
|
|
6011
|
+
background.rightMargin;
|
|
6012
|
+
this.DataSheet.publicationTemplateBackgroundMarginX =
|
|
6013
|
+
this.DataSheet.publicationTemplateWidth - background.rightMargin;
|
|
6014
|
+
}
|
|
5669
6015
|
return background;
|
|
5670
6016
|
}
|
|
5671
6017
|
getMarketingSectionForPreview(section) {
|
|
5672
|
-
|
|
5673
|
-
|
|
6018
|
+
if (!this.DataSheet.marketing ||
|
|
6019
|
+
this.DataSheet.marketing.length === 0 ||
|
|
6020
|
+
!section) {
|
|
6021
|
+
return null;
|
|
6022
|
+
}
|
|
6023
|
+
const identifier = section.gabaritName ||
|
|
6024
|
+
section.marketingName ||
|
|
6025
|
+
section.gabaritGuid ||
|
|
6026
|
+
section.guid ||
|
|
6027
|
+
section.name;
|
|
6028
|
+
if (!identifier ||
|
|
6029
|
+
typeof identifier !== 'string' ||
|
|
6030
|
+
identifier.trim() === '') {
|
|
6031
|
+
return null;
|
|
6032
|
+
}
|
|
6033
|
+
const idLower = identifier.trim().toLowerCase();
|
|
6034
|
+
const idClean = idLower.replace(/\.svg$/i, '');
|
|
6035
|
+
let mark = this.DataSheet.marketing.find((m) => {
|
|
6036
|
+
if (!m)
|
|
6037
|
+
return false;
|
|
6038
|
+
const mGuidLower = (m.guid || '').toString().toLowerCase();
|
|
6039
|
+
if (mGuidLower && (mGuidLower === idLower || mGuidLower === idClean)) {
|
|
6040
|
+
return true;
|
|
6041
|
+
}
|
|
6042
|
+
const mMarketingNameLower = (m.marketingName || '')
|
|
6043
|
+
.toString()
|
|
6044
|
+
.toLowerCase();
|
|
6045
|
+
const mMarketingClean = mMarketingNameLower.replace(/\.svg$/i, '');
|
|
6046
|
+
if (mMarketingNameLower &&
|
|
6047
|
+
(mMarketingNameLower === idLower ||
|
|
6048
|
+
mMarketingClean === idClean ||
|
|
6049
|
+
mMarketingNameLower === idClean + '.svg')) {
|
|
6050
|
+
return true;
|
|
6051
|
+
}
|
|
6052
|
+
const mNameLower = (m.name || '').toString().toLowerCase();
|
|
6053
|
+
const mNameClean = mNameLower.replace(/\.svg$/i, '');
|
|
6054
|
+
if (mNameLower &&
|
|
6055
|
+
(mNameLower === idLower ||
|
|
6056
|
+
mNameClean === idClean ||
|
|
6057
|
+
mNameLower === idClean + '.svg')) {
|
|
6058
|
+
return true;
|
|
6059
|
+
}
|
|
6060
|
+
return false;
|
|
6061
|
+
});
|
|
5674
6062
|
if (mark == undefined || mark == null) {
|
|
5675
6063
|
return null;
|
|
5676
6064
|
}
|
|
@@ -5976,9 +6364,10 @@ class DataSheetSVG {
|
|
|
5976
6364
|
getActualBlockHeight(svgContent, initialBlockHeight, blockY = 0) {
|
|
5977
6365
|
if (!svgContent)
|
|
5978
6366
|
return { actualHeight: initialBlockHeight, updatedSvg: svgContent };
|
|
5979
|
-
const
|
|
5980
|
-
/data-info=["']variantTable["']/i.test(svgContent)
|
|
5981
|
-
|
|
6367
|
+
const hasDynamicElements = /id=["']tableVariant["']/i.test(svgContent) ||
|
|
6368
|
+
/data-info=["']variantTable["']/i.test(svgContent) ||
|
|
6369
|
+
/<foreignObject/i.test(svgContent);
|
|
6370
|
+
if (!hasDynamicElements) {
|
|
5982
6371
|
return { actualHeight: initialBlockHeight, updatedSvg: svgContent };
|
|
5983
6372
|
}
|
|
5984
6373
|
let maxBottom = 0;
|
|
@@ -6532,6 +6921,9 @@ class DataSheetSku {
|
|
|
6532
6921
|
this.DataSheet = dataSheet;
|
|
6533
6922
|
this.DataSheetSVG = dataSheetSVG;
|
|
6534
6923
|
}
|
|
6924
|
+
async setDataSheetsController(dataSheetsController) {
|
|
6925
|
+
this.dataSheetsController = dataSheetsController;
|
|
6926
|
+
}
|
|
6535
6927
|
async setPublicationsService(publicationsService) {
|
|
6536
6928
|
if (!publicationsService) {
|
|
6537
6929
|
throw new Error('PublicationsService instance is required');
|
|
@@ -6576,7 +6968,7 @@ class DataSheetSku {
|
|
|
6576
6968
|
this.DataSheet.maxSkusSection = lstSkuObjects.length;
|
|
6577
6969
|
let pages = [];
|
|
6578
6970
|
let background = this.DataSheetSVG.getBackgroundSectionForPreview(section);
|
|
6579
|
-
let backgroundTpl = background
|
|
6971
|
+
let backgroundTpl = background?.svgImage || '';
|
|
6580
6972
|
let allBackgroundTags = this.DataSheetSVG.GetSvgGroupToReplace(backgroundTpl);
|
|
6581
6973
|
let allElements = this.DataSheetSVG.GetAllTags(backgroundTpl);
|
|
6582
6974
|
let group = false;
|
|
@@ -6584,7 +6976,9 @@ class DataSheetSku {
|
|
|
6584
6976
|
const tagName = element.tagName?.toLowerCase();
|
|
6585
6977
|
if (tagName === 'svg') {
|
|
6586
6978
|
// HEADER HEIGHT
|
|
6587
|
-
const attrHeader = element.getAttribute('data-margin-top') ||
|
|
6979
|
+
const attrHeader = element.getAttribute('data-margin-top') ||
|
|
6980
|
+
element.getAttribute('data-header-height') ||
|
|
6981
|
+
element.getAttribute('data-margin-vertical');
|
|
6588
6982
|
const parsedHeader = parseFloat(attrHeader);
|
|
6589
6983
|
if (!isNaN(parsedHeader)) {
|
|
6590
6984
|
this.DataSheet.publicationTemplateBackgroundHeightHeader =
|
|
@@ -6594,7 +6988,9 @@ class DataSheetSku {
|
|
|
6594
6988
|
this.DataSheet.publicationTemplateBackgroundHeightHeader = 0;
|
|
6595
6989
|
}
|
|
6596
6990
|
// FOOTER HEIGHT
|
|
6597
|
-
const attrFooter = element.getAttribute('data-margin-bottom') ||
|
|
6991
|
+
const attrFooter = element.getAttribute('data-margin-bottom') ||
|
|
6992
|
+
element.getAttribute('data-footer-height') ||
|
|
6993
|
+
element.getAttribute('data-margin-vertical');
|
|
6598
6994
|
const parsedFooter = parseFloat(attrFooter);
|
|
6599
6995
|
if (!isNaN(parsedFooter)) {
|
|
6600
6996
|
this.DataSheet.publicationTemplateBackgroundHeightFooter =
|
|
@@ -6608,8 +7004,10 @@ class DataSheetSku {
|
|
|
6608
7004
|
this.DataSheet.publicationTemplateHeight;
|
|
6609
7005
|
}
|
|
6610
7006
|
// MARGIN
|
|
6611
|
-
const attrMarginLeft = element.getAttribute('data-margin-left') ||
|
|
6612
|
-
|
|
7007
|
+
const attrMarginLeft = element.getAttribute('data-margin-left') ||
|
|
7008
|
+
element.getAttribute('data-margin-horizontal');
|
|
7009
|
+
const attrMarginRight = element.getAttribute('data-margin-right') ||
|
|
7010
|
+
element.getAttribute('data-margin-horizontal');
|
|
6613
7011
|
const parsedMarginLeft = parseFloat(attrMarginLeft);
|
|
6614
7012
|
if (!isNaN(parsedMarginLeft)) {
|
|
6615
7013
|
this.DataSheet.publicationTemplateBackgroundLeftMargin =
|
|
@@ -6699,7 +7097,7 @@ class DataSheetSku {
|
|
|
6699
7097
|
let currentBackgroundTpl = backgroundTpl;
|
|
6700
7098
|
if (pageConfig) {
|
|
6701
7099
|
if (pageConfig.backgroundGuid) {
|
|
6702
|
-
const bg = this.DataSheet.backgrounds.find((b) => b.
|
|
7100
|
+
const bg = this.DataSheet.backgrounds.find((b) => b.guid === pageConfig.backgroundGuid);
|
|
6703
7101
|
if (bg && bg.svgImage) {
|
|
6704
7102
|
currentBackgroundTpl = bg.svgImage;
|
|
6705
7103
|
}
|
|
@@ -6712,6 +7110,21 @@ class DataSheetSku {
|
|
|
6712
7110
|
for (const jObject of lstSkus) {
|
|
6713
7111
|
let aJobject = [];
|
|
6714
7112
|
aJobject.push(jObject);
|
|
7113
|
+
if (jObject && jObject.type === PublicationDataType.CALLOUT) {
|
|
7114
|
+
const cGuid = jObject.publicationDataCallout ||
|
|
7115
|
+
jObject.PublicationDataCallout;
|
|
7116
|
+
const needForce = !this.DataSheet.preview;
|
|
7117
|
+
if (cGuid && (!this.DataSheet.callouts?.[cGuid] || needForce)) {
|
|
7118
|
+
let loaded = [];
|
|
7119
|
+
if (this.dataSheetsController) {
|
|
7120
|
+
loaded =
|
|
7121
|
+
await this.dataSheetsController.updateCalloutsList(cGuid, needForce);
|
|
7122
|
+
}
|
|
7123
|
+
if (!this.DataSheet.callouts)
|
|
7124
|
+
this.DataSheet.callouts = {};
|
|
7125
|
+
this.DataSheet.callouts[cGuid] = loaded;
|
|
7126
|
+
}
|
|
7127
|
+
}
|
|
6715
7128
|
const newFiles = await this.DataSheetSVG.GenerateSvgFiles(aJobject, currentBackgroundTpl, currentBackgroundTpl, fileIndex.toString());
|
|
6716
7129
|
if (newFiles) {
|
|
6717
7130
|
files = files.concat(newFiles);
|
|
@@ -6748,6 +7161,9 @@ class DataSheetPublication {
|
|
|
6748
7161
|
this.sectionActiveObject = sectionActiveObject;
|
|
6749
7162
|
this.skusSection = skusSection;
|
|
6750
7163
|
}
|
|
7164
|
+
async setDataSheetsController(dataSheetsController) {
|
|
7165
|
+
this.dataSheetsController = dataSheetsController;
|
|
7166
|
+
}
|
|
6751
7167
|
async setPublicationsService(publicationsService) {
|
|
6752
7168
|
if (!publicationsService) {
|
|
6753
7169
|
throw new Error('PublicationsService instance is required');
|
|
@@ -6921,8 +7337,12 @@ class DataSheetPublication {
|
|
|
6921
7337
|
return;
|
|
6922
7338
|
const lang = this.languagePreviewSelected.toLowerCase();
|
|
6923
7339
|
let val = null;
|
|
6924
|
-
if (attr.attributeValue &&
|
|
6925
|
-
|
|
7340
|
+
if (attr.attributeValue &&
|
|
7341
|
+
typeof attr.attributeValue === 'object') {
|
|
7342
|
+
val =
|
|
7343
|
+
attr.attributeValue[lang] ||
|
|
7344
|
+
attr.attributeValue[this.languagePreviewSelected] ||
|
|
7345
|
+
'';
|
|
6926
7346
|
}
|
|
6927
7347
|
else {
|
|
6928
7348
|
val = attr.attributeValue || '';
|
|
@@ -7056,7 +7476,9 @@ class DataSheetPublication {
|
|
|
7056
7476
|
const tagName = element.tagName?.toLowerCase();
|
|
7057
7477
|
if (tagName === 'svg') {
|
|
7058
7478
|
// HEADER HEIGHT
|
|
7059
|
-
const attrHeader = element.getAttribute('data-margin-top') ||
|
|
7479
|
+
const attrHeader = element.getAttribute('data-margin-top') ||
|
|
7480
|
+
element.getAttribute('data-header-height') ||
|
|
7481
|
+
element.getAttribute('data-margin-vertical');
|
|
7060
7482
|
const parsedHeader = Number.parseFloat(attrHeader);
|
|
7061
7483
|
if (Number.isNaN(parsedHeader)) {
|
|
7062
7484
|
this.DataSheet.publicationTemplateBackgroundHeightHeader = 0;
|
|
@@ -7066,7 +7488,9 @@ class DataSheetPublication {
|
|
|
7066
7488
|
parsedHeader;
|
|
7067
7489
|
}
|
|
7068
7490
|
// FOOTER HEIGHT
|
|
7069
|
-
const attrFooter = element.getAttribute('data-margin-bottom') ||
|
|
7491
|
+
const attrFooter = element.getAttribute('data-margin-bottom') ||
|
|
7492
|
+
element.getAttribute('data-footer-height') ||
|
|
7493
|
+
element.getAttribute('data-margin-vertical');
|
|
7070
7494
|
const parsedFooter = Number.parseFloat(attrFooter);
|
|
7071
7495
|
if (Number.isNaN(parsedFooter)) {
|
|
7072
7496
|
this.DataSheet.publicationTemplateBackgroundHeightFooter = 0;
|
|
@@ -7080,23 +7504,30 @@ class DataSheetPublication {
|
|
|
7080
7504
|
this.DataSheet.publicationTemplateHeight - parsedFooter;
|
|
7081
7505
|
}
|
|
7082
7506
|
// MARGIN
|
|
7083
|
-
const attrMarginLeft = element.getAttribute('data-margin-left') ||
|
|
7084
|
-
|
|
7507
|
+
const attrMarginLeft = element.getAttribute('data-margin-left') ||
|
|
7508
|
+
element.getAttribute('data-margin-horizontal');
|
|
7509
|
+
const attrMarginRight = element.getAttribute('data-margin-right') ||
|
|
7510
|
+
element.getAttribute('data-margin-horizontal');
|
|
7085
7511
|
const parsedMarginLeft = Number.parseFloat(attrMarginLeft);
|
|
7086
7512
|
if (Number.isNaN(parsedMarginLeft)) {
|
|
7087
7513
|
this.DataSheet.publicationTemplateBackgroundLeftMargin = 0;
|
|
7088
7514
|
}
|
|
7089
7515
|
else {
|
|
7090
|
-
this.DataSheet.publicationTemplateBackgroundLeftMargin =
|
|
7516
|
+
this.DataSheet.publicationTemplateBackgroundLeftMargin =
|
|
7517
|
+
parsedMarginLeft;
|
|
7091
7518
|
}
|
|
7092
7519
|
const parsedMarginRight = Number.parseFloat(attrMarginRight);
|
|
7093
7520
|
if (Number.isNaN(parsedMarginRight)) {
|
|
7094
7521
|
this.DataSheet.publicationTemplateBackgroundRightMargin = 0;
|
|
7095
|
-
this.DataSheet.publicationTemplateBackgroundMarginX =
|
|
7522
|
+
this.DataSheet.publicationTemplateBackgroundMarginX =
|
|
7523
|
+
this.DataSheet.publicationTemplateWidth;
|
|
7096
7524
|
}
|
|
7097
7525
|
else {
|
|
7098
|
-
this.DataSheet.publicationTemplateBackgroundRightMargin =
|
|
7099
|
-
|
|
7526
|
+
this.DataSheet.publicationTemplateBackgroundRightMargin =
|
|
7527
|
+
parsedMarginRight;
|
|
7528
|
+
this.DataSheet.publicationTemplateBackgroundMarginX =
|
|
7529
|
+
this.DataSheet.publicationTemplateWidth -
|
|
7530
|
+
parsedMarginRight;
|
|
7100
7531
|
}
|
|
7101
7532
|
}
|
|
7102
7533
|
// GROUPE <g>
|
|
@@ -7168,11 +7599,24 @@ class DataSheetPublication {
|
|
|
7168
7599
|
}
|
|
7169
7600
|
else {
|
|
7170
7601
|
let background = this.DataSheetSVG.getBackgroundSectionForPreview(section);
|
|
7171
|
-
let backgroundTpl = background
|
|
7602
|
+
let backgroundTpl = background?.svgImage || '';
|
|
7172
7603
|
let allBackgroundTags = this.DataSheetSVG.GetSvgGroupToReplace(backgroundTpl);
|
|
7173
|
-
|
|
7174
|
-
|
|
7175
|
-
|
|
7604
|
+
const hasDataSide = backgroundTpl.includes('data-side');
|
|
7605
|
+
const isDoublePage = backgroundTpl.includes('data-double-page="true"') ||
|
|
7606
|
+
backgroundTpl.includes("data-double-page='true'");
|
|
7607
|
+
let backgroundTplLeft = backgroundTpl;
|
|
7608
|
+
let backgroundTplRight = backgroundTpl;
|
|
7609
|
+
if (hasDataSide) {
|
|
7610
|
+
if (isDoublePage) {
|
|
7611
|
+
backgroundTplLeft = this.DataSheetSVG.keepOnlySideRegex(backgroundTpl, 'left');
|
|
7612
|
+
backgroundTplRight = this.DataSheetSVG.keepOnlySideRegex(backgroundTpl, 'right');
|
|
7613
|
+
}
|
|
7614
|
+
else {
|
|
7615
|
+
const onlyRight = this.DataSheetSVG.keepOnlySideRegex(backgroundTpl, 'right');
|
|
7616
|
+
backgroundTplLeft = onlyRight;
|
|
7617
|
+
backgroundTplRight = onlyRight;
|
|
7618
|
+
}
|
|
7619
|
+
}
|
|
7176
7620
|
let allElements = this.DataSheetSVG.GetAllTags(backgroundTplLeft);
|
|
7177
7621
|
let group = false;
|
|
7178
7622
|
if (allElements) {
|
|
@@ -7180,7 +7624,10 @@ class DataSheetPublication {
|
|
|
7180
7624
|
const tagName = element.tagName?.toLowerCase();
|
|
7181
7625
|
if (tagName === 'svg') {
|
|
7182
7626
|
// HEADER HEIGHT
|
|
7183
|
-
const attrHeader = element.getAttribute('data-margin-top') ||
|
|
7627
|
+
const attrHeader = element.getAttribute('data-margin-top') ||
|
|
7628
|
+
element.getAttribute('data-header-height') ||
|
|
7629
|
+
element.getAttribute('data-margin-vertical') ||
|
|
7630
|
+
'0';
|
|
7184
7631
|
const parsedHeader = Number.parseFloat(attrHeader);
|
|
7185
7632
|
if (Number.isNaN(parsedHeader)) {
|
|
7186
7633
|
this.DataSheet.publicationTemplateBackgroundHeightHeader = 0;
|
|
@@ -7190,7 +7637,10 @@ class DataSheetPublication {
|
|
|
7190
7637
|
parsedHeader;
|
|
7191
7638
|
}
|
|
7192
7639
|
// FOOTER HEIGHT
|
|
7193
|
-
const attrFooter = element.getAttribute('data-margin-bottom') ||
|
|
7640
|
+
const attrFooter = element.getAttribute('data-margin-bottom') ||
|
|
7641
|
+
element.getAttribute('data-footer-height') ||
|
|
7642
|
+
element.getAttribute('data-margin-vertical') ||
|
|
7643
|
+
'0';
|
|
7194
7644
|
const parsedFooter = Number.parseFloat(attrFooter);
|
|
7195
7645
|
if (Number.isNaN(parsedFooter)) {
|
|
7196
7646
|
this.DataSheet.publicationTemplateBackgroundHeightFooter = 0;
|
|
@@ -7204,23 +7654,31 @@ class DataSheetPublication {
|
|
|
7204
7654
|
this.DataSheet.publicationTemplateHeight - parsedFooter;
|
|
7205
7655
|
}
|
|
7206
7656
|
// MARGIN
|
|
7207
|
-
const attrMarginLeft = element.getAttribute('data-margin-left') ||
|
|
7208
|
-
|
|
7657
|
+
const attrMarginLeft = element.getAttribute('data-margin-left') ||
|
|
7658
|
+
element.getAttribute('data-margin-horizontal') ||
|
|
7659
|
+
'0';
|
|
7660
|
+
const attrMarginRight = element.getAttribute('data-margin-right') ||
|
|
7661
|
+
element.getAttribute('data-margin-horizontal') ||
|
|
7662
|
+
'0';
|
|
7209
7663
|
const parsedMarginLeft = Number.parseFloat(attrMarginLeft);
|
|
7210
7664
|
if (Number.isNaN(parsedMarginLeft)) {
|
|
7211
7665
|
this.DataSheet.publicationTemplateBackgroundLeftMargin = 0;
|
|
7212
7666
|
}
|
|
7213
7667
|
else {
|
|
7214
|
-
this.DataSheet.publicationTemplateBackgroundLeftMargin =
|
|
7668
|
+
this.DataSheet.publicationTemplateBackgroundLeftMargin =
|
|
7669
|
+
parsedMarginLeft;
|
|
7215
7670
|
}
|
|
7216
7671
|
const parsedMarginRight = Number.parseFloat(attrMarginRight);
|
|
7217
7672
|
if (Number.isNaN(parsedMarginRight)) {
|
|
7218
7673
|
this.DataSheet.publicationTemplateBackgroundRightMargin = 0;
|
|
7219
|
-
this.DataSheet.publicationTemplateBackgroundMarginX =
|
|
7674
|
+
this.DataSheet.publicationTemplateBackgroundMarginX =
|
|
7675
|
+
this.DataSheet.publicationTemplateWidth;
|
|
7220
7676
|
}
|
|
7221
7677
|
else {
|
|
7222
|
-
this.DataSheet.publicationTemplateBackgroundRightMargin =
|
|
7223
|
-
|
|
7678
|
+
this.DataSheet.publicationTemplateBackgroundRightMargin =
|
|
7679
|
+
parsedMarginRight;
|
|
7680
|
+
this.DataSheet.publicationTemplateBackgroundMarginX =
|
|
7681
|
+
this.DataSheet.publicationTemplateWidth - parsedMarginRight;
|
|
7224
7682
|
}
|
|
7225
7683
|
}
|
|
7226
7684
|
// GROUPE <g>
|
|
@@ -7284,6 +7742,24 @@ class DataSheetPublication {
|
|
|
7284
7742
|
else {
|
|
7285
7743
|
lstSkus = [...lstSkuObjects];
|
|
7286
7744
|
}
|
|
7745
|
+
if (lstSkus && lstSkus.length > 0) {
|
|
7746
|
+
for (const item of lstSkus) {
|
|
7747
|
+
if (item && item.type === PublicationDataType.CALLOUT) {
|
|
7748
|
+
const cGuid = item.publicationDataCallout ||
|
|
7749
|
+
item.PublicationDataCallout;
|
|
7750
|
+
const needForce = !this.DataSheet.preview;
|
|
7751
|
+
if (cGuid && (!this.DataSheet.callouts?.[cGuid] || needForce)) {
|
|
7752
|
+
let loaded = [];
|
|
7753
|
+
if (this.dataSheetsController) {
|
|
7754
|
+
loaded = await this.dataSheetsController.updateCalloutsList(cGuid, needForce);
|
|
7755
|
+
}
|
|
7756
|
+
if (!this.DataSheet.callouts)
|
|
7757
|
+
this.DataSheet.callouts = {};
|
|
7758
|
+
this.DataSheet.callouts[cGuid] = loaded;
|
|
7759
|
+
}
|
|
7760
|
+
}
|
|
7761
|
+
}
|
|
7762
|
+
}
|
|
7287
7763
|
files = await this.DataSheetSVG.GenerateSvgFiles(lstSkus, backgroundTplLeft, backgroundTplRight, section.pageId.toString());
|
|
7288
7764
|
lstBackgroundTags = [];
|
|
7289
7765
|
}
|
|
@@ -7609,6 +8085,7 @@ class DataSheetController {
|
|
|
7609
8085
|
case 2: // Publication
|
|
7610
8086
|
//console.log("Generate SVG for publication");
|
|
7611
8087
|
let dataSheetPublication = new DataSheetPublication(dataSheetSVG, dataSheet, publication, json.sectionActiveObject, json.skusSection);
|
|
8088
|
+
dataSheetPublication.setDataSheetsController(this);
|
|
7612
8089
|
dataSheetPublication.setPublicationsService(this._publicationsService);
|
|
7613
8090
|
dataSheetPublication.setDamAssetsService(this._damAssets);
|
|
7614
8091
|
dataSheetPublication.setDocumentsService(this._documents);
|
|
@@ -7618,6 +8095,7 @@ class DataSheetController {
|
|
|
7618
8095
|
case 3: // SKUs
|
|
7619
8096
|
//console.log('Generate SVG for SKUs');
|
|
7620
8097
|
let dataSheetSku = new DataSheetSku(dataSheetSVG, dataSheet);
|
|
8098
|
+
dataSheetSku.setDataSheetsController(this);
|
|
7621
8099
|
dataSheetSku.setPublicationsService(this._publicationsService);
|
|
7622
8100
|
files = await dataSheetSku.GenerateAllInOneExportFile(json.sourceGuid, json.option1PerPage, displayModeVariant, json.multiColumns);
|
|
7623
8101
|
dataSheetSku = null;
|
|
@@ -7626,6 +8104,7 @@ class DataSheetController {
|
|
|
7626
8104
|
for (let sourceGuid of sourceGuids) {
|
|
7627
8105
|
dataSheet.progress = 25;
|
|
7628
8106
|
let dataSheetSku = new DataSheetSku(dataSheetSVG, dataSheet);
|
|
8107
|
+
dataSheetSku.setDataSheetsController(this);
|
|
7629
8108
|
dataSheetSku.setPublicationsService(this._publicationsService);
|
|
7630
8109
|
let files2 = await dataSheetSku.GenerateAllInOneExportFile(sourceGuid, json.option1PerPage, displayModeVariant, json.multiColumns);
|
|
7631
8110
|
dataSheetSku = null;
|
|
@@ -7784,6 +8263,29 @@ class DataSheetController {
|
|
|
7784
8263
|
return [];
|
|
7785
8264
|
}
|
|
7786
8265
|
}
|
|
8266
|
+
async updateCalloutsList(templateGuid, forceRefresh = false) {
|
|
8267
|
+
const singleton = DataSheetSingleton.getInstance();
|
|
8268
|
+
const cached = singleton.getCallouts(templateGuid);
|
|
8269
|
+
if (!forceRefresh && cached && cached.length > 0) {
|
|
8270
|
+
return cached;
|
|
8271
|
+
}
|
|
8272
|
+
try {
|
|
8273
|
+
const res = await this._publicationsTemplates
|
|
8274
|
+
.getTemplateCallouts(templateGuid)
|
|
8275
|
+
.toPromise();
|
|
8276
|
+
const rawCallouts = res?.['callouts'] ||
|
|
8277
|
+
res?.['productBlocks'] ||
|
|
8278
|
+
res ||
|
|
8279
|
+
[];
|
|
8280
|
+
const callouts = await this.loadGabaritsSvg(Array.isArray(rawCallouts) ? rawCallouts : []);
|
|
8281
|
+
singleton.setCallouts(templateGuid, callouts);
|
|
8282
|
+
return callouts;
|
|
8283
|
+
}
|
|
8284
|
+
catch (e) {
|
|
8285
|
+
console.error('Erreur dans updateCalloutsList :', e);
|
|
8286
|
+
return [];
|
|
8287
|
+
}
|
|
8288
|
+
}
|
|
7787
8289
|
async updateBackgroundsList(templateGuid, forceRefresh = false) {
|
|
7788
8290
|
const singleton = DataSheetSingleton.getInstance();
|
|
7789
8291
|
const cached = singleton.getBackgrounds(templateGuid);
|
|
@@ -7854,6 +8356,9 @@ class DataSheetController {
|
|
|
7854
8356
|
return [];
|
|
7855
8357
|
}
|
|
7856
8358
|
}
|
|
8359
|
+
clearTemplatesCache(templateGuid) {
|
|
8360
|
+
DataSheetSingleton.getInstance().clearTemplatesCache(templateGuid);
|
|
8361
|
+
}
|
|
7857
8362
|
async loadGabaritsSvg(gabarits) {
|
|
7858
8363
|
const loadedGabarits = [];
|
|
7859
8364
|
for (let template of gabarits) {
|