shareneus 1.7.23 → 1.7.25

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.
@@ -422,15 +422,15 @@ function buildHeaderContentWithLogo(logoDataUrl, hasLogo, organizationStack, log
422
422
  return { stack: safeOrganizationStack };
423
423
  }
424
424
  const logoBlock = {
425
- width: 80,
425
+ width: 120,
426
426
  image: logoDataUrl,
427
- fit: [72, 72],
427
+ fit: [80, 80],
428
428
  margin: [0, 2, 6, 0]
429
429
  };
430
430
  if (logoPosition === 'Top') {
431
431
  return {
432
432
  stack: [
433
- { image: logoDataUrl, fit: [72, 72], alignment: textAlignment, margin: [0, 2, 0, 6] },
433
+ { image: logoDataUrl, fit: [80, 80], alignment: textAlignment, margin: [0, 2, 0, 6] },
434
434
  ...safeOrganizationStack
435
435
  ]
436
436
  };
@@ -452,7 +452,7 @@ function buildHeaderContentWithLogo(logoDataUrl, hasLogo, organizationStack, log
452
452
  logoBlock,
453
453
  {
454
454
  width: '*',
455
- marginLeft: -90,
455
+ marginLeft: textAlignment === 'center' ? -90 : 0,
456
456
  stack: safeOrganizationStack
457
457
  }
458
458
  ],
@@ -90,12 +90,12 @@ function getRenderableColumns(headerConfig, sType = '') {
90
90
  type: 'tax',
91
91
  taxKind: 'rate',
92
92
  dbField: 'IGST',
93
- width: getTaxSubWidth(header.width),
93
+ width: getTaxSubWidth(header.width, 'rate'),
94
94
  }, {
95
95
  type: 'tax',
96
96
  taxKind: 'amount',
97
97
  dbField: 'IGST',
98
- width: getTaxSubWidth(header.width),
98
+ width: getTaxSubWidth(header.width, 'amount'),
99
99
  });
100
100
  continue;
101
101
  }
@@ -127,12 +127,12 @@ function getRenderableColumns(headerConfig, sType = '') {
127
127
  type: 'tax',
128
128
  taxKind: 'rate',
129
129
  dbField: 'CGST',
130
- width: getTaxSubWidth(header.width),
130
+ width: getTaxSubWidth(header.width, 'rate'),
131
131
  }, {
132
132
  type: 'tax',
133
133
  taxKind: 'amount',
134
134
  dbField: 'CGST',
135
- width: getTaxSubWidth(header.width),
135
+ width: getTaxSubWidth(header.width, 'amount'),
136
136
  });
137
137
  continue;
138
138
  }
@@ -141,12 +141,12 @@ function getRenderableColumns(headerConfig, sType = '') {
141
141
  type: 'tax',
142
142
  taxKind: 'rate',
143
143
  dbField: 'SGST',
144
- width: getTaxSubWidth(header.width),
144
+ width: getTaxSubWidth(header.width, 'rate'),
145
145
  }, {
146
146
  type: 'tax',
147
147
  taxKind: 'amount',
148
148
  dbField: 'SGST',
149
- width: getTaxSubWidth(header.width),
149
+ width: getTaxSubWidth(header.width, 'amount'),
150
150
  });
151
151
  continue;
152
152
  }
@@ -155,12 +155,12 @@ function getRenderableColumns(headerConfig, sType = '') {
155
155
  type: 'tax',
156
156
  taxKind: 'rate',
157
157
  dbField: 'CGST',
158
- width: getTaxSubWidth(header.width),
158
+ width: getTaxSubWidth(header.width, 'rate'),
159
159
  }, {
160
160
  type: 'tax',
161
161
  taxKind: 'rate',
162
162
  dbField: 'SGST',
163
- width: getTaxSubWidth(header.width),
163
+ width: getTaxSubWidth(header.width, 'rate'),
164
164
  });
165
165
  continue;
166
166
  }
@@ -169,12 +169,12 @@ function getRenderableColumns(headerConfig, sType = '') {
169
169
  type: 'tax',
170
170
  taxKind: 'amount',
171
171
  dbField: 'CGST',
172
- width: getTaxSubWidth(header.width),
172
+ width: getTaxSubWidth(header.width, 'amount'),
173
173
  }, {
174
174
  type: 'tax',
175
175
  taxKind: 'amount',
176
176
  dbField: 'SGST',
177
- width: getTaxSubWidth(header.width),
177
+ width: getTaxSubWidth(header.width, 'amount'),
178
178
  });
179
179
  continue;
180
180
  }
@@ -256,11 +256,12 @@ function buildHeaderRows(headerConfig, sType = '') {
256
256
  }
257
257
  return [topRow, subRow];
258
258
  }
