@pdfme/ui 5.4.0 → 5.4.1
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 +53261 -59858
- package/dist/index.umd.js +256 -265
- package/package.json +11 -11
- package/src/Viewer.tsx +3 -1
- package/src/components/Designer/Canvas/Moveable.tsx +1 -1
- package/src/components/Designer/Canvas/index.tsx +10 -9
- package/src/components/Designer/LeftSidebar.tsx +18 -15
- package/src/components/StaticSchema.tsx +9 -5
- package/src/helper.ts +5 -1
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@pdfme/ui",
|
3
|
-
"version": "5.4.
|
3
|
+
"version": "5.4.1",
|
4
4
|
"sideEffects": false,
|
5
5
|
"author": "hand-dot",
|
6
6
|
"license": "MIT",
|
@@ -40,11 +40,11 @@
|
|
40
40
|
"@dnd-kit/sortable": "^10.0.0",
|
41
41
|
"@pdfme/converter": "*",
|
42
42
|
"@scena/react-guides": "^0.28.2",
|
43
|
-
"antd": "^5.
|
44
|
-
"form-render": "^2.
|
43
|
+
"antd": "^5.26.3",
|
44
|
+
"form-render": "^2.5.3",
|
45
45
|
"globrex": "^0.1.2",
|
46
|
-
"hotkeys-js": "^3.13.
|
47
|
-
"lucide-react": "^0.
|
46
|
+
"hotkeys-js": "^3.13.14",
|
47
|
+
"lucide-react": "^0.525.0",
|
48
48
|
"react": "^16.14.0",
|
49
49
|
"react-dom": "^16.14.0",
|
50
50
|
"react-moveable": "^0.56.0",
|
@@ -56,22 +56,22 @@
|
|
56
56
|
"@pdfme/schemas": "*",
|
57
57
|
"@testing-library/jest-dom": "^6.6.3",
|
58
58
|
"@testing-library/react": "^12.1.2",
|
59
|
-
"@types/jest": "^
|
59
|
+
"@types/jest": "^30.0.0",
|
60
60
|
"@types/react": "^17.0.52",
|
61
61
|
"@types/react-dom": "^17.0.18",
|
62
62
|
"@ungap/structured-clone": "^1.3.0",
|
63
|
-
"@vitejs/plugin-react": "^4.
|
63
|
+
"@vitejs/plugin-react": "^4.6.0",
|
64
64
|
"csstype": "^3.1.2",
|
65
|
-
"esbuild": "^0.25.
|
65
|
+
"esbuild": "^0.25.5",
|
66
66
|
"eslint-plugin-react": "^7.37.5",
|
67
67
|
"eslint-plugin-react-hooks": "^5.2.0",
|
68
68
|
"is-path-inside": "^4.0.0",
|
69
69
|
"jest-canvas-mock": "^2.3.1",
|
70
70
|
"jest-environment-jsdom": "^29.7.0",
|
71
|
-
"postcss": "^8.5.
|
71
|
+
"postcss": "^8.5.6",
|
72
72
|
"process": "^0.11.10",
|
73
|
-
"rollup": "^4.
|
74
|
-
"vite": "^
|
73
|
+
"rollup": "^4.44.1",
|
74
|
+
"vite": "^7.0.0",
|
75
75
|
"vite-plugin-css-injected-by-js": "^3.3.0",
|
76
76
|
"vite-tsconfig-paths": "^5.1.4"
|
77
77
|
},
|
package/src/Viewer.tsx
CHANGED
@@ -9,7 +9,9 @@ import AppContextProvider from './components/AppContextProvider.js';
|
|
9
9
|
class Viewer extends PreviewUI {
|
10
10
|
constructor(props: PreviewProps) {
|
11
11
|
super(props);
|
12
|
-
console.warn(
|
12
|
+
console.warn(
|
13
|
+
'[@pdfme/ui] Viewer component is deprecated and will be removed in a future version.',
|
14
|
+
);
|
13
15
|
}
|
14
16
|
|
15
17
|
protected render() {
|
@@ -508,20 +508,21 @@ const Canvas = (props: Props, ref: Ref<HTMLDivElement>) => {
|
|
508
508
|
onChange={
|
509
509
|
(schemasList[pageCursor] || []).some((s) => s.id === schema.id)
|
510
510
|
? (arg) => {
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
511
|
+
// Use type assertion to safely handle the argument
|
512
|
+
type ChangeArg = { key: string; value: unknown };
|
513
|
+
const args = Array.isArray(arg) ? (arg as ChangeArg[]) : [arg as ChangeArg];
|
514
|
+
changeSchemas(
|
515
|
+
args.map(({ key, value }) => ({ key, value, schemaId: schema.id })),
|
516
|
+
);
|
517
|
+
}
|
518
518
|
: undefined
|
519
519
|
}
|
520
520
|
stopEditing={() => setEditing(false)}
|
521
|
-
outline={`1px ${hoveringSchemaId === schema.id ? 'solid' : 'dashed'} ${
|
521
|
+
outline={`1px ${hoveringSchemaId === schema.id ? 'solid' : 'dashed'} ${
|
522
|
+
schema.readOnly && hoveringSchemaId !== schema.id
|
522
523
|
? 'transparent'
|
523
524
|
: token.colorPrimary
|
524
|
-
|
525
|
+
}`}
|
525
526
|
scale={scale}
|
526
527
|
/>
|
527
528
|
);
|
@@ -27,21 +27,24 @@ const Draggable = (props: {
|
|
27
27
|
const { listeners, setNodeRef, attributes, transform, isDragging } = draggable;
|
28
28
|
const style = { transform: CSS.Translate.toString(transform) };
|
29
29
|
|
30
|
-
const renderedSchema = React.useMemo(
|
31
|
-
|
32
|
-
<
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
30
|
+
const renderedSchema = React.useMemo(
|
31
|
+
() => (
|
32
|
+
<div style={{ transform: `scale(${scale})` }}>
|
33
|
+
<Renderer
|
34
|
+
schema={{ ...defaultSchema, id: defaultSchema.type }}
|
35
|
+
basePdf={basePdf}
|
36
|
+
value={defaultSchema.content || ''}
|
37
|
+
onChangeHoveringSchemaId={() => {
|
38
|
+
void 0;
|
39
|
+
}}
|
40
|
+
mode={'viewer'}
|
41
|
+
outline={`1px solid ${token.colorPrimary}`}
|
42
|
+
scale={scale}
|
43
|
+
/>
|
44
|
+
</div>
|
45
|
+
),
|
46
|
+
[defaultSchema, basePdf, scale, token.colorPrimary],
|
47
|
+
);
|
45
48
|
|
46
49
|
return (
|
47
50
|
<div ref={setNodeRef} style={style} {...listeners} {...attributes}>
|
@@ -25,11 +25,15 @@ const StaticSchema = (props: {
|
|
25
25
|
key={schema.name}
|
26
26
|
schema={{ ...schema, id: uuid() }}
|
27
27
|
basePdf={basePdf}
|
28
|
-
value={
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
28
|
+
value={
|
29
|
+
schema.readOnly
|
30
|
+
? replacePlaceholders({
|
31
|
+
content: schema.content || '',
|
32
|
+
variables: { ...input, totalPages, currentPage },
|
33
|
+
schemas,
|
34
|
+
})
|
35
|
+
: schema.content || ''
|
36
|
+
}
|
33
37
|
onChangeHoveringSchemaId={() => {
|
34
38
|
void 0;
|
35
39
|
}}
|
package/src/helper.ts
CHANGED
@@ -526,7 +526,11 @@ export const setFontNameRecursively = (
|
|
526
526
|
seen.add(obj);
|
527
527
|
|
528
528
|
for (const key in obj) {
|
529
|
-
if (
|
529
|
+
if (
|
530
|
+
key === 'fontName' &&
|
531
|
+
Object.prototype.hasOwnProperty.call(obj, key) &&
|
532
|
+
obj[key] === undefined
|
533
|
+
) {
|
530
534
|
obj[key] = fontName;
|
531
535
|
} else if (typeof obj[key] === 'object' && obj[key] !== null) {
|
532
536
|
setFontNameRecursively(obj[key] as Record<string, unknown>, fontName, seen);
|