@pdfme/ui 1.1.4 → 1.1.6
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/.eslintrc.js +2 -2
- package/dist/index.js +3 -0
- package/dist/index.js.LICENSE.txt +95 -0
- package/dist/index.js.map +1 -0
- package/dist/types/{src/Designer.d.ts → Designer.d.ts} +1 -1
- package/dist/types/{src/Form.d.ts → Form.d.ts} +1 -1
- package/dist/types/{src/Viewer.d.ts → Viewer.d.ts} +1 -1
- package/dist/types/{src/class.d.ts → class.d.ts} +2 -4
- package/dist/types/{src/components → components}/CtlBar/Pager.d.ts +0 -1
- package/dist/types/{src/components → components}/CtlBar/Zoom.d.ts +0 -1
- package/dist/types/{src/components → components}/CtlBar/index.d.ts +0 -1
- package/dist/types/{src/components → components}/Designer/Main/Mask.d.ts +0 -1
- package/dist/types/components/Designer/Main/Moveable.d.ts +32 -0
- package/dist/types/{src/components → components}/Designer/Main/Selecto.d.ts +0 -1
- package/dist/types/{src/components → components}/Designer/Sidebar/DetailView/ExampleInputEditor.d.ts +0 -1
- package/dist/types/{src/components → components}/Designer/Sidebar/DetailView/PositionAndSizeEditor.d.ts +1 -2
- package/dist/types/{src/components → components}/Designer/Sidebar/DetailView/TextPropEditor.d.ts +0 -1
- package/dist/types/{src/components → components}/Designer/Sidebar/DetailView/TypeAndKeyEditor.d.ts +1 -2
- package/dist/types/{src/components → components}/Designer/Sidebar/DetailView/index.d.ts +1 -2
- package/dist/types/{src/components → components}/Designer/Sidebar/ListView/SelectableSortableContainer.d.ts +1 -2
- package/dist/types/{src/components → components}/Designer/Sidebar/ListView/index.d.ts +1 -2
- package/dist/types/{src/components → components}/Designer/Sidebar/index.d.ts +0 -1
- package/dist/types/{src/components → components}/Designer/index.d.ts +1 -2
- package/dist/types/{src/components → components}/Divider.d.ts +0 -1
- package/dist/types/{src/components → components}/Error.d.ts +0 -1
- package/dist/types/{src/components → components}/Preview.d.ts +0 -1
- package/dist/types/{src/components → components}/Schemas/BarcodeSchema.d.ts +1 -1
- package/dist/types/{src/components → components}/Schemas/ImageSchema.d.ts +1 -1
- package/dist/types/{src/components → components}/Schemas/SchemaUI.d.ts +1 -1
- package/dist/types/{src/components → components}/Schemas/TextSchema.d.ts +1 -1
- package/dist/types/{src/components → components}/Spinner.d.ts +0 -1
- package/dist/types/{src/components → components}/UnitPager.d.ts +0 -1
- package/dist/types/{src/contexts.d.ts → contexts.d.ts} +2 -2
- package/dist/types/{src/helper.d.ts → helper.d.ts} +0 -1
- package/dist/types/index.d.ts +7 -0
- package/package.json +16 -23
- package/src/Designer.tsx +10 -8
- package/src/Form.tsx +9 -7
- package/src/Viewer.tsx +9 -7
- package/src/class.ts +6 -10
- package/src/components/CtlBar/Pager.tsx +1 -1
- package/src/components/CtlBar/index.tsx +2 -2
- package/src/components/Designer/Main/Guides.tsx +1 -1
- package/src/components/Designer/Main/Mask.tsx +1 -1
- package/src/components/Designer/Main/Moveable.tsx +27 -15
- package/src/components/Designer/Main/Selecto.tsx +1 -1
- package/src/components/Designer/Main/index.tsx +55 -38
- package/src/components/Designer/Sidebar/DetailView/ExampleInputEditor.tsx +5 -5
- package/src/components/Designer/Sidebar/DetailView/PositionAndSizeEditor.tsx +15 -2
- package/src/components/Designer/Sidebar/DetailView/TextPropEditor.tsx +3 -2
- package/src/components/Designer/Sidebar/DetailView/TypeAndKeyEditor.tsx +2 -2
- package/src/components/Designer/Sidebar/DetailView/index.tsx +7 -7
- package/src/components/Designer/Sidebar/ListView/Item.tsx +1 -1
- package/src/components/Designer/Sidebar/ListView/SelectableSortableContainer.tsx +55 -51
- package/src/components/Designer/Sidebar/ListView/SelectableSortableItem.tsx +3 -3
- package/src/components/Designer/Sidebar/ListView/index.tsx +5 -5
- package/src/components/Designer/Sidebar/index.tsx +4 -4
- package/src/components/Designer/index.tsx +9 -9
- package/src/components/Error.tsx +1 -1
- package/src/components/Paper.tsx +2 -2
- package/src/components/Preview.tsx +9 -9
- package/src/components/Root.tsx +14 -12
- package/src/components/Schemas/BarcodeSchema.tsx +2 -2
- package/src/components/Schemas/ImageSchema.tsx +5 -5
- package/src/components/Schemas/SchemaUI.tsx +5 -4
- package/src/components/Schemas/TextSchema.tsx +2 -2
- package/src/contexts.ts +2 -2
- package/src/helper.ts +1 -8
- package/src/hooks.ts +2 -2
- package/src/i18n.ts +1 -1
- package/src/index.ts +45 -6
- package/tsconfig.json +22 -0
- package/webpack.config.js +35 -0
- package/dist/cjs/__tests__/assets/helper.js +0 -79
- package/dist/cjs/__tests__/assets/helper.js.map +0 -1
- package/dist/cjs/__tests__/components/Designer.test.js +0 -39
- package/dist/cjs/__tests__/components/Designer.test.js.map +0 -1
- package/dist/cjs/__tests__/components/Preview.test.js +0 -51
- package/dist/cjs/__tests__/components/Preview.test.js.map +0 -1
- package/dist/cjs/__tests__/helper.test.js +0 -94
- package/dist/cjs/__tests__/helper.test.js.map +0 -1
- package/dist/cjs/src/Designer.js +0 -61
- package/dist/cjs/src/Designer.js.map +0 -1
- package/dist/cjs/src/Form.js +0 -35
- package/dist/cjs/src/Form.js.map +0 -1
- package/dist/cjs/src/Viewer.js +0 -25
- package/dist/cjs/src/Viewer.js.map +0 -1
- package/dist/cjs/src/class.js +0 -119
- package/dist/cjs/src/class.js.map +0 -1
- package/dist/cjs/src/components/CtlBar/Pager.js +0 -49
- package/dist/cjs/src/components/CtlBar/Pager.js.map +0 -1
- package/dist/cjs/src/components/CtlBar/Zoom.js +0 -31
- package/dist/cjs/src/components/CtlBar/Zoom.js.map +0 -1
- package/dist/cjs/src/components/CtlBar/index.js +0 -33
- package/dist/cjs/src/components/CtlBar/index.js.map +0 -1
- package/dist/cjs/src/components/Designer/Main/Guides.js +0 -33
- package/dist/cjs/src/components/Designer/Main/Guides.js.map +0 -1
- package/dist/cjs/src/components/Designer/Main/Mask.js +0 -18
- package/dist/cjs/src/components/Designer/Main/Mask.js.map +0 -1
- package/dist/cjs/src/components/Designer/Main/Moveable.js +0 -37
- package/dist/cjs/src/components/Designer/Main/Moveable.js.map +0 -1
- package/dist/cjs/src/components/Designer/Main/Selecto.js +0 -11
- package/dist/cjs/src/components/Designer/Main/Selecto.js.map +0 -1
- package/dist/cjs/src/components/Designer/Main/index.js +0 -224
- package/dist/cjs/src/components/Designer/Main/index.js.map +0 -1
- package/dist/cjs/src/components/Designer/Sidebar/DetailView/ExampleInputEditor.js +0 -69
- package/dist/cjs/src/components/Designer/Sidebar/DetailView/ExampleInputEditor.js.map +0 -1
- package/dist/cjs/src/components/Designer/Sidebar/DetailView/PositionAndSizeEditor.js +0 -184
- package/dist/cjs/src/components/Designer/Sidebar/DetailView/PositionAndSizeEditor.js.map +0 -1
- package/dist/cjs/src/components/Designer/Sidebar/DetailView/TextPropEditor.js +0 -116
- package/dist/cjs/src/components/Designer/Sidebar/DetailView/TextPropEditor.js.map +0 -1
- package/dist/cjs/src/components/Designer/Sidebar/DetailView/TypeAndKeyEditor.js +0 -72
- package/dist/cjs/src/components/Designer/Sidebar/DetailView/TypeAndKeyEditor.js.map +0 -1
- package/dist/cjs/src/components/Designer/Sidebar/DetailView/index.js +0 -54
- package/dist/cjs/src/components/Designer/Sidebar/DetailView/index.js.map +0 -1
- package/dist/cjs/src/components/Designer/Sidebar/ListView/Item.js +0 -76
- package/dist/cjs/src/components/Designer/Sidebar/ListView/Item.js.map +0 -1
- package/dist/cjs/src/components/Designer/Sidebar/ListView/SelectableSortableContainer.js +0 -108
- package/dist/cjs/src/components/Designer/Sidebar/ListView/SelectableSortableContainer.js.map +0 -1
- package/dist/cjs/src/components/Designer/Sidebar/ListView/SelectableSortableItem.js +0 -62
- package/dist/cjs/src/components/Designer/Sidebar/ListView/SelectableSortableItem.js.map +0 -1
- package/dist/cjs/src/components/Designer/Sidebar/ListView/index.js +0 -84
- package/dist/cjs/src/components/Designer/Sidebar/ListView/index.js.map +0 -1
- package/dist/cjs/src/components/Designer/Sidebar/index.js +0 -105
- package/dist/cjs/src/components/Designer/Sidebar/index.js.map +0 -1
- package/dist/cjs/src/components/Designer/index.js +0 -235
- package/dist/cjs/src/components/Designer/index.js.map +0 -1
- package/dist/cjs/src/components/Divider.js +0 -9
- package/dist/cjs/src/components/Divider.js.map +0 -1
- package/dist/cjs/src/components/Error.js +0 -41
- package/dist/cjs/src/components/Error.js.map +0 -1
- package/dist/cjs/src/components/Paper.js +0 -63
- package/dist/cjs/src/components/Paper.js.map +0 -1
- package/dist/cjs/src/components/Preview.js +0 -102
- package/dist/cjs/src/components/Preview.js.map +0 -1
- package/dist/cjs/src/components/Root.js +0 -52
- package/dist/cjs/src/components/Root.js.map +0 -1
- package/dist/cjs/src/components/Schemas/BarcodeSchema.js +0 -94
- package/dist/cjs/src/components/Schemas/BarcodeSchema.js.map +0 -1
- package/dist/cjs/src/components/Schemas/ImageSchema.js +0 -72
- package/dist/cjs/src/components/Schemas/ImageSchema.js.map +0 -1
- package/dist/cjs/src/components/Schemas/SchemaUI.js +0 -55
- package/dist/cjs/src/components/Schemas/SchemaUI.js.map +0 -1
- package/dist/cjs/src/components/Schemas/TextSchema.js +0 -54
- package/dist/cjs/src/components/Schemas/TextSchema.js.map +0 -1
- package/dist/cjs/src/components/Spinner.js +0 -31
- package/dist/cjs/src/components/Spinner.js.map +0 -1
- package/dist/cjs/src/components/UnitPager.js +0 -63
- package/dist/cjs/src/components/UnitPager.js.map +0 -1
- package/dist/cjs/src/constants.js +0 -10
- package/dist/cjs/src/constants.js.map +0 -1
- package/dist/cjs/src/contexts.js +0 -10
- package/dist/cjs/src/contexts.js.map +0 -1
- package/dist/cjs/src/helper.js +0 -466
- package/dist/cjs/src/helper.js.map +0 -1
- package/dist/cjs/src/hooks.js +0 -100
- package/dist/cjs/src/hooks.js.map +0 -1
- package/dist/cjs/src/i18n.js +0 -50
- package/dist/cjs/src/i18n.js.map +0 -1
- package/dist/cjs/src/index.js +0 -24
- package/dist/cjs/src/index.js.map +0 -1
- package/dist/esm/__tests__/assets/helper.js +0 -51
- package/dist/esm/__tests__/assets/helper.js.map +0 -1
- package/dist/esm/__tests__/components/Designer.test.js +0 -34
- package/dist/esm/__tests__/components/Designer.test.js.map +0 -1
- package/dist/esm/__tests__/components/Preview.test.js +0 -46
- package/dist/esm/__tests__/components/Preview.test.js.map +0 -1
- package/dist/esm/__tests__/helper.test.js +0 -92
- package/dist/esm/__tests__/helper.test.js.map +0 -1
- package/dist/esm/src/Designer.js +0 -56
- package/dist/esm/src/Designer.js.map +0 -1
- package/dist/esm/src/Form.js +0 -30
- package/dist/esm/src/Form.js.map +0 -1
- package/dist/esm/src/Viewer.js +0 -20
- package/dist/esm/src/Viewer.js.map +0 -1
- package/dist/esm/src/class.js +0 -114
- package/dist/esm/src/class.js.map +0 -1
- package/dist/esm/src/components/CtlBar/Pager.js +0 -24
- package/dist/esm/src/components/CtlBar/Pager.js.map +0 -1
- package/dist/esm/src/components/CtlBar/Zoom.js +0 -26
- package/dist/esm/src/components/CtlBar/Zoom.js.map +0 -1
- package/dist/esm/src/components/CtlBar/index.js +0 -28
- package/dist/esm/src/components/CtlBar/index.js.map +0 -1
- package/dist/esm/src/components/Designer/Main/Guides.js +0 -28
- package/dist/esm/src/components/Designer/Main/Guides.js.map +0 -1
- package/dist/esm/src/components/Designer/Main/Mask.js +0 -13
- package/dist/esm/src/components/Designer/Main/Mask.js.map +0 -1
- package/dist/esm/src/components/Designer/Main/Moveable.js +0 -9
- package/dist/esm/src/components/Designer/Main/Moveable.js.map +0 -1
- package/dist/esm/src/components/Designer/Main/Selecto.js +0 -6
- package/dist/esm/src/components/Designer/Main/Selecto.js.map +0 -1
- package/dist/esm/src/components/Designer/Main/index.js +0 -196
- package/dist/esm/src/components/Designer/Main/index.js.map +0 -1
- package/dist/esm/src/components/Designer/Sidebar/DetailView/ExampleInputEditor.js +0 -44
- package/dist/esm/src/components/Designer/Sidebar/DetailView/ExampleInputEditor.js.map +0 -1
- package/dist/esm/src/components/Designer/Sidebar/DetailView/PositionAndSizeEditor.js +0 -179
- package/dist/esm/src/components/Designer/Sidebar/DetailView/PositionAndSizeEditor.js.map +0 -1
- package/dist/esm/src/components/Designer/Sidebar/DetailView/TextPropEditor.js +0 -91
- package/dist/esm/src/components/Designer/Sidebar/DetailView/TextPropEditor.js.map +0 -1
- package/dist/esm/src/components/Designer/Sidebar/DetailView/TypeAndKeyEditor.js +0 -47
- package/dist/esm/src/components/Designer/Sidebar/DetailView/TypeAndKeyEditor.js.map +0 -1
- package/dist/esm/src/components/Designer/Sidebar/DetailView/index.js +0 -26
- package/dist/esm/src/components/Designer/Sidebar/DetailView/index.js.map +0 -1
- package/dist/esm/src/components/Designer/Sidebar/ListView/Item.js +0 -51
- package/dist/esm/src/components/Designer/Sidebar/ListView/Item.js.map +0 -1
- package/dist/esm/src/components/Designer/Sidebar/ListView/SelectableSortableContainer.js +0 -80
- package/dist/esm/src/components/Designer/Sidebar/ListView/SelectableSortableContainer.js.map +0 -1
- package/dist/esm/src/components/Designer/Sidebar/ListView/SelectableSortableItem.js +0 -34
- package/dist/esm/src/components/Designer/Sidebar/ListView/SelectableSortableItem.js.map +0 -1
- package/dist/esm/src/components/Designer/Sidebar/ListView/index.js +0 -56
- package/dist/esm/src/components/Designer/Sidebar/ListView/index.js.map +0 -1
- package/dist/esm/src/components/Designer/Sidebar/index.js +0 -77
- package/dist/esm/src/components/Designer/Sidebar/index.js.map +0 -1
- package/dist/esm/src/components/Designer/index.js +0 -207
- package/dist/esm/src/components/Designer/index.js.map +0 -1
- package/dist/esm/src/components/Divider.js +0 -4
- package/dist/esm/src/components/Divider.js.map +0 -1
- package/dist/esm/src/components/Error.js +0 -16
- package/dist/esm/src/components/Error.js.map +0 -1
- package/dist/esm/src/components/Paper.js +0 -38
- package/dist/esm/src/components/Paper.js.map +0 -1
- package/dist/esm/src/components/Preview.js +0 -74
- package/dist/esm/src/components/Preview.js.map +0 -1
- package/dist/esm/src/components/Root.js +0 -24
- package/dist/esm/src/components/Root.js.map +0 -1
- package/dist/esm/src/components/Schemas/BarcodeSchema.js +0 -69
- package/dist/esm/src/components/Schemas/BarcodeSchema.js.map +0 -1
- package/dist/esm/src/components/Schemas/ImageSchema.js +0 -47
- package/dist/esm/src/components/Schemas/ImageSchema.js.map +0 -1
- package/dist/esm/src/components/Schemas/SchemaUI.js +0 -27
- package/dist/esm/src/components/Schemas/SchemaUI.js.map +0 -1
- package/dist/esm/src/components/Schemas/TextSchema.js +0 -29
- package/dist/esm/src/components/Schemas/TextSchema.js.map +0 -1
- package/dist/esm/src/components/Spinner.js +0 -26
- package/dist/esm/src/components/Spinner.js.map +0 -1
- package/dist/esm/src/components/UnitPager.js +0 -58
- package/dist/esm/src/components/UnitPager.js.map +0 -1
- package/dist/esm/src/constants.js +0 -7
- package/dist/esm/src/constants.js.map +0 -1
- package/dist/esm/src/contexts.js +0 -7
- package/dist/esm/src/contexts.js.map +0 -1
- package/dist/esm/src/helper.js +0 -439
- package/dist/esm/src/helper.js.map +0 -1
- package/dist/esm/src/hooks.js +0 -93
- package/dist/esm/src/hooks.js.map +0 -1
- package/dist/esm/src/i18n.js +0 -46
- package/dist/esm/src/i18n.js.map +0 -1
- package/dist/esm/src/index.js +0 -6
- package/dist/esm/src/index.js.map +0 -1
- package/dist/types/__tests__/assets/helper.d.ts +0 -3
- package/dist/types/__tests__/components/Designer.test.d.ts +0 -1
- package/dist/types/__tests__/components/Preview.test.d.ts +0 -1
- package/dist/types/__tests__/helper.test.d.ts +0 -1
- package/dist/types/src/components/Designer/Main/Moveable.d.ts +0 -31
- package/dist/types/src/index.d.ts +0 -6
- package/tsconfig.cjs.json +0 -10
- package/tsconfig.esm.json +0 -10
- /package/dist/types/{src/components → components}/Designer/Main/Guides.d.ts +0 -0
- /package/dist/types/{src/components → components}/Designer/Main/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/Designer/Sidebar/ListView/Item.d.ts +0 -0
- /package/dist/types/{src/components → components}/Designer/Sidebar/ListView/SelectableSortableItem.d.ts +0 -0
- /package/dist/types/{src/components → components}/Paper.d.ts +0 -0
- /package/dist/types/{src/components → components}/Root.d.ts +0 -0
- /package/dist/types/{src/constants.d.ts → constants.d.ts} +0 -0
- /package/dist/types/{src/hooks.d.ts → hooks.d.ts} +0 -0
- /package/dist/types/{src/i18n.d.ts → i18n.d.ts} +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import Selecto, { OnDragStart as _OnDragStart, OnSelect as _OnSelect } from 'react-selecto';
|
3
|
-
import { SELECTABLE_CLASSNAME } from '../../../constants
|
3
|
+
import { SELECTABLE_CLASSNAME } from '../../../constants';
|
4
4
|
|
5
5
|
const _Selecto = ({
|
6
6
|
container,
|
@@ -7,26 +7,30 @@ import React, {
|
|
7
7
|
forwardRef,
|
8
8
|
useCallback,
|
9
9
|
} from 'react';
|
10
|
-
import { OnDrag, OnResize, OnClick } from 'react-moveable';
|
10
|
+
import { OnDrag, OnResize, OnRotate, OnClick } from 'react-moveable';
|
11
11
|
import { SchemaForUI, Size } from '@pdfme/common';
|
12
|
-
import {
|
13
|
-
import {
|
14
|
-
import {
|
15
|
-
import
|
16
|
-
import
|
17
|
-
import
|
18
|
-
import
|
19
|
-
import
|
20
|
-
import
|
12
|
+
import { XMarkIcon } from '@heroicons/react/24/outline';
|
13
|
+
import { ZOOM, RULER_HEIGHT } from '../../../constants';
|
14
|
+
import { usePrevious } from '../../../hooks';
|
15
|
+
import { uuid, round, flatten } from '../../../helper';
|
16
|
+
import Paper from '../../Paper';
|
17
|
+
import SchemaUI from '../../Schemas/SchemaUI';
|
18
|
+
import Selecto from './Selecto';
|
19
|
+
import Moveable from './Moveable';
|
20
|
+
import Guides from './Guides';
|
21
|
+
import Mask from './Mask';
|
21
22
|
|
22
23
|
const DELETE_BTN_ID = uuid();
|
23
|
-
const
|
24
|
-
const
|
24
|
+
const px2Num = (prop: string) => Number(prop.replace('px', ''));
|
25
|
+
const transformRotate2Num = (transform: string) =>
|
26
|
+
Number(transform.match(/rotate\(([^deg)]*)deg\)/)?.[1]) || 0;
|
27
|
+
const fmtPx = (prop: string) => round(px2Num(prop) / ZOOM, 2);
|
28
|
+
const fmtDeg = (prop: string) => round(transformRotate2Num(prop), 2);
|
25
29
|
const isTopLeftResize = (d: string) => d === '-1,-1' || d === '-1,0' || d === '0,-1';
|
26
30
|
|
27
31
|
const DeleteButton = ({ activeElements: aes }: { activeElements: HTMLElement[] }) => {
|
28
|
-
const top = Math.min(...aes.map(({ style }) =>
|
29
|
-
const left = Math.max(...aes.map(({ style }) =>
|
32
|
+
const top = Math.min(...aes.map(({ style }) => px2Num(style.top)));
|
33
|
+
const left = Math.max(...aes.map(({ style }) => px2Num(style.left) + px2Num(style.width))) + 10;
|
30
34
|
|
31
35
|
return (
|
32
36
|
<button
|
@@ -49,16 +53,7 @@ const DeleteButton = ({ activeElements: aes }: { activeElements: HTMLElement[] }
|
|
49
53
|
justifyContent: 'center',
|
50
54
|
}}
|
51
55
|
>
|
52
|
-
<
|
53
|
-
style={{ pointerEvents: 'none' }}
|
54
|
-
xmlns="http://www.w3.org/2000/svg"
|
55
|
-
fill="none"
|
56
|
-
viewBox="0 0 24 24"
|
57
|
-
strokeWidth="1.5"
|
58
|
-
stroke="currentColor"
|
59
|
-
>
|
60
|
-
<path strokeLinecap="round" strokeLinejoin="round" d="M6 18L18 6M6 6l12 12" />
|
61
|
-
</svg>
|
56
|
+
<XMarkIcon width={10} height={10} />
|
62
57
|
</button>
|
63
58
|
);
|
64
59
|
};
|
@@ -157,15 +152,15 @@ const Main = (props: Props, ref: Ref<HTMLDivElement>) => {
|
|
157
152
|
const onDragEnd = ({ target }: { target: HTMLElement | SVGElement }) => {
|
158
153
|
const { top, left } = target.style;
|
159
154
|
changeSchemas([
|
160
|
-
{ key: 'position.y', value:
|
161
|
-
{ key: 'position.x', value:
|
155
|
+
{ key: 'position.y', value: fmtPx(top), schemaId: target.id },
|
156
|
+
{ key: 'position.x', value: fmtPx(left), schemaId: target.id },
|
162
157
|
]);
|
163
158
|
};
|
164
159
|
|
165
160
|
const onDragEnds = ({ targets }: { targets: (HTMLElement | SVGElement)[] }) => {
|
166
161
|
const arg = targets.map(({ style: { top, left }, id }) => [
|
167
|
-
{ key: 'position.y', value:
|
168
|
-
{ key: 'position.x', value:
|
162
|
+
{ key: 'position.y', value: fmtPx(top), schemaId: id },
|
163
|
+
{ key: 'position.x', value: fmtPx(left), schemaId: id },
|
169
164
|
]);
|
170
165
|
changeSchemas(flatten(arg));
|
171
166
|
};
|
@@ -174,19 +169,19 @@ const Main = (props: Props, ref: Ref<HTMLDivElement>) => {
|
|
174
169
|
const { id, style } = target;
|
175
170
|
const { width, height, top, left } = style;
|
176
171
|
changeSchemas([
|
177
|
-
{ key: 'width', value:
|
178
|
-
{ key: 'height', value:
|
179
|
-
{ key: 'position.y', value:
|
180
|
-
{ key: 'position.x', value:
|
172
|
+
{ key: 'width', value: fmtPx(width), schemaId: id },
|
173
|
+
{ key: 'height', value: fmtPx(height), schemaId: id },
|
174
|
+
{ key: 'position.y', value: fmtPx(top), schemaId: id },
|
175
|
+
{ key: 'position.x', value: fmtPx(left), schemaId: id },
|
181
176
|
]);
|
182
177
|
};
|
183
178
|
|
184
179
|
const onResizeEnds = ({ targets }: { targets: (HTMLElement | SVGElement)[] }) => {
|
185
180
|
const arg = targets.map(({ style: { width, height, top, left }, id }) => [
|
186
|
-
{ key: 'width', value:
|
187
|
-
{ key: 'height', value:
|
188
|
-
{ key: 'position.y', value:
|
189
|
-
{ key: 'position.x', value:
|
181
|
+
{ key: 'width', value: fmtPx(width), schemaId: id },
|
182
|
+
{ key: 'height', value: fmtPx(height), schemaId: id },
|
183
|
+
{ key: 'position.y', value: fmtPx(top), schemaId: id },
|
184
|
+
{ key: 'position.x', value: fmtPx(left), schemaId: id },
|
190
185
|
]);
|
191
186
|
changeSchemas(flatten(arg));
|
192
187
|
};
|
@@ -194,8 +189,8 @@ const Main = (props: Props, ref: Ref<HTMLDivElement>) => {
|
|
194
189
|
const onResize = ({ target, width, height, direction }: OnResize) => {
|
195
190
|
if (!target) return;
|
196
191
|
const s = target.style;
|
197
|
-
const newLeft =
|
198
|
-
const newTop =
|
192
|
+
const newLeft = px2Num(s.left) + (px2Num(s.width) - width);
|
193
|
+
const newTop = px2Num(s.top) + (px2Num(s.height) - height);
|
199
194
|
const obj: { top?: string; left?: string; width: string; height: string } = {
|
200
195
|
width: `${width}px`,
|
201
196
|
height: `${height}px`,
|
@@ -212,6 +207,25 @@ const Main = (props: Props, ref: Ref<HTMLDivElement>) => {
|
|
212
207
|
Object.assign(s, obj);
|
213
208
|
};
|
214
209
|
|
210
|
+
const onRotate = ({ target, rotate }: OnRotate) => {
|
211
|
+
if (!target) return;
|
212
|
+
target.style.transform = `rotate(${rotate}deg)`;
|
213
|
+
};
|
214
|
+
|
215
|
+
const onRotateEnd = ({ target }: { target: HTMLElement | SVGElement }) => {
|
216
|
+
const { id, style } = target;
|
217
|
+
const { transform } = style;
|
218
|
+
changeSchemas([{ key: 'rotate', value: fmtDeg(transform), schemaId: id }]);
|
219
|
+
};
|
220
|
+
|
221
|
+
const onRotateEnds = ({ targets }: { targets: (HTMLElement | SVGElement)[] }) => {
|
222
|
+
const arg = targets.map(({ style: { transform }, id }) => [
|
223
|
+
{ key: 'rotate', value: fmtDeg(transform), schemaId: id },
|
224
|
+
{ key: 'rotate', value: fmtDeg(transform), schemaId: id },
|
225
|
+
]);
|
226
|
+
changeSchemas(flatten(arg));
|
227
|
+
};
|
228
|
+
|
215
229
|
const getGuideLines = (guides: GuidesInterface[], index: number) =>
|
216
230
|
guides[index] && guides[index].getGuides().map((g) => g * ZOOM);
|
217
231
|
|
@@ -308,6 +322,9 @@ const Main = (props: Props, ref: Ref<HTMLDivElement>) => {
|
|
308
322
|
onResize={onResize}
|
309
323
|
onResizeEnd={onResizeEnd}
|
310
324
|
onResizeGroupEnd={onResizeEnds}
|
325
|
+
onRotate={onRotate}
|
326
|
+
onRotateEnd={onRotateEnd}
|
327
|
+
onRotateGroupEnd={onRotateEnds}
|
311
328
|
onClick={onClickMoveable}
|
312
329
|
/>
|
313
330
|
)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React, { useContext } from 'react';
|
2
2
|
import { SchemaForUI } from '@pdfme/common';
|
3
|
-
import { readFiles } from '../../../../helper
|
4
|
-
import { I18nContext } from '../../../../contexts
|
3
|
+
import { readFiles } from '../../../../helper';
|
4
|
+
import { I18nContext } from '../../../../contexts';
|
5
5
|
import { SidebarProps } from '..';
|
6
6
|
import { XMarkIcon } from '@heroicons/react/24/outline';
|
7
7
|
|
@@ -24,15 +24,15 @@ const ExampleInputEditor = (
|
|
24
24
|
top: 0,
|
25
25
|
left: 0,
|
26
26
|
display: 'flex',
|
27
|
-
justifyContent: 'center',
|
28
27
|
alignItems: 'center',
|
28
|
+
justifyContent: 'center',
|
29
29
|
color: '#333',
|
30
30
|
background: '#f2f2f2',
|
31
31
|
cursor: 'pointer',
|
32
32
|
borderRadius: 2,
|
33
33
|
border: '1px solid #767676',
|
34
|
-
height:
|
35
|
-
width:
|
34
|
+
height: 24,
|
35
|
+
width: 24,
|
36
36
|
}}
|
37
37
|
aria-label="close"
|
38
38
|
onClick={() =>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React, { CSSProperties } from 'react';
|
2
2
|
import { SchemaForUI } from '@pdfme/common';
|
3
|
-
import { round } from '../../../../helper
|
4
|
-
import { SidebarProps } from '../index
|
3
|
+
import { round } from '../../../../helper';
|
4
|
+
import { SidebarProps } from '../index';
|
5
5
|
|
6
6
|
const inputSetStyle: CSSProperties = { marginRight: '1rem', display: 'flex', alignItems: 'center' };
|
7
7
|
|
@@ -258,6 +258,19 @@ const PositionAndSizeEditor = (
|
|
258
258
|
<span style={{ fontSize: '0.6rem' }}>mm</span>
|
259
259
|
</div>
|
260
260
|
</div>
|
261
|
+
<div style={inputSetStyle}>
|
262
|
+
<label style={{ width: 44 }}>Rotate</label>
|
263
|
+
<input
|
264
|
+
style={inputStyle}
|
265
|
+
type="number"
|
266
|
+
onChange={(e) => {
|
267
|
+
const value = Number(e.target.value || 0);
|
268
|
+
changeSchemas([{ key: 'rotate', value, schemaId: activeSchema.id }]);
|
269
|
+
}}
|
270
|
+
value={activeSchema.rotate || 0}
|
271
|
+
/>
|
272
|
+
<span style={{ fontSize: '0.6rem' }}>deg</span>
|
273
|
+
</div>
|
261
274
|
</div>
|
262
275
|
);
|
263
276
|
};
|
@@ -7,7 +7,7 @@ import {
|
|
7
7
|
DEFAULT_CHARACTER_SPACING,
|
8
8
|
DEFAULT_FONT_COLOR,
|
9
9
|
} from '@pdfme/common';
|
10
|
-
import { FontContext } from '../../../../contexts
|
10
|
+
import { FontContext } from '../../../../contexts';
|
11
11
|
import { SidebarProps } from '..';
|
12
12
|
import { XMarkIcon } from '@heroicons/react/24/outline';
|
13
13
|
|
@@ -53,8 +53,9 @@ const ColorInputSet = (props: {
|
|
53
53
|
onClick={onClear}
|
54
54
|
style={{
|
55
55
|
display: 'flex',
|
56
|
-
background: 'none',
|
57
56
|
alignItems: 'center',
|
57
|
+
justifyContent: 'center',
|
58
|
+
background: 'none',
|
58
59
|
borderRadius: 2,
|
59
60
|
border: '1px solid #767676',
|
60
61
|
cursor: 'pointer',
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React, { useContext, useRef, useCallback } from 'react';
|
2
2
|
import { schemaTypes, SchemaForUI } from '@pdfme/common';
|
3
|
-
import { SidebarProps } from '../index
|
4
|
-
import { I18nContext } from '../../../../contexts
|
3
|
+
import { SidebarProps } from '../index';
|
4
|
+
import { I18nContext } from '../../../../contexts';
|
5
5
|
|
6
6
|
const ErrorLabel = ({ isError, msg }: { isError: boolean; msg: string }) => (
|
7
7
|
<span
|
@@ -1,12 +1,12 @@
|
|
1
1
|
import React, { useContext } from 'react';
|
2
2
|
import { SchemaForUI } from '@pdfme/common';
|
3
|
-
import { I18nContext } from '../../../../contexts
|
4
|
-
import Divider from '../../../Divider
|
5
|
-
import { SidebarProps } from '../index
|
6
|
-
import TextPropEditor from './TextPropEditor
|
7
|
-
import ExampleInputEditor from './ExampleInputEditor
|
8
|
-
import PositionAndSizeEditor from './PositionAndSizeEditor
|
9
|
-
import TypeAndKeyEditor from './TypeAndKeyEditor
|
3
|
+
import { I18nContext } from '../../../../contexts';
|
4
|
+
import Divider from '../../../Divider';
|
5
|
+
import { SidebarProps } from '../index';
|
6
|
+
import TextPropEditor from './TextPropEditor';
|
7
|
+
import ExampleInputEditor from './ExampleInputEditor';
|
8
|
+
import PositionAndSizeEditor from './PositionAndSizeEditor';
|
9
|
+
import TypeAndKeyEditor from './TypeAndKeyEditor';
|
10
10
|
|
11
11
|
const DetailView = (
|
12
12
|
props: Pick<SidebarProps, 'schemas' | 'pageSize' | 'changeSchemas' | 'activeElements'> & {
|
@@ -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';
|
4
4
|
import { ExclamationTriangleIcon } from '@heroicons/react/24/outline';
|
5
5
|
|
6
6
|
interface Props {
|
@@ -16,9 +16,9 @@ import {
|
|
16
16
|
verticalListSortingStrategy,
|
17
17
|
} from '@dnd-kit/sortable';
|
18
18
|
import { SchemaForUI } from '@pdfme/common';
|
19
|
-
import Item from './Item
|
20
|
-
import SelectableSortableItem from './SelectableSortableItem
|
21
|
-
import { SidebarProps } from '../index
|
19
|
+
import Item from './Item';
|
20
|
+
import SelectableSortableItem from './SelectableSortableItem';
|
21
|
+
import { SidebarProps } from '../index';
|
22
22
|
|
23
23
|
const SelectableSortableContainer = (
|
24
24
|
props: Pick<
|
@@ -106,55 +106,59 @@ const SelectableSortableContainer = (
|
|
106
106
|
setClonedItems(null);
|
107
107
|
}}
|
108
108
|
>
|
109
|
-
|
110
|
-
<
|
111
|
-
<
|
112
|
-
{
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
</SortableContext>
|
129
|
-
</div>
|
130
|
-
{createPortal(
|
131
|
-
<DragOverlay adjustScale>
|
132
|
-
{activeId ? (
|
133
|
-
<>
|
134
|
-
<ul style={{ margin: 0, padding: 0, listStyle: 'none' }}>
|
135
|
-
<Item
|
136
|
-
value={schemas.find((schema) => schema.id === activeId)!.key}
|
137
|
-
style={{ color: '#fff', background: '#18a0fb' }}
|
138
|
-
dragOverlay
|
109
|
+
<>
|
110
|
+
<div style={{ height, overflowY: 'auto' }}>
|
111
|
+
<SortableContext items={schemas} strategy={verticalListSortingStrategy}>
|
112
|
+
<ul style={{ margin: 0, padding: 0, listStyle: 'none', borderRadius: 5 }}>
|
113
|
+
{schemas.map((schema) => (
|
114
|
+
<SelectableSortableItem
|
115
|
+
key={schema.id}
|
116
|
+
style={{
|
117
|
+
border: `1px solid ${
|
118
|
+
schema.id === hoveringSchemaId ? '#18a0fb' : 'transparent'
|
119
|
+
}`,
|
120
|
+
}}
|
121
|
+
schema={schema}
|
122
|
+
schemas={schemas}
|
123
|
+
isSelected={isItemSelected(schema.id) || activeId === schema.id}
|
124
|
+
onEdit={onEdit}
|
125
|
+
onSelect={onSelectionChanged}
|
126
|
+
onMouseEnter={() => onChangeHoveringSchemaId(schema.id)}
|
127
|
+
onMouseLeave={() => onChangeHoveringSchemaId(null)}
|
139
128
|
/>
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
129
|
+
))}
|
130
|
+
</ul>
|
131
|
+
</SortableContext>
|
132
|
+
</div>
|
133
|
+
{createPortal(
|
134
|
+
<DragOverlay adjustScale>
|
135
|
+
{activeId ? (
|
136
|
+
<>
|
137
|
+
<ul style={{ margin: 0, padding: 0, listStyle: 'none' }}>
|
138
|
+
<Item
|
139
|
+
value={schemas.find((schema) => schema.id === activeId)!.key}
|
140
|
+
style={{ color: '#fff', background: '#18a0fb' }}
|
141
|
+
dragOverlay
|
142
|
+
/>
|
143
|
+
</ul>
|
144
|
+
<ul style={{ margin: 0, padding: 0, listStyle: 'none' }}>
|
145
|
+
{selectedSchemas
|
146
|
+
.filter((item) => item.id !== activeId)
|
147
|
+
.map((item) => (
|
148
|
+
<Item
|
149
|
+
key={item.id}
|
150
|
+
value={item.key}
|
151
|
+
style={{ color: '#fff', background: '#18a0fb' }}
|
152
|
+
dragOverlay
|
153
|
+
/>
|
154
|
+
))}
|
155
|
+
</ul>
|
156
|
+
</>
|
157
|
+
) : null}
|
158
|
+
</DragOverlay>,
|
159
|
+
document.body
|
160
|
+
)}
|
161
|
+
</>
|
158
162
|
</DndContext>
|
159
163
|
);
|
160
164
|
};
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import React, { useContext } from 'react';
|
2
2
|
import { useSortable } from '@dnd-kit/sortable';
|
3
3
|
import { SchemaForUI } from '@pdfme/common';
|
4
|
-
import { I18nContext } from '../../../../contexts
|
5
|
-
import Item from './Item
|
6
|
-
import { useMountStatus } from '../../../../hooks
|
4
|
+
import { I18nContext } from '../../../../contexts';
|
5
|
+
import Item from './Item';
|
6
|
+
import { useMountStatus } from '../../../../hooks';
|
7
7
|
|
8
8
|
interface Props {
|
9
9
|
isSelected: boolean;
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import React, { useContext, useState } from 'react';
|
2
|
-
import { RULER_HEIGHT, SIDEBAR_WIDTH } from '../../../../constants
|
3
|
-
import { I18nContext } from '../../../../contexts
|
4
|
-
import Divider from '../../../Divider
|
5
|
-
import SelectableSortableContainer from './SelectableSortableContainer
|
6
|
-
import { SidebarProps } from '../index
|
2
|
+
import { RULER_HEIGHT, SIDEBAR_WIDTH } from '../../../../constants';
|
3
|
+
import { I18nContext } from '../../../../contexts';
|
4
|
+
import Divider from '../../../Divider';
|
5
|
+
import SelectableSortableContainer from './SelectableSortableContainer';
|
6
|
+
import { SidebarProps } from '../index';
|
7
7
|
|
8
8
|
const ListView = (
|
9
9
|
props: Pick<
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import React, { useState, useContext } from 'react';
|
2
2
|
import { SchemaForUI, Size } from '@pdfme/common';
|
3
|
-
import { RULER_HEIGHT, SIDEBAR_WIDTH } from '../../../constants
|
4
|
-
import { I18nContext } from '../../../contexts
|
3
|
+
import { RULER_HEIGHT, SIDEBAR_WIDTH } from '../../../constants';
|
4
|
+
import { I18nContext } from '../../../contexts';
|
5
5
|
import { ArrowLeftIcon, ArrowRightIcon } from '@heroicons/react/24/outline';
|
6
|
-
import ListView from './ListView/index
|
7
|
-
import DetailView from './DetailView/index
|
6
|
+
import ListView from './ListView/index';
|
7
|
+
import DetailView from './DetailView/index';
|
8
8
|
|
9
9
|
export type SidebarProps = {
|
10
10
|
height: number;
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import React, { useRef, useState, useEffect, useContext, useCallback } from 'react';
|
2
2
|
import { DesignerReactProps, Template, SchemaForUI } from '@pdfme/common';
|
3
|
-
import Sidebar from './Sidebar/index
|
4
|
-
import Main from './Main/index
|
5
|
-
import { ZOOM, RULER_HEIGHT } from '../../constants
|
6
|
-
import { I18nContext } from '../../contexts
|
3
|
+
import Sidebar from './Sidebar/index';
|
4
|
+
import Main from './Main/index';
|
5
|
+
import { ZOOM, RULER_HEIGHT } from '../../constants';
|
6
|
+
import { I18nContext } from '../../contexts';
|
7
7
|
import {
|
8
8
|
uuid,
|
9
9
|
set,
|
@@ -18,11 +18,11 @@ import {
|
|
18
18
|
getUniqSchemaKey,
|
19
19
|
moveCommandToChangeSchemasArg,
|
20
20
|
getPagesScrollTopByIndex,
|
21
|
-
} from '../../helper
|
22
|
-
import { useUIPreProcessor, useScrollPageCursor } from '../../hooks
|
23
|
-
import Root from '../Root
|
24
|
-
import Error from '../Error
|
25
|
-
import CtlBar from '../CtlBar/index
|
21
|
+
} from '../../helper';
|
22
|
+
import { useUIPreProcessor, useScrollPageCursor } from '../../hooks';
|
23
|
+
import Root from '../Root';
|
24
|
+
import Error from '../Error';
|
25
|
+
import CtlBar from '../CtlBar/index';
|
26
26
|
|
27
27
|
const TemplateEditor = ({
|
28
28
|
template,
|
package/src/components/Error.tsx
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import React, { useContext } from 'react';
|
2
2
|
import { Size } from '@pdfme/common';
|
3
|
-
import { I18nContext } from '../contexts
|
3
|
+
import { I18nContext } from '../contexts';
|
4
4
|
|
5
5
|
const Error = ({ size, error }: { size: Size; error: Error }) => {
|
6
6
|
const i18n = useContext(I18nContext);
|
package/src/components/Paper.tsx
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import React, { MutableRefObject, ReactNode, useContext } from 'react';
|
2
2
|
import { SchemaForUI, Size, getFallbackFontName } from '@pdfme/common';
|
3
|
-
import { FontContext } from '../contexts
|
4
|
-
import { ZOOM, RULER_HEIGHT } from '../constants
|
3
|
+
import { FontContext } from '../contexts';
|
4
|
+
import { ZOOM, RULER_HEIGHT } from '../constants';
|
5
5
|
|
6
6
|
const Paper = (porps: {
|
7
7
|
paperRefs: MutableRefObject<HTMLDivElement[]>;
|
@@ -1,14 +1,14 @@
|
|
1
1
|
import React, { useCallback, useRef, useState, useEffect } from 'react';
|
2
2
|
import { PreviewReactProps, SchemaForUI } from '@pdfme/common';
|
3
|
-
import { ZOOM, RULER_HEIGHT } from '../constants
|
4
|
-
import UnitPager from './UnitPager
|
5
|
-
import Root from './Root
|
6
|
-
import Error from './Error
|
7
|
-
import CtlBar from './CtlBar/index
|
8
|
-
import Paper from './Paper
|
9
|
-
import SchemaUI from './Schemas/SchemaUI
|
10
|
-
import { useUIPreProcessor, useScrollPageCursor } from '../hooks
|
11
|
-
import { templateSchemas2SchemasList, getPagesScrollTopByIndex } from '../helper
|
3
|
+
import { ZOOM, RULER_HEIGHT } from '../constants';
|
4
|
+
import UnitPager from './UnitPager';
|
5
|
+
import Root from './Root';
|
6
|
+
import Error from './Error';
|
7
|
+
import CtlBar from './CtlBar/index';
|
8
|
+
import Paper from './Paper';
|
9
|
+
import SchemaUI from './Schemas/SchemaUI';
|
10
|
+
import { useUIPreProcessor, useScrollPageCursor } from '../hooks';
|
11
|
+
import { templateSchemas2SchemasList, getPagesScrollTopByIndex } from '../helper';
|
12
12
|
|
13
13
|
const Preview = ({ template, inputs, size, onChangeInput }: PreviewReactProps) => {
|
14
14
|
const rootRef = useRef<HTMLDivElement>(null);
|
package/src/components/Root.tsx
CHANGED
@@ -1,8 +1,7 @@
|
|
1
|
-
import type {} from 'css-font-loading-module';
|
2
1
|
import React, { useContext, forwardRef, ReactNode, Ref, useEffect } from 'react';
|
3
2
|
import { Size } from '@pdfme/common';
|
4
|
-
import { FontContext } from '../contexts
|
5
|
-
import Spinner from './Spinner
|
3
|
+
import { FontContext } from '../contexts';
|
4
|
+
import Spinner from './Spinner';
|
6
5
|
|
7
6
|
type Props = { size: Size; scale: number; children: ReactNode };
|
8
7
|
|
@@ -10,17 +9,20 @@ const Root = ({ size, scale, children }: Props, ref: Ref<HTMLDivElement>) => {
|
|
10
9
|
const font = useContext(FontContext);
|
11
10
|
|
12
11
|
useEffect(() => {
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
if (!document || !document.fonts) return;
|
13
|
+
const fontFaces = Object.entries(font).map(
|
14
|
+
([key, { data }]) =>
|
15
|
+
new FontFace(key, typeof data === 'string' ? `url(${data})` : data, {
|
16
|
+
display: 'swap',
|
17
|
+
})
|
18
|
+
);
|
19
|
+
// @ts-ignore
|
20
|
+
const newFontFaces = fontFaces.filter((fontFace) => !document.fonts.has(fontFace));
|
16
21
|
|
17
|
-
|
18
|
-
});
|
19
|
-
Promise.all(fontFaces).then((loadedFontFaces) => {
|
22
|
+
Promise.all(newFontFaces.map((f) => f.load())).then((loadedFontFaces) => {
|
20
23
|
loadedFontFaces.forEach((loadedFontFace) => {
|
21
|
-
|
22
|
-
|
23
|
-
}
|
24
|
+
// @ts-ignore
|
25
|
+
document.fonts.add(loadedFontFace);
|
24
26
|
});
|
25
27
|
});
|
26
28
|
}, [font]);
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React, { forwardRef, Ref } from 'react';
|
2
2
|
import { validateBarcodeInput, BarCodeType, BarcodeSchema } from '@pdfme/common';
|
3
|
-
import { ZOOM } from '../../constants
|
4
|
-
import { SchemaUIProps } from './SchemaUI
|
3
|
+
import { ZOOM } from '../../constants';
|
4
|
+
import { SchemaUIProps } from './SchemaUI';
|
5
5
|
|
6
6
|
const barcodeExampleImageObj: { [key: string]: string } = {
|
7
7
|
qrcode:
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import React, { useState, forwardRef, ChangeEvent, Ref } from 'react';
|
2
2
|
import { ImageSchema } from '@pdfme/common';
|
3
|
-
import { SchemaUIProps } from './SchemaUI
|
4
|
-
import { readFiles } from '../../helper
|
5
|
-
import { ZOOM } from '../../constants
|
3
|
+
import { SchemaUIProps } from './SchemaUI';
|
4
|
+
import { readFiles } from '../../helper';
|
5
|
+
import { ZOOM } from '../../constants';
|
6
6
|
import { XMarkIcon } from '@heroicons/react/24/outline';
|
7
7
|
|
8
8
|
type Props = SchemaUIProps & { schema: ImageSchema };
|
@@ -46,8 +46,8 @@ const ImageSchemaUI = (props: Props, ref: Ref<HTMLInputElement>) => {
|
|
46
46
|
borderRadius: 2,
|
47
47
|
border: '1px solid #767676',
|
48
48
|
cursor: 'pointer',
|
49
|
-
height:
|
50
|
-
width:
|
49
|
+
height: 24,
|
50
|
+
width: 24,
|
51
51
|
}}
|
52
52
|
aria-label="close"
|
53
53
|
onClick={() => {
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import React, { forwardRef, RefObject, Ref, ReactNode } from 'react';
|
2
2
|
import { SchemaForUI, isTextSchema, isImageSchema, isBarcodeSchema } from '@pdfme/common';
|
3
|
-
import { ZOOM, SELECTABLE_CLASSNAME } from '../../constants
|
4
|
-
import TextSchema from './TextSchema
|
5
|
-
import ImageSchema from './ImageSchema
|
6
|
-
import BarcodeSchema from './BarcodeSchema
|
3
|
+
import { ZOOM, SELECTABLE_CLASSNAME } from '../../constants';
|
4
|
+
import TextSchema from './TextSchema';
|
5
|
+
import ImageSchema from './ImageSchema';
|
6
|
+
import BarcodeSchema from './BarcodeSchema';
|
7
7
|
|
8
8
|
export interface SchemaUIProps {
|
9
9
|
schema: SchemaForUI;
|
@@ -37,6 +37,7 @@ const Wrapper = ({
|
|
37
37
|
width: schema.width * ZOOM,
|
38
38
|
top: schema.position.y * ZOOM,
|
39
39
|
left: schema.position.x * ZOOM,
|
40
|
+
transform: `rotate(${schema.rotate || 0}deg)`,
|
40
41
|
border,
|
41
42
|
}}
|
42
43
|
>
|
@@ -7,8 +7,8 @@ import {
|
|
7
7
|
DEFAULT_FONT_COLOR,
|
8
8
|
TextSchema,
|
9
9
|
} from '@pdfme/common';
|
10
|
-
import { SchemaUIProps } from './SchemaUI
|
11
|
-
import { ZOOM } from '../../constants
|
10
|
+
import { SchemaUIProps } from './SchemaUI';
|
11
|
+
import { ZOOM } from '../../constants';
|
12
12
|
|
13
13
|
type Props = SchemaUIProps & { schema: TextSchema };
|
14
14
|
|