ats-form-react-pdf-layout 4.4.7 → 4.4.8
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 +18 -0
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1210,6 +1210,9 @@ const NON_WRAP_TYPES = [P.Svg, P.Note, P.Image, P.Canvas];
|
|
|
1210
1210
|
const canCauseBlankSpace = (node, prevNode, currentChildren) => {
|
|
1211
1211
|
if (!('preventBlankSpace' in node.props))
|
|
1212
1212
|
return false;
|
|
1213
|
+
// Don't override explicit wrap: false - respect user's intent to move to next page
|
|
1214
|
+
if ('wrap' in node.props && node.props.wrap === false)
|
|
1215
|
+
return false;
|
|
1213
1216
|
const prevNodeHasHeightOne = prevNode?.box?.height === 1;
|
|
1214
1217
|
const childrenIsEmpty = currentChildren?.length === 0;
|
|
1215
1218
|
// padding/margin case
|
|
@@ -1227,6 +1230,9 @@ const getWrap = (node, prevNode, currentChildren) => {
|
|
|
1227
1230
|
return false;
|
|
1228
1231
|
if (!node.props)
|
|
1229
1232
|
return true;
|
|
1233
|
+
// Check wrap prop first - if explicitly set to false, respect that
|
|
1234
|
+
if ('wrap' in node.props && node.props.wrap === false)
|
|
1235
|
+
return false;
|
|
1230
1236
|
if (canCauseBlankSpace(node, prevNode, currentChildren))
|
|
1231
1237
|
return true;
|
|
1232
1238
|
return 'wrap' in node.props ? node.props.wrap : true;
|
|
@@ -2650,6 +2656,18 @@ const splitNodes = (height, contentArea, nodes) => {
|
|
|
2650
2656
|
break;
|
|
2651
2657
|
}
|
|
2652
2658
|
}
|
|
2659
|
+
// Element fits on a full page but not in remaining space and cannot wrap - move to next page
|
|
2660
|
+
if (fitsInsidePage && shouldSplit && !canWrap) {
|
|
2661
|
+
const box = Object.assign({}, child.box, { top: child.box.top - height });
|
|
2662
|
+
const props = Object.assign({}, child.props, {
|
|
2663
|
+
wrap: true,
|
|
2664
|
+
break: false,
|
|
2665
|
+
});
|
|
2666
|
+
const next = Object.assign({}, child, { box, props });
|
|
2667
|
+
currentChildren.push(...futureFixedNodes);
|
|
2668
|
+
nextChildren.push(next, ...futureNodes);
|
|
2669
|
+
break;
|
|
2670
|
+
}
|
|
2653
2671
|
if (shouldBreak$1) {
|
|
2654
2672
|
const box = Object.assign({}, child.box, { top: child.box.top - height });
|
|
2655
2673
|
const props = Object.assign({}, child.props, {
|