shareneus 1.5.69 → 1.5.71
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);
|
|
@@ -73,7 +72,6 @@ function buildPdfDocDefinition(PDFInvoiceData = {}, PrintConfigData = {}, printC
|
|
|
73
72
|
const background = (0, pdf_header_footer_section_1.buildLogoWatermarkBackground)(PrintConfig, PDFInvoiceData);
|
|
74
73
|
const footer = (0, pdf_header_footer_section_1.buildFooter)(PrintConfig);
|
|
75
74
|
const content = [];
|
|
76
|
-
console.log('Normalized PrintConfig:', PrintConfig);
|
|
77
75
|
copyLabels.forEach((copyLabel, index) => {
|
|
78
76
|
const invoiceHeaderContent = (0, pdf_header_footer_section_1.buildDocumentHeaderSection)(PrintConfig, PDFInvoiceData);
|
|
79
77
|
const invoiceHeadingContent = (0, pdf_header_footer_section_1.buildDocumentHeadingSection)(PDFInvoiceData, PrintConfig, availableWidth);
|
|
@@ -134,14 +132,12 @@ function normalizePrintConfig(PDFInvoiceData, PrintConfigData) {
|
|
|
134
132
|
const watermark = !!(config === null || config === void 0 ? void 0 : config.Watermark);
|
|
135
133
|
const watermarkEnabled = !!(config === null || config === void 0 ? void 0 : config.WatermarkEnabled);
|
|
136
134
|
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
135
|
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
136
|
OrgNameFsize: config === null || config === void 0 ? void 0 : config.OrgNameFsize,
|
|
140
137
|
OrgNameClr: config === null || config === void 0 ? void 0 : config.OrgNameClr,
|
|
141
138
|
AdrsFsize: config === null || config === void 0 ? void 0 : config.AdrsFsize,
|
|
142
139
|
AdrsClr: config === null || config === void 0 ? void 0 : config.AdrsClr
|
|
143
140
|
});
|
|
144
|
-
console.log('headerStyles', headerStyles);
|
|
145
141
|
const fixedTo = normalizeFixedTo(config === null || config === void 0 ? void 0 : config.fixedTo);
|
|
146
142
|
return Object.assign(Object.assign({}, config), { itemsHeader,
|
|
147
143
|
headerData,
|
|
@@ -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,17 @@ 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
|
-
const footerConfig = (
|
|
202
|
-
const showFooter = (footerConfig === null || footerConfig === void 0 ? void 0 : footerConfig.Show) !== false
|
|
199
|
+
var _a, _b, _c;
|
|
200
|
+
const footerConfig = (_a = PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.Footer) !== null && _a !== void 0 ? _a : {};
|
|
201
|
+
const showFooter = (footerConfig === null || footerConfig === void 0 ? void 0 : footerConfig.Show) !== false;
|
|
203
202
|
if (!showFooter) {
|
|
204
203
|
return null;
|
|
205
204
|
}
|
|
206
|
-
const value = (0, pdf_shared_utils_1.firstValue)((
|
|
205
|
+
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);
|
|
207
206
|
if (!value) {
|
|
208
207
|
return null;
|
|
209
208
|
}
|
|
210
|
-
const textAlignment = normalizeFooterAlignment((
|
|
209
|
+
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
210
|
const pageAlignment = textAlignment === 'right' ? 'left' : 'right';
|
|
212
211
|
return (_currentPage, pageCount) => ({
|
|
213
212
|
margin: [20, 0, 20, 6],
|
|
@@ -228,7 +227,6 @@ function normalizeFooterAlignment(value) {
|
|
|
228
227
|
return 'left';
|
|
229
228
|
}
|
|
230
229
|
function buildOrganizationStack(organization, headerStyles, alignment) {
|
|
231
|
-
console.log('headerStyles', headerStyles);
|
|
232
230
|
const stack = [];
|
|
233
231
|
const orgNameFontSize = (0, pdf_shared_utils_1.readPositiveNumber)(headerStyles === null || headerStyles === void 0 ? void 0 : headerStyles.OrgNameFsize, DEFAULT_ORG_NAME_FONT_SIZE);
|
|
234
232
|
const orgAddressFontSize = (0, pdf_shared_utils_1.readPositiveNumber)(headerStyles === null || headerStyles === void 0 ? void 0 : headerStyles.AdrsFsize, DEFAULT_ORG_ADDRESS_FONT_SIZE);
|