@solidpepper/solidpepper-solidgeneration 0.2.5 → 0.2.6
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.
|
@@ -1095,7 +1095,7 @@ class DataSheetSVG {
|
|
|
1095
1095
|
}
|
|
1096
1096
|
}
|
|
1097
1097
|
else {
|
|
1098
|
-
console.
|
|
1098
|
+
console.error('[ERROR] RowTotalWidth is 0, this should not happen.');
|
|
1099
1099
|
}
|
|
1100
1100
|
}
|
|
1101
1101
|
}
|
|
@@ -1219,7 +1219,7 @@ class DataSheetSVG {
|
|
|
1219
1219
|
}
|
|
1220
1220
|
}
|
|
1221
1221
|
else {
|
|
1222
|
-
console.
|
|
1222
|
+
console.error('[ERROR] RowTotalWidth is 0, this should not happen.');
|
|
1223
1223
|
}
|
|
1224
1224
|
}
|
|
1225
1225
|
// Save for variant table (very useful)
|
|
@@ -2531,10 +2531,6 @@ class DataSheetSVG {
|
|
|
2531
2531
|
let fieldObject = this.DataSheet.fields[i];
|
|
2532
2532
|
if (fieldToSearch.includes('[') && fieldToSearch.includes(']')) {
|
|
2533
2533
|
let name = fieldToSearch.substring(fieldToSearch.indexOf('[') + 1, fieldToSearch.length - 1 - fieldToSearch.indexOf('[') - 1);
|
|
2534
|
-
// Debug case for new functionnality
|
|
2535
|
-
if (fieldToSearch.indexOf('CLASSIFICATION') == -1) {
|
|
2536
|
-
console.log('[INFO] Field not currently managed : ' + fieldToSearch);
|
|
2537
|
-
}
|
|
2538
2534
|
}
|
|
2539
2535
|
if (fieldObject['fieldsGroup']['key'].toString() !== 'p_categories') {
|
|
2540
2536
|
let fieldObjectFields = fieldObject['fields'];
|
|
@@ -3145,7 +3141,7 @@ class DataSheetSVG {
|
|
|
3145
3141
|
}
|
|
3146
3142
|
catch (e) {
|
|
3147
3143
|
val = '';
|
|
3148
|
-
console.
|
|
3144
|
+
console.error('[ERROR QR] ', e);
|
|
3149
3145
|
}
|
|
3150
3146
|
}
|
|
3151
3147
|
// Gestion Barcode
|
|
@@ -3160,7 +3156,7 @@ class DataSheetSVG {
|
|
|
3160
3156
|
}
|
|
3161
3157
|
catch (e) {
|
|
3162
3158
|
val = '';
|
|
3163
|
-
console.
|
|
3159
|
+
console.error('[ERROR Barcode] ', e);
|
|
3164
3160
|
}
|
|
3165
3161
|
}
|
|
3166
3162
|
val =
|
|
@@ -3676,7 +3672,6 @@ class DataSheetSVG {
|
|
|
3676
3672
|
}
|
|
3677
3673
|
else if (idVal.toLowerCase().includes('sku images')) {
|
|
3678
3674
|
// TODO
|
|
3679
|
-
console.log('todo');
|
|
3680
3675
|
}
|
|
3681
3676
|
else if (field.includes('skuDiscount')) {
|
|
3682
3677
|
let priceStart = null;
|
|
@@ -4375,7 +4370,7 @@ class DataSheetSVG {
|
|
|
4375
4370
|
newVal = await this.GenerateBarcode(tag, newVal);
|
|
4376
4371
|
}
|
|
4377
4372
|
catch (e) {
|
|
4378
|
-
console.
|
|
4373
|
+
console.error('[ERROR] Error generating Barcode: ', e);
|
|
4379
4374
|
newVal = '';
|
|
4380
4375
|
}
|
|
4381
4376
|
}
|
|
@@ -4399,7 +4394,7 @@ class DataSheetSVG {
|
|
|
4399
4394
|
newVal = await this.GenerateQRCode(tag, newVal);
|
|
4400
4395
|
}
|
|
4401
4396
|
catch (e) {
|
|
4402
|
-
console.
|
|
4397
|
+
console.error('[ERROR] Error generating QRCode: ', e);
|
|
4403
4398
|
newVal = '';
|
|
4404
4399
|
}
|
|
4405
4400
|
}
|
|
@@ -4414,7 +4409,7 @@ class DataSheetSVG {
|
|
|
4414
4409
|
newVal = await this.GenerateQRCode(tag, newVal);
|
|
4415
4410
|
}
|
|
4416
4411
|
catch (e) {
|
|
4417
|
-
console.
|
|
4412
|
+
console.error('[ERROR] Error generating QRCode: ', e);
|
|
4418
4413
|
newVal = '';
|
|
4419
4414
|
}
|
|
4420
4415
|
}
|
|
@@ -4433,7 +4428,7 @@ class DataSheetSVG {
|
|
|
4433
4428
|
newVal = await this.GenerateQRCode(tag, newVal);
|
|
4434
4429
|
}
|
|
4435
4430
|
catch (e) {
|
|
4436
|
-
console.
|
|
4431
|
+
console.error('[ERROR] Error generating QRCode: ', e);
|
|
4437
4432
|
newVal = '';
|
|
4438
4433
|
}
|
|
4439
4434
|
}
|
|
@@ -4875,9 +4870,6 @@ class DataSheetSVG {
|
|
|
4875
4870
|
let domObjects = dom.querySelectorAll('*');
|
|
4876
4871
|
tag.XmlTag = domObjects[0];
|
|
4877
4872
|
}
|
|
4878
|
-
else {
|
|
4879
|
-
console.log('[DEBUG] Error during newVal for VariantsTable');
|
|
4880
|
-
}
|
|
4881
4873
|
}
|
|
4882
4874
|
else if (tag.Barcode == true || tag.QRCode == true) {
|
|
4883
4875
|
if (newVal != '') {
|
|
@@ -5010,7 +5002,7 @@ class DataSheetSVG {
|
|
|
5010
5002
|
}
|
|
5011
5003
|
}
|
|
5012
5004
|
else {
|
|
5013
|
-
console.
|
|
5005
|
+
console.error('[ERROR] Getting a parameters', newVal);
|
|
5014
5006
|
tag.XmlTag = null;
|
|
5015
5007
|
}
|
|
5016
5008
|
}
|
|
@@ -5287,14 +5279,16 @@ class DataSheetSVG {
|
|
|
5287
5279
|
if (tagToUpdate.XmlTag.hasAttribute('width')) {
|
|
5288
5280
|
const w = tagToUpdate.XmlTag.getAttribute('width');
|
|
5289
5281
|
element.setAttribute('width', w);
|
|
5290
|
-
if (element.style &&
|
|
5282
|
+
if (element.style &&
|
|
5283
|
+
element.style.width) {
|
|
5291
5284
|
element.style.width = w + 'px';
|
|
5292
5285
|
}
|
|
5293
5286
|
}
|
|
5294
5287
|
if (tagToUpdate.XmlTag.hasAttribute('height')) {
|
|
5295
5288
|
const h = tagToUpdate.XmlTag.getAttribute('height');
|
|
5296
5289
|
element.setAttribute('height', h);
|
|
5297
|
-
if (element.style &&
|
|
5290
|
+
if (element.style &&
|
|
5291
|
+
element.style.height) {
|
|
5298
5292
|
element.style.height = h + 'px';
|
|
5299
5293
|
}
|
|
5300
5294
|
}
|
|
@@ -6614,7 +6608,7 @@ class DataSheetSVG {
|
|
|
6614
6608
|
return null;
|
|
6615
6609
|
}
|
|
6616
6610
|
catch (e) {
|
|
6617
|
-
console.
|
|
6611
|
+
console.error('[ERROR] An error occured during getting url', e);
|
|
6618
6612
|
return null;
|
|
6619
6613
|
}
|
|
6620
6614
|
}
|
|
@@ -6941,6 +6935,7 @@ class DataSheetSku {
|
|
|
6941
6935
|
}
|
|
6942
6936
|
let lstSkuObjects = res?.sku || [];
|
|
6943
6937
|
if (lstSkuObjects == null || lstSkuObjects.length === 0) {
|
|
6938
|
+
console.error('[DATASHEET-GENERATION][DataSheetSku] lstSkuObjects is null or empty for SKU:', sourceId);
|
|
6944
6939
|
this.DataSheet.currentStep = 99;
|
|
6945
6940
|
return [];
|
|
6946
6941
|
}
|
|
@@ -6969,6 +6964,9 @@ class DataSheetSku {
|
|
|
6969
6964
|
let pages = [];
|
|
6970
6965
|
let background = this.DataSheetSVG.getBackgroundSectionForPreview(section);
|
|
6971
6966
|
let backgroundTpl = background?.svgImage || '';
|
|
6967
|
+
if (!background || !backgroundTpl) {
|
|
6968
|
+
console.error('[DATASHEET-GENERATION][DataSheetSku] Background or SVG image is missing for section:', section, 'background object:', background);
|
|
6969
|
+
}
|
|
6972
6970
|
let allBackgroundTags = this.DataSheetSVG.GetSvgGroupToReplace(backgroundTpl);
|
|
6973
6971
|
let allElements = this.DataSheetSVG.GetAllTags(backgroundTpl);
|
|
6974
6972
|
let group = false;
|
|
@@ -7096,14 +7094,32 @@ class DataSheetSku {
|
|
|
7096
7094
|
const pageConfig = pagesConfigs[p];
|
|
7097
7095
|
let currentBackgroundTpl = backgroundTpl;
|
|
7098
7096
|
if (pageConfig) {
|
|
7099
|
-
|
|
7100
|
-
|
|
7097
|
+
const bgGuid = pageConfig.backgroundGuid || pageConfig.background;
|
|
7098
|
+
let bg = null;
|
|
7099
|
+
if (bgGuid) {
|
|
7100
|
+
const cleanBg = String(bgGuid).trim().toLowerCase();
|
|
7101
|
+
bg = (this.DataSheet.backgrounds || []).find((b) => (b.guid && String(b.guid).toLowerCase() === cleanBg) ||
|
|
7102
|
+
(b.name && String(b.name).toLowerCase() === cleanBg) ||
|
|
7103
|
+
(b.nameNoSvg && String(b.nameNoSvg).toLowerCase() === cleanBg) ||
|
|
7104
|
+
(b.name && String(b.name).toLowerCase().replace('.svg', '') === cleanBg.replace('.svg', '')));
|
|
7101
7105
|
if (bg && bg.svgImage) {
|
|
7102
7106
|
currentBackgroundTpl = bg.svgImage;
|
|
7103
7107
|
}
|
|
7104
7108
|
}
|
|
7105
|
-
|
|
7106
|
-
|
|
7109
|
+
const gabGuid = pageConfig.gabaritGuid || pageConfig.gabarit;
|
|
7110
|
+
let gab = null;
|
|
7111
|
+
if (gabGuid) {
|
|
7112
|
+
const cleanGab = String(gabGuid).trim().toLowerCase();
|
|
7113
|
+
gab = (this.DataSheet.gabarits || []).find((g) => (g.guid && String(g.guid).toLowerCase() === cleanGab) ||
|
|
7114
|
+
(g.name && String(g.name).toLowerCase() === cleanGab) ||
|
|
7115
|
+
(g.nameNoSvg && String(g.nameNoSvg).toLowerCase() === cleanGab) ||
|
|
7116
|
+
(g.name && String(g.name).toLowerCase().replace('.svg', '') === cleanGab.replace('.svg', '')));
|
|
7117
|
+
if (gab) {
|
|
7118
|
+
this.DataSheet.defaultGabaritGuid = gab.guid || gab.name;
|
|
7119
|
+
}
|
|
7120
|
+
else {
|
|
7121
|
+
this.DataSheet.defaultGabaritGuid = gabGuid;
|
|
7122
|
+
}
|
|
7107
7123
|
}
|
|
7108
7124
|
}
|
|
7109
7125
|
let i = 0;
|
|
@@ -7141,7 +7157,7 @@ class DataSheetSku {
|
|
|
7141
7157
|
return arrayFiles;
|
|
7142
7158
|
}
|
|
7143
7159
|
catch (e) {
|
|
7144
|
-
console.
|
|
7160
|
+
console.error('[ERROR] Error in GenerateAllInOneExportFile:', e);
|
|
7145
7161
|
return null;
|
|
7146
7162
|
}
|
|
7147
7163
|
}
|
|
@@ -7198,7 +7214,6 @@ class DataSheetPublication {
|
|
|
7198
7214
|
else {
|
|
7199
7215
|
sections = [];
|
|
7200
7216
|
if (sections.length == 0) {
|
|
7201
|
-
console.log('[PUBLICATIONS] No pages detected try to get pages');
|
|
7202
7217
|
if (!this.publicationsService) {
|
|
7203
7218
|
throw new Error('PublicationsService instance is required');
|
|
7204
7219
|
}
|
|
@@ -7252,7 +7267,7 @@ class DataSheetPublication {
|
|
|
7252
7267
|
.toPromise();
|
|
7253
7268
|
let skus = res?.['skus'];
|
|
7254
7269
|
if (!Array.isArray(skus)) {
|
|
7255
|
-
console.
|
|
7270
|
+
console.error('[ERROR] No SKUs found for this page:', section.pageId);
|
|
7256
7271
|
skus = [];
|
|
7257
7272
|
}
|
|
7258
7273
|
for (let sku of skus) {
|
|
@@ -7769,7 +7784,7 @@ class DataSheetPublication {
|
|
|
7769
7784
|
return arrayFiles;
|
|
7770
7785
|
}
|
|
7771
7786
|
catch (e) {
|
|
7772
|
-
console.
|
|
7787
|
+
console.error('[ERROR] Error in GenerateAllInOneExportFilePublication:', e);
|
|
7773
7788
|
return null;
|
|
7774
7789
|
}
|
|
7775
7790
|
}
|
|
@@ -7939,18 +7954,29 @@ class DataSheetController {
|
|
|
7939
7954
|
}
|
|
7940
7955
|
let publication = null;
|
|
7941
7956
|
let templateGuid = '00000000-0000-0000-0000-000000000000';
|
|
7942
|
-
if (source == 2) {
|
|
7957
|
+
if (source == 2 || source == 7) {
|
|
7958
|
+
const pubGuid = source == 2 ? json.sourceGuid : json.publicationGuid;
|
|
7943
7959
|
publication = json.publication;
|
|
7944
7960
|
if (publication == null || publication == undefined) {
|
|
7945
|
-
|
|
7946
|
-
.
|
|
7947
|
-
|
|
7948
|
-
|
|
7961
|
+
try {
|
|
7962
|
+
const res = await this._publicationsService
|
|
7963
|
+
.getPublication(pubGuid)
|
|
7964
|
+
.toPromise();
|
|
7965
|
+
publication = res?.['publication'];
|
|
7966
|
+
}
|
|
7967
|
+
catch (e) {
|
|
7968
|
+
console.error('Error fetching publication info for datasheet generation:', e);
|
|
7969
|
+
}
|
|
7949
7970
|
}
|
|
7950
7971
|
if (publication) {
|
|
7951
|
-
dataSheet.
|
|
7952
|
-
|
|
7953
|
-
|
|
7972
|
+
if (!dataSheet.productSheetGuid && (publication.publicationProductSheetAssetGuid || publication.publicationproductsheetassetguid)) {
|
|
7973
|
+
dataSheet.productSheetGuid = publication.publicationProductSheetAssetGuid || publication.publicationproductsheetassetguid;
|
|
7974
|
+
}
|
|
7975
|
+
if (source == 2) {
|
|
7976
|
+
dataSheet.currentObjectName = publication.publicationName;
|
|
7977
|
+
startPageNumber = publication.startPageNumber || 1;
|
|
7978
|
+
dataSheet.leftPage = publication.publicationPageStartLeft === true;
|
|
7979
|
+
}
|
|
7954
7980
|
if (dataSheet.language == null ||
|
|
7955
7981
|
dataSheet.language === '' ||
|
|
7956
7982
|
dataSheet.language === undefined) {
|
|
@@ -7969,16 +7995,21 @@ class DataSheetController {
|
|
|
7969
7995
|
dataSheet.priceListGuid = '00000000-0000-0000-0000-000000000000';
|
|
7970
7996
|
}
|
|
7971
7997
|
}
|
|
7998
|
+
if (publication.publicationTemplateGuid) {
|
|
7999
|
+
templateGuid = publication.publicationTemplateGuid;
|
|
8000
|
+
}
|
|
8001
|
+
const pubPages = publication.publicationPages || publication.PublicationPages || publication._publicationPages || [];
|
|
8002
|
+
if ((!dataSheet.pagesSettings || dataSheet.pagesSettings.length === 0) && pubPages.length > 0) {
|
|
8003
|
+
dataSheet.pagesSettings = pubPages.map((page) => ({
|
|
8004
|
+
backgroundGuid: page.background || page.publicationpagebackground || page.backgroundGuid,
|
|
8005
|
+
gabaritGuid: page.gabarit || page.publicationpagedefaultgabarit || page.gabaritGuid,
|
|
8006
|
+
order: page.order || page.publicationpageorder || 0
|
|
8007
|
+
}));
|
|
8008
|
+
}
|
|
7972
8009
|
}
|
|
7973
|
-
// Template
|
|
7974
|
-
templateGuid =
|
|
7975
|
-
publication.publicationTemplateGuid ||
|
|
7976
|
-
'00000000-0000-0000-0000-000000000000';
|
|
7977
8010
|
}
|
|
7978
|
-
|
|
7979
|
-
|
|
7980
|
-
templateGuid = json.templateGuid;
|
|
7981
|
-
}
|
|
8011
|
+
if (json.templateGuid) {
|
|
8012
|
+
templateGuid = json.templateGuid;
|
|
7982
8013
|
}
|
|
7983
8014
|
dataSheet.publicationTemplateTemplateGuid = templateGuid;
|
|
7984
8015
|
if (dataSheet.defaultGabaritGuid == null ||
|
|
@@ -8017,12 +8048,14 @@ class DataSheetController {
|
|
|
8017
8048
|
if (dataSheet.gabarits == null ||
|
|
8018
8049
|
dataSheet.gabarits == undefined ||
|
|
8019
8050
|
dataSheet.gabarits.length === 0) {
|
|
8051
|
+
console.error('[DATASHEET-GENERATION][ERROR] Gabarits is empty for templateGuid:', templateGuid);
|
|
8020
8052
|
dataSheet.currentStep = 99;
|
|
8021
8053
|
return [];
|
|
8022
8054
|
}
|
|
8023
8055
|
if (dataSheet.backgrounds == null ||
|
|
8024
8056
|
dataSheet.backgrounds == undefined ||
|
|
8025
8057
|
dataSheet.backgrounds.length === 0) {
|
|
8058
|
+
console.error('[DATASHEET-GENERATION][ERROR] Backgrounds is empty for templateGuid:', templateGuid);
|
|
8026
8059
|
dataSheet.currentStep = 99;
|
|
8027
8060
|
return [];
|
|
8028
8061
|
}
|
|
@@ -8100,6 +8133,13 @@ class DataSheetController {
|
|
|
8100
8133
|
files = await dataSheetSku.GenerateAllInOneExportFile(json.sourceGuid, json.option1PerPage, displayModeVariant, json.multiColumns);
|
|
8101
8134
|
dataSheetSku = null;
|
|
8102
8135
|
break;
|
|
8136
|
+
case 7: // Datasheet (Publication Datasheet SKU)
|
|
8137
|
+
let dataSheet7 = new DataSheetSku(dataSheetSVG, dataSheet);
|
|
8138
|
+
dataSheet7.setDataSheetsController(this);
|
|
8139
|
+
dataSheet7.setPublicationsService(this._publicationsService);
|
|
8140
|
+
files = await dataSheet7.GenerateAllInOneExportFile(json.sourceGuid, json.option1PerPage, displayModeVariant, json.multiColumns);
|
|
8141
|
+
dataSheet7 = null;
|
|
8142
|
+
break;
|
|
8103
8143
|
case 4: // Variants
|
|
8104
8144
|
for (let sourceGuid of sourceGuids) {
|
|
8105
8145
|
dataSheet.progress = 25;
|
|
@@ -8119,7 +8159,7 @@ class DataSheetController {
|
|
|
8119
8159
|
dataSheet.currentStep = 3;
|
|
8120
8160
|
if (files == null || files == undefined || files.length === 0) {
|
|
8121
8161
|
dataSheet.currentStep = 99;
|
|
8122
|
-
console.
|
|
8162
|
+
console.error('[ERROR] Files is null or undefined or empty');
|
|
8123
8163
|
return [];
|
|
8124
8164
|
}
|
|
8125
8165
|
if (dataSheet.preview) {
|