@pdfme/schemas 3.2.3-dev.1 → 4.0.0-alpha.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/dist/cjs/__tests__/text.test.js +5 -4
- package/dist/cjs/__tests__/text.test.js.map +1 -1
- package/dist/cjs/__tests__/utils.test.js +3 -0
- package/dist/cjs/__tests__/utils.test.js.map +1 -1
- package/dist/cjs/src/barcodes/propPanel.js +11 -11
- package/dist/cjs/src/barcodes/propPanel.js.map +1 -1
- package/dist/cjs/src/barcodes/uiRender.js +1 -1
- package/dist/cjs/src/barcodes/uiRender.js.map +1 -1
- package/dist/cjs/src/graphics/image.js +5 -11
- package/dist/cjs/src/graphics/image.js.map +1 -1
- package/dist/cjs/src/graphics/svg.js +2 -3
- package/dist/cjs/src/graphics/svg.js.map +1 -1
- package/dist/cjs/src/index.js +6 -1
- package/dist/cjs/src/index.js.map +1 -1
- package/dist/cjs/src/shapes/line.js +5 -9
- package/dist/cjs/src/shapes/line.js.map +1 -1
- package/dist/cjs/src/shapes/rectAndEllipse.js +3 -2
- package/dist/cjs/src/shapes/rectAndEllipse.js.map +1 -1
- package/dist/cjs/src/tables/cell.js +125 -0
- package/dist/cjs/src/tables/cell.js.map +1 -0
- package/dist/cjs/src/tables/classes.js +467 -0
- package/dist/cjs/src/tables/classes.js.map +1 -0
- package/dist/cjs/src/tables/dynamicTemplate.js +71 -0
- package/dist/cjs/src/tables/dynamicTemplate.js.map +1 -0
- package/dist/cjs/src/tables/helper.js +171 -0
- package/dist/cjs/src/tables/helper.js.map +1 -0
- package/dist/cjs/src/tables/index.js +12 -0
- package/dist/cjs/src/tables/index.js.map +1 -0
- package/dist/cjs/src/tables/pdfRender.js +95 -0
- package/dist/cjs/src/tables/pdfRender.js.map +1 -0
- package/dist/cjs/src/tables/propPanel.js +87 -0
- package/dist/cjs/src/tables/propPanel.js.map +1 -0
- package/dist/cjs/src/tables/tableHelper.js +231 -0
- package/dist/cjs/src/tables/tableHelper.js.map +1 -0
- package/dist/cjs/src/tables/types.js +3 -0
- package/dist/cjs/src/tables/types.js.map +1 -0
- package/dist/cjs/src/tables/uiRender.js +321 -0
- package/dist/cjs/src/tables/uiRender.js.map +1 -0
- package/dist/cjs/src/text/helper.js +21 -6
- package/dist/cjs/src/text/helper.js.map +1 -1
- package/dist/cjs/src/text/index.js +0 -1
- package/dist/cjs/src/text/index.js.map +1 -1
- package/dist/cjs/src/text/pdfRender.js +5 -8
- package/dist/cjs/src/text/pdfRender.js.map +1 -1
- package/dist/cjs/src/text/propPanel.js +6 -4
- package/dist/cjs/src/text/propPanel.js.map +1 -1
- package/dist/cjs/src/text/uiRender.js +18 -17
- package/dist/cjs/src/text/uiRender.js.map +1 -1
- package/dist/cjs/src/utils.js +9 -1
- package/dist/cjs/src/utils.js.map +1 -1
- package/dist/esm/__tests__/text.test.js +5 -4
- package/dist/esm/__tests__/text.test.js.map +1 -1
- package/dist/esm/__tests__/utils.test.js +3 -0
- package/dist/esm/__tests__/utils.test.js.map +1 -1
- package/dist/esm/src/barcodes/propPanel.js +11 -11
- package/dist/esm/src/barcodes/propPanel.js.map +1 -1
- package/dist/esm/src/barcodes/uiRender.js +1 -1
- package/dist/esm/src/barcodes/uiRender.js.map +1 -1
- package/dist/esm/src/graphics/image.js +4 -10
- package/dist/esm/src/graphics/image.js.map +1 -1
- package/dist/esm/src/graphics/svg.js +2 -3
- package/dist/esm/src/graphics/svg.js.map +1 -1
- package/dist/esm/src/index.js +3 -1
- package/dist/esm/src/index.js.map +1 -1
- package/dist/esm/src/shapes/line.js +5 -9
- package/dist/esm/src/shapes/line.js.map +1 -1
- package/dist/esm/src/shapes/rectAndEllipse.js +3 -2
- package/dist/esm/src/shapes/rectAndEllipse.js.map +1 -1
- package/dist/esm/src/tables/cell.js +120 -0
- package/dist/esm/src/tables/cell.js.map +1 -0
- package/dist/esm/src/tables/classes.js +460 -0
- package/dist/esm/src/tables/classes.js.map +1 -0
- package/dist/esm/src/tables/dynamicTemplate.js +66 -0
- package/dist/esm/src/tables/dynamicTemplate.js.map +1 -0
- package/dist/esm/src/tables/helper.js +163 -0
- package/dist/esm/src/tables/helper.js.map +1 -0
- package/dist/esm/src/tables/index.js +10 -0
- package/dist/esm/src/tables/index.js.map +1 -0
- package/dist/esm/src/tables/pdfRender.js +88 -0
- package/dist/esm/src/tables/pdfRender.js.map +1 -0
- package/dist/esm/src/tables/propPanel.js +84 -0
- package/dist/esm/src/tables/propPanel.js.map +1 -0
- package/dist/esm/src/tables/tableHelper.js +226 -0
- package/dist/esm/src/tables/tableHelper.js.map +1 -0
- package/dist/esm/src/tables/types.js +2 -0
- package/dist/esm/src/tables/types.js.map +1 -0
- package/dist/esm/src/tables/uiRender.js +314 -0
- package/dist/esm/src/tables/uiRender.js.map +1 -0
- package/dist/esm/src/text/helper.js +19 -5
- package/dist/esm/src/text/helper.js.map +1 -1
- package/dist/esm/src/text/index.js +0 -1
- package/dist/esm/src/text/index.js.map +1 -1
- package/dist/esm/src/text/pdfRender.js +6 -9
- package/dist/esm/src/text/pdfRender.js.map +1 -1
- package/dist/esm/src/text/propPanel.js +6 -4
- package/dist/esm/src/text/propPanel.js.map +1 -1
- package/dist/esm/src/text/uiRender.js +19 -18
- package/dist/esm/src/text/uiRender.js.map +1 -1
- package/dist/esm/src/utils.js +6 -0
- package/dist/esm/src/utils.js.map +1 -1
- package/dist/types/src/index.d.ts +3 -1
- package/dist/types/src/shapes/rectAndEllipse.d.ts +13 -27
- package/dist/types/src/tables/cell.d.ts +4 -0
- package/dist/types/src/tables/classes.d.ts +68 -0
- package/dist/types/src/tables/dynamicTemplate.d.ts +13 -0
- package/dist/types/src/tables/helper.d.ts +252 -0
- package/dist/types/src/tables/index.d.ts +4 -0
- package/dist/types/src/tables/pdfRender.d.ts +3 -0
- package/dist/types/src/tables/propPanel.d.ts +3 -0
- package/dist/types/src/tables/tableHelper.d.ts +11 -0
- package/dist/types/src/tables/types.d.ts +91 -0
- package/dist/types/src/tables/uiRender.d.ts +3 -0
- package/dist/types/src/text/helper.d.ts +8 -1
- package/dist/types/src/utils.d.ts +2 -0
- package/package.json +1 -1
- package/src/barcodes/propPanel.ts +12 -12
- package/src/barcodes/uiRender.ts +1 -1
- package/src/graphics/image.ts +6 -11
- package/src/graphics/svg.ts +2 -3
- package/src/index.ts +5 -0
- package/src/shapes/line.ts +4 -9
- package/src/shapes/rectAndEllipse.ts +4 -4
- package/src/tables/cell.ts +157 -0
- package/src/tables/classes.ts +398 -0
- package/src/tables/dynamicTemplate.ts +81 -0
- package/src/tables/helper.ts +198 -0
- package/src/tables/index.ts +12 -0
- package/src/tables/pdfRender.ts +115 -0
- package/src/tables/propPanel.ts +90 -0
- package/src/tables/tableHelper.ts +322 -0
- package/src/tables/types.ts +88 -0
- package/src/tables/uiRender.ts +362 -0
- package/src/text/helper.ts +30 -6
- package/src/text/index.ts +0 -1
- package/src/text/pdfRender.ts +7 -11
- package/src/text/propPanel.ts +6 -4
- package/src/text/uiRender.ts +18 -18
- package/src/utils.ts +8 -0
@@ -1,7 +1,7 @@
|
|
1
1
|
import { getDefaultFont } from '@pdfme/common';
|
2
2
|
import { DEFAULT_FONT_SIZE, DEFAULT_ALIGNMENT, VERTICAL_ALIGN_TOP, VERTICAL_ALIGN_MIDDLE, VERTICAL_ALIGN_BOTTOM, DEFAULT_VERTICAL_ALIGNMENT, DEFAULT_LINE_HEIGHT, DEFAULT_CHARACTER_SPACING, DEFAULT_FONT_COLOR, PLACEHOLDER_FONT_COLOR, } from './constants.js';
|
3
3
|
import { calculateDynamicFontSize, getFontKitFont, getBrowserVerticalFontAdjustments, } from './helper.js';
|
4
|
-
import {
|
4
|
+
import { isEditable } from '../utils.js';
|
5
5
|
const mapVerticalAlignToFlex = (verticalAlignmentValue) => {
|
6
6
|
switch (verticalAlignmentValue) {
|
7
7
|
case VERTICAL_ALIGN_TOP:
|
@@ -13,15 +13,13 @@ const mapVerticalAlignToFlex = (verticalAlignmentValue) => {
|
|
13
13
|
}
|
14
14
|
return 'flex-start';
|
15
15
|
};
|
16
|
-
const getBackgroundColor = (value, schema
|
17
|
-
if (!value)
|
16
|
+
const getBackgroundColor = (value, schema) => {
|
17
|
+
if (!value || !schema.backgroundColor)
|
18
18
|
return 'transparent';
|
19
|
-
|
20
|
-
return schema.backgroundColor;
|
21
|
-
return defaultBackgroundColor;
|
19
|
+
return schema.backgroundColor;
|
22
20
|
};
|
23
21
|
export const uiRender = async (arg) => {
|
24
|
-
const { value, schema, rootElement, mode, onChange, stopEditing, tabIndex, placeholder, options,
|
22
|
+
const { value, schema, rootElement, mode, onChange, stopEditing, tabIndex, placeholder, options, _cache, } = arg;
|
25
23
|
const font = options?.font || getDefaultFont();
|
26
24
|
let dynamicFontSize = undefined;
|
27
25
|
const getCdfArg = (v) => ({
|
@@ -34,7 +32,7 @@ export const uiRender = async (arg) => {
|
|
34
32
|
if (schema.dynamicFontSize && value) {
|
35
33
|
dynamicFontSize = await calculateDynamicFontSize(getCdfArg(value));
|
36
34
|
}
|
37
|
-
const fontKitFont = await getFontKitFont(schema, font, _cache);
|
35
|
+
const fontKitFont = await getFontKitFont(schema.fontName, font, _cache);
|
38
36
|
// Depending on vertical alignment, we need to move the top or bottom of the font to keep
|
39
37
|
// it within it's defined box and align it with the generated pdf.
|
40
38
|
const { topAdj, bottomAdj } = getBrowserVerticalFontAdjustments(fontKitFont, dynamicFontSize ?? schema.fontSize ?? DEFAULT_FONT_SIZE, schema.lineHeight ?? DEFAULT_LINE_HEIGHT, schema.verticalAlignment ?? DEFAULT_VERTICAL_ALIGNMENT);
|
@@ -44,13 +42,14 @@ export const uiRender = async (arg) => {
|
|
44
42
|
const containerStyle = {
|
45
43
|
padding: 0,
|
46
44
|
resize: 'none',
|
47
|
-
backgroundColor: getBackgroundColor(value, schema
|
45
|
+
backgroundColor: getBackgroundColor(value, schema),
|
48
46
|
border: 'none',
|
49
47
|
display: 'flex',
|
50
48
|
flexDirection: 'column',
|
51
49
|
justifyContent: mapVerticalAlignToFlex(schema.verticalAlignment),
|
52
50
|
width: '100%',
|
53
51
|
height: '100%',
|
52
|
+
cursor: isEditable(mode, schema) ? 'text' : 'default',
|
54
53
|
};
|
55
54
|
Object.assign(container.style, containerStyle);
|
56
55
|
rootElement.innerHTML = '';
|
@@ -80,7 +79,7 @@ export const uiRender = async (arg) => {
|
|
80
79
|
textBlock.tabIndex = tabIndex || 0;
|
81
80
|
textBlock.innerText = value;
|
82
81
|
textBlock.addEventListener('blur', (e) => {
|
83
|
-
onChange && onChange(e.target.innerText);
|
82
|
+
onChange && onChange({ key: 'content', value: e.target.innerText });
|
84
83
|
stopEditing && stopEditing();
|
85
84
|
});
|
86
85
|
if (schema.dynamicFontSize) {
|
@@ -114,14 +113,16 @@ export const uiRender = async (arg) => {
|
|
114
113
|
}
|
115
114
|
container.appendChild(textBlock);
|
116
115
|
if (mode === 'designer') {
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
116
|
+
setTimeout(() => {
|
117
|
+
textBlock.focus();
|
118
|
+
// Set the focus to the end of the editable element when you focus, as we would for a textarea
|
119
|
+
const selection = window.getSelection();
|
120
|
+
const range = document.createRange();
|
121
|
+
range.selectNodeContents(textBlock);
|
122
|
+
range.collapse(false); // Collapse range to the end
|
123
|
+
selection?.removeAllRanges();
|
124
|
+
selection?.addRange(range);
|
125
|
+
});
|
125
126
|
}
|
126
127
|
}
|
127
128
|
else {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"uiRender.js","sourceRoot":"","sources":["../../../../src/text/uiRender.ts"],"names":[],"mappings":"AACA,OAAO,EAAyB,cAAc,EAAE,MAAM,eAAe,CAAC;AAEtE,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,qBAAqB,EACrB,qBAAqB,EACrB,0BAA0B,EAC1B,mBAAmB,EACnB,yBAAyB,EACzB,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,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AAE,CACvB,+BACE,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SACvC,MAAM,CAAC,SAAS,CACnB;aACA,IAAI,CAAC,EAAE,CAAC,CAAC;QAEZ,SAAS,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;KAClC;AACH,CAAC,CAAC"}
|
package/dist/esm/src/utils.js
CHANGED
@@ -121,4 +121,10 @@ export const createErrorElm = () => {
|
|
121
121
|
container.appendChild(span);
|
122
122
|
return container;
|
123
123
|
};
|
124
|
+
export const px2mm = (px) => {
|
125
|
+
// http://www.endmemo.com/sconvert/millimeterpixel.php
|
126
|
+
const ratio = 0.26458333333333;
|
127
|
+
return parseFloat(String(px)) * ratio;
|
128
|
+
};
|
129
|
+
export const cloneDeep = (value) => JSON.parse(JSON.stringify(value));
|
124
130
|
//# sourceMappingURL=utils.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAU,KAAK,EAAQ,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhE,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,EACvC,MAAM,EACN,UAAU,EACV,oBAAoB,GAAG,IAAI,GAK5B,EAAE,EAAE;IACH,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IAC/E,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,QAAQ,CAAC;IAEpC,MAAM,aAAa,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAC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AE,MAAM;QAChB,UAAU,EAAE,MAAM;QAClB,YAAY,EAAE,KAAK;QACnB,UAAU,EAAE,yBAAyB;KACtC,CAAC;IACF,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IAErC,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC;IAC3B,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAE5B,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,EAAU,EAAU,EAAE;IAC1C,sDAAsD;IACtD,MAAM,KAAK,GAAG,gBAAgB,CAAC;IAC/B,OAAO,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,GAAG,KAAK,CAAC;AACxC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAI,KAAQ,EAAK,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC"}
|
@@ -3,9 +3,11 @@ import image, { readOnlyImage } from './graphics/image.js';
|
|
3
3
|
import svg, { readOnlySvg } from './graphics/svg.js';
|
4
4
|
import barcodes from './barcodes/index.js';
|
5
5
|
import line from './shapes/line.js';
|
6
|
+
import table from './tables/index.js';
|
7
|
+
import { modifyTemplateForTable, getDynamicHeightForTable } from './tables/dynamicTemplate.js';
|
6
8
|
import { rectangle, ellipse } from './shapes/rectAndEllipse.js';
|
7
9
|
import { convertForPdfLayoutProps, rotatePoint } from './utils.js';
|
8
10
|
declare const builtInPlugins: {
|
9
11
|
Text: import("@pdfme/common").Plugin<import("./text/types.js").TextSchema>;
|
10
12
|
};
|
11
|
-
export { text, readOnlyText, image, readOnlyImage, svg, readOnlySvg, barcodes, line, rectangle, ellipse, builtInPlugins, convertForPdfLayoutProps, rotatePoint, };
|
13
|
+
export { text, readOnlyText, image, readOnlyImage, svg, readOnlySvg, barcodes, line, table, modifyTemplateForTable, getDynamicHeightForTable, rectangle, ellipse, builtInPlugins, convertForPdfLayoutProps, rotatePoint, };
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Schema } from '@pdfme/common';
|
2
|
-
interface
|
2
|
+
interface ShapeSchema extends Schema {
|
3
3
|
type: 'ellipse' | 'rectangle';
|
4
4
|
borderWidth: number;
|
5
5
|
borderColor: string;
|
@@ -18,10 +18,10 @@ export declare const rectangle: {
|
|
18
18
|
};
|
19
19
|
width: number;
|
20
20
|
height: number;
|
21
|
-
|
22
|
-
readOnlyValue?: string | undefined;
|
21
|
+
content?: string | undefined;
|
23
22
|
rotate?: number | undefined;
|
24
23
|
opacity?: number | undefined;
|
24
|
+
readOnly?: boolean | undefined;
|
25
25
|
};
|
26
26
|
schema: ((propPanelProps: Omit<{
|
27
27
|
rootElement: HTMLDivElement;
|
@@ -33,13 +33,12 @@ export declare const rectangle: {
|
|
33
33
|
x: number;
|
34
34
|
y: number;
|
35
35
|
};
|
36
|
-
data: string;
|
37
36
|
id: string;
|
38
37
|
key: string;
|
39
38
|
opacity?: number | undefined;
|
40
39
|
rotate?: number | undefined;
|
40
|
+
content?: string | undefined;
|
41
41
|
readOnly?: boolean | undefined;
|
42
|
-
readOnlyValue?: string | undefined;
|
43
42
|
};
|
44
43
|
activeElements: HTMLElement[];
|
45
44
|
changeSchemas: import("@pdfme/common").ChangeSchemas;
|
@@ -51,27 +50,21 @@ export declare const rectangle: {
|
|
51
50
|
x: number;
|
52
51
|
y: number;
|
53
52
|
};
|
54
|
-
data: string;
|
55
53
|
id: string;
|
56
54
|
key: string;
|
57
55
|
opacity?: number | undefined;
|
58
56
|
rotate?: number | undefined;
|
57
|
+
content?: string | undefined;
|
59
58
|
readOnly?: boolean | undefined;
|
60
|
-
readOnlyValue?: string | undefined;
|
61
59
|
}[];
|
62
|
-
pageSize: {
|
63
|
-
width: number;
|
64
|
-
height: number;
|
65
|
-
};
|
66
60
|
options: import("@pdfme/common").UIOptions;
|
67
61
|
theme: import("antd").GlobalToken;
|
68
62
|
i18n: (key: string) => string;
|
69
63
|
}, "rootElement">) => Record<string, Partial<import("form-render").SchemaBase>>) | Record<string, Partial<import("form-render").SchemaBase>>;
|
70
64
|
widgets?: Record<string, (props: import("@pdfme/common").PropPanelWidgetProps) => void> | undefined;
|
71
|
-
defaultValue: string;
|
72
65
|
};
|
73
|
-
pdf: (arg: import("@pdfme/common").PDFRenderProps<
|
74
|
-
ui: (arg: import("@pdfme/common").UIRenderProps<
|
66
|
+
pdf: (arg: import("@pdfme/common").PDFRenderProps<ShapeSchema>) => void | Promise<void>;
|
67
|
+
ui: (arg: import("@pdfme/common").UIRenderProps<ShapeSchema>) => void | Promise<void>;
|
75
68
|
};
|
76
69
|
export declare const ellipse: {
|
77
70
|
propPanel: {
|
@@ -86,10 +79,10 @@ export declare const ellipse: {
|
|
86
79
|
};
|
87
80
|
width: number;
|
88
81
|
height: number;
|
89
|
-
|
90
|
-
readOnlyValue?: string | undefined;
|
82
|
+
content?: string | undefined;
|
91
83
|
rotate?: number | undefined;
|
92
84
|
opacity?: number | undefined;
|
85
|
+
readOnly?: boolean | undefined;
|
93
86
|
};
|
94
87
|
schema: ((propPanelProps: Omit<{
|
95
88
|
rootElement: HTMLDivElement;
|
@@ -101,13 +94,12 @@ export declare const ellipse: {
|
|
101
94
|
x: number;
|
102
95
|
y: number;
|
103
96
|
};
|
104
|
-
data: string;
|
105
97
|
id: string;
|
106
98
|
key: string;
|
107
99
|
opacity?: number | undefined;
|
108
100
|
rotate?: number | undefined;
|
101
|
+
content?: string | undefined;
|
109
102
|
readOnly?: boolean | undefined;
|
110
|
-
readOnlyValue?: string | undefined;
|
111
103
|
};
|
112
104
|
activeElements: HTMLElement[];
|
113
105
|
changeSchemas: import("@pdfme/common").ChangeSchemas;
|
@@ -119,26 +111,20 @@ export declare const ellipse: {
|
|
119
111
|
x: number;
|
120
112
|
y: number;
|
121
113
|
};
|
122
|
-
data: string;
|
123
114
|
id: string;
|
124
115
|
key: string;
|
125
116
|
opacity?: number | undefined;
|
126
117
|
rotate?: number | undefined;
|
118
|
+
content?: string | undefined;
|
127
119
|
readOnly?: boolean | undefined;
|
128
|
-
readOnlyValue?: string | undefined;
|
129
120
|
}[];
|
130
|
-
pageSize: {
|
131
|
-
width: number;
|
132
|
-
height: number;
|
133
|
-
};
|
134
121
|
options: import("@pdfme/common").UIOptions;
|
135
122
|
theme: import("antd").GlobalToken;
|
136
123
|
i18n: (key: string) => string;
|
137
124
|
}, "rootElement">) => Record<string, Partial<import("form-render").SchemaBase>>) | Record<string, Partial<import("form-render").SchemaBase>>;
|
138
125
|
widgets?: Record<string, (props: import("@pdfme/common").PropPanelWidgetProps) => void> | undefined;
|
139
|
-
defaultValue: string;
|
140
126
|
};
|
141
|
-
pdf: (arg: import("@pdfme/common").PDFRenderProps<
|
142
|
-
ui: (arg: import("@pdfme/common").UIRenderProps<
|
127
|
+
pdf: (arg: import("@pdfme/common").PDFRenderProps<ShapeSchema>) => void | Promise<void>;
|
128
|
+
ui: (arg: import("@pdfme/common").UIRenderProps<ShapeSchema>) => void | Promise<void>;
|
143
129
|
};
|
144
130
|
export {};
|
@@ -0,0 +1,68 @@
|
|
1
|
+
import { Font } from '@pdfme/common';
|
2
|
+
import type { Styles, TableInput, Settings, Section, StylesProps } from './types';
|
3
|
+
type ContentSettings = {
|
4
|
+
body: Row[];
|
5
|
+
head: Row[];
|
6
|
+
columns: Column[];
|
7
|
+
};
|
8
|
+
export declare class Cell {
|
9
|
+
raw: string;
|
10
|
+
text: string[];
|
11
|
+
styles: Styles;
|
12
|
+
section: Section;
|
13
|
+
contentHeight: number;
|
14
|
+
contentWidth: number;
|
15
|
+
wrappedWidth: number;
|
16
|
+
minReadableWidth: number;
|
17
|
+
minWidth: number;
|
18
|
+
width: number;
|
19
|
+
height: number;
|
20
|
+
x: number;
|
21
|
+
y: number;
|
22
|
+
constructor(raw: string, styles: Styles, section: Section);
|
23
|
+
getContentHeight(): number;
|
24
|
+
padding(name: 'top' | 'bottom' | 'left' | 'right'): number;
|
25
|
+
}
|
26
|
+
export declare class Column {
|
27
|
+
index: number;
|
28
|
+
wrappedWidth: number;
|
29
|
+
minReadableWidth: number;
|
30
|
+
minWidth: number;
|
31
|
+
width: number;
|
32
|
+
constructor(index: number);
|
33
|
+
getMaxCustomCellWidth(table: Table): number;
|
34
|
+
}
|
35
|
+
export declare class Row {
|
36
|
+
readonly raw: string[];
|
37
|
+
readonly index: number;
|
38
|
+
readonly section: Section;
|
39
|
+
readonly cells: {
|
40
|
+
[key: string]: Cell;
|
41
|
+
};
|
42
|
+
height: number;
|
43
|
+
constructor(raw: string[], index: number, section: Section, cells: {
|
44
|
+
[key: string]: Cell;
|
45
|
+
});
|
46
|
+
getMaxCellHeight(columns: Column[]): number;
|
47
|
+
getMinimumRowHeight(columns: Column[]): number;
|
48
|
+
}
|
49
|
+
export declare class Table {
|
50
|
+
readonly settings: Settings;
|
51
|
+
readonly styles: StylesProps;
|
52
|
+
readonly columns: Column[];
|
53
|
+
readonly head: Row[];
|
54
|
+
readonly body: Row[];
|
55
|
+
constructor(input: TableInput, content: ContentSettings);
|
56
|
+
static create(arg: {
|
57
|
+
input: TableInput;
|
58
|
+
content: ContentSettings;
|
59
|
+
font: Font;
|
60
|
+
_cache: Map<any, any>;
|
61
|
+
}): Promise<Table>;
|
62
|
+
getHeadHeight(): number;
|
63
|
+
getBodyHeight(): number;
|
64
|
+
allRows(): Row[];
|
65
|
+
getWidth(): number;
|
66
|
+
getHeight(): number;
|
67
|
+
}
|
68
|
+
export {};
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { Template, Schema, BasePdf, CommonOptions } from '@pdfme/common';
|
2
|
+
export declare const modifyTemplateForTable: (arg: {
|
3
|
+
template: Template;
|
4
|
+
input: Record<string, string>;
|
5
|
+
_cache: Map<any, any>;
|
6
|
+
options: CommonOptions;
|
7
|
+
}) => Promise<Template>;
|
8
|
+
export declare const getDynamicHeightForTable: (value: string, args: {
|
9
|
+
schema: Schema;
|
10
|
+
basePdf: BasePdf;
|
11
|
+
options: CommonOptions;
|
12
|
+
_cache: Map<any, any>;
|
13
|
+
}) => Promise<number>;
|
@@ -0,0 +1,252 @@
|
|
1
|
+
export declare const getDefaultCellStyles: () => {
|
2
|
+
fontName: undefined;
|
3
|
+
alignment: import("../text/types").ALIGNMENT;
|
4
|
+
verticalAlignment: import("../text/types").VERTICAL_ALIGNMENT;
|
5
|
+
fontSize: number;
|
6
|
+
lineHeight: number;
|
7
|
+
characterSpacing: number;
|
8
|
+
fontColor: string;
|
9
|
+
backgroundColor: string;
|
10
|
+
borderColor: string;
|
11
|
+
borderWidth: {
|
12
|
+
top: number;
|
13
|
+
bottom: number;
|
14
|
+
left: number;
|
15
|
+
right: number;
|
16
|
+
};
|
17
|
+
padding: {
|
18
|
+
top: number;
|
19
|
+
bottom: number;
|
20
|
+
left: number;
|
21
|
+
right: number;
|
22
|
+
};
|
23
|
+
};
|
24
|
+
export declare const getCellPropPanelSchema: (arg: {
|
25
|
+
i18n: (key: string) => string;
|
26
|
+
fallbackFontName: string;
|
27
|
+
fontNames: string[];
|
28
|
+
isBody?: boolean | undefined;
|
29
|
+
}) => {
|
30
|
+
'-': {
|
31
|
+
type: string;
|
32
|
+
widget: string;
|
33
|
+
};
|
34
|
+
borderWidth: {
|
35
|
+
title: string;
|
36
|
+
type: string;
|
37
|
+
widget: string;
|
38
|
+
span: number;
|
39
|
+
properties: {
|
40
|
+
top: {
|
41
|
+
type: string;
|
42
|
+
widget: string;
|
43
|
+
props: {
|
44
|
+
min: number;
|
45
|
+
step: number;
|
46
|
+
};
|
47
|
+
span: number;
|
48
|
+
title: string;
|
49
|
+
};
|
50
|
+
right: {
|
51
|
+
type: string;
|
52
|
+
widget: string;
|
53
|
+
props: {
|
54
|
+
min: number;
|
55
|
+
step: number;
|
56
|
+
};
|
57
|
+
span: number;
|
58
|
+
title: string;
|
59
|
+
};
|
60
|
+
bottom: {
|
61
|
+
type: string;
|
62
|
+
widget: string;
|
63
|
+
props: {
|
64
|
+
min: number;
|
65
|
+
step: number;
|
66
|
+
};
|
67
|
+
span: number;
|
68
|
+
title: string;
|
69
|
+
};
|
70
|
+
left: {
|
71
|
+
type: string;
|
72
|
+
widget: string;
|
73
|
+
props: {
|
74
|
+
min: number;
|
75
|
+
step: number;
|
76
|
+
};
|
77
|
+
span: number;
|
78
|
+
title: string;
|
79
|
+
};
|
80
|
+
};
|
81
|
+
};
|
82
|
+
'--': {
|
83
|
+
type: string;
|
84
|
+
widget: string;
|
85
|
+
};
|
86
|
+
padding: {
|
87
|
+
title: string;
|
88
|
+
type: string;
|
89
|
+
widget: string;
|
90
|
+
span: number;
|
91
|
+
properties: {
|
92
|
+
top: {
|
93
|
+
type: string;
|
94
|
+
widget: string;
|
95
|
+
props: {
|
96
|
+
min: number;
|
97
|
+
step: number;
|
98
|
+
};
|
99
|
+
span: number;
|
100
|
+
title: string;
|
101
|
+
};
|
102
|
+
right: {
|
103
|
+
type: string;
|
104
|
+
widget: string;
|
105
|
+
props: {
|
106
|
+
min: number;
|
107
|
+
step: number;
|
108
|
+
};
|
109
|
+
span: number;
|
110
|
+
title: string;
|
111
|
+
};
|
112
|
+
bottom: {
|
113
|
+
type: string;
|
114
|
+
widget: string;
|
115
|
+
props: {
|
116
|
+
min: number;
|
117
|
+
step: number;
|
118
|
+
};
|
119
|
+
span: number;
|
120
|
+
title: string;
|
121
|
+
};
|
122
|
+
left: {
|
123
|
+
type: string;
|
124
|
+
widget: string;
|
125
|
+
props: {
|
126
|
+
min: number;
|
127
|
+
step: number;
|
128
|
+
};
|
129
|
+
span: number;
|
130
|
+
title: string;
|
131
|
+
};
|
132
|
+
};
|
133
|
+
};
|
134
|
+
alternateBackgroundColor?: {
|
135
|
+
title: string;
|
136
|
+
type: string;
|
137
|
+
widget: string;
|
138
|
+
rules: {
|
139
|
+
pattern: string;
|
140
|
+
message: string;
|
141
|
+
}[];
|
142
|
+
} | undefined;
|
143
|
+
fontName: {
|
144
|
+
title: string;
|
145
|
+
type: string;
|
146
|
+
widget: string;
|
147
|
+
default: string;
|
148
|
+
props: {
|
149
|
+
options: {
|
150
|
+
label: string;
|
151
|
+
value: string;
|
152
|
+
}[];
|
153
|
+
};
|
154
|
+
span: number;
|
155
|
+
};
|
156
|
+
fontSize: {
|
157
|
+
title: string;
|
158
|
+
type: string;
|
159
|
+
widget: string;
|
160
|
+
props: {
|
161
|
+
min: number;
|
162
|
+
};
|
163
|
+
span: number;
|
164
|
+
};
|
165
|
+
characterSpacing: {
|
166
|
+
title: string;
|
167
|
+
type: string;
|
168
|
+
widget: string;
|
169
|
+
props: {
|
170
|
+
min: number;
|
171
|
+
};
|
172
|
+
span: number;
|
173
|
+
};
|
174
|
+
alignment: {
|
175
|
+
title: string;
|
176
|
+
type: string;
|
177
|
+
widget: string;
|
178
|
+
props: {
|
179
|
+
options: {
|
180
|
+
label: string;
|
181
|
+
value: import("../text/types").ALIGNMENT;
|
182
|
+
}[];
|
183
|
+
};
|
184
|
+
span: number;
|
185
|
+
};
|
186
|
+
verticalAlignment: {
|
187
|
+
title: string;
|
188
|
+
type: string;
|
189
|
+
widget: string;
|
190
|
+
props: {
|
191
|
+
options: {
|
192
|
+
label: string;
|
193
|
+
value: import("../text/types").VERTICAL_ALIGNMENT;
|
194
|
+
}[];
|
195
|
+
};
|
196
|
+
span: number;
|
197
|
+
};
|
198
|
+
lineHeight: {
|
199
|
+
title: string;
|
200
|
+
type: string;
|
201
|
+
widget: string;
|
202
|
+
props: {
|
203
|
+
step: number;
|
204
|
+
min: number;
|
205
|
+
};
|
206
|
+
span: number;
|
207
|
+
};
|
208
|
+
fontColor: {
|
209
|
+
title: string;
|
210
|
+
type: string;
|
211
|
+
widget: string;
|
212
|
+
rules: {
|
213
|
+
pattern: string;
|
214
|
+
message: string;
|
215
|
+
}[];
|
216
|
+
};
|
217
|
+
borderColor: {
|
218
|
+
title: string;
|
219
|
+
type: string;
|
220
|
+
widget: string;
|
221
|
+
rules: {
|
222
|
+
pattern: string;
|
223
|
+
message: string;
|
224
|
+
}[];
|
225
|
+
};
|
226
|
+
backgroundColor: {
|
227
|
+
title: string;
|
228
|
+
type: string;
|
229
|
+
widget: string;
|
230
|
+
rules: {
|
231
|
+
pattern: string;
|
232
|
+
message: string;
|
233
|
+
}[];
|
234
|
+
};
|
235
|
+
};
|
236
|
+
export declare const getColumnStylesPropPanelSchema: ({ head, i18n, }: {
|
237
|
+
head: string[];
|
238
|
+
i18n: (key: string) => string;
|
239
|
+
}) => {
|
240
|
+
alignment: {
|
241
|
+
type: string;
|
242
|
+
widget: string;
|
243
|
+
title: string;
|
244
|
+
column: number;
|
245
|
+
properties: {};
|
246
|
+
};
|
247
|
+
};
|
248
|
+
export declare const getBody: (value: string) => string[][];
|
249
|
+
export declare const getBodyWithRange: (value: string, range?: {
|
250
|
+
start: number;
|
251
|
+
end?: number | undefined;
|
252
|
+
}) => string[][];
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { Schema, BasePdf, CommonOptions } from '@pdfme/common';
|
2
|
+
import { Table } from './classes';
|
3
|
+
interface CreateTableArgs {
|
4
|
+
schema: Schema;
|
5
|
+
basePdf: BasePdf;
|
6
|
+
options: CommonOptions;
|
7
|
+
_cache: Map<any, any>;
|
8
|
+
}
|
9
|
+
export declare function createSingleTable(body: string[][], args: CreateTableArgs): Promise<Table>;
|
10
|
+
export declare function createMultiTables(body: string[][], args: CreateTableArgs): Promise<Table[]>;
|
11
|
+
export {};
|