makeapps-transformer 1.0.6 → 1.0.8
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.
|
@@ -24,11 +24,12 @@ function generatePodmiot2(podmiot2) {
|
|
|
24
24
|
}
|
|
25
25
|
if (podmiot2.DaneKontaktowe || podmiot2.NrKlienta) {
|
|
26
26
|
result.push((0, PDF_functions_1.formatText)('Dane kontaktowe', [common_enum_1.default.Label, common_enum_1.default.LabelMargin]), ...(0, PodmiotDaneKontaktowe_1.generateDaneKontaktowe)((_a = podmiot2.DaneKontaktowe) !== null && _a !== void 0 ? _a : []), (0, PDF_functions_1.createLabelText)('Numer klienta: ', podmiot2.NrKlienta));
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
}
|
|
28
|
+
if (podmiot2.JST) {
|
|
29
|
+
result.push((0, PDF_functions_1.createLabelText)('Faktura dotyczy jednostki podrzędnej JST: ', ((_b = podmiot2.JST) === null || _b === void 0 ? void 0 : _b._text) === '1' ? 'TAK' : 'NIE', common_enum_1.default.Default, { marginTop: 8 }));
|
|
30
|
+
}
|
|
31
|
+
if (podmiot2.GV) {
|
|
32
|
+
result.push((0, PDF_functions_1.createLabelText)('Faktura dotyczy członka grupy GV: ', ((_c = podmiot2.GV) === null || _c === void 0 ? void 0 : _c._text) === '1' ? 'TAK' : 'NIE', common_enum_1.default.Default, podmiot2.JST ? {} : { marginTop: 8 }));
|
|
32
33
|
}
|
|
33
34
|
return result;
|
|
34
35
|
}
|
|
@@ -49,6 +49,7 @@ exports.getTable = getTable;
|
|
|
49
49
|
exports.getRowTable = getRowTable;
|
|
50
50
|
exports.hasColumnsValue = hasColumnsValue;
|
|
51
51
|
exports.getDifferentColumnsValue = getDifferentColumnsValue;
|
|
52
|
+
exports.makeBreakable = makeBreakable;
|
|
52
53
|
exports.getContentTable = getContentTable;
|
|
53
54
|
exports.generateTwoColumns = generateTwoColumns;
|
|
54
55
|
exports.generateQRCode = generateQRCode;
|
|
@@ -347,6 +348,12 @@ function getDifferentColumnsValue(name, data) {
|
|
|
347
348
|
});
|
|
348
349
|
return result;
|
|
349
350
|
}
|
|
351
|
+
function makeBreakable(value, wordBreak = 40) {
|
|
352
|
+
if (typeof value === 'string') {
|
|
353
|
+
return value.replace(new RegExp(`(.{${wordBreak}})`, 'g'), '$1\u200B');
|
|
354
|
+
}
|
|
355
|
+
return value;
|
|
356
|
+
}
|
|
350
357
|
function getContentTable(headers, data, defaultWidths, margin) {
|
|
351
358
|
const fieldsWithValue = headers.filter((header) => {
|
|
352
359
|
return data.some((d) => {
|
|
@@ -373,7 +380,7 @@ function getContentTable(headers, data, defaultWidths, margin) {
|
|
|
373
380
|
var _a, _b;
|
|
374
381
|
const fp = (header.name ? row[header.name] : row);
|
|
375
382
|
const value = typeof fp === 'object' ? fp === null || fp === void 0 ? void 0 : fp._text : fp;
|
|
376
|
-
return formatText(header.mappingData && value ? header.mappingData[value] : (value !== null && value !== void 0 ? value : ''), (_a = header.format) !== null && _a !== void 0 ? _a : common_enum_1.default.Default, { rowSpan: (_b = fp === null || fp === void 0 ? void 0 : fp._rowSpan) !== null && _b !== void 0 ? _b : 1 });
|
|
383
|
+
return formatText(makeBreakable(header.mappingData && value ? header.mappingData[value] : (value !== null && value !== void 0 ? value : ''), 40), (_a = header.format) !== null && _a !== void 0 ? _a : common_enum_1.default.Default, { rowSpan: (_b = fp === null || fp === void 0 ? void 0 : fp._rowSpan) !== null && _b !== void 0 ? _b : 1 });
|
|
377
384
|
});
|
|
378
385
|
});
|
|
379
386
|
return {
|
package/package.json
CHANGED
|
@@ -37,19 +37,24 @@ export function generatePodmiot2(podmiot2: Podmiot2): Content[] {
|
|
|
37
37
|
...generateDaneKontaktowe(podmiot2.DaneKontaktowe ?? []),
|
|
38
38
|
createLabelText('Numer klienta: ', podmiot2.NrKlienta)
|
|
39
39
|
);
|
|
40
|
+
}
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
if (daneKontaktowe.length) {
|
|
44
|
-
createLabelText(
|
|
42
|
+
if (podmiot2.JST) {
|
|
43
|
+
result.push(createLabelText(
|
|
45
44
|
'Faktura dotyczy jednostki podrzędnej JST: ',
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
daneKontaktowe[0].GV?._text === '1' ? 'TAK' : 'NIE'
|
|
51
|
-
);
|
|
45
|
+
podmiot2.JST?._text === '1' ? 'TAK' : 'NIE',
|
|
46
|
+
FormatTyp.Default,
|
|
47
|
+
{ marginTop: 8 }
|
|
48
|
+
));
|
|
52
49
|
}
|
|
53
|
-
|
|
50
|
+
if (podmiot2.GV) {
|
|
51
|
+
result.push(createLabelText(
|
|
52
|
+
'Faktura dotyczy członka grupy GV: ',
|
|
53
|
+
podmiot2.GV?._text === '1' ? 'TAK' : 'NIE',
|
|
54
|
+
FormatTyp.Default,
|
|
55
|
+
podmiot2.JST ? {} : { marginTop: 8 }
|
|
56
|
+
));
|
|
57
|
+
}
|
|
58
|
+
|
|
54
59
|
return result;
|
|
55
60
|
}
|
|
@@ -361,6 +361,16 @@ export function getDifferentColumnsValue<T, K extends FilteredKeysOfValues<T>>(
|
|
|
361
361
|
return result;
|
|
362
362
|
}
|
|
363
363
|
|
|
364
|
+
export function makeBreakable(
|
|
365
|
+
value: string | number | undefined,
|
|
366
|
+
wordBreak = 40
|
|
367
|
+
): string | number | undefined {
|
|
368
|
+
if (typeof value === 'string') {
|
|
369
|
+
return value.replace(new RegExp(`(.{${wordBreak}})`, 'g'), '$1\u200B');
|
|
370
|
+
}
|
|
371
|
+
return value;
|
|
372
|
+
}
|
|
373
|
+
|
|
364
374
|
export function getContentTable<T>(
|
|
365
375
|
headers: HeaderDefine[],
|
|
366
376
|
data: T[],
|
|
@@ -370,7 +380,7 @@ export function getContentTable<T>(
|
|
|
370
380
|
const fieldsWithValue: HeaderDefine[] = headers.filter((header: HeaderDefine): boolean => {
|
|
371
381
|
return data.some((d: T): boolean => {
|
|
372
382
|
const name = header.name as keyof T;
|
|
373
|
-
|
|
383
|
+
|
|
374
384
|
if (name === '' && (d as FP)?._text) {
|
|
375
385
|
return true;
|
|
376
386
|
}
|
|
@@ -400,8 +410,8 @@ export function getContentTable<T>(
|
|
|
400
410
|
const fp = (header.name ? row[header.name as keyof T] : row) as PdfFP;
|
|
401
411
|
const value: string | undefined = typeof fp === 'object' ? fp?._text : fp;
|
|
402
412
|
|
|
403
|
-
return formatText(
|
|
404
|
-
header.mappingData && value ? header.mappingData[value] : (value ?? ''),
|
|
413
|
+
return formatText(
|
|
414
|
+
makeBreakable(header.mappingData && value ? header.mappingData[value] : (value ?? ''), 40),
|
|
405
415
|
header.format ?? FormatTyp.Default,
|
|
406
416
|
{ rowSpan: fp?._rowSpan ?? 1 }
|
|
407
417
|
);
|
|
@@ -436,12 +446,12 @@ export function generateTwoColumns(kol1: Column, kol2: Column, margin?: Margins)
|
|
|
436
446
|
export function generateQRCode(qrCode?: string): ContentQr | undefined {
|
|
437
447
|
return qrCode
|
|
438
448
|
? {
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
449
|
+
qr: qrCode,
|
|
450
|
+
fit: 150,
|
|
451
|
+
foreground: 'black',
|
|
452
|
+
background: 'white',
|
|
453
|
+
eccLevel: 'M',
|
|
454
|
+
}
|
|
445
455
|
: undefined;
|
|
446
456
|
}
|
|
447
457
|
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
"terminal.integrated.fontFamily": "Droid Sans Mono",
|
|
38
38
|
"terminal.integrated.fontSize": 13,
|
|
39
39
|
"window.autoDetectColorScheme": true,
|
|
40
|
-
"workbench.preferredDarkColorTheme": "
|
|
41
|
-
"workbench.preferredHighContrastColorTheme": "
|
|
42
|
-
"workbench.preferredLightColorTheme": "
|
|
40
|
+
"workbench.preferredDarkColorTheme": "Dark+",
|
|
41
|
+
"workbench.preferredHighContrastColorTheme": "Dark Modern",
|
|
42
|
+
"workbench.preferredLightColorTheme": "Light+",
|
|
43
43
|
"editor.stickyScroll.enabled": false
|
|
44
44
|
}
|
|
45
45
|
}
|