shareneus 1.5.68 → 1.5.70
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.
|
@@ -63,7 +63,6 @@ function GetInvoicePdfDataUrl(PDFInvoiceData = {}, PrintConfigData = {}, printCo
|
|
|
63
63
|
// });
|
|
64
64
|
}
|
|
65
65
|
function buildPdfDocDefinition(PDFInvoiceData = {}, PrintConfigData = {}, printCopies = []) {
|
|
66
|
-
console.log('Building PDF with data:', PDFInvoiceData);
|
|
67
66
|
const PrintConfig = normalizePrintConfig(PDFInvoiceData, PrintConfigData);
|
|
68
67
|
const pageOrientation = (0, pdf_header_footer_section_1.resolvePageOrientation)(PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.PageOrientation);
|
|
69
68
|
const pageMargins = (0, pdf_header_footer_section_1.resolvePageMargins)(PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.pageMargins);
|
|
@@ -71,9 +70,9 @@ function buildPdfDocDefinition(PDFInvoiceData = {}, PrintConfigData = {}, printC
|
|
|
71
70
|
const copyLabels = normalizeCopyLabels(printCopies);
|
|
72
71
|
const watermark = (0, pdf_header_footer_section_1.buildWatermark)(PrintConfig);
|
|
73
72
|
const background = (0, pdf_header_footer_section_1.buildLogoWatermarkBackground)(PrintConfig, PDFInvoiceData);
|
|
73
|
+
console.log('Normalized PrintConfig:', PrintConfig);
|
|
74
74
|
const footer = (0, pdf_header_footer_section_1.buildFooter)(PrintConfig);
|
|
75
75
|
const content = [];
|
|
76
|
-
console.log('Normalized PrintConfig:', PrintConfig);
|
|
77
76
|
copyLabels.forEach((copyLabel, index) => {
|
|
78
77
|
const invoiceHeaderContent = (0, pdf_header_footer_section_1.buildDocumentHeaderSection)(PrintConfig, PDFInvoiceData);
|
|
79
78
|
const invoiceHeadingContent = (0, pdf_header_footer_section_1.buildDocumentHeadingSection)(PDFInvoiceData, PrintConfig, availableWidth);
|
|
@@ -134,14 +133,12 @@ function normalizePrintConfig(PDFInvoiceData, PrintConfigData) {
|
|
|
134
133
|
const watermark = !!(config === null || config === void 0 ? void 0 : config.Watermark);
|
|
135
134
|
const watermarkEnabled = !!(config === null || config === void 0 ? void 0 : config.WatermarkEnabled);
|
|
136
135
|
const footerText = (0, pdf_shared_utils_1.toStr)((_b = config === null || config === void 0 ? void 0 : config.Footer) === null || _b === void 0 ? void 0 : _b.Text);
|
|
137
|
-
console.log('config?.headerStyles', config === null || config === void 0 ? void 0 : config.headerStyles);
|
|
138
136
|
const headerStyles = (0, pdf_header_footer_section_1.normalizeHeaderStyle)((_c = config === null || config === void 0 ? void 0 : config.headerStyles) !== null && _c !== void 0 ? _c : {
|
|
139
137
|
OrgNameFsize: config === null || config === void 0 ? void 0 : config.OrgNameFsize,
|
|
140
138
|
OrgNameClr: config === null || config === void 0 ? void 0 : config.OrgNameClr,
|
|
141
139
|
AdrsFsize: config === null || config === void 0 ? void 0 : config.AdrsFsize,
|
|
142
140
|
AdrsClr: config === null || config === void 0 ? void 0 : config.AdrsClr
|
|
143
141
|
});
|
|
144
|
-
console.log('headerStyles', headerStyles);
|
|
145
142
|
const fixedTo = normalizeFixedTo(config === null || config === void 0 ? void 0 : config.fixedTo);
|
|
146
143
|
return Object.assign(Object.assign({}, config), { itemsHeader,
|
|
147
144
|
headerData,
|
|
@@ -41,10 +41,10 @@ export declare function normalizeHeaderData(headerData: any): {
|
|
|
41
41
|
};
|
|
42
42
|
};
|
|
43
43
|
export declare function normalizeHeaderStyle(headerStyles: any): {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
OrgNameFsize: number;
|
|
45
|
+
OrgNameClr: string;
|
|
46
|
+
AdrsFsize: number;
|
|
47
|
+
AdrsClr: string;
|
|
48
48
|
};
|
|
49
49
|
export declare function resolvePageMargins(value: any): [number, number, number, number];
|
|
50
50
|
export declare function buildDocumentHeaderSection(PrintConfig: any, DocumentData?: any): {
|
|
@@ -73,10 +73,10 @@ function normalizeHeaderData(headerData) {
|
|
|
73
73
|
function normalizeHeaderStyle(headerStyles) {
|
|
74
74
|
var _a, _b, _c, _d;
|
|
75
75
|
return {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
OrgNameFsize: (0, pdf_shared_utils_1.readPositiveNumber)((_a = headerStyles === null || headerStyles === void 0 ? void 0 : headerStyles.orgNameFontSize) !== null && _a !== void 0 ? _a : headerStyles === null || headerStyles === void 0 ? void 0 : headerStyles.OrgNameFsize, DEFAULT_ORG_NAME_FONT_SIZE),
|
|
77
|
+
OrgNameClr: (0, pdf_shared_utils_1.normalizeColor)((_b = headerStyles === null || headerStyles === void 0 ? void 0 : headerStyles.orgNameFontColor) !== null && _b !== void 0 ? _b : headerStyles === null || headerStyles === void 0 ? void 0 : headerStyles.OrgNameClr, DEFAULT_ORG_NAME_FONT_COLOR),
|
|
78
|
+
AdrsFsize: (0, pdf_shared_utils_1.readPositiveNumber)((_c = headerStyles === null || headerStyles === void 0 ? void 0 : headerStyles.orgAddressFontSize) !== null && _c !== void 0 ? _c : headerStyles === null || headerStyles === void 0 ? void 0 : headerStyles.AdrsFsize, DEFAULT_ORG_ADDRESS_FONT_SIZE),
|
|
79
|
+
AdrsClr: (0, pdf_shared_utils_1.normalizeColor)((_d = headerStyles === null || headerStyles === void 0 ? void 0 : headerStyles.orgAddressFontColor) !== null && _d !== void 0 ? _d : headerStyles === null || headerStyles === void 0 ? void 0 : headerStyles.AdrsClr, DEFAULT_ORG_ADDRESS_FONT_COLOR)
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
82
|
function resolvePageMargins(value) {
|
|
@@ -104,7 +104,6 @@ function buildDocumentHeaderSection(PrintConfig, DocumentData = {}) {
|
|
|
104
104
|
const documentLogoDataUrl = resolveDocumentLogoDataUrl(DocumentData);
|
|
105
105
|
const headerData = normalizeHeaderData((_b = PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.headerData) !== null && _b !== void 0 ? _b : {});
|
|
106
106
|
const mergedHeaderData = normalizeHeaderData(Object.assign(Object.assign({}, headerData), { logoDataUrl: (0, pdf_shared_utils_1.firstValue)(documentLogoDataUrl, headerData === null || headerData === void 0 ? void 0 : headerData.logoDataUrl), organization: Object.assign(Object.assign({}, ((_c = headerData === null || headerData === void 0 ? void 0 : headerData.organization) !== null && _c !== void 0 ? _c : {})), { cName: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.CName, (_d = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _d === void 0 ? void 0 : _d.cName), address1: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.Adrs1, (_e = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _e === void 0 ? void 0 : _e.address1), address2: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.Adrs2, (_f = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _f === void 0 ? void 0 : _f.address2), dlNo: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.DLNo, entity === null || entity === void 0 ? void 0 : entity.DLNO, (_g = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _g === void 0 ? void 0 : _g.dlNo), gstin: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.GSTIN, (_h = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _h === void 0 ? void 0 : _h.gstin), pan: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.PAN, (_j = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _j === void 0 ? void 0 : _j.pan), city: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.City, (_k = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _k === void 0 ? void 0 : _k.city), state: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.State, (_l = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _l === void 0 ? void 0 : _l.state), pin: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.PIN, entity === null || entity === void 0 ? void 0 : entity.Pin, (_m = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _m === void 0 ? void 0 : _m.pin), email: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.Email, entity === null || entity === void 0 ? void 0 : entity.EMail, (_o = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _o === void 0 ? void 0 : _o.email), phone: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.Phone, entity === null || entity === void 0 ? void 0 : entity.Ph, (_p = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _p === void 0 ? void 0 : _p.phone), phone2: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.Phone2, entity === null || entity === void 0 ? void 0 : entity.Ph2, (_q = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _q === void 0 ? void 0 : _q.phone2) }) }));
|
|
107
|
-
console.log('PrintConfig?.headerStyles', PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.headerStyles);
|
|
108
107
|
const headerStyles = normalizeHeaderStyle((_r = PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.headerStyles) !== null && _r !== void 0 ? _r : {
|
|
109
108
|
OrgNameFsize: PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.OrgNameFsize,
|
|
110
109
|
OrgNameClr: PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.OrgNameClr,
|
|
@@ -197,17 +196,20 @@ function resolveDocumentLogoDataUrl(DocumentData) {
|
|
|
197
196
|
return (0, pdf_shared_utils_1.firstValue)((0, pdf_shared_utils_1.asDataUrl)(DocumentData === null || DocumentData === void 0 ? void 0 : DocumentData.logoDataUrl), (0, pdf_shared_utils_1.asDataUrl)(DocumentData === null || DocumentData === void 0 ? void 0 : DocumentData.LogoDataUrl), (0, pdf_shared_utils_1.asDataUrl)(DocumentData === null || DocumentData === void 0 ? void 0 : DocumentData.Image), (0, pdf_shared_utils_1.asDataUrl)(DocumentData === null || DocumentData === void 0 ? void 0 : DocumentData.Logo), (0, pdf_shared_utils_1.asDataUrl)(entity === null || entity === void 0 ? void 0 : entity.Image), (0, pdf_shared_utils_1.asDataUrl)(entity === null || entity === void 0 ? void 0 : entity.Logo), (0, pdf_shared_utils_1.asDataUrl)(entity === null || entity === void 0 ? void 0 : entity.CLogo), (0, pdf_shared_utils_1.asDataUrl)(entity === null || entity === void 0 ? void 0 : entity.LogoDataUrl));
|
|
198
197
|
}
|
|
199
198
|
function buildFooter(PrintConfig) {
|
|
200
|
-
var _a, _b, _c
|
|
201
|
-
|
|
202
|
-
const
|
|
199
|
+
var _a, _b, _c;
|
|
200
|
+
console.log('buildFooter PrintConfig', PrintConfig);
|
|
201
|
+
const footerConfig = (_a = PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.Footer) !== null && _a !== void 0 ? _a : {};
|
|
202
|
+
const showFooter = (footerConfig === null || footerConfig === void 0 ? void 0 : footerConfig.Show) !== false;
|
|
203
|
+
console.log('Footer Show:', showFooter);
|
|
203
204
|
if (!showFooter) {
|
|
204
205
|
return null;
|
|
205
206
|
}
|
|
206
|
-
const value = (0, pdf_shared_utils_1.firstValue)((
|
|
207
|
+
const value = (0, pdf_shared_utils_1.firstValue)((_b = footerConfig === null || footerConfig === void 0 ? void 0 : footerConfig.Text) !== null && _b !== void 0 ? _b : PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.FooterText);
|
|
208
|
+
console.log('Footer Text:', value);
|
|
207
209
|
if (!value) {
|
|
208
210
|
return null;
|
|
209
211
|
}
|
|
210
|
-
const textAlignment = normalizeFooterAlignment((
|
|
212
|
+
const textAlignment = normalizeFooterAlignment((_c = footerConfig === null || footerConfig === void 0 ? void 0 : footerConfig.Position) !== null && _c !== void 0 ? _c : footerConfig === null || footerConfig === void 0 ? void 0 : footerConfig.Position);
|
|
211
213
|
const pageAlignment = textAlignment === 'right' ? 'left' : 'right';
|
|
212
214
|
return (_currentPage, pageCount) => ({
|
|
213
215
|
margin: [20, 0, 20, 6],
|
|
@@ -228,7 +230,6 @@ function normalizeFooterAlignment(value) {
|
|
|
228
230
|
return 'left';
|
|
229
231
|
}
|
|
230
232
|
function buildOrganizationStack(organization, headerStyles, alignment) {
|
|
231
|
-
console.log('headerStyles', headerStyles);
|
|
232
233
|
const stack = [];
|
|
233
234
|
const orgNameFontSize = (0, pdf_shared_utils_1.readPositiveNumber)(headerStyles === null || headerStyles === void 0 ? void 0 : headerStyles.OrgNameFsize, DEFAULT_ORG_NAME_FONT_SIZE);
|
|
234
235
|
const orgAddressFontSize = (0, pdf_shared_utils_1.readPositiveNumber)(headerStyles === null || headerStyles === void 0 ? void 0 : headerStyles.AdrsFsize, DEFAULT_ORG_ADDRESS_FONT_SIZE);
|