@pdfme/ui 6.1.12-dev.13 → 6.1.12-dev.15

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/index.js CHANGED
@@ -73786,6 +73786,10 @@ var getBoxInsets = (schema) => ({
73786
73786
  borderWidth: normalizeBoxDimension(schema.borderWidth),
73787
73787
  padding: normalizeBoxDimension(schema.padding)
73788
73788
  });
73789
+ var getBoxVerticalInset = (schema) => {
73790
+ const { borderWidth, padding } = getBoxInsets(schema);
73791
+ return borderWidth.top + borderWidth.bottom + padding.top + padding.bottom;
73792
+ };
73789
73793
  var getBoxContentArea = (schema) => {
73790
73794
  const { borderWidth, padding } = getBoxInsets(schema);
73791
73795
  const leftInset = borderWidth.left + padding.left;
@@ -74759,7 +74763,7 @@ var getRichTextLineHeight = (line, fontSize) => {
74759
74763
  return Math.max(...line.runs.map((run) => heightOfFontAtSize(run.fontKitFont, fontSize)));
74760
74764
  };
74761
74765
  //#endregion
74762
- //#region ../schemas/dist/dynamicTemplate-Bs3HHtDw.js
74766
+ //#region ../schemas/dist/dynamicTemplate-CnK0nlnj.js
74763
74767
  function _typeof$17(o) {
74764
74768
  "@babel/helpers - typeof";
74765
74769
  return _typeof$17 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -74812,16 +74816,17 @@ var Cell$1 = class {
74812
74816
  this.text = raw.split(splitRegex);
74813
74817
  }
74814
74818
  getContentHeight() {
74815
- const lineCount = Array.isArray(this.text) ? this.text.length : 1;
74816
- const lineHeight = pt2mm(this.styles.fontSize) * this.styles.lineHeight;
74817
- const vPadding = this.padding("top") + this.padding("bottom");
74818
- const height = lineCount * lineHeight + vPadding;
74819
+ const height = (Array.isArray(this.text) ? this.text.length : 1) * (pt2mm(this.styles.fontSize) * this.styles.lineHeight) + getBoxVerticalInset(getCellBoxStyle(this));
74819
74820
  return Math.max(height, this.styles.minCellHeight);
74820
74821
  }
74821
74822
  padding(name) {
74822
74823
  return this.styles.cellPadding[name];
74823
74824
  }
74824
74825
  };
74826
+ var getCellBoxStyle = (cell) => ({
74827
+ padding: cell.styles.cellPadding,
74828
+ borderWidth: cell.styles.lineWidth
74829
+ });
74825
74830
  var Column$2 = class {
74826
74831
  constructor(index) {
74827
74832
  _defineProperty$12(this, "index", void 0);
@@ -74989,10 +74994,19 @@ async function fitContent(table, getFontKitFontByFontName) {
74989
74994
  const cell = row.cells[column.index];
74990
74995
  if (!cell) continue;
74991
74996
  const fontKitFont = await getFontKitFontByFontName(cell.styles.fontName);
74997
+ const contentArea = getBoxContentArea({
74998
+ position: {
74999
+ x: 0,
75000
+ y: 0
75001
+ },
75002
+ width: cell.width,
75003
+ height: cell.height,
75004
+ ...getCellBoxStyle(cell)
75005
+ });
74992
75006
  cell.text = splitTextToSize({
74993
75007
  value: cell.raw,
74994
75008
  characterSpacing: cell.styles.characterSpacing,
74995
- boxWidthInPt: mm2pt(cell.width),
75009
+ boxWidthInPt: mm2pt(contentArea.width),
74996
75010
  fontSize: cell.styles.fontSize,
74997
75011
  fontKitFont
74998
75012
  });
@@ -75326,7 +75340,7 @@ var getDynamicLayoutForTable = async (value, args) => {
75326
75340
  };
75327
75341
  };
75328
75342
  //#endregion
75329
- //#region ../schemas/dist/utils-DK3W81o_.js
75343
+ //#region ../schemas/dist/utils-D_sFXK0U.js
75330
75344
  var convertForPdfLayoutProps = ({ schema, pageHeight, applyRotateTranslate = true }) => {
75331
75345
  const { width: mmWidth, height: mmHeight, position, rotate, opacity } = schema;
75332
75346
  const { x: mmX, y: mmY } = position;
@@ -75616,7 +75630,7 @@ var Underline = [["path", { d: "M6 4v6a6 6 0 0 0 12 0V4" }], ["line", {
75616
75630
  y2: "20"
75617
75631
  }]];
75618
75632
  //#endregion
75619
- //#region ../schemas/dist/builtins-DZAw3Nhr.js
75633
+ //#region ../schemas/dist/builtins-8En4EIAG.js
75620
75634
  var addUriLinkAnnotation = (arg) => {
75621
75635
  const { pdfDoc, page, uri, rect, borderWidth = 0 } = arg;
75622
75636
  const safeUri = normalizeSafeLinkUri(uri);
@@ -204494,12 +204508,12 @@ var validateVariables = (value, schema) => {
204494
204508
  return true;
204495
204509
  };
204496
204510
  //#endregion
204497
- //#region ../schemas/dist/dynamicTemplate-BcCrm2SZ.js
204511
+ //#region ../schemas/dist/dynamicTemplate-DFk_de1Y.js
204498
204512
  var getDynamicLayoutForMultiVariableText = async (value, args) => {
204499
204513
  if (args.schema.type !== "multiVariableText") return { heights: [args.schema.height] };
204500
204514
  const schema = args.schema;
204501
204515
  if (schema.overflow !== "expand") return { heights: [schema.height] };
204502
- let renderValue = value;
204516
+ let renderValue = schema.readOnly && schema.variables.length === 0 ? schema.text || "" : value;
204503
204517
  if (!schema.readOnly) {
204504
204518
  if (!validateVariables(value, schema)) return { heights: [schema.height] };
204505
204519
  renderValue = isInlineMarkdownTextSchema(schema) ? substituteVariablesAsInlineMarkdownLiterals(schema.text || "", value) : substituteVariables(schema.text || "", value);