@softwear/latestcollectioncore 1.0.181 → 1.0.183
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.
- package/dist/reports.js +39 -12
- package/package.json +1 -1
- package/src/reports.ts +39 -10
- package/test/reports.spec.ts +2 -2
package/dist/reports.js
CHANGED
|
@@ -380,6 +380,9 @@ function drawSimpleObject(x, y, doc, object, printBuffer, width, height, options
|
|
|
380
380
|
}
|
|
381
381
|
}
|
|
382
382
|
function addPage(originX, originY, doc, layout, rootPrintBuffer, paperSize, options, containerChain, context) {
|
|
383
|
+
/** Absolute tenths where the overflowing repeat resumes; callers already computed this correctly. */
|
|
384
|
+
const continuationOxTenths = originX;
|
|
385
|
+
const continuationOyTenths = originY;
|
|
383
386
|
context.pendingRootStartBumpTenths = 0;
|
|
384
387
|
context.applyRootStartBumpToThisCall = false;
|
|
385
388
|
context.remainingRootStartBumpTenths = 0;
|
|
@@ -397,29 +400,53 @@ function addPage(originX, originY, doc, layout, rootPrintBuffer, paperSize, opti
|
|
|
397
400
|
if (!context.measureOnly) {
|
|
398
401
|
drawStaticPartOfPage(doc, layout, rootPrintBuffer, paperSize, options, context);
|
|
399
402
|
}
|
|
400
|
-
|
|
401
|
-
|
|
403
|
+
// Bounding box tracked for snap-to-bottom; continuation cursor is ALWAYS the passed-in coords.
|
|
404
|
+
const absoluteLowerRightHandSide = { x: continuationOxTenths / 10, y: continuationOyTenths / 10 };
|
|
402
405
|
if (containerChain.length > 0) {
|
|
403
|
-
//
|
|
406
|
+
// Re-draw ancestor frames on the new page (local coordinates). Do NOT treat this pass as another
|
|
407
|
+
// repeat iteration: skip repeatContainer advancement on the innermost link—the real loop resumes
|
|
408
|
+
// after addPage returns with continuationOxTenths / continuationOyTenths.
|
|
404
409
|
originX = containerChain[0].object.x;
|
|
405
410
|
originY = containerChain[0].object.y;
|
|
406
|
-
absoluteLowerRightHandSide.x = originX / 10;
|
|
407
|
-
absoluteLowerRightHandSide.y = originY / 10;
|
|
408
|
-
containerChain.forEach((link) => {
|
|
411
|
+
absoluteLowerRightHandSide.x = Math.max(absoluteLowerRightHandSide.x, originX / 10);
|
|
412
|
+
absoluteLowerRightHandSide.y = Math.max(absoluteLowerRightHandSide.y, originY / 10);
|
|
413
|
+
containerChain.forEach((link, linkIdx) => {
|
|
414
|
+
var _a;
|
|
415
|
+
const deeperLinkChild = (_a = containerChain[linkIdx + 1]) === null || _a === void 0 ? void 0 : _a.object;
|
|
409
416
|
link.object.children.forEach((child) => {
|
|
410
|
-
if (
|
|
417
|
+
if (child.snapToBottom)
|
|
418
|
+
return;
|
|
419
|
+
// Skip inner repeat container on chain: advancing origin by x,y is enough; the live loop draws rows.
|
|
420
|
+
if (child.type === 'container' &&
|
|
421
|
+
deeperLinkChild &&
|
|
422
|
+
child === deeperLinkChild &&
|
|
423
|
+
!containerRedrawsAfterContinuationPage(child)) {
|
|
424
|
+
const c = child;
|
|
425
|
+
originX += c.x;
|
|
426
|
+
originY += c.y;
|
|
427
|
+
return;
|
|
428
|
+
}
|
|
429
|
+
if (child.type !== 'container' || containerRedrawsAfterContinuationPage(child)) {
|
|
411
430
|
const childLowerRightHandSide = addObjectToPDF(originX, originY, doc, child, link.printBuffer, paperSize, layout, options, rootPrintBuffer, [], context);
|
|
412
431
|
absoluteLowerRightHandSide.x = Math.max(absoluteLowerRightHandSide.x, childLowerRightHandSide.x);
|
|
413
432
|
absoluteLowerRightHandSide.y = Math.max(absoluteLowerRightHandSide.y, childLowerRightHandSide.y);
|
|
414
433
|
}
|
|
415
434
|
});
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
435
|
+
const isLastLinkOnChain = linkIdx >= containerChain.length - 1;
|
|
436
|
+
if (!isLastLinkOnChain) {
|
|
437
|
+
if (link.object.repeatContainer === 'horizontal')
|
|
438
|
+
originX = absoluteLowerRightHandSide.x * 10;
|
|
439
|
+
if (link.object.repeatContainer === 'vertical')
|
|
440
|
+
originY = absoluteLowerRightHandSide.y * 10;
|
|
441
|
+
}
|
|
420
442
|
});
|
|
421
443
|
}
|
|
422
|
-
return {
|
|
444
|
+
return {
|
|
445
|
+
originX: continuationOxTenths,
|
|
446
|
+
originY: continuationOyTenths,
|
|
447
|
+
x: absoluteLowerRightHandSide.x,
|
|
448
|
+
y: absoluteLowerRightHandSide.y,
|
|
449
|
+
};
|
|
423
450
|
}
|
|
424
451
|
function drawBottomDwellers(object, originX, originY, absoluteLowerRightHandSide, bottomChildY, paperSize, doc, layout, rootPrintBuffer, options, newContainerChain, container, context) {
|
|
425
452
|
let childRelativeToBottomDrawn = false;
|
package/package.json
CHANGED
package/src/reports.ts
CHANGED
|
@@ -453,6 +453,10 @@ function addPage(
|
|
|
453
453
|
containerChain: { object: ContainerLayoutObject; printBuffer: any }[],
|
|
454
454
|
context: RenderContext
|
|
455
455
|
): { originX: number; originY: number; x: number; y: number } {
|
|
456
|
+
/** Absolute tenths where the overflowing repeat resumes; callers already computed this correctly. */
|
|
457
|
+
const continuationOxTenths = originX
|
|
458
|
+
const continuationOyTenths = originY
|
|
459
|
+
|
|
456
460
|
context.pendingRootStartBumpTenths = 0
|
|
457
461
|
context.applyRootStartBumpToThisCall = false
|
|
458
462
|
context.remainingRootStartBumpTenths = 0
|
|
@@ -469,27 +473,52 @@ function addPage(
|
|
|
469
473
|
if (!context.measureOnly) {
|
|
470
474
|
drawStaticPartOfPage(doc, layout, rootPrintBuffer, paperSize, options, context)
|
|
471
475
|
}
|
|
472
|
-
|
|
473
|
-
|
|
476
|
+
// Bounding box tracked for snap-to-bottom; continuation cursor is ALWAYS the passed-in coords.
|
|
477
|
+
const absoluteLowerRightHandSide = { x: continuationOxTenths / 10, y: continuationOyTenths / 10 }
|
|
474
478
|
if (containerChain.length > 0) {
|
|
475
|
-
//
|
|
479
|
+
// Re-draw ancestor frames on the new page (local coordinates). Do NOT treat this pass as another
|
|
480
|
+
// repeat iteration: skip repeatContainer advancement on the innermost link—the real loop resumes
|
|
481
|
+
// after addPage returns with continuationOxTenths / continuationOyTenths.
|
|
476
482
|
originX = containerChain[0].object.x
|
|
477
483
|
originY = containerChain[0].object.y
|
|
478
|
-
absoluteLowerRightHandSide.x = originX / 10
|
|
479
|
-
absoluteLowerRightHandSide.y = originY / 10
|
|
480
|
-
|
|
484
|
+
absoluteLowerRightHandSide.x = Math.max(absoluteLowerRightHandSide.x, originX / 10)
|
|
485
|
+
absoluteLowerRightHandSide.y = Math.max(absoluteLowerRightHandSide.y, originY / 10)
|
|
486
|
+
|
|
487
|
+
containerChain.forEach((link, linkIdx) => {
|
|
488
|
+
const deeperLinkChild = containerChain[linkIdx + 1]?.object
|
|
481
489
|
link.object.children.forEach((child) => {
|
|
482
|
-
if (
|
|
490
|
+
if (child.snapToBottom) return
|
|
491
|
+
// Skip inner repeat container on chain: advancing origin by x,y is enough; the live loop draws rows.
|
|
492
|
+
if (
|
|
493
|
+
child.type === 'container' &&
|
|
494
|
+
deeperLinkChild &&
|
|
495
|
+
child === deeperLinkChild &&
|
|
496
|
+
!containerRedrawsAfterContinuationPage(child)
|
|
497
|
+
) {
|
|
498
|
+
const c = child as ContainerLayoutObject
|
|
499
|
+
originX += c.x
|
|
500
|
+
originY += c.y
|
|
501
|
+
return
|
|
502
|
+
}
|
|
503
|
+
if (child.type !== 'container' || containerRedrawsAfterContinuationPage(child)) {
|
|
483
504
|
const childLowerRightHandSide = addObjectToPDF(originX, originY, doc, child, link.printBuffer, paperSize, layout, options, rootPrintBuffer, [], context)
|
|
484
505
|
absoluteLowerRightHandSide.x = Math.max(absoluteLowerRightHandSide.x, childLowerRightHandSide.x)
|
|
485
506
|
absoluteLowerRightHandSide.y = Math.max(absoluteLowerRightHandSide.y, childLowerRightHandSide.y)
|
|
486
507
|
}
|
|
487
508
|
})
|
|
488
|
-
|
|
489
|
-
if (
|
|
509
|
+
const isLastLinkOnChain = linkIdx >= containerChain.length - 1
|
|
510
|
+
if (!isLastLinkOnChain) {
|
|
511
|
+
if (link.object.repeatContainer === 'horizontal') originX = absoluteLowerRightHandSide.x * 10
|
|
512
|
+
if (link.object.repeatContainer === 'vertical') originY = absoluteLowerRightHandSide.y * 10
|
|
513
|
+
}
|
|
490
514
|
})
|
|
491
515
|
}
|
|
492
|
-
return {
|
|
516
|
+
return {
|
|
517
|
+
originX: continuationOxTenths,
|
|
518
|
+
originY: continuationOyTenths,
|
|
519
|
+
x: absoluteLowerRightHandSide.x,
|
|
520
|
+
y: absoluteLowerRightHandSide.y,
|
|
521
|
+
}
|
|
493
522
|
}
|
|
494
523
|
|
|
495
524
|
function drawBottomDwellers(
|