@pdfme/ui
Version:
TypeScript base PDF generator and React base UI. Open source, developed by the community, and completely free to use under the MIT license!
115 lines (114 loc) • 3.83 kB
TypeScript
import { Template, BasePdf, SchemaForUI, Size, PluginRegistry } from '@pdfme/common';
export declare const uuid: () => string;
export declare const debounce: <T extends (...args: unknown[]) => unknown>(cb: T, wait?: number) => T;
export declare const round: (number: number, precision: number) => number;
export declare const flatten: <T>(arr: T[][]) => T[];
export declare const initShortCuts: (arg: {
move: (command: "up" | "down" | "left" | "right", isShift: boolean) => void;
remove: () => void;
esc: () => void;
copy: () => void;
paste: () => void;
redo: () => void;
undo: () => void;
save: () => void;
selectAll: () => void;
}) => void;
export declare const destroyShortCuts: () => void;
export declare const arrayBufferToBase64: (arrayBuffer: ArrayBuffer) => string;
export declare const template2SchemasList: (_template: Template) => Promise<{
name: string;
type: string;
position: {
x: number;
y: number;
};
width: number;
height: number;
id: string;
content?: string | undefined;
rotate?: number | undefined;
opacity?: number | undefined;
readOnly?: boolean | undefined;
required?: boolean | undefined;
__splitRange?: {
unit: string;
start: number;
end?: number | undefined;
} | undefined;
__isSplit?: boolean | undefined;
}[][]>;
export declare const schemasList2template: (schemasList: SchemaForUI[][], basePdf: BasePdf) => Template;
export declare const getUniqueSchemaName: (arg: {
copiedSchemaName: string;
schema: SchemaForUI[];
stackUniqueSchemaNames: string[];
}) => string;
export declare const moveCommandToChangeSchemasArg: (props: {
command: "up" | "down" | "left" | "right";
activeSchemas: SchemaForUI[];
isShift: boolean;
pageSize: Size;
}) => {
key: string;
value: number;
schemaId: string;
}[];
export declare const getPagesScrollTopByIndex: (pageSizes: Size[], index: number, scale: number) => number;
export type ZoomMode = 'manual' | 'fit-width' | 'fit-height';
export type ZoomAnchor = {
pageIndex: number;
localX: number;
localY: number;
clientX: number;
clientY: number;
};
export declare const MIN_ZOOM = 0.25;
export declare const clampZoomLevel: (zoomLevel: number, maxZoom: number, minZoom?: number) => number;
export declare const getFitZoomLevel: ({ mode, pageSize, container, baseScale, maxZoom, hasRulers, }: {
mode: Exclude<ZoomMode, "manual">;
pageSize: Size | undefined;
container: HTMLElement | null;
baseScale: number;
maxZoom: number;
hasRulers?: boolean;
}) => number;
export declare const getZoomAnchor: ({ pageIndex, paper, clientX, clientY, scale, }: {
pageIndex: number;
paper: HTMLElement | undefined;
clientX: number;
clientY: number;
scale: number;
}) => ZoomAnchor | null;
export declare const restoreZoomAnchor: ({ container, paper, anchor, scale, }: {
container: HTMLElement | null;
paper: HTMLElement | undefined;
anchor: ZoomAnchor | null;
scale: number;
}) => void;
export declare const changeSchemas: (args: {
objs: {
key: string;
value: unknown;
schemaId: string;
}[];
schemas: SchemaForUI[];
basePdf: BasePdf;
pluginsRegistry: PluginRegistry;
pageSize: {
width: number;
height: number;
};
commitSchemas: (newSchemas: SchemaForUI[]) => void;
}) => void;
export declare const getDynamicHeightReflowChanges: (args: {
schemas: SchemaForUI[];
schema: SchemaForUI;
height: unknown;
}) => {
key: string;
value: unknown;
schemaId: string;
}[];
export declare const useMaxZoom: () => number;
export declare const setFontNameRecursively: (obj: Record<string, unknown>, fontName: string, seen?: WeakSet<WeakKey>) => void;