ats-form-react-pdf-layout 4.4.5 → 4.4.7

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.
Files changed (2) hide show
  1. package/lib/index.js +6 -2
  2. package/package.json +5 -5
package/lib/index.js CHANGED
@@ -1337,7 +1337,11 @@ const shouldBreak = (child, futureElements, height, previousElements) => {
1337
1337
  if ('fixed' in child.props)
1338
1338
  return false;
1339
1339
  const shouldSplit = height < child.box.top + child.box.height;
1340
- const canWrap = getWrap(child, child, []);
1340
+ // Get the previous sibling from the previous elements for consistent wrap calculation
1341
+ const prevNode = previousElements.length > 0
1342
+ ? previousElements[previousElements.length - 1]
1343
+ : child;
1344
+ const canWrap = getWrap(child, prevNode, previousElements);
1341
1345
  // Calculate the y coordinate where the desired presence of the child ends
1342
1346
  const endOfPresence = getEndOfPresence(child, futureElements);
1343
1347
  // If the child is already at the top of the page, breaking won't improve its presence
@@ -2581,7 +2585,7 @@ const breakableViewChild = (children, height, path = '', currentChildren) => {
2581
2585
  for (let i = 0; i < children.length; i += 1) {
2582
2586
  if (children[i].type !== 'VIEW')
2583
2587
  continue;
2584
- if (shouldBreak(children[i], children.slice(i + 1, height), height, currentChildren)) {
2588
+ if (shouldBreak(children[i], children.slice(i + 1), height, currentChildren)) {
2585
2589
  return {
2586
2590
  child: children[i],
2587
2591
  path: `${path}/${i}`,
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "ats-form-react-pdf-layout",
3
- "version": "4.4.5",
3
+ "version": "4.4.7",
4
4
  "license": "MIT",
5
5
  "description": "Resolve document component's layout",
6
- "author": "Diego Muracciole <diegomuracciole@gmail.com>",
7
- "homepage": "https://github.com/diegomura/react-pdf#readme",
6
+ "author": "Atharva System",
7
+ "homepage": "https://github.com/Atharva-System/react-pdf#readme",
8
8
  "type": "module",
9
9
  "main": "./lib/index.js",
10
10
  "types": "./lib/index.d.ts",
11
11
  "repository": {
12
12
  "type": "git",
13
- "url": "https://github.com/diegomura/react-pdf.git",
13
+ "url": "https://github.com/Atharva-System/react-pdf.git",
14
14
  "directory": "packages/layout"
15
15
  },
16
16
  "scripts": {
@@ -23,7 +23,7 @@
23
23
  "@react-pdf/fns": "3.1.2",
24
24
  "@react-pdf/image": "^3.0.3",
25
25
  "@react-pdf/primitives": "^4.1.1",
26
- "ats-form-react-pdf-stylesheet": "^6.1.3",
26
+ "ats-form-react-pdf-stylesheet": "^6.1.4",
27
27
  "@react-pdf/textkit": "^6.0.0",
28
28
  "@react-pdf/types": "^2.9.1",
29
29
  "emoji-regex-xs": "^1.0.0",