@pdfme/ui 5.2.0 → 5.2.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/index.es.js +13266 -13264
- package/dist/index.umd.js +171 -171
- package/dist/types/constants.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/Designer/LeftSidebar.tsx +3 -1
- package/src/components/Designer/index.tsx +61 -57
- package/src/constants.ts +2 -0
@@ -3,5 +3,6 @@ export declare const DESTROYED_ERR_MSG = "[@pdfme/ui] this instance is already d
|
|
3
3
|
export declare const SELECTABLE_CLASSNAME = "selectable";
|
4
4
|
export declare const RULER_HEIGHT = 30;
|
5
5
|
export declare const PAGE_GAP = 10;
|
6
|
+
export declare const LEFT_SIDEBAR_WIDTH = 45;
|
6
7
|
export declare const RIGHT_SIDEBAR_WIDTH = 400;
|
7
8
|
export declare const BACKGROUND_COLOR = "rgb(74, 74, 74)";
|
package/package.json
CHANGED
@@ -8,9 +8,11 @@ import { theme, Button } from 'antd';
|
|
8
8
|
import { useDraggable } from '@dnd-kit/core';
|
9
9
|
import { CSS } from "@dnd-kit/utilities";
|
10
10
|
import Renderer from '../Renderer';
|
11
|
+
import { LEFT_SIDEBAR_WIDTH } from '../../constants';
|
11
12
|
import { PluginsRegistry } from '../../contexts';
|
12
13
|
import PluginIcon from "./PluginIcon";
|
13
14
|
|
15
|
+
|
14
16
|
const Draggable = (props: { plugin: Plugin<any>, scale: number, basePdf: BasePdf, children: React.ReactNode }) => {
|
15
17
|
const { scale, basePdf, plugin } = props;
|
16
18
|
const { token } = theme.useToken();
|
@@ -67,7 +69,7 @@ const LeftSidebar = ({ height, scale, basePdf }: { height: number, scale: number
|
|
67
69
|
position: 'absolute',
|
68
70
|
zIndex: 1,
|
69
71
|
height,
|
70
|
-
width:
|
72
|
+
width: LEFT_SIDEBAR_WIDTH,
|
71
73
|
background: token.colorBgLayout,
|
72
74
|
textAlign: 'center',
|
73
75
|
overflow: isDragging ? 'visible' : 'auto',
|
@@ -15,7 +15,7 @@ import { DndContext } from '@dnd-kit/core';
|
|
15
15
|
import RightSidebar from './RightSidebar/index';
|
16
16
|
import LeftSidebar from './LeftSidebar';
|
17
17
|
import Canvas from './Canvas/index';
|
18
|
-
import { RULER_HEIGHT, RIGHT_SIDEBAR_WIDTH } from '../../constants';
|
18
|
+
import { RULER_HEIGHT, RIGHT_SIDEBAR_WIDTH, LEFT_SIDEBAR_WIDTH } from '../../constants';
|
19
19
|
import { I18nContext, OptionsContext, PluginsRegistry } from '../../contexts';
|
20
20
|
import {
|
21
21
|
schemasList2template,
|
@@ -235,8 +235,9 @@ const TemplateEditor = ({
|
|
235
235
|
void updateTemplate(template);
|
236
236
|
}
|
237
237
|
|
238
|
-
const
|
239
|
-
|
238
|
+
const canvasWidth = size.width - LEFT_SIDEBAR_WIDTH;
|
239
|
+
const sizeExcSidebars = {
|
240
|
+
width: sidebarOpen ? canvasWidth - RIGHT_SIDEBAR_WIDTH : canvasWidth,
|
240
241
|
height: size.height,
|
241
242
|
};
|
242
243
|
|
@@ -271,66 +272,69 @@ const TemplateEditor = ({
|
|
271
272
|
}}
|
272
273
|
onDragStart={onEditEnd}
|
273
274
|
>
|
274
|
-
<CtlBar
|
275
|
-
size={sizeExcSidebar}
|
276
|
-
pageCursor={pageCursor}
|
277
|
-
pageNum={schemasList.length}
|
278
|
-
setPageCursor={(p) => {
|
279
|
-
if (!canvasRef.current) return;
|
280
|
-
canvasRef.current.scrollTop = getPagesScrollTopByIndex(pageSizes, p, scale);
|
281
|
-
setPageCursor(p);
|
282
|
-
onEditEnd();
|
283
|
-
}}
|
284
|
-
zoomLevel={zoomLevel}
|
285
|
-
setZoomLevel={setZoomLevel}
|
286
|
-
{...pageManipulation}
|
287
|
-
/>
|
288
275
|
<LeftSidebar
|
289
276
|
height={canvasRef.current ? canvasRef.current.clientHeight : 0}
|
290
277
|
scale={scale}
|
291
278
|
basePdf={template.basePdf}
|
292
279
|
/>
|
293
280
|
|
294
|
-
<
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
281
|
+
<div style={{ position: 'absolute', width: canvasWidth, marginLeft: LEFT_SIDEBAR_WIDTH }}>
|
282
|
+
<CtlBar
|
283
|
+
size={sizeExcSidebars}
|
284
|
+
pageCursor={pageCursor}
|
285
|
+
pageNum={schemasList.length}
|
286
|
+
setPageCursor={(p) => {
|
287
|
+
if (!canvasRef.current) return;
|
288
|
+
canvasRef.current.scrollTop = getPagesScrollTopByIndex(pageSizes, p, scale);
|
289
|
+
setPageCursor(p);
|
290
|
+
onEditEnd();
|
291
|
+
}}
|
292
|
+
zoomLevel={zoomLevel}
|
293
|
+
setZoomLevel={setZoomLevel}
|
294
|
+
{...pageManipulation}
|
295
|
+
/>
|
296
|
+
|
297
|
+
<RightSidebar
|
298
|
+
hoveringSchemaId={hoveringSchemaId}
|
299
|
+
onChangeHoveringSchemaId={onChangeHoveringSchemaId}
|
300
|
+
height={canvasRef.current ? canvasRef.current.clientHeight : 0}
|
301
|
+
size={size}
|
302
|
+
pageSize={pageSizes[pageCursor] ?? []}
|
303
|
+
activeElements={activeElements}
|
304
|
+
schemasList={schemasList}
|
305
|
+
schemas={schemasList[pageCursor] ?? []}
|
306
|
+
changeSchemas={changeSchemas}
|
307
|
+
onSortEnd={onSortEnd}
|
308
|
+
onEdit={id => {
|
309
|
+
const editingElem = document.getElementById(id);
|
310
|
+
editingElem && onEdit([editingElem]);
|
311
|
+
}}
|
312
|
+
onEditEnd={onEditEnd}
|
313
|
+
deselectSchema={onEditEnd}
|
314
|
+
sidebarOpen={sidebarOpen}
|
315
|
+
setSidebarOpen={setSidebarOpen}
|
316
|
+
/>
|
317
|
+
|
318
|
+
<Canvas
|
319
|
+
ref={canvasRef}
|
320
|
+
paperRefs={paperRefs}
|
321
|
+
basePdf={template.basePdf}
|
322
|
+
hoveringSchemaId={hoveringSchemaId}
|
323
|
+
onChangeHoveringSchemaId={onChangeHoveringSchemaId}
|
324
|
+
height={size.height - RULER_HEIGHT * ZOOM}
|
325
|
+
pageCursor={pageCursor}
|
326
|
+
scale={scale}
|
327
|
+
size={sizeExcSidebars}
|
328
|
+
pageSizes={pageSizes}
|
329
|
+
backgrounds={backgrounds}
|
330
|
+
activeElements={activeElements}
|
331
|
+
schemasList={schemasList}
|
332
|
+
changeSchemas={changeSchemas}
|
333
|
+
removeSchemas={removeSchemas}
|
334
|
+
sidebarOpen={sidebarOpen}
|
335
|
+
onEdit={onEdit}
|
336
|
+
/>
|
337
|
+
</div>
|
334
338
|
</DndContext>
|
335
339
|
</Root>
|
336
340
|
);
|