@pdfme/ui 6.1.1-dev.8 → 6.1.2-dev.11
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/class.d.ts +4 -18
- package/dist/helper.d.ts +2 -9
- package/dist/index.js +412 -148
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -45683,7 +45683,7 @@ function parseExpressionAt(input, pos, options) {
|
|
|
45683
45683
|
}
|
|
45684
45684
|
//#endregion
|
|
45685
45685
|
//#region ../common/dist/index.js
|
|
45686
|
-
var PDFME_VERSION = "6.1.
|
|
45686
|
+
var PDFME_VERSION = "6.1.2";
|
|
45687
45687
|
var PAGE_SIZE_PRESETS = {
|
|
45688
45688
|
A3: {
|
|
45689
45689
|
width: 297,
|
|
@@ -45859,6 +45859,11 @@ object$1({
|
|
|
45859
45859
|
height: number$1(),
|
|
45860
45860
|
width: number$1()
|
|
45861
45861
|
});
|
|
45862
|
+
var DynamicLayoutSplitRange = object$1({
|
|
45863
|
+
unit: string$1().min(1),
|
|
45864
|
+
start: number$1(),
|
|
45865
|
+
end: number$1().optional()
|
|
45866
|
+
});
|
|
45862
45867
|
var Schema$1 = object$1({
|
|
45863
45868
|
name: string$1(),
|
|
45864
45869
|
type: string$1(),
|
|
@@ -45873,18 +45878,7 @@ var Schema$1 = object$1({
|
|
|
45873
45878
|
opacity: number$1().optional(),
|
|
45874
45879
|
readOnly: boolean$1().optional(),
|
|
45875
45880
|
required: boolean$1().optional(),
|
|
45876
|
-
|
|
45877
|
-
start: number$1(),
|
|
45878
|
-
end: number$1().optional()
|
|
45879
|
-
}).optional(),
|
|
45880
|
-
__itemRange: object$1({
|
|
45881
|
-
start: number$1(),
|
|
45882
|
-
end: number$1().optional()
|
|
45883
|
-
}).optional(),
|
|
45884
|
-
__textLineRange: object$1({
|
|
45885
|
-
start: number$1(),
|
|
45886
|
-
end: number$1().optional()
|
|
45887
|
-
}).optional(),
|
|
45881
|
+
__splitRange: DynamicLayoutSplitRange.optional(),
|
|
45888
45882
|
__isSplit: boolean$1().optional()
|
|
45889
45883
|
}).passthrough();
|
|
45890
45884
|
var SchemaForUIAdditionalInfo = object$1({ id: string$1() });
|
|
@@ -46671,6 +46665,10 @@ var getDynamicTemplate = async (arg) => {
|
|
|
46671
46665
|
const PARALLEL_LIMIT = 10;
|
|
46672
46666
|
for (let pageIndex = 0; pageIndex < template.schemas.length; pageIndex++) {
|
|
46673
46667
|
const pageSchemas = template.schemas[pageIndex];
|
|
46668
|
+
if (pageSchemas.length === 0) {
|
|
46669
|
+
resultPages.push([]);
|
|
46670
|
+
continue;
|
|
46671
|
+
}
|
|
46674
46672
|
const { items, orderMap } = normalizePageSchemas(pageSchemas, paddingTop);
|
|
46675
46673
|
for (let i = 0; i < items.length; i += PARALLEL_LIMIT) {
|
|
46676
46674
|
const chunk = items.slice(i, i + PARALLEL_LIMIT);
|
|
@@ -46687,7 +46685,6 @@ var getDynamicTemplate = async (arg) => {
|
|
|
46687
46685
|
const processedPages = processDynamicPage(items, orderMap, contentHeight, paddingTop);
|
|
46688
46686
|
resultPages.push(...processedPages);
|
|
46689
46687
|
}
|
|
46690
|
-
removeTrailingEmptyPages(resultPages);
|
|
46691
46688
|
if (resultPages.length === template.schemas.length) {
|
|
46692
46689
|
let unchanged = true;
|
|
46693
46690
|
for (let i = 0; i < resultPages.length && unchanged; i++) {
|
|
@@ -46708,6 +46705,19 @@ var getDynamicTemplate = async (arg) => {
|
|
|
46708
46705
|
schemas: resultPages
|
|
46709
46706
|
};
|
|
46710
46707
|
};
|
|
46708
|
+
var createDynamicLayoutSplitRange = (unit, start, end) => ({
|
|
46709
|
+
unit,
|
|
46710
|
+
start,
|
|
46711
|
+
...end === void 0 ? {} : { end }
|
|
46712
|
+
});
|
|
46713
|
+
var getDynamicLayoutSplitRange = (schema, unit) => {
|
|
46714
|
+
const range = schema.__splitRange;
|
|
46715
|
+
if (range?.unit !== unit) return void 0;
|
|
46716
|
+
return {
|
|
46717
|
+
start: range.start,
|
|
46718
|
+
...range.end === void 0 ? {} : { end: range.end }
|
|
46719
|
+
};
|
|
46720
|
+
};
|
|
46711
46721
|
/**
|
|
46712
46722
|
* Wraps plugins collection with utility methods
|
|
46713
46723
|
*/
|
|
@@ -98629,7 +98639,7 @@ $d636bc798e7178db$export$36b2f24e97d43be($21ee218f84ac7f32$export$2e2bcd8739ae03
|
|
|
98629
98639
|
$d636bc798e7178db$export$36b2f24e97d43be($cd5853a56c68fec7$export$2e2bcd8739ae039);
|
|
98630
98640
|
$d636bc798e7178db$export$36b2f24e97d43be($05f49f930186144e$export$2e2bcd8739ae039);
|
|
98631
98641
|
//#endregion
|
|
98632
|
-
//#region ../schemas/dist/
|
|
98642
|
+
//#region ../schemas/dist/splitRange-DmVDtmzO.js
|
|
98633
98643
|
var ALIGN_LEFT = "left";
|
|
98634
98644
|
var ALIGN_CENTER = "center";
|
|
98635
98645
|
var ALIGN_RIGHT = "right";
|
|
@@ -98723,6 +98733,84 @@ var LINE_END_FORBIDDEN_CHARS = [
|
|
|
98723
98733
|
"⦅",
|
|
98724
98734
|
"«"
|
|
98725
98735
|
];
|
|
98736
|
+
var createBoxDimension = (value = 0) => ({
|
|
98737
|
+
top: value,
|
|
98738
|
+
right: value,
|
|
98739
|
+
bottom: value,
|
|
98740
|
+
left: value
|
|
98741
|
+
});
|
|
98742
|
+
var normalizeBoxDimension = (value) => ({
|
|
98743
|
+
top: value?.top ?? 0,
|
|
98744
|
+
right: value?.right ?? 0,
|
|
98745
|
+
bottom: value?.bottom ?? 0,
|
|
98746
|
+
left: value?.left ?? 0
|
|
98747
|
+
});
|
|
98748
|
+
var getBoxInsets = (schema) => ({
|
|
98749
|
+
borderWidth: normalizeBoxDimension(schema.borderWidth),
|
|
98750
|
+
padding: normalizeBoxDimension(schema.padding)
|
|
98751
|
+
});
|
|
98752
|
+
var getBoxContentArea = (schema) => {
|
|
98753
|
+
const { borderWidth, padding } = getBoxInsets(schema);
|
|
98754
|
+
const leftInset = borderWidth.left + padding.left;
|
|
98755
|
+
const topInset = borderWidth.top + padding.top;
|
|
98756
|
+
const rightInset = borderWidth.right + padding.right;
|
|
98757
|
+
const bottomInset = borderWidth.bottom + padding.bottom;
|
|
98758
|
+
return {
|
|
98759
|
+
position: {
|
|
98760
|
+
x: schema.position.x + leftInset,
|
|
98761
|
+
y: schema.position.y + topInset
|
|
98762
|
+
},
|
|
98763
|
+
width: Math.max(0, schema.width - leftInset - rightInset),
|
|
98764
|
+
height: Math.max(0, schema.height - topInset - bottomInset),
|
|
98765
|
+
leftInset,
|
|
98766
|
+
topInset,
|
|
98767
|
+
rightInset,
|
|
98768
|
+
bottomInset
|
|
98769
|
+
};
|
|
98770
|
+
};
|
|
98771
|
+
var hasBoxDimension = (dimension) => {
|
|
98772
|
+
const resolved = normalizeBoxDimension(dimension);
|
|
98773
|
+
return resolved.top > 0 || resolved.right > 0 || resolved.bottom > 0 || resolved.left > 0;
|
|
98774
|
+
};
|
|
98775
|
+
var getSplitBoxDimension = (dimension, range, totalUnits) => {
|
|
98776
|
+
const resolved = normalizeBoxDimension(dimension);
|
|
98777
|
+
const end = range.end ?? totalUnits;
|
|
98778
|
+
return {
|
|
98779
|
+
top: range.start === 0 ? resolved.top : 0,
|
|
98780
|
+
right: resolved.right,
|
|
98781
|
+
bottom: end >= totalUnits ? resolved.bottom : 0,
|
|
98782
|
+
left: resolved.left
|
|
98783
|
+
};
|
|
98784
|
+
};
|
|
98785
|
+
var getBoxDimensionPropPanelSchema = (step = 1) => {
|
|
98786
|
+
const getCommonProp = () => ({
|
|
98787
|
+
type: "number",
|
|
98788
|
+
widget: "inputNumber",
|
|
98789
|
+
props: {
|
|
98790
|
+
min: 0,
|
|
98791
|
+
step
|
|
98792
|
+
},
|
|
98793
|
+
span: 6
|
|
98794
|
+
});
|
|
98795
|
+
return {
|
|
98796
|
+
top: {
|
|
98797
|
+
title: "Top",
|
|
98798
|
+
...getCommonProp()
|
|
98799
|
+
},
|
|
98800
|
+
right: {
|
|
98801
|
+
title: "Right",
|
|
98802
|
+
...getCommonProp()
|
|
98803
|
+
},
|
|
98804
|
+
bottom: {
|
|
98805
|
+
title: "Bottom",
|
|
98806
|
+
...getCommonProp()
|
|
98807
|
+
},
|
|
98808
|
+
left: {
|
|
98809
|
+
title: "Left",
|
|
98810
|
+
...getCommonProp()
|
|
98811
|
+
}
|
|
98812
|
+
};
|
|
98813
|
+
};
|
|
98726
98814
|
var getBrowserVerticalFontAdjustments = (fontKitFont, fontSize, lineHeight, verticalAlignment) => {
|
|
98727
98815
|
const { ascent, descent, unitsPerEm } = fontKitFont;
|
|
98728
98816
|
const fontBaseLineHeight = (ascent - descent) / unitsPerEm;
|
|
@@ -98810,7 +98898,8 @@ var getFontKitFont = async (fontName, font, _cache) => {
|
|
|
98810
98898
|
* the box width based on the proposed size.
|
|
98811
98899
|
*/
|
|
98812
98900
|
var calculateDynamicFontSize = ({ textSchema, fontKitFont, value, startingFontSize }) => {
|
|
98813
|
-
const { fontSize: schemaFontSize, dynamicFontSize: dynamicFontSizeSetting, characterSpacing: schemaCharacterSpacing,
|
|
98901
|
+
const { fontSize: schemaFontSize, dynamicFontSize: dynamicFontSizeSetting, characterSpacing: schemaCharacterSpacing, lineHeight = 1 } = textSchema;
|
|
98902
|
+
const { width: boxWidth, height: boxHeight } = getBoxContentArea(textSchema);
|
|
98814
98903
|
const fontSize = startingFontSize || schemaFontSize || 13;
|
|
98815
98904
|
if (!dynamicFontSizeSetting) return fontSize;
|
|
98816
98905
|
if (dynamicFontSizeSetting.max < dynamicFontSizeSetting.min) return fontSize;
|
|
@@ -99002,8 +99091,21 @@ var filterEndJP = (lines) => {
|
|
|
99002
99091
|
return [...filtered.slice(0, -1), combinedItem];
|
|
99003
99092
|
} else return filtered;
|
|
99004
99093
|
};
|
|
99005
|
-
|
|
99006
|
-
|
|
99094
|
+
var BUILT_IN_DYNAMIC_LAYOUT_SPLIT_UNITS = {
|
|
99095
|
+
tableBody: "tableBody",
|
|
99096
|
+
listItem: "listItem",
|
|
99097
|
+
textLine: "textLine"
|
|
99098
|
+
};
|
|
99099
|
+
var TABLE_BODY_SPLIT_UNIT = BUILT_IN_DYNAMIC_LAYOUT_SPLIT_UNITS.tableBody;
|
|
99100
|
+
var LIST_ITEM_SPLIT_UNIT = BUILT_IN_DYNAMIC_LAYOUT_SPLIT_UNITS.listItem;
|
|
99101
|
+
var TEXT_LINE_SPLIT_UNIT = BUILT_IN_DYNAMIC_LAYOUT_SPLIT_UNITS.textLine;
|
|
99102
|
+
var createTableBodySplitRange = (start, end) => createDynamicLayoutSplitRange(TABLE_BODY_SPLIT_UNIT, start, end);
|
|
99103
|
+
var createListItemSplitRange = (start, end) => createDynamicLayoutSplitRange(LIST_ITEM_SPLIT_UNIT, start, end);
|
|
99104
|
+
var createTextLineSplitRange = (start, end) => createDynamicLayoutSplitRange(TEXT_LINE_SPLIT_UNIT, start, end);
|
|
99105
|
+
var getTableBodyRange = (schema) => getDynamicLayoutSplitRange(schema, TABLE_BODY_SPLIT_UNIT);
|
|
99106
|
+
var getTextLineRange = (schema) => getDynamicLayoutSplitRange(schema, TEXT_LINE_SPLIT_UNIT);
|
|
99107
|
+
//#endregion
|
|
99108
|
+
//#region ../schemas/dist/measure-L5diay3k.js
|
|
99007
99109
|
var MARKDOWN_ESCAPABLE_CHARS = new Set([
|
|
99008
99110
|
"\\",
|
|
99009
99111
|
"*",
|
|
@@ -99242,7 +99344,7 @@ var resolveRichTextRuns = async (arg) => {
|
|
|
99242
99344
|
var measureRunText = (run, text, fontSize, characterSpacing) => {
|
|
99243
99345
|
const syntheticBoldWidth = run.syntheticBold ? fontSize * SYNTHETIC_BOLD_OFFSET_RATIO * 2 : 0;
|
|
99244
99346
|
const syntheticItalicWidth = run.syntheticItalic ? heightOfFontAtSize(run.fontKitFont, fontSize) * Math.tan(12 * Math.PI / 180) : 0;
|
|
99245
|
-
return widthOfTextAtSize(text, run.fontKitFont, fontSize, characterSpacing) + syntheticBoldWidth + syntheticItalicWidth;
|
|
99347
|
+
return widthOfTextAtSize(text, run.fontKitFont, fontSize, characterSpacing) + syntheticBoldWidth + syntheticItalicWidth + (run.code ? CODE_HORIZONTAL_PADDING * 2 : 0);
|
|
99246
99348
|
};
|
|
99247
99349
|
var createLine = () => ({
|
|
99248
99350
|
runs: [],
|
|
@@ -99252,6 +99354,14 @@ var createLine = () => ({
|
|
|
99252
99354
|
var pushRunToLine = (line, run, text, fontSize, characterSpacing) => {
|
|
99253
99355
|
if (!text) return;
|
|
99254
99356
|
const width = measureRunText(run, text, fontSize, characterSpacing);
|
|
99357
|
+
const lastRun = line.runs[line.runs.length - 1];
|
|
99358
|
+
if (lastRun && canMergeRichTextRuns(lastRun, run)) {
|
|
99359
|
+
const previousWidth = lastRun.width;
|
|
99360
|
+
lastRun.text += text;
|
|
99361
|
+
lastRun.width = measureRunText(lastRun, lastRun.text, fontSize, characterSpacing);
|
|
99362
|
+
line.width += lastRun.width - previousWidth;
|
|
99363
|
+
return;
|
|
99364
|
+
}
|
|
99255
99365
|
if (line.runs.length > 0) line.width += characterSpacing;
|
|
99256
99366
|
line.runs.push({
|
|
99257
99367
|
...run,
|
|
@@ -99260,6 +99370,7 @@ var pushRunToLine = (line, run, text, fontSize, characterSpacing) => {
|
|
|
99260
99370
|
});
|
|
99261
99371
|
line.width += width;
|
|
99262
99372
|
};
|
|
99373
|
+
var canMergeRichTextRuns = (a, b) => a.fontName === b.fontName && a.fontKitFont === b.fontKitFont && a.syntheticBold === b.syntheticBold && a.syntheticItalic === b.syntheticItalic && a.bold === b.bold && a.italic === b.italic && a.strikethrough === b.strikethrough && a.code === b.code && a.href === b.href;
|
|
99263
99374
|
var measurePiecesWidth = (pieces, fontSize, characterSpacing) => {
|
|
99264
99375
|
let width = 0;
|
|
99265
99376
|
let hasText = false;
|
|
@@ -99415,7 +99526,8 @@ var getLineHeightAtSize = (line, fontSize) => {
|
|
|
99415
99526
|
};
|
|
99416
99527
|
var calculateDynamicRichTextFontSize = async (arg) => {
|
|
99417
99528
|
const { value, schema, font, _cache, startingFontSize } = arg;
|
|
99418
|
-
const { fontSize: schemaFontSize, dynamicFontSize: dynamicFontSizeSetting, characterSpacing: schemaCharacterSpacing,
|
|
99529
|
+
const { fontSize: schemaFontSize, dynamicFontSize: dynamicFontSizeSetting, characterSpacing: schemaCharacterSpacing, lineHeight = 1 } = schema;
|
|
99530
|
+
const { width: boxWidth, height: boxHeight } = getBoxContentArea(schema);
|
|
99419
99531
|
const fontSize = startingFontSize || schemaFontSize || 13;
|
|
99420
99532
|
if (!dynamicFontSizeSetting) return fontSize;
|
|
99421
99533
|
if (dynamicFontSizeSetting.max < dynamicFontSizeSetting.min) return fontSize;
|
|
@@ -99501,7 +99613,7 @@ var measureTextLines = async ({ value, schema, font = getDefaultFont(), _cache =
|
|
|
99501
99613
|
const fontSize = schema.fontSize ?? 13;
|
|
99502
99614
|
const lineHeight = schema.lineHeight ?? 1;
|
|
99503
99615
|
const characterSpacing = schema.characterSpacing ?? 0;
|
|
99504
|
-
const boxWidthInPt = mm2pt(schema.width);
|
|
99616
|
+
const boxWidthInPt = mm2pt(getBoxContentArea(schema).width);
|
|
99505
99617
|
if (isInlineMarkdownTextSchema(schema)) {
|
|
99506
99618
|
const resolvedRuns = await resolveRichTextRuns({
|
|
99507
99619
|
runs: parseInlineMarkdown(value),
|
|
@@ -99545,7 +99657,8 @@ var measureTextLines = async ({ value, schema, font = getDefaultFont(), _cache =
|
|
|
99545
99657
|
};
|
|
99546
99658
|
};
|
|
99547
99659
|
var mergeTextLineRangeValue = async ({ value, replacement, schema, font = getDefaultFont(), _cache = /* @__PURE__ */ new Map() }) => {
|
|
99548
|
-
|
|
99660
|
+
const range = getTextLineRange(schema);
|
|
99661
|
+
if (!range) return replacement;
|
|
99549
99662
|
const { lines } = await measureTextLines({
|
|
99550
99663
|
value,
|
|
99551
99664
|
schema,
|
|
@@ -99553,12 +99666,29 @@ var mergeTextLineRangeValue = async ({ value, replacement, schema, font = getDef
|
|
|
99553
99666
|
_cache,
|
|
99554
99667
|
ignoreDynamicFontSize: true
|
|
99555
99668
|
});
|
|
99556
|
-
const { start, end = lines.length } =
|
|
99669
|
+
const { start, end = lines.length } = range;
|
|
99557
99670
|
const nextLines = [...lines];
|
|
99558
99671
|
nextLines.splice(start, end - start, ...splitReplacementTextToLines(replacement));
|
|
99559
99672
|
return plainTextLinesToValue(nextLines);
|
|
99560
99673
|
};
|
|
99561
99674
|
var sumLineHeights = (lineHeights) => lineHeights.reduce((sum, height) => sum + height, 0);
|
|
99675
|
+
var getTextLineHeightsWithBox = (lineHeights, schema) => lineHeights.map((height, index) => height + getTextBoxVerticalInsetForRange(schema, {
|
|
99676
|
+
start: index,
|
|
99677
|
+
end: index + 1
|
|
99678
|
+
}, lineHeights.length));
|
|
99679
|
+
var getTextSplitBoxStyle = (schema, range, totalLines) => {
|
|
99680
|
+
const { borderWidth, padding } = getBoxInsets(schema);
|
|
99681
|
+
return {
|
|
99682
|
+
...hasBoxDimension(schema.borderWidth) ? { borderWidth: getSplitBoxDimension(borderWidth, range, totalLines) } : {},
|
|
99683
|
+
...hasBoxDimension(schema.padding) ? { padding: getSplitBoxDimension(padding, range, totalLines) } : {}
|
|
99684
|
+
};
|
|
99685
|
+
};
|
|
99686
|
+
var getTextBoxVerticalInsetForRange = (schema, range, totalLines) => {
|
|
99687
|
+
const { borderWidth, padding } = getBoxInsets(schema);
|
|
99688
|
+
const splitBorderWidth = getSplitBoxDimension(borderWidth, range, totalLines);
|
|
99689
|
+
const splitPadding = getSplitBoxDimension(padding, range, totalLines);
|
|
99690
|
+
return splitBorderWidth.top + splitBorderWidth.bottom + splitPadding.top + splitPadding.bottom;
|
|
99691
|
+
};
|
|
99562
99692
|
var measurePlainTextLineHeights = (lines, fontKitFont, fontSize, lineHeight) => {
|
|
99563
99693
|
if (lines.length === 0) return [];
|
|
99564
99694
|
const firstLineHeight = heightOfFontAtSize(fontKitFont, fontSize) * lineHeight;
|
|
@@ -99574,7 +99704,7 @@ var getRichTextLineHeight = (line, fontSize) => {
|
|
|
99574
99704
|
return Math.max(...line.runs.map((run) => heightOfFontAtSize(run.fontKitFont, fontSize)));
|
|
99575
99705
|
};
|
|
99576
99706
|
//#endregion
|
|
99577
|
-
//#region ../schemas/dist/dynamicTemplate-
|
|
99707
|
+
//#region ../schemas/dist/dynamicTemplate-B4GCNLF9.js
|
|
99578
99708
|
function _typeof$18(o) {
|
|
99579
99709
|
"@babel/helpers - typeof";
|
|
99580
99710
|
return _typeof$18 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -100043,7 +100173,7 @@ function createSingleTable(body, args) {
|
|
|
100043
100173
|
const { options, _cache, basePdf } = args;
|
|
100044
100174
|
if (!isBlankPdf(basePdf)) console.warn("[@pdfme/schema/table]When specifying a custom PDF for basePdf, you cannot use features such as page breaks or re-layout of other elements.To utilize these features, please define basePdf as follows:\n{ width: number; height: number; padding: [number, number, number, number]; }");
|
|
100045
100175
|
const schema = cloneDeep$1(args.schema);
|
|
100046
|
-
const { start } = schema
|
|
100176
|
+
const { start } = getTableBodyRange(schema) || { start: 0 };
|
|
100047
100177
|
if (start % 2 === 1) {
|
|
100048
100178
|
const alternateBackgroundColor = schema.bodyStyles.alternateBackgroundColor;
|
|
100049
100179
|
schema.bodyStyles.alternateBackgroundColor = schema.bodyStyles.backgroundColor;
|
|
@@ -100073,7 +100203,8 @@ var getBodyWithRange = (value, range) => {
|
|
|
100073
100203
|
var getDynamicHeightsForTable = async (value, args) => {
|
|
100074
100204
|
if (args.schema.type !== "table") return Promise.resolve([args.schema.height]);
|
|
100075
100205
|
const schema = args.schema;
|
|
100076
|
-
const
|
|
100206
|
+
const bodyRange = getTableBodyRange(schema);
|
|
100207
|
+
const table = await createSingleTable(bodyRange?.start === 0 ? getBody$1(value) : getBodyWithRange(value, bodyRange), args);
|
|
100077
100208
|
const baseHeights = schema.showHead ? table.allRows().map((row) => row.height) : [0].concat(table.body.map((row) => row.height));
|
|
100078
100209
|
const headerHeight = schema.showHead ? table.getHeadHeight() : 0;
|
|
100079
100210
|
if (!(schema.repeatHead && isBlankPdf(args.basePdf) && headerHeight > 0)) return baseHeights;
|
|
@@ -100124,17 +100255,20 @@ var getDynamicLayoutForTable = async (value, args) => {
|
|
|
100124
100255
|
return {
|
|
100125
100256
|
heights: await getDynamicHeightsForTable(value, args),
|
|
100126
100257
|
avoidFirstUnitOnly: true,
|
|
100127
|
-
patchSplitSchema: ({ start, end, isSplit }) =>
|
|
100128
|
-
|
|
100258
|
+
patchSplitSchema: ({ start, end, isSplit }) => {
|
|
100259
|
+
const range = {
|
|
100129
100260
|
start: start === 0 ? 0 : start - 1,
|
|
100130
100261
|
end: end - 1
|
|
100131
|
-
}
|
|
100132
|
-
|
|
100133
|
-
|
|
100262
|
+
};
|
|
100263
|
+
return {
|
|
100264
|
+
__splitRange: createTableBodySplitRange(range.start, range.end),
|
|
100265
|
+
__isSplit: isSplit
|
|
100266
|
+
};
|
|
100267
|
+
}
|
|
100134
100268
|
};
|
|
100135
100269
|
};
|
|
100136
100270
|
//#endregion
|
|
100137
|
-
//#region ../schemas/dist/utils.js
|
|
100271
|
+
//#region ../schemas/dist/utils-zDZkqBnX.js
|
|
100138
100272
|
var convertForPdfLayoutProps = ({ schema, pageHeight, applyRotateTranslate = true }) => {
|
|
100139
100273
|
const { width: mmWidth, height: mmHeight, position, rotate, opacity } = schema;
|
|
100140
100274
|
const { x: mmX, y: mmY } = position;
|
|
@@ -100424,7 +100558,7 @@ var Underline = [["path", { d: "M6 4v6a6 6 0 0 0 12 0V4" }], ["line", {
|
|
|
100424
100558
|
y2: "20"
|
|
100425
100559
|
}]];
|
|
100426
100560
|
//#endregion
|
|
100427
|
-
//#region ../schemas/dist/builtins-
|
|
100561
|
+
//#region ../schemas/dist/builtins-BB2DHceW.js
|
|
100428
100562
|
var addUriLinkAnnotation = (arg) => {
|
|
100429
100563
|
const { pdfDoc, page, uri, rect, borderWidth = 0 } = arg;
|
|
100430
100564
|
const safeUri = normalizeSafeLinkUri(uri);
|
|
@@ -100453,7 +100587,7 @@ var addUriLinkAnnotation = (arg) => {
|
|
|
100453
100587
|
};
|
|
100454
100588
|
var getSyntheticBoldWidth = (run, fontSize) => run.syntheticBold ? fontSize * SYNTHETIC_BOLD_OFFSET_RATIO * 2 : 0;
|
|
100455
100589
|
var getSyntheticItalicWidth = (run, fontSize) => run.syntheticItalic ? heightOfFontAtSize(run.fontKitFont, fontSize) * Math.tan(12 * Math.PI / 180) : 0;
|
|
100456
|
-
var getRunWidth = (run, fontSize, characterSpacing) => widthOfTextAtSize(run.text, run.fontKitFont, fontSize, characterSpacing) + getSyntheticBoldWidth(run, fontSize) + getSyntheticItalicWidth(run, fontSize);
|
|
100590
|
+
var getRunWidth = (run, fontSize, characterSpacing) => widthOfTextAtSize(run.text, run.fontKitFont, fontSize, characterSpacing) + getSyntheticBoldWidth(run, fontSize) + getSyntheticItalicWidth(run, fontSize) + (run.code ? CODE_HORIZONTAL_PADDING * 2 : 0);
|
|
100457
100591
|
var getPdfFontFromObj = (run, pdfFontObj) => {
|
|
100458
100592
|
const pdfFont = pdfFontObj[run.fontName];
|
|
100459
100593
|
if (!pdfFont) throw new Error(`[@pdfme/schemas] Missing embedded font "${run.fontName}".`);
|
|
@@ -100534,10 +100668,12 @@ var getLinkAnnotationRect = (arg) => {
|
|
|
100534
100668
|
var drawRun = (arg) => {
|
|
100535
100669
|
const { page, pdfLib, run, pdfFont, x, y, rotate, pivotPoint, fontSize, lineHeight, color, opacity, colorType, characterSpacing, strikethrough, underline } = arg;
|
|
100536
100670
|
const runWidth = getRunWidth(run, fontSize, characterSpacing);
|
|
100671
|
+
const codePadding = run.code ? CODE_HORIZONTAL_PADDING : 0;
|
|
100672
|
+
const textX = x + codePadding;
|
|
100673
|
+
const textWidth = runWidth - codePadding * 2;
|
|
100537
100674
|
const textHeight = heightOfFontAtSize(run.fontKitFont, fontSize);
|
|
100538
100675
|
if (run.code) {
|
|
100539
|
-
const
|
|
100540
|
-
const bgX = x - padding;
|
|
100676
|
+
const bgX = x;
|
|
100541
100677
|
const bgY = y - textHeight * .2;
|
|
100542
100678
|
const bgPoint = rotate.angle === 0 ? {
|
|
100543
100679
|
x: bgX,
|
|
@@ -100549,7 +100685,7 @@ var drawRun = (arg) => {
|
|
|
100549
100685
|
page.drawRectangle({
|
|
100550
100686
|
x: bgPoint.x,
|
|
100551
100687
|
y: bgPoint.y,
|
|
100552
|
-
width: runWidth
|
|
100688
|
+
width: runWidth,
|
|
100553
100689
|
height: textHeight * 1.2,
|
|
100554
100690
|
rotate,
|
|
100555
100691
|
color: hex2PrintingColor(CODE_BACKGROUND_COLOR, colorType),
|
|
@@ -100558,9 +100694,9 @@ var drawRun = (arg) => {
|
|
|
100558
100694
|
}
|
|
100559
100695
|
if (strikethrough && runWidth > 0) drawDecorationLine({
|
|
100560
100696
|
page,
|
|
100561
|
-
x,
|
|
100697
|
+
x: textX,
|
|
100562
100698
|
y: y + textHeight / 3,
|
|
100563
|
-
width:
|
|
100699
|
+
width: textWidth,
|
|
100564
100700
|
rotate,
|
|
100565
100701
|
pivotPoint,
|
|
100566
100702
|
fontSize,
|
|
@@ -100569,9 +100705,9 @@ var drawRun = (arg) => {
|
|
|
100569
100705
|
});
|
|
100570
100706
|
if (underline && runWidth > 0) drawDecorationLine({
|
|
100571
100707
|
page,
|
|
100572
|
-
x,
|
|
100708
|
+
x: textX,
|
|
100573
100709
|
y: y - textHeight / 12,
|
|
100574
|
-
width:
|
|
100710
|
+
width: textWidth,
|
|
100575
100711
|
rotate,
|
|
100576
100712
|
pivotPoint,
|
|
100577
100713
|
fontSize,
|
|
@@ -100598,14 +100734,14 @@ var drawRun = (arg) => {
|
|
|
100598
100734
|
...run.syntheticItalic ? { ySkew: pdfLib.degrees(12) } : {}
|
|
100599
100735
|
});
|
|
100600
100736
|
};
|
|
100601
|
-
drawAt(
|
|
100737
|
+
drawAt(textX);
|
|
100602
100738
|
if (run.syntheticBold) {
|
|
100603
100739
|
const offset = fontSize * SYNTHETIC_BOLD_OFFSET_RATIO;
|
|
100604
|
-
for (let i = 1; i <= 2; i++) drawAt(
|
|
100740
|
+
for (let i = 1; i <= 2; i++) drawAt(textX + offset * i);
|
|
100605
100741
|
}
|
|
100606
100742
|
};
|
|
100607
100743
|
var renderInlineMarkdownText = async (arg) => {
|
|
100608
|
-
const { value, schema, font, embedPdfFont, fontKitFont, pdfDoc, page, pdfLib, _cache, colorType, fontSize, color, alignment, verticalAlignment, lineHeight, characterSpacing, x, width, height,
|
|
100744
|
+
const { value, schema, font, embedPdfFont, fontKitFont, pdfDoc, page, pdfLib, _cache, colorType, fontSize, color, alignment, verticalAlignment, lineHeight, characterSpacing, x, y, width, height, pivotPoint, rotate, opacity } = arg;
|
|
100609
100745
|
const allLines = layoutRichTextLines({
|
|
100610
100746
|
runs: await resolveRichTextRuns({
|
|
100611
100747
|
runs: parseInlineMarkdown(value),
|
|
@@ -100617,8 +100753,9 @@ var renderInlineMarkdownText = async (arg) => {
|
|
|
100617
100753
|
characterSpacing,
|
|
100618
100754
|
boxWidthInPt: width
|
|
100619
100755
|
});
|
|
100620
|
-
const
|
|
100621
|
-
const
|
|
100756
|
+
const lineRange = getTextLineRange(schema);
|
|
100757
|
+
const lines = applyTextLineRange(allLines, lineRange);
|
|
100758
|
+
const lineRangeStart = lineRange?.start ?? 0;
|
|
100622
100759
|
const pdfFontObj = await embedFontsForRuns(lines.flatMap((line) => line.runs), embedPdfFont);
|
|
100623
100760
|
const firstLineTextHeight = heightOfFontAtSize(fontKitFont, fontSize);
|
|
100624
100761
|
const descent = getFontDescentInPt(fontKitFont, fontSize);
|
|
@@ -100644,7 +100781,7 @@ var renderInlineMarkdownText = async (arg) => {
|
|
|
100644
100781
|
let xLine = x;
|
|
100645
100782
|
if (alignment === "center") xLine += (width - textWidth) / 2;
|
|
100646
100783
|
else if (alignment === "right") xLine += width - textWidth;
|
|
100647
|
-
const yLine =
|
|
100784
|
+
const yLine = y + height - yOffset - lineHeight * fontSize * rowIndex;
|
|
100648
100785
|
page.pushOperators(pdfLib.setCharacterSpacing(spacing));
|
|
100649
100786
|
if (schema.strikethrough || schema.underline) {
|
|
100650
100787
|
const textHeight = Math.max(...line.runs.map((run) => heightOfFontAtSize(run.fontKitFont, fontSize)));
|
|
@@ -100719,8 +100856,11 @@ var renderInlineMarkdownText = async (arg) => {
|
|
|
100719
100856
|
}, xLine);
|
|
100720
100857
|
});
|
|
100721
100858
|
};
|
|
100722
|
-
var
|
|
100723
|
-
var
|
|
100859
|
+
var TEXT_OVERFLOW_EXPAND_SCHEMA_TYPES$1 = new Set(["text", "multiVariableText"]);
|
|
100860
|
+
var isTextOverflowExpandSchema = (schema) => schema.type === void 0 || TEXT_OVERFLOW_EXPAND_SCHEMA_TYPES$1.has(schema.type);
|
|
100861
|
+
var canUseTextOverflowExpand = (schema, basePdf) => !isTextOverflowExpandSchema(schema) || basePdf === void 0 || isBlankPdf(basePdf);
|
|
100862
|
+
var isTextOverflowExpand = (schema, basePdf) => canUseTextOverflowExpand(schema, basePdf) && schema.overflow === "expand";
|
|
100863
|
+
var shouldUseDynamicFontSize = (schema, basePdf) => Boolean(schema.dynamicFontSize) && !isTextOverflowExpand(schema, basePdf);
|
|
100724
100864
|
var PDF_FONT_CACHE_KEY = "text-pdf-font-cache";
|
|
100725
100865
|
var getPdfFontCache = (_cache) => {
|
|
100726
100866
|
let pdfFontCache = _cache.get(PDF_FONT_CACHE_KEY);
|
|
@@ -100745,8 +100885,8 @@ var embedAndGetFont = (arg) => {
|
|
|
100745
100885
|
pdfFontCache[fontName] = pdfFontPromise;
|
|
100746
100886
|
return pdfFontPromise;
|
|
100747
100887
|
};
|
|
100748
|
-
var getFontProp = ({ value, fontKitFont, schema, colorType, fontSize: resolvedFontSize }) => {
|
|
100749
|
-
const fontSize = resolvedFontSize ?? (shouldUseDynamicFontSize(schema) ? calculateDynamicFontSize({
|
|
100888
|
+
var getFontProp = ({ value, fontKitFont, schema, basePdf, colorType, fontSize: resolvedFontSize }) => {
|
|
100889
|
+
const fontSize = resolvedFontSize ?? (shouldUseDynamicFontSize(schema, basePdf) ? calculateDynamicFontSize({
|
|
100750
100890
|
textSchema: schema,
|
|
100751
100891
|
fontKitFont,
|
|
100752
100892
|
value
|
|
@@ -100767,11 +100907,37 @@ var getGraphemeSegmenter = () => {
|
|
|
100767
100907
|
return graphemeSegmenter;
|
|
100768
100908
|
};
|
|
100769
100909
|
var pdfRender = async (arg) => {
|
|
100770
|
-
const { value, pdfDoc, pdfLib, page, options, schema, _cache } = arg;
|
|
100771
|
-
if (!value) return;
|
|
100910
|
+
const { value, pdfDoc, pdfLib, page, options, schema, basePdf, _cache } = arg;
|
|
100772
100911
|
const { font = getDefaultFont(), colorType } = options;
|
|
100912
|
+
const pageHeight = page.getHeight();
|
|
100913
|
+
const { width, height, rotate, position: { x, y }, opacity } = convertForPdfLayoutProps({
|
|
100914
|
+
schema,
|
|
100915
|
+
pageHeight,
|
|
100916
|
+
applyRotateTranslate: false
|
|
100917
|
+
});
|
|
100918
|
+
const pivotPoint = {
|
|
100919
|
+
x: x + width / 2,
|
|
100920
|
+
y: pageHeight - mm2pt(schema.position.y) - height / 2
|
|
100921
|
+
};
|
|
100922
|
+
drawTextBoxDecoration({
|
|
100923
|
+
page,
|
|
100924
|
+
schema,
|
|
100925
|
+
colorType,
|
|
100926
|
+
x,
|
|
100927
|
+
y,
|
|
100928
|
+
width,
|
|
100929
|
+
height,
|
|
100930
|
+
rotate,
|
|
100931
|
+
pivotPoint
|
|
100932
|
+
});
|
|
100933
|
+
if (!value) return;
|
|
100773
100934
|
const fontName = schema.fontName ? schema.fontName : getFallbackFontName(font);
|
|
100774
100935
|
const enableInlineMarkdown = isInlineMarkdownTextSchema(schema);
|
|
100936
|
+
const contentArea = getBoxContentArea(schema);
|
|
100937
|
+
const contentX = x + mm2pt(contentArea.leftInset);
|
|
100938
|
+
const contentY = y + mm2pt(contentArea.bottomInset);
|
|
100939
|
+
const contentWidth = mm2pt(contentArea.width);
|
|
100940
|
+
const contentHeight = mm2pt(contentArea.height);
|
|
100775
100941
|
const pdfFontValuePromise = enableInlineMarkdown ? void 0 : embedAndGetFont({
|
|
100776
100942
|
pdfDoc,
|
|
100777
100943
|
font,
|
|
@@ -100783,48 +100949,15 @@ var pdfRender = async (arg) => {
|
|
|
100783
100949
|
value: enableInlineMarkdown ? stripInlineMarkdown(value) : value,
|
|
100784
100950
|
fontKitFont,
|
|
100785
100951
|
schema,
|
|
100952
|
+
basePdf,
|
|
100786
100953
|
colorType,
|
|
100787
|
-
fontSize: enableInlineMarkdown && shouldUseDynamicFontSize(schema) ? await calculateDynamicRichTextFontSize({
|
|
100954
|
+
fontSize: enableInlineMarkdown && shouldUseDynamicFontSize(schema, basePdf) ? await calculateDynamicRichTextFontSize({
|
|
100788
100955
|
value,
|
|
100789
100956
|
schema,
|
|
100790
100957
|
font,
|
|
100791
100958
|
_cache
|
|
100792
100959
|
}) : void 0
|
|
100793
100960
|
});
|
|
100794
|
-
const pageHeight = page.getHeight();
|
|
100795
|
-
const { width, height, rotate, position: { x, y }, opacity } = convertForPdfLayoutProps({
|
|
100796
|
-
schema,
|
|
100797
|
-
pageHeight,
|
|
100798
|
-
applyRotateTranslate: false
|
|
100799
|
-
});
|
|
100800
|
-
const pivotPoint = {
|
|
100801
|
-
x: x + width / 2,
|
|
100802
|
-
y: pageHeight - mm2pt(schema.position.y) - height / 2
|
|
100803
|
-
};
|
|
100804
|
-
if (schema.backgroundColor) {
|
|
100805
|
-
const color = hex2PrintingColor(schema.backgroundColor, colorType);
|
|
100806
|
-
if (rotate.angle !== 0) {
|
|
100807
|
-
const rotatedPoint = rotatePoint({
|
|
100808
|
-
x,
|
|
100809
|
-
y
|
|
100810
|
-
}, pivotPoint, rotate.angle);
|
|
100811
|
-
page.drawRectangle({
|
|
100812
|
-
x: rotatedPoint.x,
|
|
100813
|
-
y: rotatedPoint.y,
|
|
100814
|
-
width,
|
|
100815
|
-
height,
|
|
100816
|
-
rotate,
|
|
100817
|
-
color
|
|
100818
|
-
});
|
|
100819
|
-
} else page.drawRectangle({
|
|
100820
|
-
x,
|
|
100821
|
-
y,
|
|
100822
|
-
width,
|
|
100823
|
-
height,
|
|
100824
|
-
rotate,
|
|
100825
|
-
color
|
|
100826
|
-
});
|
|
100827
|
-
}
|
|
100828
100961
|
if (enableInlineMarkdown) {
|
|
100829
100962
|
await renderInlineMarkdownText({
|
|
100830
100963
|
value,
|
|
@@ -100848,10 +100981,10 @@ var pdfRender = async (arg) => {
|
|
|
100848
100981
|
verticalAlignment,
|
|
100849
100982
|
lineHeight,
|
|
100850
100983
|
characterSpacing,
|
|
100851
|
-
x,
|
|
100852
|
-
|
|
100853
|
-
|
|
100854
|
-
|
|
100984
|
+
x: contentX,
|
|
100985
|
+
y: contentY,
|
|
100986
|
+
width: contentWidth,
|
|
100987
|
+
height: contentHeight,
|
|
100855
100988
|
pivotPoint,
|
|
100856
100989
|
rotate,
|
|
100857
100990
|
opacity
|
|
@@ -100868,16 +101001,16 @@ var pdfRender = async (arg) => {
|
|
|
100868
101001
|
characterSpacing,
|
|
100869
101002
|
fontSize,
|
|
100870
101003
|
fontKitFont,
|
|
100871
|
-
boxWidthInPt:
|
|
100872
|
-
}), schema
|
|
101004
|
+
boxWidthInPt: contentWidth
|
|
101005
|
+
}), getTextLineRange(schema));
|
|
100873
101006
|
const needsTextWidth = alignment !== "left" || Boolean(schema.strikethrough || schema.underline);
|
|
100874
101007
|
const needsTextHeight = Boolean(schema.strikethrough || schema.underline);
|
|
100875
101008
|
let yOffset = 0;
|
|
100876
101009
|
if (verticalAlignment === "top") yOffset = firstLineTextHeight + halfLineHeightAdjustment;
|
|
100877
101010
|
else {
|
|
100878
101011
|
const otherLinesHeight = lineHeight * fontSize * (lines.length - 1);
|
|
100879
|
-
if (verticalAlignment === "bottom") yOffset =
|
|
100880
|
-
else if (verticalAlignment === "middle") yOffset = (
|
|
101012
|
+
if (verticalAlignment === "bottom") yOffset = contentHeight - otherLinesHeight + descent - halfLineHeightAdjustment;
|
|
101013
|
+
else if (verticalAlignment === "middle") yOffset = (contentHeight - otherLinesHeight - firstLineTextHeight + descent) / 2 + firstLineTextHeight;
|
|
100881
101014
|
}
|
|
100882
101015
|
lines.forEach((line, rowIndex) => {
|
|
100883
101016
|
const trimmed = line.replace("\n", "");
|
|
@@ -100885,10 +101018,10 @@ var pdfRender = async (arg) => {
|
|
|
100885
101018
|
const textHeight = needsTextHeight ? heightOfFontAtSize(fontKitFont, fontSize) : 0;
|
|
100886
101019
|
const rowYOffset = lineHeight * fontSize * rowIndex;
|
|
100887
101020
|
if (line === "") line = "\r\n";
|
|
100888
|
-
let xLine =
|
|
100889
|
-
if (alignment === "center") xLine += (
|
|
100890
|
-
else if (alignment === "right") xLine +=
|
|
100891
|
-
let yLine =
|
|
101021
|
+
let xLine = contentX;
|
|
101022
|
+
if (alignment === "center") xLine += (contentWidth - textWidth) / 2;
|
|
101023
|
+
else if (alignment === "right") xLine += contentWidth - textWidth;
|
|
101024
|
+
let yLine = contentY + contentHeight - yOffset - rowYOffset;
|
|
100892
101025
|
if (schema.strikethrough && textWidth > 0) {
|
|
100893
101026
|
const _x = xLine + textWidth + 1;
|
|
100894
101027
|
const _y = yLine + textHeight / 3;
|
|
@@ -100935,7 +101068,7 @@ var pdfRender = async (arg) => {
|
|
|
100935
101068
|
if (alignment === "justify" && line.slice(-1) !== "\n") {
|
|
100936
101069
|
const iterator = getGraphemeSegmenter().segment(trimmed)[Symbol.iterator]();
|
|
100937
101070
|
const len = Array.from(iterator).length;
|
|
100938
|
-
spacing += (
|
|
101071
|
+
spacing += (contentWidth - textWidth) / len;
|
|
100939
101072
|
}
|
|
100940
101073
|
page.pushOperators(pdfLib.setCharacterSpacing(spacing));
|
|
100941
101074
|
page.drawText(trimmed, {
|
|
@@ -100950,6 +101083,75 @@ var pdfRender = async (arg) => {
|
|
|
100950
101083
|
});
|
|
100951
101084
|
});
|
|
100952
101085
|
};
|
|
101086
|
+
var drawTextBoxDecoration = (arg) => {
|
|
101087
|
+
const { page, schema, colorType, x, y, width, height, rotate, pivotPoint } = arg;
|
|
101088
|
+
const { borderWidth } = getBoxInsets(schema);
|
|
101089
|
+
const opacity = schema.opacity ?? 1;
|
|
101090
|
+
const drawRectangle = (rect) => {
|
|
101091
|
+
if (rect.width <= 0 || rect.height <= 0) return;
|
|
101092
|
+
const point = rotate.angle === 0 ? {
|
|
101093
|
+
x: rect.x,
|
|
101094
|
+
y: rect.y
|
|
101095
|
+
} : rotatePoint({
|
|
101096
|
+
x: rect.x,
|
|
101097
|
+
y: rect.y
|
|
101098
|
+
}, pivotPoint, rotate.angle);
|
|
101099
|
+
page.drawRectangle({
|
|
101100
|
+
x: point.x,
|
|
101101
|
+
y: point.y,
|
|
101102
|
+
width: rect.width,
|
|
101103
|
+
height: rect.height,
|
|
101104
|
+
rotate,
|
|
101105
|
+
color: rect.color,
|
|
101106
|
+
opacity
|
|
101107
|
+
});
|
|
101108
|
+
};
|
|
101109
|
+
if (schema.backgroundColor) {
|
|
101110
|
+
const color = hex2PrintingColor(schema.backgroundColor, colorType);
|
|
101111
|
+
if (color) drawRectangle({
|
|
101112
|
+
x,
|
|
101113
|
+
y,
|
|
101114
|
+
width,
|
|
101115
|
+
height,
|
|
101116
|
+
color
|
|
101117
|
+
});
|
|
101118
|
+
}
|
|
101119
|
+
if (!schema.borderColor || !hasBoxDimension(schema.borderWidth)) return;
|
|
101120
|
+
const color = hex2PrintingColor(schema.borderColor, colorType);
|
|
101121
|
+
if (!color) return;
|
|
101122
|
+
const top = mm2pt(borderWidth.top);
|
|
101123
|
+
const right = mm2pt(borderWidth.right);
|
|
101124
|
+
const bottom = mm2pt(borderWidth.bottom);
|
|
101125
|
+
const left = mm2pt(borderWidth.left);
|
|
101126
|
+
drawRectangle({
|
|
101127
|
+
x,
|
|
101128
|
+
y: y + height - top,
|
|
101129
|
+
width,
|
|
101130
|
+
height: top,
|
|
101131
|
+
color
|
|
101132
|
+
});
|
|
101133
|
+
drawRectangle({
|
|
101134
|
+
x: x + width - right,
|
|
101135
|
+
y,
|
|
101136
|
+
width: right,
|
|
101137
|
+
height,
|
|
101138
|
+
color
|
|
101139
|
+
});
|
|
101140
|
+
drawRectangle({
|
|
101141
|
+
x,
|
|
101142
|
+
y,
|
|
101143
|
+
width,
|
|
101144
|
+
height: bottom,
|
|
101145
|
+
color
|
|
101146
|
+
});
|
|
101147
|
+
drawRectangle({
|
|
101148
|
+
x,
|
|
101149
|
+
y,
|
|
101150
|
+
width: left,
|
|
101151
|
+
height,
|
|
101152
|
+
color
|
|
101153
|
+
});
|
|
101154
|
+
};
|
|
100953
101155
|
var TextStrikethroughIcon = createSvgStr(Strikethrough);
|
|
100954
101156
|
var TextUnderlineIcon = createSvgStr(Underline);
|
|
100955
101157
|
var TextAlignLeftIcon = createSvgStr(TextAlignStart);
|
|
@@ -101029,8 +101231,8 @@ function getExtraFormatterSchema(i18n) {
|
|
|
101029
101231
|
};
|
|
101030
101232
|
}
|
|
101031
101233
|
var UseDynamicFontSize = (props) => {
|
|
101032
|
-
const { rootElement, changeSchemas, activeSchema, i18n } = props;
|
|
101033
|
-
const isExpand = isTextOverflowExpand(activeSchema);
|
|
101234
|
+
const { rootElement, changeSchemas, activeSchema, i18n, basePdf } = props;
|
|
101235
|
+
const isExpand = isTextOverflowExpand(activeSchema, basePdf);
|
|
101034
101236
|
const checkbox = document.createElement("input");
|
|
101035
101237
|
checkbox.type = "checkbox";
|
|
101036
101238
|
checkbox.checked = !isExpand && Boolean(activeSchema?.dynamicFontSize);
|
|
@@ -101078,7 +101280,7 @@ var UseInlineMarkdown = (props) => {
|
|
|
101078
101280
|
rootElement.appendChild(label);
|
|
101079
101281
|
};
|
|
101080
101282
|
var propPanel = {
|
|
101081
|
-
schema: ({ options, activeSchema, i18n }) => {
|
|
101283
|
+
schema: ({ options, activeSchema, i18n, basePdf }) => {
|
|
101082
101284
|
const font = options.font || { ["Roboto"]: {
|
|
101083
101285
|
data: "",
|
|
101084
101286
|
fallback: true
|
|
@@ -101086,7 +101288,8 @@ var propPanel = {
|
|
|
101086
101288
|
const fontNames = Object.keys(font);
|
|
101087
101289
|
const fallbackFontName = getFallbackFontName(font);
|
|
101088
101290
|
const activeTextSchema = activeSchema;
|
|
101089
|
-
const
|
|
101291
|
+
const canExpandOverflow = canUseTextOverflowExpand(activeTextSchema, basePdf);
|
|
101292
|
+
const enableDynamicFont = !isTextOverflowExpand(activeTextSchema, basePdf) && Boolean(activeSchema?.dynamicFontSize);
|
|
101090
101293
|
const hideTextFormat = activeTextSchema.type === "text" && activeTextSchema.readOnly !== true;
|
|
101091
101294
|
const enableInlineMarkdown = activeTextSchema.textFormat === "inline-markdown" && !hideTextFormat;
|
|
101092
101295
|
const baseFontName = activeTextSchema.fontName && font[activeTextSchema.fontName] ? activeTextSchema.fontName : fallbackFontName;
|
|
@@ -101097,6 +101300,13 @@ var propPanel = {
|
|
|
101097
101300
|
label: name,
|
|
101098
101301
|
value: name
|
|
101099
101302
|
}))];
|
|
101303
|
+
const overflowOptions = [{
|
|
101304
|
+
label: i18n("schemas.text.overflowVisible"),
|
|
101305
|
+
value: TEXT_OVERFLOW_VISIBLE
|
|
101306
|
+
}, ...canExpandOverflow ? [{
|
|
101307
|
+
label: i18n("schemas.text.overflowExpand"),
|
|
101308
|
+
value: TEXT_OVERFLOW_EXPAND
|
|
101309
|
+
}] : []];
|
|
101100
101310
|
return {
|
|
101101
101311
|
fontName: {
|
|
101102
101312
|
title: i18n("schemas.text.fontName"),
|
|
@@ -101141,13 +101351,7 @@ var propPanel = {
|
|
|
101141
101351
|
type: "string",
|
|
101142
101352
|
widget: "select",
|
|
101143
101353
|
default: DEFAULT_TEXT_OVERFLOW,
|
|
101144
|
-
props: { options:
|
|
101145
|
-
label: i18n("schemas.text.overflowVisible"),
|
|
101146
|
-
value: TEXT_OVERFLOW_VISIBLE
|
|
101147
|
-
}, {
|
|
101148
|
-
label: i18n("schemas.text.overflowExpand"),
|
|
101149
|
-
value: TEXT_OVERFLOW_EXPAND
|
|
101150
|
-
}] },
|
|
101354
|
+
props: { options: overflowOptions },
|
|
101151
101355
|
span: 8
|
|
101152
101356
|
},
|
|
101153
101357
|
useDynamicFontSize: {
|
|
@@ -101210,6 +101414,30 @@ var propPanel = {
|
|
|
101210
101414
|
message: i18n("validation.hexColor")
|
|
101211
101415
|
}]
|
|
101212
101416
|
},
|
|
101417
|
+
borderColor: {
|
|
101418
|
+
title: i18n("schemas.borderColor"),
|
|
101419
|
+
type: "string",
|
|
101420
|
+
widget: "color",
|
|
101421
|
+
props: { disabledAlpha: true },
|
|
101422
|
+
rules: [{
|
|
101423
|
+
pattern: HEX_COLOR_PATTERN,
|
|
101424
|
+
message: i18n("validation.hexColor")
|
|
101425
|
+
}]
|
|
101426
|
+
},
|
|
101427
|
+
borderWidth: {
|
|
101428
|
+
title: i18n("schemas.borderWidth"),
|
|
101429
|
+
type: "object",
|
|
101430
|
+
widget: "lineTitle",
|
|
101431
|
+
span: 24,
|
|
101432
|
+
properties: getBoxDimensionPropPanelSchema(.1)
|
|
101433
|
+
},
|
|
101434
|
+
padding: {
|
|
101435
|
+
title: i18n("schemas.padding"),
|
|
101436
|
+
type: "object",
|
|
101437
|
+
widget: "lineTitle",
|
|
101438
|
+
span: 24,
|
|
101439
|
+
properties: getBoxDimensionPropPanelSchema()
|
|
101440
|
+
},
|
|
101213
101441
|
useInlineMarkdown: {
|
|
101214
101442
|
type: "boolean",
|
|
101215
101443
|
widget: "UseInlineMarkdown",
|
|
@@ -101301,6 +101529,9 @@ var propPanel = {
|
|
|
101301
101529
|
fontColor: DEFAULT_FONT_COLOR,
|
|
101302
101530
|
fontName: void 0,
|
|
101303
101531
|
backgroundColor: "",
|
|
101532
|
+
borderColor: "#000000",
|
|
101533
|
+
borderWidth: createBoxDimension(0),
|
|
101534
|
+
padding: createBoxDimension(0),
|
|
101304
101535
|
opacity: 1,
|
|
101305
101536
|
strikethrough: false,
|
|
101306
101537
|
underline: false
|
|
@@ -101323,10 +101554,10 @@ var replaceUnsupportedChars = (text, fontKitFont) => {
|
|
|
101323
101554
|
}).join("");
|
|
101324
101555
|
};
|
|
101325
101556
|
var uiRender = async (arg) => {
|
|
101326
|
-
const { value, schema, mode, onChange, stopEditing, tabIndex, placeholder, options, _cache } = arg;
|
|
101557
|
+
const { value, schema, basePdf, mode, onChange, stopEditing, tabIndex, placeholder, options, _cache } = arg;
|
|
101327
101558
|
const hasInlineMarkdownFormat = schema.textFormat === TEXT_FORMAT_INLINE_MARKDOWN;
|
|
101328
101559
|
const enableInlineMarkdown = isInlineMarkdownTextSchema(schema);
|
|
101329
|
-
const isReadOnlySplitInlineMarkdownFormChunk = mode === "form" && Boolean(schema
|
|
101560
|
+
const isReadOnlySplitInlineMarkdownFormChunk = mode === "form" && Boolean(getTextLineRange(schema)) && hasInlineMarkdownFormat;
|
|
101330
101561
|
const renderInlineMarkdownReadOnlyChunk = enableInlineMarkdown || isReadOnlySplitInlineMarkdownFormChunk;
|
|
101331
101562
|
const editable = isEditable(mode, schema) && !isReadOnlySplitInlineMarkdownFormChunk;
|
|
101332
101563
|
const usePlaceholder = editable && placeholder && !value;
|
|
@@ -101337,7 +101568,7 @@ var uiRender = async (arg) => {
|
|
|
101337
101568
|
};
|
|
101338
101569
|
const font = options?.font || getDefaultFont();
|
|
101339
101570
|
const fontKitFont = await getFontKitFont(schema.fontName, font, _cache);
|
|
101340
|
-
const enableDynamicFontSize = shouldUseDynamicFontSize(schema);
|
|
101571
|
+
const enableDynamicFontSize = shouldUseDynamicFontSize(schema, basePdf);
|
|
101341
101572
|
const displayValue = enableInlineMarkdown ? stripInlineMarkdown(value) : value;
|
|
101342
101573
|
const dynamicRichTextFontSize = enableInlineMarkdown && enableDynamicFontSize ? await calculateDynamicRichTextFontSize({
|
|
101343
101574
|
value: usePlaceholder ? placeholder : value,
|
|
@@ -101431,13 +101662,14 @@ var renderInlineMarkdownReadOnly = async (arg) => {
|
|
|
101431
101662
|
font,
|
|
101432
101663
|
_cache
|
|
101433
101664
|
});
|
|
101434
|
-
|
|
101665
|
+
const lineRange = getTextLineRange(schema);
|
|
101666
|
+
if (lineRange) {
|
|
101435
101667
|
const lines = applyTextLineRange(layoutRichTextLines({
|
|
101436
101668
|
runs,
|
|
101437
101669
|
fontSize: schema.fontSize ?? 13,
|
|
101438
101670
|
characterSpacing: schema.characterSpacing ?? 0,
|
|
101439
|
-
boxWidthInPt: mm2pt(schema.width)
|
|
101440
|
-
}),
|
|
101671
|
+
boxWidthInPt: mm2pt(getBoxContentArea(schema).width)
|
|
101672
|
+
}), lineRange);
|
|
101441
101673
|
textBlock.innerHTML = "";
|
|
101442
101674
|
lines.forEach((line, lineIndex) => {
|
|
101443
101675
|
line.runs.forEach((run) => {
|
|
@@ -101496,19 +101728,20 @@ var appendInlineMarkdownRun = (arg) => {
|
|
|
101496
101728
|
};
|
|
101497
101729
|
var getRangedPlainTextValue = (arg) => {
|
|
101498
101730
|
const { value, schema, fontKitFont, fontSize } = arg;
|
|
101499
|
-
|
|
101731
|
+
const lineRange = getTextLineRange(schema);
|
|
101732
|
+
if (!lineRange) return value;
|
|
101500
101733
|
return plainTextLinesToValue(applyTextLineRange(splitTextToSize({
|
|
101501
101734
|
value,
|
|
101502
101735
|
characterSpacing: schema.characterSpacing ?? 0,
|
|
101503
101736
|
fontSize,
|
|
101504
101737
|
fontKitFont,
|
|
101505
|
-
boxWidthInPt: mm2pt(schema.width)
|
|
101506
|
-
}),
|
|
101738
|
+
boxWidthInPt: mm2pt(getBoxContentArea(schema).width)
|
|
101739
|
+
}), lineRange));
|
|
101507
101740
|
};
|
|
101508
101741
|
var buildStyledTextContainer = (arg, fontKitFont, value, resolvedDynamicFontSize) => {
|
|
101509
101742
|
const { schema, rootElement, mode } = arg;
|
|
101510
101743
|
let dynamicFontSize = resolvedDynamicFontSize;
|
|
101511
|
-
if (dynamicFontSize === void 0 && shouldUseDynamicFontSize(schema) && value) dynamicFontSize = calculateDynamicFontSize({
|
|
101744
|
+
if (dynamicFontSize === void 0 && shouldUseDynamicFontSize(schema, arg.basePdf) && value) dynamicFontSize = calculateDynamicFontSize({
|
|
101512
101745
|
textSchema: schema,
|
|
101513
101746
|
fontKitFont,
|
|
101514
101747
|
value,
|
|
@@ -101517,15 +101750,29 @@ var buildStyledTextContainer = (arg, fontKitFont, value, resolvedDynamicFontSize
|
|
|
101517
101750
|
const { topAdj, bottomAdj } = getBrowserVerticalFontAdjustments(fontKitFont, dynamicFontSize ?? schema.fontSize ?? 13, schema.lineHeight ?? 1, schema.verticalAlignment ?? "top");
|
|
101518
101751
|
const topAdjustment = topAdj.toString();
|
|
101519
101752
|
const bottomAdjustment = bottomAdj.toString();
|
|
101753
|
+
const verticalAlignment = schema.verticalAlignment ?? "top";
|
|
101754
|
+
const isTopAligned = verticalAlignment === "top";
|
|
101520
101755
|
const container = document.createElement("div");
|
|
101756
|
+
const { borderWidth, padding } = getBoxInsets(schema);
|
|
101757
|
+
const hasPadding = hasBoxDimension(schema.padding);
|
|
101758
|
+
const hasBorder = Boolean(schema.borderColor && hasBoxDimension(schema.borderWidth));
|
|
101521
101759
|
const containerStyle = {
|
|
101522
|
-
padding: 0,
|
|
101760
|
+
padding: hasPadding ? `${padding.top}mm ${padding.right}mm ${padding.bottom}mm ${padding.left}mm` : 0,
|
|
101523
101761
|
resize: "none",
|
|
101524
|
-
backgroundColor: getBackgroundColor(
|
|
101525
|
-
border: "none",
|
|
101762
|
+
backgroundColor: getBackgroundColor(schema),
|
|
101763
|
+
border: hasBorder ? void 0 : "none",
|
|
101764
|
+
...hasBorder ? {
|
|
101765
|
+
borderTopWidth: `${borderWidth.top}mm`,
|
|
101766
|
+
borderRightWidth: `${borderWidth.right}mm`,
|
|
101767
|
+
borderBottomWidth: `${borderWidth.bottom}mm`,
|
|
101768
|
+
borderLeftWidth: `${borderWidth.left}mm`,
|
|
101769
|
+
borderStyle: "solid",
|
|
101770
|
+
borderColor: schema.borderColor
|
|
101771
|
+
} : {},
|
|
101772
|
+
...hasPadding || hasBorder ? { boxSizing: "border-box" } : {},
|
|
101526
101773
|
display: "flex",
|
|
101527
101774
|
flexDirection: "column",
|
|
101528
|
-
justifyContent: mapVerticalAlignToFlex(
|
|
101775
|
+
justifyContent: mapVerticalAlignToFlex(verticalAlignment),
|
|
101529
101776
|
width: "100%",
|
|
101530
101777
|
height: "100%",
|
|
101531
101778
|
cursor: isEditable(mode, schema) ? "text" : "default"
|
|
@@ -101551,7 +101798,8 @@ var buildStyledTextContainer = (arg, fontKitFont, value, resolvedDynamicFontSize
|
|
|
101551
101798
|
marginBottom: `${bottomAdjustment}px`,
|
|
101552
101799
|
paddingTop: `${topAdjustment}px`,
|
|
101553
101800
|
backgroundColor: "transparent",
|
|
101554
|
-
textDecoration: textDecorations.join(" ")
|
|
101801
|
+
textDecoration: textDecorations.join(" "),
|
|
101802
|
+
...isTopAligned ? { height: "100%" } : {}
|
|
101555
101803
|
};
|
|
101556
101804
|
const textBlock = document.createElement("div");
|
|
101557
101805
|
textBlock.id = "text-" + String(schema.id);
|
|
@@ -101593,8 +101841,8 @@ var mapVerticalAlignToFlex = (verticalAlignmentValue) => {
|
|
|
101593
101841
|
}
|
|
101594
101842
|
return "flex-start";
|
|
101595
101843
|
};
|
|
101596
|
-
var getBackgroundColor = (
|
|
101597
|
-
if (!
|
|
101844
|
+
var getBackgroundColor = (schema) => {
|
|
101845
|
+
if (!schema.backgroundColor) return "transparent";
|
|
101598
101846
|
return schema.backgroundColor;
|
|
101599
101847
|
};
|
|
101600
101848
|
var builtInPlugins = { Text: {
|
|
@@ -213662,7 +213910,7 @@ withProvider(FormCore, { Html: html });
|
|
|
213662
213910
|
//#region ../../node_modules/form-render/es/index.js
|
|
213663
213911
|
var es_default = withProvider(FormCore, widgets_exports);
|
|
213664
213912
|
//#endregion
|
|
213665
|
-
//#region ../schemas/dist/helper-
|
|
213913
|
+
//#region ../schemas/dist/helper-CEme39Uo.js
|
|
213666
213914
|
var substituteVariables = (text, variablesIn, valueMapper = (value) => value) => {
|
|
213667
213915
|
if (!text) return "";
|
|
213668
213916
|
let substitutedText = text;
|
|
@@ -213698,7 +213946,7 @@ var validateVariables = (value, schema) => {
|
|
|
213698
213946
|
return true;
|
|
213699
213947
|
};
|
|
213700
213948
|
//#endregion
|
|
213701
|
-
//#region ../schemas/dist/dynamicTemplate-
|
|
213949
|
+
//#region ../schemas/dist/dynamicTemplate-C7MdZxPm.js
|
|
213702
213950
|
var getDynamicLayoutForMultiVariableText = async (value, args) => {
|
|
213703
213951
|
if (args.schema.type !== "multiVariableText") return { heights: [args.schema.height] };
|
|
213704
213952
|
const schema = args.schema;
|
|
@@ -213715,20 +213963,22 @@ var getDynamicLayoutForMultiVariableText = async (value, args) => {
|
|
|
213715
213963
|
_cache: args._cache,
|
|
213716
213964
|
ignoreDynamicFontSize: true
|
|
213717
213965
|
});
|
|
213718
|
-
const
|
|
213966
|
+
const heights = getTextLineHeightsWithBox(lineHeights, schema);
|
|
213967
|
+
const measuredHeight = sumLineHeights(heights);
|
|
213719
213968
|
if (measuredHeight <= schema.height || lineHeights.length === 0) return {
|
|
213720
213969
|
heights: [schema.height],
|
|
213721
213970
|
patchSplitSchema: () => ({ dynamicFontSize: void 0 })
|
|
213722
213971
|
};
|
|
213723
213972
|
return {
|
|
213724
|
-
heights: lineHeights.length === 1 ? [Math.max(schema.height, measuredHeight)] :
|
|
213973
|
+
heights: lineHeights.length === 1 ? [Math.max(schema.height, measuredHeight)] : heights,
|
|
213725
213974
|
patchSplitSchema: ({ start, end, isSplit }) => ({
|
|
213726
213975
|
dynamicFontSize: void 0,
|
|
213727
|
-
|
|
213976
|
+
__splitRange: lineHeights.length === 1 ? void 0 : createTextLineSplitRange(start, end),
|
|
213977
|
+
__isSplit: isSplit,
|
|
213978
|
+
...getTextSplitBoxStyle(schema, {
|
|
213728
213979
|
start,
|
|
213729
213980
|
end
|
|
213730
|
-
},
|
|
213731
|
-
__isSplit: isSplit
|
|
213981
|
+
}, lineHeights.length)
|
|
213732
213982
|
})
|
|
213733
213983
|
};
|
|
213734
213984
|
};
|
|
@@ -213743,20 +213993,22 @@ var getDynamicLayoutForText = async (value, args) => {
|
|
|
213743
213993
|
_cache: args._cache,
|
|
213744
213994
|
ignoreDynamicFontSize: true
|
|
213745
213995
|
});
|
|
213746
|
-
const
|
|
213996
|
+
const heights = getTextLineHeightsWithBox(lineHeights, schema);
|
|
213997
|
+
const measuredHeight = sumLineHeights(heights);
|
|
213747
213998
|
if (measuredHeight <= schema.height || lineHeights.length === 0) return {
|
|
213748
213999
|
heights: [schema.height],
|
|
213749
214000
|
patchSplitSchema: () => ({ dynamicFontSize: void 0 })
|
|
213750
214001
|
};
|
|
213751
214002
|
return {
|
|
213752
|
-
heights: lineHeights.length === 1 ? [Math.max(schema.height, measuredHeight)] :
|
|
214003
|
+
heights: lineHeights.length === 1 ? [Math.max(schema.height, measuredHeight)] : heights,
|
|
213753
214004
|
patchSplitSchema: ({ start, end, isSplit }) => ({
|
|
213754
214005
|
dynamicFontSize: void 0,
|
|
213755
|
-
|
|
214006
|
+
__splitRange: lineHeights.length === 1 ? void 0 : createTextLineSplitRange(start, end),
|
|
214007
|
+
__isSplit: isSplit,
|
|
214008
|
+
...getTextSplitBoxStyle(schema, {
|
|
213756
214009
|
start,
|
|
213757
214010
|
end
|
|
213758
|
-
},
|
|
213759
|
-
__isSplit: isSplit
|
|
214011
|
+
}, lineHeights.length)
|
|
213760
214012
|
})
|
|
213761
214013
|
};
|
|
213762
214014
|
};
|
|
@@ -213983,6 +214235,7 @@ var ButtonGroupWidget = (props) => {
|
|
|
213983
214235
|
//#endregion
|
|
213984
214236
|
//#region src/components/Designer/RightSidebar/DetailView/index.tsx
|
|
213985
214237
|
var { Text: Text$2 } = Typography;
|
|
214238
|
+
var TEXT_OVERFLOW_EXPAND_SCHEMA_TYPES = new Set(["text", "multiVariableText"]);
|
|
213986
214239
|
var DetailView = (props) => {
|
|
213987
214240
|
const { token } = theme_default.useToken();
|
|
213988
214241
|
const { schemasList, changeSchemas, deselectSchema, activeSchema, pageSize, basePdf } = props;
|
|
@@ -214037,6 +214290,19 @@ var DetailView = (props) => {
|
|
|
214037
214290
|
values.editable = !(typeof values.readOnly === "boolean" ? values.readOnly : false);
|
|
214038
214291
|
form.setValues(values);
|
|
214039
214292
|
}, [activeSchema, form]);
|
|
214293
|
+
(0, import_react$9.useEffect)(() => {
|
|
214294
|
+
if (isBlankPdf(basePdf) || !TEXT_OVERFLOW_EXPAND_SCHEMA_TYPES.has(activeSchema.type)) return;
|
|
214295
|
+
if (activeSchema.overflow !== "expand") return;
|
|
214296
|
+
changeSchemas([{
|
|
214297
|
+
key: "overflow",
|
|
214298
|
+
value: TEXT_OVERFLOW_VISIBLE,
|
|
214299
|
+
schemaId: activeSchema.id
|
|
214300
|
+
}]);
|
|
214301
|
+
}, [
|
|
214302
|
+
activeSchema,
|
|
214303
|
+
basePdf,
|
|
214304
|
+
changeSchemas
|
|
214305
|
+
]);
|
|
214040
214306
|
(0, import_react$9.useEffect)(() => {
|
|
214041
214307
|
uniqueSchemaName.current = (value) => {
|
|
214042
214308
|
for (const page of schemasList) for (const s of Object.values(page)) if (s.name === value && s.id !== activeSchema.id) return false;
|
|
@@ -214268,11 +214534,12 @@ var DetailView = (props) => {
|
|
|
214268
214534
|
};
|
|
214269
214535
|
const safeProperties = { ...propPanelSchema.properties };
|
|
214270
214536
|
if (typeof activePropPanelSchema === "function") {
|
|
214271
|
-
const { size, schemas, pageSize, changeSchemas, activeElements, deselectSchema, activeSchema } = props;
|
|
214537
|
+
const { size, schemas, pageSize, basePdf, changeSchemas, activeElements, deselectSchema, activeSchema } = props;
|
|
214272
214538
|
const functionResult = activePropPanelSchema({
|
|
214273
214539
|
size,
|
|
214274
214540
|
schemas,
|
|
214275
214541
|
pageSize,
|
|
214542
|
+
basePdf,
|
|
214276
214543
|
changeSchemas,
|
|
214277
214544
|
activeElements,
|
|
214278
214545
|
deselectSchema,
|
|
@@ -235711,7 +235978,7 @@ var Designer = class extends BaseUIClass {
|
|
|
235711
235978
|
}
|
|
235712
235979
|
};
|
|
235713
235980
|
//#endregion
|
|
235714
|
-
//#region ../schemas/dist/dynamicTemplate-
|
|
235981
|
+
//#region ../schemas/dist/dynamicTemplate-BwzF9C1L.js
|
|
235715
235982
|
var normalizeListItems = (value) => {
|
|
235716
235983
|
if (Array.isArray(value)) return value.map((item) => String(item));
|
|
235717
235984
|
if (typeof value !== "string") return value == null ? [] : [String(value)];
|
|
@@ -235801,10 +236068,7 @@ var getDynamicLayoutForList = async (value, args) => {
|
|
|
235801
236068
|
})).items.map((item) => item.height),
|
|
235802
236069
|
avoidFirstUnitOnly: false,
|
|
235803
236070
|
patchSplitSchema: ({ start, end, isSplit }) => ({
|
|
235804
|
-
|
|
235805
|
-
start,
|
|
235806
|
-
end
|
|
235807
|
-
},
|
|
236071
|
+
__splitRange: createListItemSplitRange(start, end),
|
|
235808
236072
|
__isSplit: isSplit
|
|
235809
236073
|
})
|
|
235810
236074
|
};
|
|
@@ -236045,7 +236309,7 @@ var Preview = ({ template, inputs, size, onChangeInput, onPageChange }) => {
|
|
|
236045
236309
|
for (const { key: _key, value } of args) if (_key === "content") {
|
|
236046
236310
|
const oldValue = input?.[schema.name] || "";
|
|
236047
236311
|
const rawNewValue = value;
|
|
236048
|
-
const newValue = schema.type === "text" && schema
|
|
236312
|
+
const newValue = schema.type === "text" && getTextLineRange(schema) ? await mergeTextLineRangeValue({
|
|
236049
236313
|
value: oldValue,
|
|
236050
236314
|
replacement: rawNewValue,
|
|
236051
236315
|
schema,
|