@pdfme/ui 5.5.2 → 5.5.3-dev.2
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 +15528 -15457
- package/dist/index.umd.js +107 -107
- package/dist/types/src/components/Designer/RightSidebar/ListView/index.d.ts +1 -1
- package/dist/types/src/components/Designer/RightSidebar/layout.d.ts +15 -0
- package/dist/types/src/constants.d.ts +2 -0
- package/dist/types/src/helper.d.ts +0 -1
- package/package.json +1 -1
- package/src/components/CtlBar.tsx +18 -9
- package/src/components/Designer/Canvas/index.tsx +4 -2
- package/src/components/Designer/LeftSidebar.tsx +5 -1
- package/src/components/Designer/RightSidebar/DetailView/AlignWidget.tsx +2 -0
- package/src/components/Designer/RightSidebar/DetailView/index.tsx +25 -23
- package/src/components/Designer/RightSidebar/ListView/SelectableSortableContainer.tsx +21 -23
- package/src/components/Designer/RightSidebar/ListView/index.tsx +45 -50
- package/src/components/Designer/RightSidebar/index.tsx +36 -38
- package/src/components/Designer/RightSidebar/layout.tsx +75 -0
- package/src/components/Root.tsx +3 -3
- package/src/constants.ts +4 -0
- package/src/helper.ts +0 -3
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Divider } from 'antd';
|
|
3
|
+
|
|
4
|
+
export const SIDEBAR_H_PADDING_PX = 16;
|
|
5
|
+
export const SIDEBAR_V_PADDING_PX = 8;
|
|
6
|
+
export const SIDEBAR_HEADER_HEIGHT = 60;
|
|
7
|
+
|
|
8
|
+
type SectionProps = {
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
};
|
|
11
|
+
type SidebarFrameProps = SectionProps & {
|
|
12
|
+
className?: string;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const SidebarFrame = ({ children, className }: SidebarFrameProps) => (
|
|
16
|
+
<div
|
|
17
|
+
className={className}
|
|
18
|
+
style={{
|
|
19
|
+
height: '100%',
|
|
20
|
+
display: 'flex',
|
|
21
|
+
flex: 1,
|
|
22
|
+
flexDirection: 'column',
|
|
23
|
+
}}
|
|
24
|
+
>
|
|
25
|
+
{children}
|
|
26
|
+
</div>
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
export const SidebarHeader = ({ children }: SectionProps) => (
|
|
30
|
+
<div
|
|
31
|
+
style={{
|
|
32
|
+
position: 'relative',
|
|
33
|
+
minHeight: SIDEBAR_HEADER_HEIGHT,
|
|
34
|
+
display: 'flex',
|
|
35
|
+
flexShrink: 0,
|
|
36
|
+
flexDirection: 'column',
|
|
37
|
+
justifyContent: 'center',
|
|
38
|
+
padding: `${SIDEBAR_V_PADDING_PX}px ${SIDEBAR_H_PADDING_PX}px 0`,
|
|
39
|
+
}}
|
|
40
|
+
>
|
|
41
|
+
<div style={{ minHeight: 40, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
|
|
42
|
+
{children}
|
|
43
|
+
</div>
|
|
44
|
+
<Divider style={{ marginTop: `${SIDEBAR_V_PADDING_PX}px`, marginBottom: 0 }} />
|
|
45
|
+
</div>
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
export const SidebarBody = ({ children }: SectionProps) => (
|
|
49
|
+
<div
|
|
50
|
+
style={{
|
|
51
|
+
flex: 1,
|
|
52
|
+
minHeight: 0,
|
|
53
|
+
overflowY: 'auto',
|
|
54
|
+
overflowX: 'hidden',
|
|
55
|
+
padding: `${SIDEBAR_V_PADDING_PX}px ${SIDEBAR_H_PADDING_PX}px`,
|
|
56
|
+
}}
|
|
57
|
+
>
|
|
58
|
+
{children}
|
|
59
|
+
</div>
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
export const SidebarFooter = ({ children }: SectionProps) => (
|
|
63
|
+
<div
|
|
64
|
+
style={{
|
|
65
|
+
display: 'flex',
|
|
66
|
+
flexShrink: 0,
|
|
67
|
+
alignItems: 'center',
|
|
68
|
+
justifyContent: 'flex-end',
|
|
69
|
+
gap: `${SIDEBAR_V_PADDING_PX}px`,
|
|
70
|
+
padding: `${SIDEBAR_H_PADDING_PX}px`,
|
|
71
|
+
}}
|
|
72
|
+
>
|
|
73
|
+
{children}
|
|
74
|
+
</div>
|
|
75
|
+
);
|
package/src/components/Root.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useContext, forwardRef, ReactNode, Ref, useEffect } from 'react';
|
|
2
2
|
import { Size } from '@pdfme/common';
|
|
3
3
|
import { FontContext } from '../contexts.js';
|
|
4
|
-
import { BACKGROUND_COLOR } from '../constants.js';
|
|
4
|
+
import { BACKGROUND_COLOR, DESIGNER_CLASSNAME } from '../constants.js';
|
|
5
5
|
import Spinner from './Spinner.js';
|
|
6
6
|
|
|
7
7
|
type Props = { size: Size; scale: number; children: ReactNode };
|
|
@@ -29,8 +29,8 @@ const Root = ({ size, scale, children }: Props, ref: Ref<HTMLDivElement>) => {
|
|
|
29
29
|
}, [font]);
|
|
30
30
|
|
|
31
31
|
return (
|
|
32
|
-
<div ref={ref} style={{ position: 'relative', background: BACKGROUND_COLOR, ...size }}>
|
|
33
|
-
<div style={{ margin: '0 auto', ...size }}>{scale === 0 ? <Spinner /> : children}</div>
|
|
32
|
+
<div className={DESIGNER_CLASSNAME + 'root'} ref={ref} style={{ position: 'relative', background: BACKGROUND_COLOR, ...size }}>
|
|
33
|
+
<div className={DESIGNER_CLASSNAME + 'background'} style={{ margin: '0 auto', ...size }}>{scale === 0 ? <Spinner /> : children}</div>
|
|
34
34
|
</div>
|
|
35
35
|
);
|
|
36
36
|
};
|
package/src/constants.ts
CHANGED
package/src/helper.ts
CHANGED
|
@@ -420,9 +420,6 @@ export const getPagesScrollTopByIndex = (pageSizes: Size[], index: number, scale
|
|
|
420
420
|
.reduce((acc, cur) => acc + (cur.height * ZOOM + RULER_HEIGHT * scale) * scale, 0);
|
|
421
421
|
};
|
|
422
422
|
|
|
423
|
-
export const getSidebarContentHeight = (sidebarHeight: number) =>
|
|
424
|
-
sidebarHeight - RULER_HEIGHT - RULER_HEIGHT / 2 - 30;
|
|
425
|
-
|
|
426
423
|
const handlePositionSizeChange = (
|
|
427
424
|
schema: SchemaForUI,
|
|
428
425
|
key: string,
|