@pdfme/ui 5.3.8-dev.29 → 5.3.8-dev.36
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 +17210 -16978
- package/dist/index.umd.js +162 -173
- package/dist/types/Designer.d.ts +1 -1
- package/dist/types/Form.d.ts +1 -1
- package/dist/types/Viewer.d.ts +1 -1
- package/dist/types/components/Designer/Canvas/Guides.d.ts +9 -3
- package/dist/types/components/Designer/Canvas/Moveable.d.ts +48 -1
- package/dist/types/components/Designer/Canvas/Selecto.d.ts +14 -3
- package/dist/types/components/Designer/RightSidebar/DetailView/index.d.ts +1 -1
- package/dist/types/components/Designer/RightSidebar/ListView/SelectableSortableContainer.d.ts +1 -1
- package/dist/types/components/Designer/RightSidebar/ListView/index.d.ts +1 -1
- package/dist/types/components/Designer/RightSidebar/index.d.ts +1 -1
- package/dist/types/contexts.d.ts +1 -1
- package/package.json +4 -3
- package/src/Designer.tsx +3 -3
- package/src/Form.tsx +3 -3
- package/src/Viewer.tsx +3 -3
- package/src/components/AppContextProvider.tsx +3 -3
- package/src/components/CtlBar.tsx +2 -2
- package/src/components/Designer/Canvas/Guides.tsx +17 -8
- package/src/components/Designer/Canvas/Mask.tsx +1 -1
- package/src/components/Designer/Canvas/Moveable.tsx +64 -5
- package/src/components/Designer/Canvas/Selecto.tsx +21 -6
- package/src/components/Designer/Canvas/index.tsx +68 -14
- package/src/components/Designer/LeftSidebar.tsx +4 -4
- package/src/components/Designer/PluginIcon.tsx +1 -1
- package/src/components/Designer/RightSidebar/DetailView/AlignWidget.tsx +1 -1
- package/src/components/Designer/RightSidebar/DetailView/index.tsx +13 -9
- package/src/components/Designer/RightSidebar/ListView/Item.tsx +1 -1
- package/src/components/Designer/RightSidebar/ListView/SelectableSortableContainer.tsx +5 -5
- package/src/components/Designer/RightSidebar/ListView/SelectableSortableItem.tsx +4 -4
- package/src/components/Designer/RightSidebar/ListView/index.tsx +5 -5
- package/src/components/Designer/RightSidebar/index.tsx +4 -4
- package/src/components/Designer/index.tsx +10 -10
- package/src/components/ErrorScreen.tsx +2 -2
- package/src/components/Paper.tsx +2 -2
- package/src/components/Preview.tsx +10 -10
- package/src/components/Renderer.tsx +7 -7
- package/src/components/Root.tsx +3 -3
- package/src/components/StaticSchema.tsx +2 -2
- package/src/helper.ts +27 -12
- package/src/types/react-guides.d.ts +22 -0
- package/src/types/react-selecto.d.ts +35 -0
- /package/{vite.config.ts → vite.config.mts} +0 -0
package/dist/types/Designer.d.ts
CHANGED
package/dist/types/Form.d.ts
CHANGED
package/dist/types/Viewer.d.ts
CHANGED
@@ -1,9 +1,15 @@
|
|
1
1
|
import React, { Ref } from 'react';
|
2
|
-
import Guides from '@scena/react-guides';
|
3
2
|
import { Size } from '@pdfme/common';
|
3
|
+
interface GuidesInterface {
|
4
|
+
getGuides(): number[];
|
5
|
+
scroll(pos: number): void;
|
6
|
+
scrollGuides(pos: number): void;
|
7
|
+
loadGuides(guides: number[]): void;
|
8
|
+
resize(): void;
|
9
|
+
}
|
4
10
|
declare const _Guides: ({ paperSize, horizontalRef, verticalRef, }: {
|
5
11
|
paperSize: Size;
|
6
|
-
horizontalRef: Ref<
|
7
|
-
verticalRef: Ref<
|
12
|
+
horizontalRef: Ref<GuidesInterface> | undefined;
|
13
|
+
verticalRef: Ref<GuidesInterface> | undefined;
|
8
14
|
}) => React.JSX.Element;
|
9
15
|
export default _Guides;
|
@@ -1,5 +1,52 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
|
2
|
+
interface OnDrag {
|
3
|
+
target: HTMLElement | SVGElement;
|
4
|
+
left: number;
|
5
|
+
top: number;
|
6
|
+
beforeDelta: any;
|
7
|
+
beforeDist: any;
|
8
|
+
beforeTranslate: any;
|
9
|
+
delta: any;
|
10
|
+
dist: any;
|
11
|
+
transform: any;
|
12
|
+
translate: any;
|
13
|
+
}
|
14
|
+
interface OnResize {
|
15
|
+
target: HTMLElement | SVGElement;
|
16
|
+
width: number;
|
17
|
+
height: number;
|
18
|
+
direction: string;
|
19
|
+
offsetWidth: number;
|
20
|
+
offsetHeight: number;
|
21
|
+
dist: any;
|
22
|
+
delta: any;
|
23
|
+
transform: any;
|
24
|
+
translate: any;
|
25
|
+
}
|
26
|
+
interface OnRotate {
|
27
|
+
target: HTMLElement | SVGElement;
|
28
|
+
rotate: number;
|
29
|
+
beforeDist: any;
|
30
|
+
beforeDelta: any;
|
31
|
+
beforeRotate: any;
|
32
|
+
dist: any;
|
33
|
+
delta: any;
|
34
|
+
transform: any;
|
35
|
+
}
|
36
|
+
interface OnRotateEnd {
|
37
|
+
target: HTMLElement | SVGElement;
|
38
|
+
}
|
39
|
+
interface OnClick {
|
40
|
+
inputEvent: MouseEvent;
|
41
|
+
inputTarget: any;
|
42
|
+
isTarget: boolean;
|
43
|
+
containsTarget: boolean;
|
44
|
+
isDouble: boolean;
|
45
|
+
datas: any;
|
46
|
+
targets: any[];
|
47
|
+
clientX: number;
|
48
|
+
clientY: number;
|
49
|
+
}
|
3
50
|
type Props = {
|
4
51
|
target: HTMLElement[];
|
5
52
|
bounds: {
|
@@ -1,10 +1,21 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
|
2
|
+
interface OnDragStart {
|
3
|
+
inputEvent: MouseEvent;
|
4
|
+
stop: () => void;
|
5
|
+
isTrusted: boolean;
|
6
|
+
}
|
7
|
+
interface OnSelect {
|
8
|
+
selected: Element[];
|
9
|
+
added: Element[];
|
10
|
+
removed: Element[];
|
11
|
+
inputEvent: MouseEvent;
|
12
|
+
rect: DOMRect;
|
13
|
+
}
|
3
14
|
type Props = {
|
4
15
|
container: HTMLElement | null;
|
5
16
|
continueSelect: boolean;
|
6
|
-
onDragStart: (e:
|
7
|
-
onSelect: (e:
|
17
|
+
onDragStart: (e: OnDragStart) => void;
|
18
|
+
onSelect: (e: OnSelect) => void;
|
8
19
|
};
|
9
20
|
declare const _Selecto: (props: Props) => React.JSX.Element;
|
10
21
|
export default _Selecto;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import type { SchemaForUI } from '@pdfme/common';
|
3
|
-
import type { SidebarProps } from '../../../../types';
|
3
|
+
import type { SidebarProps } from '../../../../types.js';
|
4
4
|
type DetailViewProps = Pick<SidebarProps, 'size' | 'schemas' | 'schemasList' | 'pageSize' | 'changeSchemas' | 'activeElements' | 'deselectSchema'> & {
|
5
5
|
activeSchema: SchemaForUI;
|
6
6
|
};
|
package/dist/types/components/Designer/RightSidebar/ListView/SelectableSortableContainer.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import type { SidebarProps } from '../../../../types';
|
2
|
+
import type { SidebarProps } from '../../../../types.js';
|
3
3
|
declare const SelectableSortableContainer: (props: Pick<SidebarProps, 'schemas' | 'onEdit' | 'onSortEnd' | 'hoveringSchemaId' | 'onChangeHoveringSchemaId'>) => React.JSX.Element;
|
4
4
|
export default SelectableSortableContainer;
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import type { SidebarProps } from '../../../../types';
|
2
|
+
import type { SidebarProps } from '../../../../types.js';
|
3
3
|
declare const ListView: (props: Pick<SidebarProps, 'schemas' | 'onSortEnd' | 'onEdit' | 'size' | 'hoveringSchemaId' | 'onChangeHoveringSchemaId' | 'changeSchemas'>) => React.JSX.Element;
|
4
4
|
export default ListView;
|
package/dist/types/contexts.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
/// <reference types="react" />
|
1
|
+
/// <reference types="react" resolution-mode="require"/>
|
2
2
|
import { Plugins, UIOptions } from '@pdfme/common';
|
3
3
|
export declare const I18nContext: import("react").Context<(key: "cancel" | "close" | "set" | "clear" | "field" | "fieldName" | "align" | "width" | "opacity" | "height" | "rotate" | "edit" | "required" | "editable" | "plsInputName" | "fieldMustUniq" | "notUniq" | "noKeyName" | "fieldsList" | "editField" | "type" | "errorOccurred" | "errorBulkUpdateFieldName" | "commitBulkUpdateFieldName" | "bulkUpdateFieldName" | "addPageAfter" | "removePage" | "removePageConfirm" | "validation.uniqueName" | "validation.hexColor" | "validation.dateTimeFormat" | "schemas.color" | "schemas.borderWidth" | "schemas.borderColor" | "schemas.backgroundColor" | "schemas.textColor" | "schemas.bgColor" | "schemas.horizontal" | "schemas.vertical" | "schemas.left" | "schemas.center" | "schemas.right" | "schemas.top" | "schemas.middle" | "schemas.bottom" | "schemas.padding" | "schemas.text.fontName" | "schemas.text.size" | "schemas.text.spacing" | "schemas.text.textAlign" | "schemas.text.verticalAlign" | "schemas.text.lineHeight" | "schemas.text.min" | "schemas.text.max" | "schemas.text.fit" | "schemas.text.dynamicFontSize" | "schemas.text.format" | "schemas.mvt.typingInstructions" | "schemas.mvt.sampleField" | "schemas.mvt.variablesSampleData" | "schemas.barcodes.barColor" | "schemas.barcodes.includetext" | "schemas.table.alternateBackgroundColor" | "schemas.table.tableStyle" | "schemas.table.showHead" | "schemas.table.headStyle" | "schemas.table.bodyStyle" | "schemas.table.columnStyle" | "schemas.date.format" | "schemas.date.locale" | "schemas.select.options" | "schemas.select.optionPlaceholder" | "schemas.radioGroup.groupName", dict?: {
|
4
4
|
cancel: string;
|
package/package.json
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
{
|
2
|
+
"type": "module",
|
2
3
|
"name": "@pdfme/ui",
|
3
|
-
"version": "5.3.8-dev.
|
4
|
+
"version": "5.3.8-dev.36",
|
4
5
|
"sideEffects": false,
|
5
6
|
"author": "hand-dot",
|
6
7
|
"license": "MIT",
|
@@ -39,7 +40,7 @@
|
|
39
40
|
"@dnd-kit/core": "^6.0.8",
|
40
41
|
"@dnd-kit/sortable": "^10.0.0",
|
41
42
|
"@pdfme/converter": "*",
|
42
|
-
"@scena/react-guides": "^0.
|
43
|
+
"@scena/react-guides": "^0.28.2",
|
43
44
|
"antd": "^5.24.2",
|
44
45
|
"form-render": "^2.2.16",
|
45
46
|
"hotkeys-js": "^3.8.7",
|
@@ -66,7 +67,7 @@
|
|
66
67
|
"process": "^0.11.10",
|
67
68
|
"vite": "^5.0.0",
|
68
69
|
"vite-plugin-css-injected-by-js": "^3.3.0",
|
69
|
-
"vite-tsconfig-paths": "^
|
70
|
+
"vite-tsconfig-paths": "^5.1.4"
|
70
71
|
},
|
71
72
|
"peerDependencies": {
|
72
73
|
"@pdfme/common": "latest",
|
package/src/Designer.tsx
CHANGED
@@ -8,10 +8,10 @@ import {
|
|
8
8
|
checkTemplate,
|
9
9
|
PDFME_VERSION,
|
10
10
|
} from '@pdfme/common';
|
11
|
-
import { BaseUIClass } from './class';
|
11
|
+
import { BaseUIClass } from './class.js';
|
12
12
|
import { DESTROYED_ERR_MSG } from './constants.js';
|
13
|
-
import DesignerComponent from './components/Designer/index';
|
14
|
-
import AppContextProvider from './components/AppContextProvider';
|
13
|
+
import DesignerComponent from './components/Designer/index.js';
|
14
|
+
import AppContextProvider from './components/AppContextProvider.js';
|
15
15
|
|
16
16
|
class Designer extends BaseUIClass {
|
17
17
|
private onSaveTemplateCallback?: (template: Template) => void;
|
package/src/Form.tsx
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import ReactDOM from 'react-dom';
|
3
3
|
import { PreviewProps } from '@pdfme/common';
|
4
|
-
import { PreviewUI } from './class';
|
4
|
+
import { PreviewUI } from './class.js';
|
5
5
|
import { DESTROYED_ERR_MSG } from './constants.js';
|
6
|
-
import AppContextProvider from './components/AppContextProvider';
|
7
|
-
import Preview from './components/Preview';
|
6
|
+
import AppContextProvider from './components/AppContextProvider.js';
|
7
|
+
import Preview from './components/Preview.js';
|
8
8
|
|
9
9
|
class Form extends PreviewUI {
|
10
10
|
private onChangeInputCallback?: (arg: { index: number; value: string; name: string }) => void;
|
package/src/Viewer.tsx
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import ReactDOM from 'react-dom';
|
3
3
|
import { PreviewProps } from '@pdfme/common';
|
4
|
-
import { PreviewUI } from './class';
|
4
|
+
import { PreviewUI } from './class.js';
|
5
5
|
import { DESTROYED_ERR_MSG } from './constants.js';
|
6
|
-
import Preview from './components/Preview';
|
7
|
-
import AppContextProvider from './components/AppContextProvider';
|
6
|
+
import Preview from './components/Preview.js';
|
7
|
+
import AppContextProvider from './components/AppContextProvider.js';
|
8
8
|
|
9
9
|
class Viewer extends PreviewUI {
|
10
10
|
constructor(props: PreviewProps) {
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { ConfigProvider as ThemeConfigProvider } from 'antd';
|
3
|
-
import { I18nContext, FontContext, PluginsRegistry, OptionsContext } from '../contexts';
|
4
|
-
import { i18n, getDict } from '../i18n';
|
5
|
-
import { defaultTheme } from '../theme';
|
3
|
+
import { I18nContext, FontContext, PluginsRegistry, OptionsContext } from '../contexts.js';
|
4
|
+
import { i18n, getDict } from '../i18n.js';
|
5
|
+
import { defaultTheme } from '../theme.js';
|
6
6
|
import type { Dict, Plugins, Font, Lang, UIOptions } from '@pdfme/common';
|
7
7
|
|
8
8
|
type Props = {
|
@@ -6,8 +6,8 @@ import { Plus, Minus, ChevronLeft, ChevronRight, Ellipsis } from 'lucide-react';
|
|
6
6
|
|
7
7
|
import type { MenuProps } from 'antd';
|
8
8
|
import { theme, Typography, Button, Dropdown } from 'antd';
|
9
|
-
import { I18nContext } from '../contexts';
|
10
|
-
import { getMaxZoom } from "../helper";
|
9
|
+
import { I18nContext } from '../contexts.js';
|
10
|
+
import { getMaxZoom } from "../helper.js";
|
11
11
|
|
12
12
|
const { Text } = Typography;
|
13
13
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React, { Ref } from 'react';
|
2
|
-
import
|
2
|
+
import GuidesComponent from '@scena/react-guides';
|
3
3
|
import { ZOOM, Size } from '@pdfme/common';
|
4
|
-
import { RULER_HEIGHT } from '../../../constants';
|
4
|
+
import { RULER_HEIGHT } from '../../../constants.js';
|
5
5
|
|
6
6
|
const guideStyle = (
|
7
7
|
top: number,
|
@@ -17,31 +17,40 @@ const guideStyle = (
|
|
17
17
|
background: '#333333',
|
18
18
|
});
|
19
19
|
|
20
|
+
// Define the interface for the Guides component
|
21
|
+
interface GuidesInterface {
|
22
|
+
getGuides(): number[];
|
23
|
+
scroll(pos: number): void;
|
24
|
+
scrollGuides(pos: number): void;
|
25
|
+
loadGuides(guides: number[]): void;
|
26
|
+
resize(): void;
|
27
|
+
}
|
28
|
+
|
20
29
|
const _Guides = ({
|
21
30
|
paperSize,
|
22
31
|
horizontalRef,
|
23
32
|
verticalRef,
|
24
33
|
}: {
|
25
34
|
paperSize: Size;
|
26
|
-
horizontalRef: Ref<
|
27
|
-
verticalRef: Ref<
|
35
|
+
horizontalRef: Ref<GuidesInterface> | undefined;
|
36
|
+
verticalRef: Ref<GuidesInterface> | undefined;
|
28
37
|
}) => (
|
29
38
|
<>
|
30
39
|
<div
|
31
40
|
className="ruler-container"
|
32
41
|
style={guideStyle(-RULER_HEIGHT, -RULER_HEIGHT, RULER_HEIGHT, RULER_HEIGHT)}
|
33
42
|
/>
|
34
|
-
<
|
43
|
+
<GuidesComponent
|
35
44
|
zoom={ZOOM}
|
36
45
|
style={guideStyle(-RULER_HEIGHT, 0, RULER_HEIGHT, paperSize.width)}
|
37
46
|
type="horizontal"
|
38
|
-
ref={horizontalRef}
|
47
|
+
ref={horizontalRef as any}
|
39
48
|
/>
|
40
|
-
<
|
49
|
+
<GuidesComponent
|
41
50
|
zoom={ZOOM}
|
42
51
|
style={guideStyle(0, -RULER_HEIGHT, paperSize.height, RULER_HEIGHT)}
|
43
52
|
type="vertical"
|
44
|
-
ref={verticalRef}
|
53
|
+
ref={verticalRef as any}
|
45
54
|
/>
|
46
55
|
</>
|
47
56
|
);
|
@@ -1,7 +1,65 @@
|
|
1
1
|
import React, { useEffect, forwardRef, Ref } from 'react';
|
2
|
-
import
|
2
|
+
import MoveableComponent from 'react-moveable';
|
3
3
|
import { theme } from 'antd';
|
4
4
|
|
5
|
+
// Define the types locally since they're not exported properly
|
6
|
+
interface OnDrag {
|
7
|
+
target: HTMLElement | SVGElement;
|
8
|
+
left: number;
|
9
|
+
top: number;
|
10
|
+
// Add additional properties that might be used in the original library
|
11
|
+
beforeDelta: any;
|
12
|
+
beforeDist: any;
|
13
|
+
beforeTranslate: any;
|
14
|
+
delta: any;
|
15
|
+
dist: any;
|
16
|
+
transform: any;
|
17
|
+
translate: any;
|
18
|
+
}
|
19
|
+
|
20
|
+
interface OnResize {
|
21
|
+
target: HTMLElement | SVGElement;
|
22
|
+
width: number;
|
23
|
+
height: number;
|
24
|
+
direction: string;
|
25
|
+
// Add additional properties that might be used in the original library
|
26
|
+
offsetWidth: number;
|
27
|
+
offsetHeight: number;
|
28
|
+
dist: any;
|
29
|
+
delta: any;
|
30
|
+
transform: any;
|
31
|
+
translate: any;
|
32
|
+
}
|
33
|
+
|
34
|
+
interface OnRotate {
|
35
|
+
target: HTMLElement | SVGElement;
|
36
|
+
rotate: number;
|
37
|
+
// Add additional properties that might be used in the original library
|
38
|
+
beforeDist: any;
|
39
|
+
beforeDelta: any;
|
40
|
+
beforeRotate: any;
|
41
|
+
dist: any;
|
42
|
+
delta: any;
|
43
|
+
transform: any;
|
44
|
+
}
|
45
|
+
|
46
|
+
interface OnRotateEnd {
|
47
|
+
target: HTMLElement | SVGElement;
|
48
|
+
}
|
49
|
+
|
50
|
+
interface OnClick {
|
51
|
+
inputEvent: MouseEvent;
|
52
|
+
// Add additional properties that might be used in the original library
|
53
|
+
inputTarget: any;
|
54
|
+
isTarget: boolean;
|
55
|
+
containsTarget: boolean;
|
56
|
+
isDouble: boolean;
|
57
|
+
datas: any;
|
58
|
+
targets: any[];
|
59
|
+
clientX: number;
|
60
|
+
clientY: number;
|
61
|
+
}
|
62
|
+
|
5
63
|
type Props = {
|
6
64
|
target: HTMLElement[];
|
7
65
|
bounds: { left: number; top: number; bottom: number; right: number };
|
@@ -39,7 +97,8 @@ const _Moveable = (props: Props, ref: Ref<any>) => {
|
|
39
97
|
}, [props.target]);
|
40
98
|
|
41
99
|
return (
|
42
|
-
|
100
|
+
// @ts-ignore
|
101
|
+
<MoveableComponent
|
43
102
|
style={{ zIndex: 1 }}
|
44
103
|
className={className}
|
45
104
|
rootContainer={document ? document.body : undefined}
|
@@ -59,18 +118,18 @@ const _Moveable = (props: Props, ref: Ref<any>) => {
|
|
59
118
|
keepRatio={props.keepRatio}
|
60
119
|
onRotate={props.onRotate}
|
61
120
|
onRotateEnd={props.onRotateEnd}
|
62
|
-
onRotateGroup={({ events }) => {
|
121
|
+
onRotateGroup={({ events }: { events: any[] }) => {
|
63
122
|
events.forEach(props.onRotate);
|
64
123
|
}}
|
65
124
|
onRotateGroupEnd={props.onRotateGroupEnd}
|
66
125
|
onDrag={props.onDrag}
|
67
|
-
onDragGroup={({ events }) => {
|
126
|
+
onDragGroup={({ events }: { events: any[] }) => {
|
68
127
|
events.forEach(props.onDrag);
|
69
128
|
}}
|
70
129
|
onDragEnd={props.onDragEnd}
|
71
130
|
onDragGroupEnd={props.onDragGroupEnd}
|
72
131
|
onResize={props.onResize}
|
73
|
-
onResizeGroup={({ events }) => {
|
132
|
+
onResizeGroup={({ events }: { events: any[] }) => {
|
74
133
|
events.forEach(props.onResize);
|
75
134
|
}}
|
76
135
|
onResizeEnd={props.onResizeEnd}
|
@@ -1,13 +1,28 @@
|
|
1
1
|
import React, { useEffect } from 'react';
|
2
|
-
import
|
3
|
-
import { SELECTABLE_CLASSNAME } from '../../../constants';
|
2
|
+
import SelectoComponent from 'react-selecto';
|
3
|
+
import { SELECTABLE_CLASSNAME } from '../../../constants.js';
|
4
4
|
import { theme } from 'antd';
|
5
5
|
|
6
|
+
// Define the types locally to match what's expected in Canvas/index.tsx
|
7
|
+
interface OnDragStart {
|
8
|
+
inputEvent: MouseEvent;
|
9
|
+
stop: () => void;
|
10
|
+
isTrusted: boolean;
|
11
|
+
}
|
12
|
+
|
13
|
+
interface OnSelect {
|
14
|
+
selected: Element[];
|
15
|
+
added: Element[];
|
16
|
+
removed: Element[];
|
17
|
+
inputEvent: MouseEvent;
|
18
|
+
rect: DOMRect;
|
19
|
+
}
|
20
|
+
|
6
21
|
type Props = {
|
7
22
|
container: HTMLElement | null;
|
8
23
|
continueSelect: boolean;
|
9
|
-
onDragStart: (e:
|
10
|
-
onSelect: (e:
|
24
|
+
onDragStart: (e: OnDragStart) => void;
|
25
|
+
onSelect: (e: OnSelect) => void;
|
11
26
|
};
|
12
27
|
|
13
28
|
const className = 'pdfme-selecto';
|
@@ -24,7 +39,7 @@ const _Selecto = (props: Props) => {
|
|
24
39
|
}, [props.container]);
|
25
40
|
|
26
41
|
return (
|
27
|
-
<
|
42
|
+
<SelectoComponent
|
28
43
|
className={className}
|
29
44
|
selectFromInside={false}
|
30
45
|
selectByClick
|
@@ -34,7 +49,7 @@ const _Selecto = (props: Props) => {
|
|
34
49
|
container={props.container}
|
35
50
|
continueSelect={props.continueSelect}
|
36
51
|
onDragStart={props.onDragStart}
|
37
|
-
onSelect={props.onSelect}
|
52
|
+
onSelect={(e: any) => props.onSelect(e as OnSelect)}
|
38
53
|
/>
|
39
54
|
);
|
40
55
|
};
|
@@ -10,22 +10,74 @@ import React, {
|
|
10
10
|
useCallback,
|
11
11
|
} from 'react';
|
12
12
|
import { theme, Button } from 'antd';
|
13
|
-
import { OnDrag, OnResize, OnClick, OnRotate } from 'react-moveable';
|
14
13
|
import { ZOOM, SchemaForUI, Size, ChangeSchemas, BasePdf, isBlankPdf, replacePlaceholders } from '@pdfme/common';
|
15
|
-
import { PluginsRegistry } from '../../../contexts';
|
14
|
+
import { PluginsRegistry } from '../../../contexts.js';
|
16
15
|
import { X } from 'lucide-react';
|
17
|
-
import { RULER_HEIGHT, RIGHT_SIDEBAR_WIDTH } from '../../../constants';
|
18
|
-
import { usePrevious } from '../../../hooks';
|
19
|
-
import { uuid, round, flatten } from '../../../helper';
|
20
|
-
import Paper from '../../Paper';
|
21
|
-
import Renderer from '../../Renderer';
|
22
|
-
import Selecto from './Selecto';
|
23
|
-
import Moveable from './Moveable';
|
24
|
-
import Guides from './Guides';
|
25
|
-
import Mask from './Mask';
|
26
|
-
import Padding from './Padding';
|
27
|
-
import StaticSchema from '../../StaticSchema';
|
16
|
+
import { RULER_HEIGHT, RIGHT_SIDEBAR_WIDTH } from '../../../constants.js';
|
17
|
+
import { usePrevious } from '../../../hooks.js';
|
18
|
+
import { uuid, round, flatten } from '../../../helper.js';
|
19
|
+
import Paper from '../../Paper.js';
|
20
|
+
import Renderer from '../../Renderer.js';
|
21
|
+
import Selecto from './Selecto.js';
|
22
|
+
import Moveable from './Moveable.js';
|
23
|
+
import Guides from './Guides.js';
|
24
|
+
import Mask from './Mask.js';
|
25
|
+
import Padding from './Padding.js';
|
26
|
+
import StaticSchema from '../../StaticSchema.js';
|
27
|
+
|
28
|
+
// Define the interfaces locally since they're not exported properly
|
29
|
+
interface OnDrag {
|
30
|
+
target: HTMLElement | SVGElement;
|
31
|
+
left: number;
|
32
|
+
top: number;
|
33
|
+
// Add additional properties that might be used in the original library
|
34
|
+
beforeDelta: any;
|
35
|
+
beforeDist: any;
|
36
|
+
beforeTranslate: any;
|
37
|
+
delta: any;
|
38
|
+
dist: any;
|
39
|
+
transform: any;
|
40
|
+
translate: any;
|
41
|
+
}
|
42
|
+
|
43
|
+
interface OnResize {
|
44
|
+
target: HTMLElement | SVGElement;
|
45
|
+
width: number;
|
46
|
+
height: number;
|
47
|
+
direction: string;
|
48
|
+
// Add additional properties that might be used in the original library
|
49
|
+
offsetWidth: number;
|
50
|
+
offsetHeight: number;
|
51
|
+
dist: any;
|
52
|
+
delta: any;
|
53
|
+
transform: any;
|
54
|
+
translate: any;
|
55
|
+
}
|
28
56
|
|
57
|
+
interface OnRotate {
|
58
|
+
target: HTMLElement | SVGElement;
|
59
|
+
rotate: number;
|
60
|
+
// Add additional properties that might be used in the original library
|
61
|
+
beforeDist: any;
|
62
|
+
beforeDelta: any;
|
63
|
+
beforeRotate: any;
|
64
|
+
dist: any;
|
65
|
+
delta: any;
|
66
|
+
transform: any;
|
67
|
+
}
|
68
|
+
|
69
|
+
interface OnClick {
|
70
|
+
inputEvent: MouseEvent;
|
71
|
+
// Add additional properties that might be used in the original library
|
72
|
+
inputTarget: any;
|
73
|
+
isTarget: boolean;
|
74
|
+
containsTarget: boolean;
|
75
|
+
isDouble: boolean;
|
76
|
+
datas: any;
|
77
|
+
targets: any[];
|
78
|
+
clientX: number;
|
79
|
+
clientY: number;
|
80
|
+
}
|
29
81
|
|
30
82
|
const mm2px = (mm: number) => mm * 3.7795275591;
|
31
83
|
|
@@ -357,7 +409,9 @@ const Canvas = (props: Props, ref: Ref<HTMLDivElement>) => {
|
|
357
409
|
if (paperRefs.current[pageCursor] === inputEvent.target) {
|
358
410
|
onEdit([]);
|
359
411
|
}
|
360
|
-
if
|
412
|
+
// Check if the target is an HTMLElement and has an id property
|
413
|
+
const targetElement = inputEvent.target as HTMLElement;
|
414
|
+
if (targetElement && targetElement.id === DELETE_BTN_ID) {
|
361
415
|
removeSchemas(activeElements.map((ae) => ae.id));
|
362
416
|
}
|
363
417
|
}}
|
@@ -7,10 +7,10 @@ import {
|
|
7
7
|
import { theme, Button } from 'antd';
|
8
8
|
import { useDraggable } from '@dnd-kit/core';
|
9
9
|
import { CSS } from "@dnd-kit/utilities";
|
10
|
-
import Renderer from '../Renderer';
|
11
|
-
import { LEFT_SIDEBAR_WIDTH } from '../../constants';
|
12
|
-
import { PluginsRegistry } from '../../contexts';
|
13
|
-
import PluginIcon from "./PluginIcon";
|
10
|
+
import Renderer from '../Renderer.js';
|
11
|
+
import { LEFT_SIDEBAR_WIDTH } from '../../constants.js';
|
12
|
+
import { PluginsRegistry } from '../../contexts.js';
|
13
|
+
import PluginIcon from "./PluginIcon.js";
|
14
14
|
|
15
15
|
|
16
16
|
const Draggable = (props: { plugin: Plugin<any>, scale: number, basePdf: BasePdf, children: React.ReactNode }) => {
|
@@ -11,7 +11,7 @@ import {
|
|
11
11
|
AlignVerticalSpaceAround,
|
12
12
|
AlignHorizontalSpaceAround,
|
13
13
|
} from 'lucide-react'
|
14
|
-
import { round } from '../../../../helper';
|
14
|
+
import { round } from '../../../../helper.js';
|
15
15
|
|
16
16
|
const AlignWidget = (props: PropPanelWidgetProps) => {
|
17
17
|
const { activeElements, changeSchemas, schemas, pageSize, schema } = props;
|
@@ -1,15 +1,18 @@
|
|
1
|
-
import
|
1
|
+
import { useForm } from 'form-render';
|
2
2
|
import React, { useRef, useContext, useState, useEffect } from 'react';
|
3
3
|
import type { ChangeSchemaItem, Dict, SchemaForUI, PropPanelWidgetProps, PropPanelSchema } from '@pdfme/common';
|
4
|
-
import type { SidebarProps } from '../../../../types';
|
4
|
+
import type { SidebarProps } from '../../../../types.js';
|
5
5
|
import { Menu } from 'lucide-react';
|
6
|
-
import { I18nContext, PluginsRegistry, OptionsContext } from '../../../../contexts';
|
7
|
-
import { getSidebarContentHeight, debounce } from '../../../../helper';
|
6
|
+
import { I18nContext, PluginsRegistry, OptionsContext } from '../../../../contexts.js';
|
7
|
+
import { getSidebarContentHeight, debounce } from '../../../../helper.js';
|
8
8
|
import { theme, Typography, Button, Divider } from 'antd';
|
9
|
-
import AlignWidget from './AlignWidget';
|
10
|
-
import WidgetRenderer from './WidgetRenderer';
|
11
|
-
import ButtonGroupWidget from './ButtonGroupWidget';
|
12
|
-
import { InternalNamePath, ValidateErrorEntity } from "rc-field-form/es/interface";
|
9
|
+
import AlignWidget from './AlignWidget.js';
|
10
|
+
import WidgetRenderer from './WidgetRenderer.js';
|
11
|
+
import ButtonGroupWidget from './ButtonGroupWidget.js';
|
12
|
+
import { InternalNamePath, ValidateErrorEntity } from "rc-field-form/es/interface.js";
|
13
|
+
|
14
|
+
// Import FormRender as a default import
|
15
|
+
import FormRenderComponent from 'form-render';
|
13
16
|
|
14
17
|
const { Text } = Typography;
|
15
18
|
|
@@ -272,7 +275,8 @@ Check this document: https://pdfme.com/docs/custom-schemas`);
|
|
272
275
|
overflowX: 'hidden',
|
273
276
|
}}
|
274
277
|
>
|
275
|
-
|
278
|
+
{/* @ts-ignore */}
|
279
|
+
<FormRenderComponent
|
276
280
|
form={form}
|
277
281
|
schema={propPanelSchema}
|
278
282
|
widgets={widgets}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React, { useEffect, useContext } from 'react';
|
2
2
|
import { DraggableSyntheticListeners } from '@dnd-kit/core';
|
3
|
-
import { I18nContext } from '../../../../contexts';
|
3
|
+
import { I18nContext } from '../../../../contexts.js';
|
4
4
|
import { GripVertical, CircleAlert, Lock } from 'lucide-react'
|
5
5
|
import { Button, Typography } from 'antd';
|
6
6
|
|