@pdfme/ui 5.5.7 → 5.5.8-dev.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +1007 -1109
- package/dist/index.umd.js +13 -13
- package/package.json +9 -9
- package/src/components/Preview.tsx +13 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pdfme/ui",
|
|
3
|
-
"version": "5.5.
|
|
3
|
+
"version": "5.5.8-dev.15",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"author": "hand-dot",
|
|
6
6
|
"license": "MIT",
|
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
"form-render": "^2.5.5",
|
|
46
46
|
"globrex": "^0.1.2",
|
|
47
47
|
"hotkeys-js": "^3.13.15",
|
|
48
|
-
"lucide-react": "^0.
|
|
48
|
+
"lucide-react": "^0.562.0",
|
|
49
49
|
"react": "^16.14.0",
|
|
50
50
|
"react-dom": "^16.14.0",
|
|
51
51
|
"react-moveable": "^0.56.0",
|
|
52
|
-
"react-refresh": "^0.
|
|
52
|
+
"react-refresh": "^0.18.0",
|
|
53
53
|
"react-selecto": "^1.12.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
@@ -62,18 +62,18 @@
|
|
|
62
62
|
"@types/react": "^17.0.52",
|
|
63
63
|
"@types/react-dom": "^17.0.18",
|
|
64
64
|
"@ungap/structured-clone": "^1.3.0",
|
|
65
|
-
"@vitejs/plugin-react": "^5.
|
|
66
|
-
"csstype": "^3.
|
|
67
|
-
"esbuild": "^0.
|
|
65
|
+
"@vitejs/plugin-react": "^5.1.1",
|
|
66
|
+
"csstype": "^3.2.3",
|
|
67
|
+
"esbuild": "^0.27.0",
|
|
68
68
|
"eslint-plugin-react": "^7.37.5",
|
|
69
|
-
"eslint-plugin-react-hooks": "^
|
|
69
|
+
"eslint-plugin-react-hooks": "^7.0.1",
|
|
70
70
|
"is-path-inside": "^4.0.0",
|
|
71
71
|
"jest-canvas-mock": "^2.3.1",
|
|
72
72
|
"jest-environment-jsdom": "^29.7.0",
|
|
73
73
|
"postcss": "^8.5.6",
|
|
74
74
|
"process": "^0.11.10",
|
|
75
|
-
"rollup": "^4.
|
|
76
|
-
"vite": "^7.
|
|
75
|
+
"rollup": "^4.53.3",
|
|
76
|
+
"vite": "^7.2.6",
|
|
77
77
|
"vite-plugin-css-injected-by-js": "^3.3.0",
|
|
78
78
|
"vite-tsconfig-paths": "^5.1.4"
|
|
79
79
|
},
|
|
@@ -58,11 +58,12 @@ const Preview = ({
|
|
|
58
58
|
|
|
59
59
|
const input = inputs[unitCursor];
|
|
60
60
|
|
|
61
|
-
const init = (template: Template) => {
|
|
61
|
+
const init = (template: Template, inputOverride?: Record<string, string>) => {
|
|
62
|
+
const currentInput = inputOverride ?? input;
|
|
62
63
|
const options = { font };
|
|
63
64
|
getDynamicTemplate({
|
|
64
65
|
template,
|
|
65
|
-
input,
|
|
66
|
+
input: currentInput,
|
|
66
67
|
options,
|
|
67
68
|
_cache,
|
|
68
69
|
getDynamicHeights: (value, args) => {
|
|
@@ -117,6 +118,8 @@ const Preview = ({
|
|
|
117
118
|
|
|
118
119
|
const handleOnChangeRenderer = (args: { key: string; value: unknown }[], schema: SchemaForUI) => {
|
|
119
120
|
let isNeedInit = false;
|
|
121
|
+
let newInputValue: string | undefined;
|
|
122
|
+
|
|
120
123
|
args.forEach(({ key: _key, value }) => {
|
|
121
124
|
if (_key === 'content') {
|
|
122
125
|
const newValue = value as string;
|
|
@@ -124,7 +127,10 @@ const Preview = ({
|
|
|
124
127
|
if (newValue === oldValue) return;
|
|
125
128
|
handleChangeInput({ name: schema.name, value: newValue });
|
|
126
129
|
// TODO Improve this to allow schema types to determine whether the execution of getDynamicTemplate is required.
|
|
127
|
-
if (schema.type === 'table')
|
|
130
|
+
if (schema.type === 'table') {
|
|
131
|
+
isNeedInit = true;
|
|
132
|
+
newInputValue = newValue;
|
|
133
|
+
}
|
|
128
134
|
} else {
|
|
129
135
|
const targetSchema = schemasList[pageCursor].find((s) => s.id === schema.id) as SchemaForUI;
|
|
130
136
|
if (!targetSchema) return;
|
|
@@ -133,8 +139,10 @@ const Preview = ({
|
|
|
133
139
|
targetSchema[_key] = value as string;
|
|
134
140
|
}
|
|
135
141
|
});
|
|
136
|
-
if (isNeedInit) {
|
|
137
|
-
|
|
142
|
+
if (isNeedInit && newInputValue !== undefined) {
|
|
143
|
+
// Pass the updated input directly to recalculate with new value
|
|
144
|
+
const updatedInput = { ...input, [schema.name]: newInputValue };
|
|
145
|
+
init(template, updatedInput);
|
|
138
146
|
}
|
|
139
147
|
setSchemasList([...schemasList]);
|
|
140
148
|
};
|