@pdfme/ui 5.3.3-dev.4 → 5.3.3

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.
@@ -10,7 +10,7 @@ export declare abstract class BaseUIClass {
10
10
  private readonly setSize;
11
11
  resizeObserver: ResizeObserver;
12
12
  constructor(props: UIProps);
13
- protected getLang(): "en" | "zh" | "ja" | "ko" | "ar" | "th" | "pl" | "it" | "de" | "es" | "fr";
13
+ protected getLang(): "en" | "pl" | "zh" | "ja" | "ko" | "ar" | "th" | "it" | "de" | "es" | "fr";
14
14
  protected getFont(): Record<string, {
15
15
  data: string | ArrayBuffer | Uint8Array;
16
16
  fallback?: boolean | undefined;
@@ -6,4 +6,4 @@ export declare const PAGE_GAP = 10;
6
6
  export declare const LEFT_SIDEBAR_WIDTH = 45;
7
7
  export declare const RIGHT_SIDEBAR_WIDTH = 400;
8
8
  export declare const BACKGROUND_COLOR = "rgb(74, 74, 74)";
9
- export declare const DEFAULT_MAX_ZOOM = 2;
9
+ export declare const MAX_ZOOM = 2;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { Plugins, UIOptions } from '@pdfme/common';
3
- export declare const I18nContext: import("react").Context<(key: "cancel" | "close" | "set" | "clear" | "field" | "fieldName" | "align" | "width" | "opacity" | "height" | "rotate" | "edit" | "required" | "editable" | "plsInputName" | "fieldMustUniq" | "notUniq" | "noKeyName" | "fieldsList" | "editField" | "type" | "errorOccurred" | "errorBulkUpdateFieldName" | "commitBulkUpdateFieldName" | "bulkUpdateFieldName" | "addPageAfter" | "removePage" | "removePageConfirm" | "validation.uniqueName" | "validation.hexColor" | "validation.dateTimeFormat" | "schemas.color" | "schemas.borderWidth" | "schemas.borderColor" | "schemas.backgroundColor" | "schemas.textColor" | "schemas.bgColor" | "schemas.horizontal" | "schemas.vertical" | "schemas.left" | "schemas.center" | "schemas.right" | "schemas.top" | "schemas.middle" | "schemas.bottom" | "schemas.padding" | "schemas.text.fontName" | "schemas.text.size" | "schemas.text.spacing" | "schemas.text.textAlign" | "schemas.text.verticalAlign" | "schemas.text.lineHeight" | "schemas.text.min" | "schemas.text.max" | "schemas.text.fit" | "schemas.text.dynamicFontSize" | "schemas.text.format" | "schemas.mvt.typingInstructions" | "schemas.mvt.sampleField" | "schemas.mvt.variablesSampleData" | "schemas.barcodes.barColor" | "schemas.barcodes.includetext" | "schemas.table.alternateBackgroundColor" | "schemas.table.tableStyle" | "schemas.table.showHead" | "schemas.table.headStyle" | "schemas.table.bodyStyle" | "schemas.table.columnStyle" | "schemas.date.format" | "schemas.date.locale" | "schemas.select.options" | "schemas.select.optionPlaceholder" | "schemas.radioGroup.groupName", dict?: {
3
+ export declare const I18nContext: import("react").Context<(key: "type" | "width" | "height" | "rotate" | "opacity" | "required" | "cancel" | "close" | "set" | "clear" | "field" | "fieldName" | "align" | "edit" | "editable" | "plsInputName" | "fieldMustUniq" | "notUniq" | "noKeyName" | "fieldsList" | "editField" | "errorOccurred" | "errorBulkUpdateFieldName" | "commitBulkUpdateFieldName" | "bulkUpdateFieldName" | "addPageAfter" | "removePage" | "removePageConfirm" | "validation.uniqueName" | "validation.hexColor" | "validation.dateTimeFormat" | "schemas.color" | "schemas.borderWidth" | "schemas.borderColor" | "schemas.backgroundColor" | "schemas.textColor" | "schemas.bgColor" | "schemas.horizontal" | "schemas.vertical" | "schemas.left" | "schemas.center" | "schemas.right" | "schemas.top" | "schemas.middle" | "schemas.bottom" | "schemas.padding" | "schemas.text.fontName" | "schemas.text.size" | "schemas.text.spacing" | "schemas.text.textAlign" | "schemas.text.verticalAlign" | "schemas.text.lineHeight" | "schemas.text.min" | "schemas.text.max" | "schemas.text.fit" | "schemas.text.dynamicFontSize" | "schemas.text.format" | "schemas.mvt.typingInstructions" | "schemas.mvt.sampleField" | "schemas.mvt.variablesSampleData" | "schemas.barcodes.barColor" | "schemas.barcodes.includetext" | "schemas.table.alternateBackgroundColor" | "schemas.table.tableStyle" | "schemas.table.showHead" | "schemas.table.headStyle" | "schemas.table.bodyStyle" | "schemas.table.columnStyle" | "schemas.date.format" | "schemas.date.locale" | "schemas.select.options" | "schemas.select.optionPlaceholder" | "schemas.radioGroup.groupName", dict?: {
4
4
  cancel: string;
5
5
  close: string;
6
6
  set: string;
@@ -72,5 +72,4 @@ export declare const changeSchemas: (args: {
72
72
  };
73
73
  commitSchemas: (newSchemas: SchemaForUI[]) => void;
74
74
  }) => void;
75
- export declare const getMaxZoom: () => number;
76
75
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pdfme/ui",
3
- "version": "5.3.3-dev.4",
3
+ "version": "5.3.3",
4
4
  "sideEffects": false,
5
5
  "author": "hand-dot",
6
6
  "license": "MIT",
@@ -5,7 +5,7 @@ import { Plus, Minus, ChevronLeft, ChevronRight, Ellipsis } from 'lucide-react';
5
5
  import type { MenuProps } from 'antd';
6
6
  import { theme, Typography, Button, Dropdown } from 'antd';
7
7
  import { I18nContext } from '../contexts';
8
- import { getMaxZoom } from "../helper";
8
+ import { MAX_ZOOM } from '../constants';
9
9
 
10
10
  const { Text } = Typography;
11
11
 
@@ -18,7 +18,7 @@ type ZoomProps = {
18
18
 
19
19
  const Zoom = ({ zoomLevel, setZoomLevel, style }: ZoomProps) => {
20
20
  const zoomStep = 0.25;
21
- const maxZoom = getMaxZoom();
21
+ const maxZoom = MAX_ZOOM;
22
22
  const minZoom = 0.25;
23
23
 
24
24
  const nextZoomOut = zoomLevel - zoomStep;
package/src/constants.ts CHANGED
@@ -14,4 +14,4 @@ export const RIGHT_SIDEBAR_WIDTH = 400;
14
14
 
15
15
  export const BACKGROUND_COLOR = 'rgb(74, 74, 74)';
16
16
 
17
- export const DEFAULT_MAX_ZOOM = 2;
17
+ export const MAX_ZOOM = 2;
package/src/helper.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import hotkeys from 'hotkeys-js';
2
- import { useContext } from 'react';
3
2
  import {
4
3
  cloneDeep,
5
4
  ZOOM,
@@ -13,8 +12,7 @@ import {
13
12
  Plugins,
14
13
  } from '@pdfme/common';
15
14
  import { pdf2size } from '@pdfme/converter';
16
- import { DEFAULT_MAX_ZOOM, RULER_HEIGHT } from './constants.js';
17
- import { OptionsContext } from './contexts';
15
+ import { RULER_HEIGHT } from './constants.js';
18
16
 
19
17
  export const uuid = () =>
20
18
  'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
@@ -471,9 +469,3 @@ export const changeSchemas = (args: {
471
469
  }, cloneDeep(schemas));
472
470
  commitSchemas(newSchemas);
473
471
  };
474
-
475
- export const getMaxZoom = () => {
476
- const options = useContext(OptionsContext);
477
-
478
- return options.maxZoom ? (options.maxZoom as number) / 100 : DEFAULT_MAX_ZOOM;
479
- }
package/src/hooks.ts CHANGED
@@ -20,9 +20,8 @@ import {
20
20
  arrayBufferToBase64,
21
21
  initShortCuts,
22
22
  destroyShortCuts,
23
- getMaxZoom,
24
23
  } from './helper.js';
25
- import { RULER_HEIGHT } from './constants.js';
24
+ import { RULER_HEIGHT, MAX_ZOOM } from './constants.js';
26
25
 
27
26
  export const usePrevious = <T>(value: T) => {
28
27
  const ref = useRef<T | null>(null);
@@ -69,7 +68,7 @@ export const useUIPreProcessor = ({ template, size, zoomLevel }: UIPreProcessorP
69
68
 
70
69
  const [_pages, imgBuffers] = await Promise.all([
71
70
  pdf2size(b64toUint8Array(_basePdf)),
72
- pdf2img(b64toUint8Array(_basePdf), { scale: getMaxZoom() }),
71
+ pdf2img(b64toUint8Array(_basePdf), { scale: MAX_ZOOM }),
73
72
  ]);
74
73
 
75
74
  _pageSizes = _pages;