ats-form-react-pdf-layout 4.4.8 → 4.4.9
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/lib/index.js +24 -11
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -2668,6 +2668,18 @@ const splitNodes = (height, contentArea, nodes) => {
|
|
|
2668
2668
|
nextChildren.push(next, ...futureNodes);
|
|
2669
2669
|
break;
|
|
2670
2670
|
}
|
|
2671
|
+
// Element fits on a full page but not in remaining space - move to next page to keep together
|
|
2672
|
+
// This handles the case where wrap is true (default) but we still want to avoid splitting
|
|
2673
|
+
// if the element would fit entirely on the next page
|
|
2674
|
+
const remainingSpace = height - nodeTop;
|
|
2675
|
+
const wouldBarelyFitOnCurrentPage = remainingSpace < nodeHeight * 0.3; // Less than 30% fits
|
|
2676
|
+
if (fitsInsidePage && shouldSplit && wouldBarelyFitOnCurrentPage && currentChildren.length > 0) {
|
|
2677
|
+
const box = Object.assign({}, child.box, { top: child.box.top - height });
|
|
2678
|
+
const next = Object.assign({}, child, { box });
|
|
2679
|
+
currentChildren.push(...futureFixedNodes);
|
|
2680
|
+
nextChildren.push(next, ...futureNodes);
|
|
2681
|
+
break;
|
|
2682
|
+
}
|
|
2671
2683
|
if (shouldBreak$1) {
|
|
2672
2684
|
const box = Object.assign({}, child.box, { top: child.box.top - height });
|
|
2673
2685
|
const props = Object.assign({}, child.props, {
|
|
@@ -2681,20 +2693,21 @@ const splitNodes = (height, contentArea, nodes) => {
|
|
|
2681
2693
|
}
|
|
2682
2694
|
if (shouldSplit || firstBreakableViewChild) {
|
|
2683
2695
|
const [currentChild, nextChild] = split(child, height, contentArea);
|
|
2684
|
-
//
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2696
|
+
// Check if all non-fixed children are moved to the next page
|
|
2697
|
+
const currentNonFixedChildren = currentChild.children
|
|
2698
|
+
? currentChild.children.filter((c) => !isFixed(c))
|
|
2699
|
+
: [];
|
|
2700
|
+
const hasNonFixedChildren = child.children
|
|
2701
|
+
? child.children.filter((c) => !isFixed(c)).length > 0
|
|
2702
|
+
: false;
|
|
2703
|
+
// All meaningful children are moved to the next page, move the parent too
|
|
2704
|
+
if (hasNonFixedChildren && currentNonFixedChildren.length === 0) {
|
|
2705
|
+
const box = Object.assign({}, child.box, {
|
|
2706
|
+
top: child.box.top - height,
|
|
2693
2707
|
});
|
|
2694
|
-
const next = Object.assign({},
|
|
2708
|
+
const next = Object.assign({}, child, { box });
|
|
2695
2709
|
currentChildren.push(...futureFixedNodes);
|
|
2696
2710
|
nextChildren.push(next, ...futureNodes);
|
|
2697
|
-
// }
|
|
2698
2711
|
break;
|
|
2699
2712
|
}
|
|
2700
2713
|
if (currentChild)
|