@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 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
- 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;
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 (!child.snapToBottom && (child.type != 'container' || containerRedrawsAfterContinuationPage(child))) {
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
- if (link.object.repeatContainer == 'horizontal')
417
- originX = absoluteLowerRightHandSide.x * 10;
418
- if (link.object.repeatContainer == 'vertical')
419
- 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
+ }
420
442
  });
421
443
  }
422
- 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
+ };
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softwear/latestcollectioncore",
3
- "version": "1.0.181",
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,27 +473,52 @@ 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
480
- containerChain.forEach((link) => {
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 (!child.snapToBottom && (child.type != 'container' || containerRedrawsAfterContinuationPage(child))) {
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
- if (link.object.repeatContainer == 'horizontal') originX = absoluteLowerRightHandSide.x * 10
489
- 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
+ }
490
514
  })
491
515
  }
492
- 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
+ }
493
522
  }
494
523
 
495
524
  function drawBottomDwellers(
@@ -243,8 +243,8 @@ describe('genPDF', () => {
243
243
  {
244
244
  type: 'container',
245
245
  name: 'rows',
246
- x: 0,
247
- y: 0,
246
+ x: 30,
247
+ y: 40,
248
248
  width: 1800,
249
249
  height: 120,
250
250
  active: true,