@rnichi11/react-column-pdf-layout 4.4.4 → 4.5.0

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.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /// <reference path="../globals.d.ts" />
2
2
  /// <reference types="node" />
3
- import { Style, SafeStyle, Transform } from '@react-pdf/stylesheet';
3
+ import { Style, SafeStyle, Transform } from '@rnichi11/react-column-pdf-stylesheet';
4
4
  import { YogaNode } from 'yoga-layout/load';
5
5
  import * as React from 'react';
6
6
  import * as P from '@react-pdf/primitives';
package/lib/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { upperFirst, capitalize, parseFloat as parseFloat$1, without, pick, compose, evolve, mapValues, matchPercent, castArray, isNil, omit, asyncCompose } from '@react-pdf/fns';
2
2
  import * as P from '@react-pdf/primitives';
3
- import resolveStyle, { transformColor, flatten } from '@react-pdf/stylesheet';
3
+ import resolveStyle, { transformColor, flatten } from '@rnichi11/react-column-pdf-stylesheet';
4
4
  import layoutEngine, { fontSubstitution, wordHyphenation, scriptItemizer, textDecoration, justification, linebreaker, bidi, fromFragments } from '@rnichi11/react-column-pdf-textkit';
5
5
  import * as Yoga from 'yoga-layout/load';
6
6
  import { loadYoga as loadYoga$1 } from 'yoga-layout/load';
@@ -2987,6 +2987,7 @@ const allFixed = (nodes) => nodes.every(isFixed);
2987
2987
  const isDynamic = (node) => node.props && 'render' in node.props;
2988
2988
  const relayoutPage = compose(resolveTextLayout, resolvePageDimensions, resolveInheritance);
2989
2989
  const relayoutDynamicPage = compose(resolveTextLayout, resolvePageDimensions, resolveInheritance, resolvePageStyles);
2990
+ const relayoutDynamicPageForIndices = compose(resolveTextLayout, resolvePageDimensions, resolveInheritance);
2990
2991
  const warnUnavailableSpace = (node) => {
2991
2992
  console.warn(`Node of type ${node.type} can't wrap between pages and it's bigger than available page height`);
2992
2993
  };
@@ -3069,7 +3070,8 @@ const splitNodes = (height, contentArea, nodes, fontStore, containerWidth) => {
3069
3070
  children: overflowChildren,
3070
3071
  box: { ...viewChild.box, top: 0 },
3071
3072
  });
3072
- currentChildren.push(currentViewWithCols);
3073
+ // Keep fixed siblings (eg fixed footers/headers) on current page too.
3074
+ currentChildren.push(currentViewWithCols, ...futureFixedNodes);
3073
3075
  nextChildren.push(nextViewWithOverflow, ...futureNodes);
3074
3076
  break;
3075
3077
  }
@@ -3201,9 +3203,12 @@ const resolveDynamicNodes = (props, node) => {
3201
3203
  const lines = isNodeDynamic ? null : node.lines;
3202
3204
  return Object.assign({}, node, { box, lines, children });
3203
3205
  };
3204
- const resolveDynamicPage = (props, page, fontStore, yoga) => {
3206
+ const resolveDynamicPage = (props, page, fontStore, yoga, options) => {
3205
3207
  if (shouldResolveDynamicNodes(page)) {
3206
3208
  const resolvedPage = resolveDynamicNodes(props, page);
3209
+ if (options?.resolveStyles === false) {
3210
+ return relayoutDynamicPageForIndices(resolvedPage, fontStore, yoga);
3211
+ }
3207
3212
  return relayoutDynamicPage(resolvedPage, fontStore, yoga);
3208
3213
  }
3209
3214
  return page;
@@ -3239,7 +3244,9 @@ const resolvePageIndices = (fontStore, yoga, page, pageNumber, pages) => {
3239
3244
  subPageNumber: page.subPageNumber + 1,
3240
3245
  subPageTotalPages: page.subPageTotalPages,
3241
3246
  };
3242
- return resolveDynamicPage(props, page, fontStore, yoga);
3247
+ return resolveDynamicPage(props, page, fontStore, yoga, {
3248
+ resolveStyles: false,
3249
+ });
3243
3250
  };
3244
3251
  const assocSubPageData = (subpages) => {
3245
3252
  return subpages.map((page, i) => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rnichi11/react-column-pdf-layout",
3
- "version": "4.4.4",
3
+ "version": "4.5.0",
4
4
  "license": "MIT",
5
5
  "description": "Multi-column layout engine for react-column-pdf",
6
6
  "author": "rnichi1",
@@ -23,9 +23,9 @@
23
23
  "@react-pdf/fns": "3.1.2",
24
24
  "@react-pdf/image": "^3.0.4",
25
25
  "@react-pdf/primitives": "^4.1.1",
26
- "@react-pdf/stylesheet": "^6.1.2",
26
+ "@rnichi11/react-column-pdf-stylesheet": "^6.2.0",
27
27
  "@rnichi11/react-column-pdf-textkit": "6.1.1",
28
- "@react-pdf/types": "^2.9.2",
28
+ "@react-pdf/types": "^2.9.3",
29
29
  "emoji-regex-xs": "^1.0.0",
30
30
  "queue": "^6.0.1",
31
31
  "yoga-layout": "^3.2.1"