@pdfme/ui 5.3.8-dev.56 → 5.3.8-dev.58
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 +127 -60
- package/dist/types/src/components/Designer/LeftSidebar.d.ts +1 -1
- package/dist/types/src/components/Designer/PluginIcon.d.ts +1 -1
- package/package.json +1 -1
- package/src/Designer.tsx +4 -4
- package/src/Form.tsx +1 -3
- package/src/Viewer.tsx +1 -1
- package/src/components/AppContextProvider.tsx +1 -1
- package/src/components/CtlBar.tsx +1 -1
- package/src/components/Designer/Canvas/Guides.tsx +1 -1
- package/src/components/Designer/Canvas/Moveable.tsx +2 -2
- package/src/components/Designer/Canvas/Padding.tsx +10 -8
- package/src/components/Designer/Canvas/index.tsx +27 -14
- package/src/components/Designer/LeftSidebar.tsx +57 -49
- package/src/components/Designer/PluginIcon.tsx +21 -8
- package/src/components/Designer/RightSidebar/DetailView/AlignWidget.tsx +44 -44
- package/src/components/Designer/RightSidebar/DetailView/ButtonGroupWidget.tsx +3 -3
- package/src/components/Designer/RightSidebar/DetailView/index.tsx +51 -23
- package/src/components/Designer/RightSidebar/ListView/Item.tsx +4 -4
- package/src/components/Designer/RightSidebar/ListView/SelectableSortableContainer.tsx +56 -47
- package/src/components/Designer/RightSidebar/ListView/SelectableSortableItem.tsx +2 -3
- package/src/components/Designer/RightSidebar/ListView/index.tsx +10 -3
- package/src/components/Designer/index.tsx +41 -19
- package/src/components/Preview.tsx +25 -14
- package/src/components/Renderer.tsx +35 -22
- package/src/components/Root.tsx +1 -1
- package/src/components/Spinner.tsx +1 -1
- package/src/components/StaticSchema.tsx +39 -21
- package/src/constants.ts +1 -1
- package/src/helper.ts +7 -7
- package/src/hooks.ts +3 -3
- package/src/types/react-guides.d.ts +1 -1
package/src/helper.ts
CHANGED
@@ -19,7 +19,7 @@ import { OptionsContext } from './contexts.js';
|
|
19
19
|
// Create a simple mock for hotkeys to avoid TypeScript errors
|
20
20
|
const hotkeys = function (
|
21
21
|
keys: string,
|
22
|
-
callback: (e: KeyboardEvent, handler: { shortcut: string }) => void
|
22
|
+
callback: (e: KeyboardEvent, handler: { shortcut: string }) => void,
|
23
23
|
) {
|
24
24
|
return (hotkeysJs as any)(keys, callback);
|
25
25
|
};
|
@@ -284,7 +284,7 @@ export const template2SchemasList = async (_template: Template) => {
|
|
284
284
|
const b64BasePdf = await getB64BasePdf(basePdf);
|
285
285
|
// @ts-expect-error
|
286
286
|
const pdfArrayBuffer = b64toUint8Array(b64BasePdf) as ArrayBuffer;
|
287
|
-
|
287
|
+
|
288
288
|
pageSizes = await pdf2size(pdfArrayBuffer);
|
289
289
|
}
|
290
290
|
|
@@ -320,7 +320,7 @@ export const schemasList2template = (schemasList: SchemaForUI[][], basePdf: Base
|
|
320
320
|
// @ts-ignore
|
321
321
|
delete schema.id;
|
322
322
|
return schema;
|
323
|
-
})
|
323
|
+
}),
|
324
324
|
),
|
325
325
|
basePdf,
|
326
326
|
});
|
@@ -334,7 +334,7 @@ export const getUniqueSchemaName = (arg: {
|
|
334
334
|
const schemaNames = schema.map((s) => s.name).concat(stackUniqueSchemaNames);
|
335
335
|
const tmp: { [originalName: string]: number } = schemaNames.reduce(
|
336
336
|
(acc, cur) => Object.assign(acc, { originalName: cur, copiedNum: 0 }),
|
337
|
-
{}
|
337
|
+
{},
|
338
338
|
);
|
339
339
|
const extractOriginalName = (name: string) => name.replace(/ copy$| copy [0-9]*$/, '');
|
340
340
|
schemaNames
|
@@ -422,7 +422,7 @@ const handlePositionSizeChange = (
|
|
422
422
|
key: string,
|
423
423
|
value: any,
|
424
424
|
basePdf: BasePdf,
|
425
|
-
pageSize: Size
|
425
|
+
pageSize: Size,
|
426
426
|
) => {
|
427
427
|
const padding = isBlankPdf(basePdf) ? basePdf.padding : [0, 0, 0, 0];
|
428
428
|
const [pt, pr, pb, pl] = padding;
|
@@ -443,7 +443,7 @@ const handleTypeChange = (
|
|
443
443
|
schema: SchemaForUI,
|
444
444
|
key: string,
|
445
445
|
value: any,
|
446
|
-
pluginsRegistry: Plugins
|
446
|
+
pluginsRegistry: Plugins,
|
447
447
|
) => {
|
448
448
|
if (key !== 'type') return;
|
449
449
|
const keysToKeep = ['id', 'name', 'type', 'position', 'required'];
|
@@ -454,7 +454,7 @@ const handleTypeChange = (
|
|
454
454
|
});
|
455
455
|
// Apply attributes from new defaultSchema
|
456
456
|
const propPanel = Object.values(pluginsRegistry).find(
|
457
|
-
(plugin) => plugin?.propPanel.defaultSchema.type === value
|
457
|
+
(plugin) => plugin?.propPanel.defaultSchema.type === value,
|
458
458
|
)?.propPanel;
|
459
459
|
Object.keys(propPanel?.defaultSchema || {}).forEach((key) => {
|
460
460
|
if (!schema.hasOwnProperty(key)) {
|
package/src/hooks.ts
CHANGED
@@ -19,7 +19,7 @@ import {
|
|
19
19
|
moveCommandToChangeSchemasArg,
|
20
20
|
arrayBufferToBase64,
|
21
21
|
initShortCuts,
|
22
|
-
destroyShortCuts
|
22
|
+
destroyShortCuts,
|
23
23
|
} from './helper.js';
|
24
24
|
import { RULER_HEIGHT } from './constants.js';
|
25
25
|
|
@@ -60,7 +60,7 @@ export const useUIPreProcessor = ({ template, size, zoomLevel, maxZoom }: UIPreP
|
|
60
60
|
paperHeight = height * ZOOM;
|
61
61
|
_backgrounds = schemas.map(
|
62
62
|
() =>
|
63
|
-
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAA1JREFUGFdj+P///38ACfsD/QVDRcoAAAAASUVORK5CYII='
|
63
|
+
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAA1JREFUGFdj+P///38ACfsD/QVDRcoAAAAASUVORK5CYII=',
|
64
64
|
);
|
65
65
|
_pageSizes = schemas.map(() => ({ width, height }));
|
66
66
|
} else {
|
@@ -83,7 +83,7 @@ export const useUIPreProcessor = ({ template, size, zoomLevel, maxZoom }: UIPreP
|
|
83
83
|
|
84
84
|
const _scale = Math.min(
|
85
85
|
getScale(size.width, paperWidth),
|
86
|
-
getScale(size.height - RULER_HEIGHT, paperHeight)
|
86
|
+
getScale(size.height - RULER_HEIGHT, paperHeight),
|
87
87
|
);
|
88
88
|
|
89
89
|
return {
|