@pdfme/ui 4.1.0 → 4.1.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/types/class.d.ts
CHANGED
@@ -77,7 +77,7 @@ export declare abstract class BaseUIClass {
|
|
77
77
|
opacity: import("zod").ZodOptional<import("zod").ZodNumber>;
|
78
78
|
readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
79
79
|
}, import("zod").ZodTypeAny, "passthrough">>>, "many">;
|
80
|
-
basePdf: import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodType<ArrayBuffer, import("zod").ZodTypeDef, ArrayBuffer>, import("zod").ZodType<Uint8Array, import("zod").ZodTypeDef, Uint8Array>, import("zod").ZodObject<{
|
80
|
+
basePdf: import("zod").ZodUnion<[import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodType<ArrayBuffer, import("zod").ZodTypeDef, ArrayBuffer>, import("zod").ZodType<Uint8Array, import("zod").ZodTypeDef, Uint8Array>]>, import("zod").ZodObject<{
|
81
81
|
width: import("zod").ZodNumber;
|
82
82
|
height: import("zod").ZodNumber;
|
83
83
|
padding: import("zod").ZodTuple<[import("zod").ZodNumber, import("zod").ZodNumber, import("zod").ZodNumber, import("zod").ZodNumber], null>;
|
package/package.json
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import React, { useContext } from 'react';
|
1
|
+
import React, { useContext, useState, useEffect } from 'react';
|
2
2
|
import {
|
3
3
|
Schema,
|
4
4
|
Plugin,
|
@@ -45,16 +45,33 @@ const LeftSidebar = ({ height, scale, basePdf }: { height: number, scale: number
|
|
45
45
|
const { token } = theme.useToken();
|
46
46
|
const pluginsRegistry = useContext(PluginsRegistry);
|
47
47
|
|
48
|
+
const [isDragging, setIsDragging] = useState(false);
|
49
|
+
|
50
|
+
useEffect(() => {
|
51
|
+
const handleMouseUp = () => {
|
52
|
+
if (isDragging) {
|
53
|
+
setIsDragging(false);
|
54
|
+
}
|
55
|
+
};
|
56
|
+
|
57
|
+
document.addEventListener('mouseup', handleMouseUp);
|
58
|
+
|
59
|
+
return () => {
|
60
|
+
document.removeEventListener('mouseup', handleMouseUp);
|
61
|
+
};
|
62
|
+
}, [isDragging]);
|
63
|
+
|
48
64
|
return <div
|
49
65
|
style={{
|
50
66
|
left: 0,
|
51
|
-
position: 'absolute',
|
52
67
|
right: 0,
|
68
|
+
position: 'absolute',
|
53
69
|
zIndex: 1,
|
54
70
|
height,
|
71
|
+
width: 45,
|
55
72
|
background: token.colorBgLayout,
|
56
73
|
textAlign: 'center',
|
57
|
-
|
74
|
+
overflow: isDragging ? 'visible' : 'auto',
|
58
75
|
}}
|
59
76
|
>
|
60
77
|
{Object.entries(pluginsRegistry).map(([label, plugin]) => {
|
@@ -66,6 +83,9 @@ const LeftSidebar = ({ height, scale, basePdf }: { height: number, scale: number
|
|
66
83
|
plugin={plugin}>
|
67
84
|
<Button
|
68
85
|
title={label}
|
86
|
+
onMouseDown={() => {
|
87
|
+
setIsDragging(true);
|
88
|
+
}}
|
69
89
|
style={{ width: 35, height: 35, marginTop: '0.25rem', padding: '0.25rem' }}>
|
70
90
|
{plugin.propPanel.defaultSchema.icon ?
|
71
91
|
<div dangerouslySetInnerHTML={{ __html: plugin.propPanel.defaultSchema.icon }} />
|
@@ -137,8 +137,8 @@ const Preview = ({
|
|
137
137
|
const oldValue = (input?.[key] as string) || '';
|
138
138
|
if (newValue === oldValue) return;
|
139
139
|
handleChangeInput({ key, value: newValue });
|
140
|
-
// TODO
|
141
|
-
isNeedInit = true;
|
140
|
+
// TODO Improve this to allow schema types to determine whether the execution of getDynamicTemplate is required.
|
141
|
+
if (schema.type === 'table') isNeedInit = true;
|
142
142
|
} else {
|
143
143
|
const targetSchema = schemasList[pageCursor].find(
|
144
144
|
(s) => s.id === schema.id
|