@softwear/latestcollectioncore 1.0.182 → 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 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,44 +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
- const absoluteLowerRightHandSide = { x: originX / 10, y: originY / 10 };
401
- // Now draw all the parent containers of the current container
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
- // Let origin start at (x,y) of the outermost container
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;
411
+ absoluteLowerRightHandSide.x = Math.max(absoluteLowerRightHandSide.x, originX / 10);
412
+ absoluteLowerRightHandSide.y = Math.max(absoluteLowerRightHandSide.y, originY / 10);
408
413
  containerChain.forEach((link, linkIdx) => {
409
414
  var _a;
410
- const chainChild = (_a = containerChain[linkIdx + 1]) === null || _a === void 0 ? void 0 : _a.object;
415
+ const deeperLinkChild = (_a = containerChain[linkIdx + 1]) === null || _a === void 0 ? void 0 : _a.object;
411
416
  link.object.children.forEach((child) => {
412
417
  if (child.snapToBottom)
413
418
  return;
414
- // Advance past bound repeat containers on the overflow path (they are not redrawn here; the
415
- // innermost link draws their leaves). Without this, nested x/y offsets are lost on page 2+.
419
+ // Skip inner repeat container on chain: advancing origin by x,y is enough; the live loop draws rows.
416
420
  if (child.type === 'container' &&
417
- chainChild &&
418
- child === chainChild &&
421
+ deeperLinkChild &&
422
+ child === deeperLinkChild &&
419
423
  !containerRedrawsAfterContinuationPage(child)) {
420
424
  const c = child;
421
425
  originX += c.x;
422
426
  originY += c.y;
423
427
  return;
424
428
  }
425
- if (child.type != 'container' || containerRedrawsAfterContinuationPage(child)) {
429
+ if (child.type !== 'container' || containerRedrawsAfterContinuationPage(child)) {
426
430
  const childLowerRightHandSide = addObjectToPDF(originX, originY, doc, child, link.printBuffer, paperSize, layout, options, rootPrintBuffer, [], context);
427
431
  absoluteLowerRightHandSide.x = Math.max(absoluteLowerRightHandSide.x, childLowerRightHandSide.x);
428
432
  absoluteLowerRightHandSide.y = Math.max(absoluteLowerRightHandSide.y, childLowerRightHandSide.y);
429
433
  }
430
434
  });
431
- if (link.object.repeatContainer == 'horizontal')
432
- originX = absoluteLowerRightHandSide.x * 10;
433
- if (link.object.repeatContainer == 'vertical')
434
- originY = absoluteLowerRightHandSide.y * 10;
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
+ }
435
442
  });
436
443
  }
437
- return { originX: originX, originY: originY, x: absoluteLowerRightHandSide.x, y: absoluteLowerRightHandSide.y };
444
+ return {
445
+ originX: continuationOxTenths,
446
+ originY: continuationOyTenths,
447
+ x: absoluteLowerRightHandSide.x,
448
+ y: absoluteLowerRightHandSide.y,
449
+ };
438
450
  }
439
451
  function drawBottomDwellers(object, originX, originY, absoluteLowerRightHandSide, bottomChildY, paperSize, doc, layout, rootPrintBuffer, options, newContainerChain, container, context) {
440
452
  let childRelativeToBottomDrawn = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softwear/latestcollectioncore",
3
- "version": "1.0.182",
3
+ "version": "1.0.183",
4
4
  "description": "Core functions for LatestCollections applications",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
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,24 +473,26 @@ function addPage(
469
473
  if (!context.measureOnly) {
470
474
  drawStaticPartOfPage(doc, layout, rootPrintBuffer, paperSize, options, context)
471
475
  }
472
- const absoluteLowerRightHandSide = { x: originX / 10, y: originY / 10 }
473
- // Now draw all the parent containers of the current container
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
- // Let origin start at (x,y) of the outermost container
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
484
+ absoluteLowerRightHandSide.x = Math.max(absoluteLowerRightHandSide.x, originX / 10)
485
+ absoluteLowerRightHandSide.y = Math.max(absoluteLowerRightHandSide.y, originY / 10)
486
+
480
487
  containerChain.forEach((link, linkIdx) => {
481
- const chainChild = containerChain[linkIdx + 1]?.object
488
+ const deeperLinkChild = containerChain[linkIdx + 1]?.object
482
489
  link.object.children.forEach((child) => {
483
490
  if (child.snapToBottom) return
484
- // Advance past bound repeat containers on the overflow path (they are not redrawn here; the
485
- // innermost link draws their leaves). Without this, nested x/y offsets are lost on page 2+.
491
+ // Skip inner repeat container on chain: advancing origin by x,y is enough; the live loop draws rows.
486
492
  if (
487
493
  child.type === 'container' &&
488
- chainChild &&
489
- child === chainChild &&
494
+ deeperLinkChild &&
495
+ child === deeperLinkChild &&
490
496
  !containerRedrawsAfterContinuationPage(child)
491
497
  ) {
492
498
  const c = child as ContainerLayoutObject
@@ -494,17 +500,25 @@ function addPage(
494
500
  originY += c.y
495
501
  return
496
502
  }
497
- if (child.type != 'container' || containerRedrawsAfterContinuationPage(child)) {
503
+ if (child.type !== 'container' || containerRedrawsAfterContinuationPage(child)) {
498
504
  const childLowerRightHandSide = addObjectToPDF(originX, originY, doc, child, link.printBuffer, paperSize, layout, options, rootPrintBuffer, [], context)
499
505
  absoluteLowerRightHandSide.x = Math.max(absoluteLowerRightHandSide.x, childLowerRightHandSide.x)
500
506
  absoluteLowerRightHandSide.y = Math.max(absoluteLowerRightHandSide.y, childLowerRightHandSide.y)
501
507
  }
502
508
  })
503
- if (link.object.repeatContainer == 'horizontal') originX = absoluteLowerRightHandSide.x * 10
504
- if (link.object.repeatContainer == 'vertical') originY = absoluteLowerRightHandSide.y * 10
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
+ }
505
514
  })
506
515
  }
507
- return { originX: originX, originY: originY, x: absoluteLowerRightHandSide.x, y: absoluteLowerRightHandSide.y }
516
+ return {
517
+ originX: continuationOxTenths,
518
+ originY: continuationOyTenths,
519
+ x: absoluteLowerRightHandSide.x,
520
+ y: absoluteLowerRightHandSide.y,
521
+ }
508
522
  }
509
523
 
510
524
  function drawBottomDwellers(