@pdfme/common 6.1.13-dev.1 → 6.1.13-dev.17
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/dynamicTemplate.d.ts +8 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +15 -1
- package/dist/index.js.map +1 -1
- package/dist/schema.d.ts +7 -0
- package/package.json +1 -1
|
@@ -11,6 +11,14 @@ interface ModifyTemplateForDynamicTableArg {
|
|
|
11
11
|
_cache: Map<string | number, unknown>;
|
|
12
12
|
}) => Promise<DynamicLayoutCallbackResult>;
|
|
13
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Resolve a readOnly table body.
|
|
16
|
+
* Uses input[schema.name] when present (array or JSON string) and never runs
|
|
17
|
+
* replacePlaceholders. Falls back to schema.content (Designer sample).
|
|
18
|
+
*/
|
|
19
|
+
export declare const getReadOnlyTableValue: (schema: Schema, input?: Record<string, unknown>) => string;
|
|
20
|
+
/** Get the input value for a schema */
|
|
21
|
+
export declare const getSchemaValue: (schema: Schema, input: Record<string, string>, schemas: Schema[][]) => string;
|
|
14
22
|
/**
|
|
15
23
|
* Process a template containing tables with dynamic heights
|
|
16
24
|
* and generate a new template with proper page breaks.
|
package/dist/index.d.ts
CHANGED
|
@@ -5,9 +5,9 @@ import type { PdfLinkAnnotationRect } from './helper.js';
|
|
|
5
5
|
import type { PageOrientation, PageSize, PageSizePreset } from './pageSize.js';
|
|
6
6
|
import { cloneDeep, getFallbackFontName, getDefaultFont, getB64BasePdf, b64toUint8Array, checkFont, checkInputs, checkUIOptions, checkTemplate, checkUIProps, checkPreviewProps, checkDesignerProps, checkGenerateProps, mm2pt, pt2mm, pt2px, px2mm, isHexValid, getInputFromTemplate, isBlankPdf, isUrlSafeToFetch, getInternalLinkTarget, normalizeInternalLinkHref, normalizeLinkHref, normalizeSafeLinkUri, registerInternalLinkAnchor, registerInternalLinkAnnotation, resetInternalLinkAnnotations, applyInternalLinkAnnotations } from './helper.js';
|
|
7
7
|
import { PAGE_SIZE_PRESETS, detectPaperSize, resolvePageSize } from './pageSize.js';
|
|
8
|
-
import { getDynamicTemplate } from './dynamicTemplate.js';
|
|
8
|
+
import { getDynamicTemplate, getReadOnlyTableValue, getSchemaValue } from './dynamicTemplate.js';
|
|
9
9
|
import { createDynamicLayoutSplitRange, getDynamicLayoutSplitRange } from './splitRange.js';
|
|
10
10
|
import { replacePlaceholders } from './expression.js';
|
|
11
11
|
import { pluginRegistry } from './pluginRegistry.js';
|
|
12
|
-
export { PDFME_VERSION, MM_TO_PT_RATIO, PT_TO_MM_RATIO, PT_TO_PX_RATIO, BLANK_PDF, BLANK_A4_PDF, CUSTOM_A4_PDF, ZOOM, DEFAULT_FONT_NAME, cloneDeep, getFallbackFontName, getDefaultFont, getB64BasePdf, b64toUint8Array, mm2pt, pt2mm, pt2px, px2mm, isHexValid, getInputFromTemplate, isBlankPdf, getDynamicTemplate, replacePlaceholders, checkFont, checkInputs, checkUIOptions, checkTemplate, checkUIProps, checkPreviewProps, checkDesignerProps, checkGenerateProps, pluginRegistry, isUrlSafeToFetch, getInternalLinkTarget, normalizeInternalLinkHref, normalizeLinkHref, normalizeSafeLinkUri, registerInternalLinkAnchor, registerInternalLinkAnnotation, resetInternalLinkAnnotations, applyInternalLinkAnnotations, PAGE_SIZE_PRESETS, detectPaperSize, resolvePageSize, createDynamicLayoutSplitRange, getDynamicLayoutSplitRange, };
|
|
12
|
+
export { PDFME_VERSION, MM_TO_PT_RATIO, PT_TO_MM_RATIO, PT_TO_PX_RATIO, BLANK_PDF, BLANK_A4_PDF, CUSTOM_A4_PDF, ZOOM, DEFAULT_FONT_NAME, cloneDeep, getFallbackFontName, getDefaultFont, getB64BasePdf, b64toUint8Array, mm2pt, pt2mm, pt2px, px2mm, isHexValid, getInputFromTemplate, isBlankPdf, getDynamicTemplate, getReadOnlyTableValue, getSchemaValue, replacePlaceholders, checkFont, checkInputs, checkUIOptions, checkTemplate, checkUIProps, checkPreviewProps, checkDesignerProps, checkGenerateProps, pluginRegistry, isUrlSafeToFetch, getInternalLinkTarget, normalizeInternalLinkHref, normalizeLinkHref, normalizeSafeLinkUri, registerInternalLinkAnchor, registerInternalLinkAnnotation, resetInternalLinkAnnotations, applyInternalLinkAnnotations, PAGE_SIZE_PRESETS, detectPaperSize, resolvePageSize, createDynamicLayoutSplitRange, getDynamicLayoutSplitRange, };
|
|
13
13
|
export type { Lang, Dict, Size, Schema, SchemaForUI, Font, ColorType, DynamicLayoutRange, DynamicLayoutSplitRange, BasePdf, BlankPdf, CustomPdf, Template, CommonOptions, GeneratorOptions, Plugin, Plugins, PluginRegistry, GenerateProps, UIOptions, UIProps, PreviewProps, DesignerProps, ChangeSchemaItem, ChangeSchemas, SchemaPageArray, PropPanel, PropPanelSchema, PropPanelWidgetProps, PDFRenderProps, UIRenderProps, Mode, DynamicLayoutArgs, DynamicLayoutCallbackResult, DynamicLayoutPatchArgs, DynamicLayoutResult, GetDynamicLayout, PdfLinkAnnotationRect, PageOrientation, PageSize, PageSizePreset, };
|
package/dist/index.js
CHANGED
|
@@ -105,6 +105,7 @@ var Lang = z.enum([
|
|
|
105
105
|
"ko",
|
|
106
106
|
"ar",
|
|
107
107
|
"th",
|
|
108
|
+
"tr",
|
|
108
109
|
"pl",
|
|
109
110
|
"it",
|
|
110
111
|
"de",
|
|
@@ -970,9 +971,22 @@ var replacePlaceholders = (arg) => {
|
|
|
970
971
|
var EPSILON = .01;
|
|
971
972
|
/** Calculate the content height of a page (drawable area excluding padding) */
|
|
972
973
|
var getContentHeight = (basePdf) => basePdf.height - basePdf.padding[0] - basePdf.padding[2];
|
|
974
|
+
/**
|
|
975
|
+
* Resolve a readOnly table body.
|
|
976
|
+
* Uses input[schema.name] when present (array or JSON string) and never runs
|
|
977
|
+
* replacePlaceholders. Falls back to schema.content (Designer sample).
|
|
978
|
+
*/
|
|
979
|
+
var getReadOnlyTableValue = (schema, input) => {
|
|
980
|
+
if (input && Object.prototype.hasOwnProperty.call(input, schema.name)) {
|
|
981
|
+
const value = input[schema.name];
|
|
982
|
+
if (value !== void 0 && value !== null) return typeof value === "string" ? value : JSON.stringify(value);
|
|
983
|
+
}
|
|
984
|
+
return schema.content || "";
|
|
985
|
+
};
|
|
973
986
|
/** Get the input value for a schema */
|
|
974
987
|
var getSchemaValue = (schema, input, schemas) => {
|
|
975
988
|
if (!schema.readOnly) return input?.[schema.name] || "";
|
|
989
|
+
if (schema.type === "table") return getReadOnlyTableValue(schema, input);
|
|
976
990
|
if (schema.type !== "text" && schema.type !== "multiVariableText") return schema.content || "";
|
|
977
991
|
return replacePlaceholders({
|
|
978
992
|
content: schema.content || "",
|
|
@@ -1212,6 +1226,6 @@ var pluginRegistry = (plugins) => {
|
|
|
1212
1226
|
};
|
|
1213
1227
|
};
|
|
1214
1228
|
//#endregion
|
|
1215
|
-
export { BLANK_A4_PDF, BLANK_PDF, CUSTOM_A4_PDF, DEFAULT_FONT_NAME, MM_TO_PT_RATIO, PAGE_SIZE_PRESETS, PDFME_VERSION, PT_TO_MM_RATIO, PT_TO_PX_RATIO, ZOOM, applyInternalLinkAnnotations, b64toUint8Array, checkDesignerProps, checkFont, checkGenerateProps, checkInputs, checkPreviewProps, checkTemplate, checkUIOptions, checkUIProps, cloneDeep, createDynamicLayoutSplitRange, detectPaperSize, getB64BasePdf, getDefaultFont, getDynamicLayoutSplitRange, getDynamicTemplate, getFallbackFontName, getInputFromTemplate, getInternalLinkTarget, isBlankPdf, isHexValid, isUrlSafeToFetch, mm2pt, normalizeInternalLinkHref, normalizeLinkHref, normalizeSafeLinkUri, pluginRegistry, pt2mm, pt2px, px2mm, registerInternalLinkAnchor, registerInternalLinkAnnotation, replacePlaceholders, resetInternalLinkAnnotations, resolvePageSize };
|
|
1229
|
+
export { BLANK_A4_PDF, BLANK_PDF, CUSTOM_A4_PDF, DEFAULT_FONT_NAME, MM_TO_PT_RATIO, PAGE_SIZE_PRESETS, PDFME_VERSION, PT_TO_MM_RATIO, PT_TO_PX_RATIO, ZOOM, applyInternalLinkAnnotations, b64toUint8Array, checkDesignerProps, checkFont, checkGenerateProps, checkInputs, checkPreviewProps, checkTemplate, checkUIOptions, checkUIProps, cloneDeep, createDynamicLayoutSplitRange, detectPaperSize, getB64BasePdf, getDefaultFont, getDynamicLayoutSplitRange, getDynamicTemplate, getFallbackFontName, getInputFromTemplate, getInternalLinkTarget, getReadOnlyTableValue, getSchemaValue, isBlankPdf, isHexValid, isUrlSafeToFetch, mm2pt, normalizeInternalLinkHref, normalizeLinkHref, normalizeSafeLinkUri, pluginRegistry, pt2mm, pt2px, px2mm, registerInternalLinkAnchor, registerInternalLinkAnnotation, replacePlaceholders, resetInternalLinkAnnotations, resolvePageSize };
|
|
1216
1230
|
|
|
1217
1231
|
//# sourceMappingURL=index.js.map
|