@solidpepper/solidpepper-solidgeneration 0.1.4 → 0.1.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.
|
@@ -2864,6 +2864,8 @@ class DataSheetSVG {
|
|
|
2864
2864
|
newVal = new Date().toLocaleDateString('fr-FR');
|
|
2865
2865
|
return newVal;
|
|
2866
2866
|
}
|
|
2867
|
+
const attrObj = jRowSku['attributeObject'] || [];
|
|
2868
|
+
const attrPub = jRowSku['attributePublication'] || [];
|
|
2867
2869
|
if (jRowSku.hasOwnProperty(field) &&
|
|
2868
2870
|
!idVal.toLowerCase().includes('sku images') &&
|
|
2869
2871
|
(tag == null || tag.Image == false)) {
|
|
@@ -2875,84 +2877,128 @@ class DataSheetSVG {
|
|
|
2875
2877
|
}
|
|
2876
2878
|
}
|
|
2877
2879
|
else if (tag != null && tag.Image == true) {
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2880
|
+
let index = parseInt(tag.XmlTag.getAttribute('number'));
|
|
2881
|
+
if (jRowSku[field] != null) {
|
|
2882
|
+
newVal = jRowSku[field];
|
|
2883
|
+
let valuePairs = new Map();
|
|
2884
|
+
let i = 0;
|
|
2885
|
+
newVal.split('#').forEach((asset) => {
|
|
2886
|
+
if (asset.trim() !== '') {
|
|
2887
|
+
valuePairs.set(i, asset);
|
|
2888
|
+
i += 1;
|
|
2889
|
+
}
|
|
2890
|
+
});
|
|
2891
|
+
if (index !== 0) {
|
|
2892
|
+
if (valuePairs.has(index - 1)) {
|
|
2893
|
+
newVal = valuePairs.get(index - 1);
|
|
2894
|
+
}
|
|
2895
|
+
else {
|
|
2896
|
+
newVal = '';
|
|
2897
|
+
}
|
|
2898
|
+
}
|
|
2899
|
+
else {
|
|
2900
|
+
if (valuePairs.has(index)) {
|
|
2901
|
+
newVal = valuePairs.get(index);
|
|
2902
|
+
}
|
|
2903
|
+
else {
|
|
2904
|
+
newVal = '';
|
|
2905
|
+
}
|
|
2906
|
+
}
|
|
2907
|
+
}
|
|
2908
|
+
else if (attrObj.filter((x) => x.hasOwnProperty(field)) != undefined &&
|
|
2909
|
+
attrObj.filter((x) => x.hasOwnProperty(field)) != null &&
|
|
2910
|
+
attrObj.find((obj) => obj.hasOwnProperty(field)) != undefined &&
|
|
2911
|
+
attrObj.find((obj) => obj.hasOwnProperty(field)) != null) {
|
|
2912
|
+
newVal = attrObj.find((obj) => obj.hasOwnProperty(field))[field];
|
|
2913
|
+
let valuePairs = new Map();
|
|
2914
|
+
let i = 0;
|
|
2915
|
+
if (newVal != null) {
|
|
2884
2916
|
newVal.split('#').forEach((asset) => {
|
|
2885
2917
|
if (asset.trim() !== '') {
|
|
2886
2918
|
valuePairs.set(i, asset);
|
|
2887
2919
|
i += 1;
|
|
2888
2920
|
}
|
|
2889
2921
|
});
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
else {
|
|
2895
|
-
newVal = '';
|
|
2896
|
-
}
|
|
2922
|
+
}
|
|
2923
|
+
if (index !== 0) {
|
|
2924
|
+
if (valuePairs.has(index - 1)) {
|
|
2925
|
+
newVal = valuePairs.get(index - 1);
|
|
2897
2926
|
}
|
|
2898
2927
|
else {
|
|
2899
|
-
|
|
2900
|
-
newVal = valuePairs.get(index);
|
|
2901
|
-
}
|
|
2902
|
-
else {
|
|
2903
|
-
newVal = '';
|
|
2904
|
-
}
|
|
2928
|
+
newVal = '';
|
|
2905
2929
|
}
|
|
2906
2930
|
}
|
|
2907
|
-
else
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
jRowSku['attributeObject'].find((obj) => obj.hasOwnProperty(field)) != null) {
|
|
2911
|
-
newVal = jRowSku['attributeObject'].find((obj) => obj.hasOwnProperty(field))[field];
|
|
2912
|
-
let valuePairs = new Map();
|
|
2913
|
-
let i = 0;
|
|
2914
|
-
if (newVal != null) {
|
|
2915
|
-
newVal.split('#').forEach((asset) => {
|
|
2916
|
-
if (asset.trim() !== '') {
|
|
2917
|
-
valuePairs.set(i, asset);
|
|
2918
|
-
i += 1;
|
|
2919
|
-
}
|
|
2920
|
-
});
|
|
2921
|
-
}
|
|
2922
|
-
if (index !== 0) {
|
|
2923
|
-
if (valuePairs.has(index - 1)) {
|
|
2924
|
-
newVal = valuePairs.get(index - 1);
|
|
2925
|
-
}
|
|
2926
|
-
else {
|
|
2927
|
-
newVal = '';
|
|
2928
|
-
}
|
|
2931
|
+
else {
|
|
2932
|
+
if (valuePairs.has(index)) {
|
|
2933
|
+
newVal = valuePairs.get(index);
|
|
2929
2934
|
}
|
|
2930
2935
|
else {
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2936
|
+
newVal = '';
|
|
2937
|
+
}
|
|
2938
|
+
}
|
|
2939
|
+
let urlBase = '';
|
|
2940
|
+
if (jRowSku['skuImagesDetail'] != null &&
|
|
2941
|
+
jRowSku['skuImagesDetail'] != '') {
|
|
2942
|
+
if (jRowSku['skuImagesDetail'][0] != null &&
|
|
2943
|
+
jRowSku['skuImagesDetail'][0] != '') {
|
|
2944
|
+
urlBase = jRowSku['skuImagesDetail'][0].assetUrlOriginal;
|
|
2945
|
+
urlBase = urlBase.substring(0, urlBase.lastIndexOf('/') + 1);
|
|
2937
2946
|
}
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2947
|
+
}
|
|
2948
|
+
if (urlBase != null &&
|
|
2949
|
+
urlBase != '' &&
|
|
2950
|
+
newVal != null &&
|
|
2951
|
+
newVal != '') {
|
|
2952
|
+
newVal = urlBase + newVal;
|
|
2953
|
+
}
|
|
2954
|
+
}
|
|
2955
|
+
else if (attrPub.filter((x) => x.hasOwnProperty(field)) != undefined &&
|
|
2956
|
+
attrPub.filter((x) => x.hasOwnProperty(field)) != null &&
|
|
2957
|
+
attrPub.find((obj) => obj.hasOwnProperty(field)) != undefined &&
|
|
2958
|
+
attrPub.find((obj) => obj.hasOwnProperty(field)) != null) {
|
|
2959
|
+
//console.log('ON EST LA');
|
|
2960
|
+
newVal = attrPub.find((obj) => obj.hasOwnProperty(field))[field];
|
|
2961
|
+
console.log(newVal);
|
|
2962
|
+
let valuePairs = new Map();
|
|
2963
|
+
let i = 0;
|
|
2964
|
+
if (newVal != null) {
|
|
2965
|
+
newVal.split('#').forEach((asset) => {
|
|
2966
|
+
if (asset.trim() !== '') {
|
|
2967
|
+
valuePairs.set(i, asset);
|
|
2968
|
+
i += 1;
|
|
2945
2969
|
}
|
|
2970
|
+
});
|
|
2971
|
+
}
|
|
2972
|
+
if (index !== 0) {
|
|
2973
|
+
if (valuePairs.has(index - 1)) {
|
|
2974
|
+
newVal = valuePairs.get(index - 1);
|
|
2946
2975
|
}
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
newVal != null &&
|
|
2950
|
-
newVal != '') {
|
|
2951
|
-
newVal = urlBase + newVal;
|
|
2976
|
+
else {
|
|
2977
|
+
newVal = '';
|
|
2952
2978
|
}
|
|
2953
2979
|
}
|
|
2954
2980
|
else {
|
|
2955
|
-
|
|
2981
|
+
if (valuePairs.has(index)) {
|
|
2982
|
+
newVal = valuePairs.get(index);
|
|
2983
|
+
}
|
|
2984
|
+
else {
|
|
2985
|
+
newVal = '';
|
|
2986
|
+
}
|
|
2987
|
+
}
|
|
2988
|
+
let urlBase = '';
|
|
2989
|
+
if (jRowSku['skuImagesDetail'] != null &&
|
|
2990
|
+
jRowSku['skuImagesDetail'] != '') {
|
|
2991
|
+
if (jRowSku['skuImagesDetail'][0] != null &&
|
|
2992
|
+
jRowSku['skuImagesDetail'][0] != '') {
|
|
2993
|
+
urlBase = jRowSku['skuImagesDetail'][0].assetUrlOriginal;
|
|
2994
|
+
urlBase = urlBase.substring(0, urlBase.lastIndexOf('/') + 1);
|
|
2995
|
+
}
|
|
2996
|
+
}
|
|
2997
|
+
if (urlBase != null &&
|
|
2998
|
+
urlBase != '' &&
|
|
2999
|
+
newVal != null &&
|
|
3000
|
+
newVal != '') {
|
|
3001
|
+
newVal = urlBase + newVal;
|
|
2956
3002
|
}
|
|
2957
3003
|
}
|
|
2958
3004
|
else {
|
|
@@ -4163,6 +4209,11 @@ class DataSheetSVG {
|
|
|
4163
4209
|
const table = foEl.querySelector('table');
|
|
4164
4210
|
if (!table)
|
|
4165
4211
|
return { width: 0, height: 0 };
|
|
4212
|
+
let tableId = table.getAttribute('id');
|
|
4213
|
+
if (!tableId) {
|
|
4214
|
+
tableId = 'generation-table-' + Math.random().toString(36).substr(2, 9);
|
|
4215
|
+
table.setAttribute('id', tableId);
|
|
4216
|
+
}
|
|
4166
4217
|
const foWidth = parseFloat(foEl.getAttribute('width')) ||
|
|
4167
4218
|
foEl.getBoundingClientRect().width ||
|
|
4168
4219
|
0;
|
|
@@ -4188,7 +4239,7 @@ class DataSheetSVG {
|
|
|
4188
4239
|
tempDiv.style.top = '-9999px';
|
|
4189
4240
|
tempDiv.style.width = 'auto';
|
|
4190
4241
|
document.body.appendChild(tempDiv);
|
|
4191
|
-
const tableElement = tempDiv.querySelector(
|
|
4242
|
+
const tableElement = tempDiv.querySelector(`#${tableId}`);
|
|
4192
4243
|
if (!tableElement) {
|
|
4193
4244
|
document.body.removeChild(tempDiv);
|
|
4194
4245
|
return { width: 0, height: 0 };
|