@pdfme/ui 4.3.2-dev.2 → 4.3.2-dev.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.
@@ -3,7 +3,6 @@ export declare const uuid: () => string;
3
3
  export declare const set: <T extends object>(obj: T, path: string | string[], value: any) => void;
4
4
  export declare const debounce: <T extends Function>(cb: T, wait?: number) => T;
5
5
  export declare const round: (number: number, precision: number) => number;
6
- export declare const cloneDeep: <T>(value: T) => T;
7
6
  export declare const flatten: <T>(arr: T[][]) => T[];
8
7
  declare const esc = "esc";
9
8
  export declare const initShortCuts: (arg: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pdfme/ui",
3
- "version": "4.3.2-dev.2",
3
+ "version": "4.3.2-dev.3",
4
4
  "sideEffects": false,
5
5
  "author": "hand-dot",
6
6
  "license": "MIT",
package/src/Designer.tsx CHANGED
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import ReactDOM from 'react-dom';
3
3
  import {
4
+ cloneDeep,
4
5
  Template,
5
6
  DesignerProps,
6
7
  checkDesignerProps,
@@ -11,7 +12,6 @@ import { BaseUIClass } from './class';
11
12
  import { DESTROYED_ERR_MSG } from './constants.js';
12
13
  import DesignerComponent from './components/Designer/index';
13
14
  import AppContextProvider from './components/AppContextProvider';
14
- import { cloneDeep } from './helper.js';
15
15
 
16
16
  class Designer extends BaseUIClass {
17
17
  private onSaveTemplateCallback?: (template: Template) => void;
package/src/class.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import ReactDOM from 'react-dom';
2
2
  import { DESTROYED_ERR_MSG, DEFAULT_LANG } from './constants.js';
3
- import { debounce, cloneDeep } from './helper.js';
3
+ import { debounce } from './helper.js';
4
4
  import {
5
+ cloneDeep,
5
6
  Template,
6
7
  Size,
7
8
  Lang,
@@ -1,5 +1,6 @@
1
1
  import React, { useRef, useState, useContext, useCallback } from 'react';
2
2
  import {
3
+ cloneDeep,
3
4
  ZOOM,
4
5
  Template,
5
6
  Schema,
@@ -20,7 +21,6 @@ import {
20
21
  schemasList2template,
21
22
  uuid,
22
23
  round,
23
- cloneDeep,
24
24
  template2SchemasList,
25
25
  getPagesScrollTopByIndex,
26
26
  changeSchemas as _changeSchemas,
@@ -1,6 +1,6 @@
1
1
  import React, { useRef, useState, useEffect, useContext } from 'react';
2
2
  import { Template, SchemaForUI, PreviewProps, Size, getDynamicTemplate } from '@pdfme/common';
3
- import { modifyTemplateForTable, getDynamicHeightForTable } from '@pdfme/schemas';
3
+ import { getDynamicHeightsForTable } from '@pdfme/schemas';
4
4
  import UnitPager from './UnitPager';
5
5
  import Root from './Root';
6
6
  import ErrorScreen from './ErrorScreen';
@@ -49,13 +49,10 @@ const Preview = ({
49
49
  input,
50
50
  options,
51
51
  _cache,
52
- modifyTemplate: (arg) => {
53
- return modifyTemplateForTable(arg);
54
- },
55
- getDynamicHeight: (value, args) => {
56
- if (args.schema.type !== 'table') return Promise.resolve(args.schema.height);
57
- return getDynamicHeightForTable(value, args);
58
- },
52
+ getDynamicHeights: (value, args) => {
53
+ if (args.schema.type !== 'table') return Promise.resolve([args.schema.height]);
54
+ return getDynamicHeightsForTable(value, args);
55
+ }
59
56
  })
60
57
  .then(async (dynamicTemplate) => {
61
58
  const sl = await template2SchemasList(dynamicTemplate);
package/src/helper.ts CHANGED
@@ -6,6 +6,7 @@ GlobalWorkerOptions.workerSrc = PDFJSWorker;
6
6
 
7
7
  import hotkeys from 'hotkeys-js';
8
8
  import {
9
+ cloneDeep,
9
10
  ZOOM,
10
11
  getB64BasePdf,
11
12
  b64toUint8Array,
@@ -65,8 +66,6 @@ export const round = (number: number, precision: number) => {
65
66
  return shift(Math.round(shift(number, precision, false)), precision, true);
66
67
  };
67
68
 
68
- export const cloneDeep = <T>(value: T): T => JSON.parse(JSON.stringify(value));
69
-
70
69
  export const flatten = <T>(arr: T[][]): T[] => ([] as T[]).concat(...arr);
71
70
 
72
71
  const up = 'up';
package/src/hooks.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { RefObject, useRef, useState, useCallback, useEffect } from 'react';
2
2
  import {
3
+ cloneDeep,
3
4
  ZOOM,
4
5
  Template,
5
6
  Size,
@@ -12,7 +13,6 @@ import {
12
13
  import {
13
14
  schemasList2template,
14
15
  uuid,
15
- cloneDeep,
16
16
  getUniqSchemaKey,
17
17
  moveCommandToChangeSchemasArg,
18
18
  pdf2Pngs,