@pdfme/ui 5.3.16-dev.3 → 5.3.16-dev.30
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 +12885 -12674
- package/dist/index.umd.js +162 -162
- package/package.json +8 -8
- package/src/class.ts +3 -1
- package/src/components/Designer/Canvas/index.tsx +10 -11
- package/src/components/Designer/LeftSidebar.tsx +17 -15
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@pdfme/ui",
|
3
|
-
"version": "5.3.16-dev.
|
3
|
+
"version": "5.3.16-dev.30",
|
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.
|
43
|
+
"antd": "^5.25.0",
|
44
44
|
"form-render": "^2.2.16",
|
45
45
|
"globrex": "^0.1.2",
|
46
|
-
"hotkeys-js": "^3.
|
47
|
-
"lucide-react": "^0.
|
46
|
+
"hotkeys-js": "^3.13.10",
|
47
|
+
"lucide-react": "^0.508.0",
|
48
48
|
"react": "^16.14.0",
|
49
49
|
"react-dom": "^16.14.0",
|
50
50
|
"react-moveable": "^0.56.0",
|
@@ -60,9 +60,9 @@
|
|
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.4.1",
|
64
64
|
"csstype": "^3.1.2",
|
65
|
-
"esbuild": "^0.25.
|
65
|
+
"esbuild": "^0.25.4",
|
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",
|
@@ -70,8 +70,8 @@
|
|
70
70
|
"jest-environment-jsdom": "^29.7.0",
|
71
71
|
"postcss": "^8.5.3",
|
72
72
|
"process": "^0.11.10",
|
73
|
-
"rollup": "^4.
|
74
|
-
"vite": "^6.
|
73
|
+
"rollup": "^4.40.2",
|
74
|
+
"vite": "^6.3.5",
|
75
75
|
"vite-plugin-css-injected-by-js": "^3.3.0",
|
76
76
|
"vite-tsconfig-paths": "^5.1.4"
|
77
77
|
},
|
package/src/class.ts
CHANGED
@@ -36,7 +36,9 @@ export abstract class BaseUIClass {
|
|
36
36
|
private options: UIOptions = {};
|
37
37
|
|
38
38
|
private readonly setSize = debounce(() => {
|
39
|
-
if (!this.domContainer)
|
39
|
+
if (!this.domContainer) {
|
40
|
+
return;
|
41
|
+
}
|
40
42
|
this.size = {
|
41
43
|
height: this.domContainer.clientHeight || window.innerHeight,
|
42
44
|
width: this.domContainer.clientWidth || window.innerWidth,
|
@@ -515,23 +515,22 @@ const Canvas = (props: Props, ref: Ref<HTMLDivElement>) => {
|
|
515
515
|
onChangeHoveringSchemaId={onChangeHoveringSchemaId}
|
516
516
|
mode={mode}
|
517
517
|
onChange={
|
518
|
-
schemasList[pageCursor].some((s) => s.id === schema.id)
|
518
|
+
(schemasList[pageCursor] || []).some((s) => s.id === schema.id)
|
519
519
|
? (arg) => {
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
520
|
+
// Use type assertion to safely handle the argument
|
521
|
+
type ChangeArg = { key: string; value: unknown };
|
522
|
+
const args = Array.isArray(arg) ? (arg as ChangeArg[]) : [arg as ChangeArg];
|
523
|
+
changeSchemas(
|
524
|
+
args.map(({ key, value }) => ({ key, value, schemaId: schema.id })),
|
525
|
+
);
|
526
|
+
}
|
527
527
|
: undefined
|
528
528
|
}
|
529
529
|
stopEditing={() => setEditing(false)}
|
530
|
-
outline={`1px ${hoveringSchemaId === schema.id ? 'solid' : 'dashed'} ${
|
531
|
-
schema.readOnly && hoveringSchemaId !== schema.id
|
530
|
+
outline={`1px ${hoveringSchemaId === schema.id ? 'solid' : 'dashed'} ${schema.readOnly && hoveringSchemaId !== schema.id
|
532
531
|
? 'transparent'
|
533
532
|
: token.colorPrimary
|
534
|
-
|
533
|
+
}`}
|
535
534
|
scale={scale}
|
536
535
|
/>
|
537
536
|
);
|
@@ -21,23 +21,25 @@ const Draggable = (props: {
|
|
21
21
|
const { listeners, setNodeRef, attributes, transform, isDragging } = draggable;
|
22
22
|
const style = { transform: CSS.Translate.toString(transform) };
|
23
23
|
|
24
|
+
const renderedSchema = React.useMemo(() => (
|
25
|
+
<div style={{ transform: `scale(${scale})` }}>
|
26
|
+
<Renderer
|
27
|
+
schema={{ ...defaultSchema, id: defaultSchema.type }}
|
28
|
+
basePdf={basePdf}
|
29
|
+
value={defaultSchema.content || ''}
|
30
|
+
onChangeHoveringSchemaId={() => {
|
31
|
+
void 0;
|
32
|
+
}}
|
33
|
+
mode={'viewer'}
|
34
|
+
outline={`1px solid ${token.colorPrimary}`}
|
35
|
+
scale={scale}
|
36
|
+
/>
|
37
|
+
</div>
|
38
|
+
), [defaultSchema, basePdf, scale, token.colorPrimary]);
|
39
|
+
|
24
40
|
return (
|
25
41
|
<div ref={setNodeRef} style={style} {...listeners} {...attributes}>
|
26
|
-
{isDragging &&
|
27
|
-
<div style={{ transform: `scale(${scale})` }}>
|
28
|
-
<Renderer
|
29
|
-
schema={{ ...defaultSchema, id: defaultSchema.type }}
|
30
|
-
basePdf={basePdf}
|
31
|
-
value={defaultSchema.content || ''}
|
32
|
-
onChangeHoveringSchemaId={() => {
|
33
|
-
void 0;
|
34
|
-
}}
|
35
|
-
mode={'viewer'}
|
36
|
-
outline={`1px solid ${token.colorPrimary}`}
|
37
|
-
scale={scale}
|
38
|
-
/>
|
39
|
-
</div>
|
40
|
-
)}
|
42
|
+
{isDragging && renderedSchema}
|
41
43
|
<div style={{ visibility: isDragging ? 'hidden' : 'visible' }}>{props.children}</div>
|
42
44
|
</div>
|
43
45
|
);
|