259
- function getTaxSubWidth(width) {
259
+ function getTaxSubWidth(width, taxKind) {
260
260
  if (typeof width !== 'number') {
261
261
  return 'auto';
262
262
  }
263
- return Math.max(1, width / 2);
263
+ const ratio = taxKind === 'rate' ? 0.3 : 0.7;
264
+ return Math.max(1, width * ratio);
264
265
  }
265
266
  function isDiscountAmountHeader(text) {
266
267
  return text === 'Disc Amount' || text === 'Adisc Amount';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shareneus",
3
- "version": "1.7.23",
3
+ "version": "1.7.25",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -482,16 +482,16 @@ function buildHeaderContentWithLogo(
482
482
  }
483
483
 
484
484
  const logoBlock = {
485
- width: 80,
485
+ width: 120,
486
486
  image: logoDataUrl,
487
- fit: [72, 72],
487
+ fit: [80, 80],
488
488
  margin: [0, 2, 6, 0]
489
489
  };
490
490
 
491
491
  if (logoPosition === 'Top') {
492
492
  return {
493
493
  stack: [
494
- { image: logoDataUrl, fit: [72, 72], alignment: textAlignment, margin: [0, 2, 0, 6] },
494
+ { image: logoDataUrl, fit: [80, 80], alignment: textAlignment, margin: [0, 2, 0, 6] },
495
495
  ...safeOrganizationStack
496
496
  ]
497
497
  };
@@ -518,7 +518,7 @@ function buildHeaderContentWithLogo(
518
518
  logoBlock,
519
519
  {
520
520
  width: '*',
521
- marginLeft: -90,
521
+ marginLeft: textAlignment === 'center' ? -90 : 0,
522
522
  stack: safeOrganizationStack
523
523
  }
524
524
  ],
@@ -96,13 +96,13 @@ export function getRenderableColumns(headerConfig: any[], sType: string = '') {
96
96
  type: 'tax',
97
97
  taxKind: 'rate',
98
98
  dbField: 'IGST',
99
- width: getTaxSubWidth(header.width),
99
+ width: getTaxSubWidth(header.width, 'rate'),
100
100
  },
101
101
  {
102
102
  type: 'tax',
103
103
  taxKind: 'amount',
104
104
  dbField: 'IGST',
105
- width: getTaxSubWidth(header.width),
105
+ width: getTaxSubWidth(header.width, 'amount'),
106
106
  }
107
107
  );
108
108
  continue;
@@ -140,13 +140,13 @@ export function getRenderableColumns(headerConfig: any[], sType: string = '') {
140
140
  type: 'tax',
141
141
  taxKind: 'rate',
142
142
  dbField: 'CGST',
143
- width: getTaxSubWidth(header.width),
143
+ width: getTaxSubWidth(header.width, 'rate'),
144
144
  },
145
145
  {
146
146
  type: 'tax',
147
147
  taxKind: 'amount',
148
148
  dbField: 'CGST',
149
- width: getTaxSubWidth(header.width),
149
+ width: getTaxSubWidth(header.width, 'amount'),
150
150
  }
151
151
  );
152
152
  continue;
@@ -158,13 +158,13 @@ export function getRenderableColumns(headerConfig: any[], sType: string = '') {
158
158
  type: 'tax',
159
159
  taxKind: 'rate',
160
160
  dbField: 'SGST',
161
- width: getTaxSubWidth(header.width),
161
+ width: getTaxSubWidth(header.width, 'rate'),
162
162
  },
163
163
  {
164
164
  type: 'tax',
165
165
  taxKind: 'amount',
166
166
  dbField: 'SGST',
167
- width: getTaxSubWidth(header.width),
167
+ width: getTaxSubWidth(header.width, 'amount'),
168
168
  }
169
169
  );
170
170
  continue;
@@ -176,13 +176,13 @@ export function getRenderableColumns(headerConfig: any[], sType: string = '') {
176
176
  type: 'tax',
177
177
  taxKind: 'rate',
178
178
  dbField: 'CGST',
179
- width: getTaxSubWidth(header.width),
179
+ width: getTaxSubWidth(header.width, 'rate'),
180
180
  },
181
181
  {
182
182
  type: 'tax',
183
183
  taxKind: 'rate',
184
184
  dbField: 'SGST',
185
- width: getTaxSubWidth(header.width),
185
+ width: getTaxSubWidth(header.width, 'rate'),
186
186
  }
187
187
  );
188
188
  continue;
@@ -194,13 +194,13 @@ export function getRenderableColumns(headerConfig: any[], sType: string = '') {
194
194
  type: 'tax',
195
195
  taxKind: 'amount',
196
196
  dbField: 'CGST',
197
- width: getTaxSubWidth(header.width),
197
+ width: getTaxSubWidth(header.width, 'amount'),
198
198
  },
199
199
  {
200
200
  type: 'tax',
201
201
  taxKind: 'amount',
202
202
  dbField: 'SGST',
203
- width: getTaxSubWidth(header.width),
203
+ width: getTaxSubWidth(header.width, 'amount'),
204
204
  }
205
205
  );
206
206
  continue;
@@ -342,11 +342,12 @@ export function buildHeaderRows(headerConfig: any[], sType: string = '') {
342
342
  return [topRow, subRow];
343
343
  }
344
344
 
345
- function getTaxSubWidth(width: any) {
345
+ function getTaxSubWidth(width: any, taxKind: 'rate' | 'amount') {
346
346
  if (typeof width !== 'number') {
347
347
  return 'auto';
348
348
  }
349
- return Math.max(1, width / 2);
349
+ const ratio = taxKind === 'rate' ? 0.3 : 0.7;
350
+ return Math.max(1, width * ratio);
350
351
  }
351
352
 
352
353
  function isDiscountAmountHeader(text: string) {