@pdfme/ui 1.1.4 → 1.1.5
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/.eslintrc.js +2 -2
- package/dist/index.js +3 -0
- package/dist/index.js.LICENSE.txt +95 -0
- package/dist/index.js.map +1 -0
- package/dist/types/{src/Designer.d.ts → Designer.d.ts} +1 -1
- package/dist/types/{src/Form.d.ts → Form.d.ts} +1 -1
- package/dist/types/{src/Viewer.d.ts → Viewer.d.ts} +1 -1
- package/dist/types/{src/class.d.ts → class.d.ts} +1 -3
- package/dist/types/{src/components → components}/CtlBar/Pager.d.ts +0 -1
- package/dist/types/{src/components → components}/CtlBar/Zoom.d.ts +0 -1
- package/dist/types/{src/components → components}/CtlBar/index.d.ts +0 -1
- package/dist/types/{src/components → components}/Designer/Main/Guides.d.ts +0 -0
- package/dist/types/{src/components → components}/Designer/Main/Mask.d.ts +0 -1
- package/dist/types/{src/components → components}/Designer/Main/Moveable.d.ts +0 -0
- package/dist/types/{src/components → components}/Designer/Main/Selecto.d.ts +0 -1
- package/dist/types/{src/components → components}/Designer/Main/index.d.ts +0 -0
- package/dist/types/{src/components → components}/Designer/Sidebar/DetailView/ExampleInputEditor.d.ts +0 -1
- package/dist/types/{src/components → components}/Designer/Sidebar/DetailView/PositionAndSizeEditor.d.ts +1 -2
- package/dist/types/{src/components → components}/Designer/Sidebar/DetailView/TextPropEditor.d.ts +0 -1
- package/dist/types/{src/components → components}/Designer/Sidebar/DetailView/TypeAndKeyEditor.d.ts +1 -2
- package/dist/types/{src/components → components}/Designer/Sidebar/DetailView/index.d.ts +1 -2
- package/dist/types/{src/components → components}/Designer/Sidebar/ListView/Item.d.ts +0 -0
- package/dist/types/{src/components → components}/Designer/Sidebar/ListView/SelectableSortableContainer.d.ts +1 -2
- package/dist/types/{src/components → components}/Designer/Sidebar/ListView/SelectableSortableItem.d.ts +0 -0
- package/dist/types/{src/components → components}/Designer/Sidebar/ListView/index.d.ts +1 -2
- package/dist/types/{src/components → components}/Designer/Sidebar/index.d.ts +0 -1
- package/dist/types/{src/components → components}/Designer/index.d.ts +0 -1
- package/dist/types/{src/components → components}/Divider.d.ts +0 -1
- package/dist/types/{src/components → components}/Error.d.ts +0 -1
- package/dist/types/{src/components → components}/Paper.d.ts +0 -0
- package/dist/types/{src/components → components}/Preview.d.ts +0 -1
- package/dist/types/{src/components → components}/Root.d.ts +0 -0
- package/dist/types/{src/components → components}/Schemas/BarcodeSchema.d.ts +1 -1
- package/dist/types/{src/components → components}/Schemas/ImageSchema.d.ts +1 -1
- package/dist/types/{src/components → components}/Schemas/SchemaUI.d.ts +1 -1
- package/dist/types/{src/components → components}/Schemas/TextSchema.d.ts +1 -1
- package/dist/types/{src/components → components}/Spinner.d.ts +0 -1
- package/dist/types/{src/components → components}/UnitPager.d.ts +0 -1
- package/dist/types/{src/constants.d.ts → constants.d.ts} +0 -0
- package/dist/types/{src/contexts.d.ts → contexts.d.ts} +1 -1
- package/dist/types/{src/helper.d.ts → helper.d.ts} +0 -0
- package/dist/types/{src/hooks.d.ts → hooks.d.ts} +0 -0
- package/dist/types/{src/i18n.d.ts → i18n.d.ts} +0 -0
- package/dist/types/{src/index.d.ts → index.d.ts} +3 -3
- package/package.json +16 -23
- package/src/Designer.tsx +10 -8
- package/src/Form.tsx +9 -7
- package/src/Viewer.tsx +9 -7
- package/src/class.ts +6 -10
- package/src/components/CtlBar/Pager.tsx +1 -1
- package/src/components/CtlBar/index.tsx +2 -2
- package/src/components/Designer/Main/Guides.tsx +1 -1
- package/src/components/Designer/Main/Mask.tsx +1 -1
- package/src/components/Designer/Main/Selecto.tsx +1 -1
- package/src/components/Designer/Main/index.tsx +9 -9
- package/src/components/Designer/Sidebar/DetailView/ExampleInputEditor.tsx +2 -2
- package/src/components/Designer/Sidebar/DetailView/PositionAndSizeEditor.tsx +2 -2
- package/src/components/Designer/Sidebar/DetailView/TextPropEditor.tsx +1 -1
- package/src/components/Designer/Sidebar/DetailView/TypeAndKeyEditor.tsx +2 -2
- package/src/components/Designer/Sidebar/DetailView/index.tsx +7 -7
- package/src/components/Designer/Sidebar/ListView/Item.tsx +1 -1
- package/src/components/Designer/Sidebar/ListView/SelectableSortableContainer.tsx +55 -51
- package/src/components/Designer/Sidebar/ListView/SelectableSortableItem.tsx +3 -3
- package/src/components/Designer/Sidebar/ListView/index.tsx +5 -5
- package/src/components/Designer/Sidebar/index.tsx +4 -4
- package/src/components/Designer/index.tsx +9 -9
- package/src/components/Error.tsx +1 -1
- package/src/components/Paper.tsx +2 -2
- package/src/components/Preview.tsx +9 -9
- package/src/components/Root.tsx +4 -3
- package/src/components/Schemas/BarcodeSchema.tsx +2 -2
- package/src/components/Schemas/ImageSchema.tsx +3 -3
- package/src/components/Schemas/SchemaUI.tsx +4 -4
- package/src/components/Schemas/TextSchema.tsx +2 -2
- package/src/contexts.ts +2 -2
- package/src/helper.ts +4 -1
- package/src/hooks.ts +2 -2
- package/src/i18n.ts +1 -1
- package/src/index.ts +3 -3
- package/tsconfig.json +22 -0
- package/vite.config.ts +0 -0
- package/webpack.config.js +49 -0
- package/dist/cjs/__tests__/assets/helper.js +0 -79
- package/dist/cjs/__tests__/assets/helper.js.map +0 -1
- package/dist/cjs/__tests__/components/Designer.test.js +0 -39
- package/dist/cjs/__tests__/components/Designer.test.js.map +0 -1
- package/dist/cjs/__tests__/components/Preview.test.js +0 -51
- package/dist/cjs/__tests__/components/Preview.test.js.map +0 -1
- package/dist/cjs/__tests__/helper.test.js +0 -94
- package/dist/cjs/__tests__/helper.test.js.map +0 -1
- package/dist/cjs/src/Designer.js +0 -61
- package/dist/cjs/src/Designer.js.map +0 -1
- package/dist/cjs/src/Form.js +0 -35
- package/dist/cjs/src/Form.js.map +0 -1
- package/dist/cjs/src/Viewer.js +0 -25
- package/dist/cjs/src/Viewer.js.map +0 -1
- package/dist/cjs/src/class.js +0 -119
- package/dist/cjs/src/class.js.map +0 -1
- package/dist/cjs/src/components/CtlBar/Pager.js +0 -49
- package/dist/cjs/src/components/CtlBar/Pager.js.map +0 -1
- package/dist/cjs/src/components/CtlBar/Zoom.js +0 -31
- package/dist/cjs/src/components/CtlBar/Zoom.js.map +0 -1
- package/dist/cjs/src/components/CtlBar/index.js +0 -33
- package/dist/cjs/src/components/CtlBar/index.js.map +0 -1
- package/dist/cjs/src/components/Designer/Main/Guides.js +0 -33
- package/dist/cjs/src/components/Designer/Main/Guides.js.map +0 -1
- package/dist/cjs/src/components/Designer/Main/Mask.js +0 -18
- package/dist/cjs/src/components/Designer/Main/Mask.js.map +0 -1
- package/dist/cjs/src/components/Designer/Main/Moveable.js +0 -37
- package/dist/cjs/src/components/Designer/Main/Moveable.js.map +0 -1
- package/dist/cjs/src/components/Designer/Main/Selecto.js +0 -11
- package/dist/cjs/src/components/Designer/Main/Selecto.js.map +0 -1
- package/dist/cjs/src/components/Designer/Main/index.js +0 -224
- package/dist/cjs/src/components/Designer/Main/index.js.map +0 -1
- package/dist/cjs/src/components/Designer/Sidebar/DetailView/ExampleInputEditor.js +0 -69
- package/dist/cjs/src/components/Designer/Sidebar/DetailView/ExampleInputEditor.js.map +0 -1
- package/dist/cjs/src/components/Designer/Sidebar/DetailView/PositionAndSizeEditor.js +0 -184
- package/dist/cjs/src/components/Designer/Sidebar/DetailView/PositionAndSizeEditor.js.map +0 -1
- package/dist/cjs/src/components/Designer/Sidebar/DetailView/TextPropEditor.js +0 -116
- package/dist/cjs/src/components/Designer/Sidebar/DetailView/TextPropEditor.js.map +0 -1
- package/dist/cjs/src/components/Designer/Sidebar/DetailView/TypeAndKeyEditor.js +0 -72
- package/dist/cjs/src/components/Designer/Sidebar/DetailView/TypeAndKeyEditor.js.map +0 -1
- package/dist/cjs/src/components/Designer/Sidebar/DetailView/index.js +0 -54
- package/dist/cjs/src/components/Designer/Sidebar/DetailView/index.js.map +0 -1
- package/dist/cjs/src/components/Designer/Sidebar/ListView/Item.js +0 -76
- package/dist/cjs/src/components/Designer/Sidebar/ListView/Item.js.map +0 -1
- package/dist/cjs/src/components/Designer/Sidebar/ListView/SelectableSortableContainer.js +0 -108
- package/dist/cjs/src/components/Designer/Sidebar/ListView/SelectableSortableContainer.js.map +0 -1
- package/dist/cjs/src/components/Designer/Sidebar/ListView/SelectableSortableItem.js +0 -62
- package/dist/cjs/src/components/Designer/Sidebar/ListView/SelectableSortableItem.js.map +0 -1
- package/dist/cjs/src/components/Designer/Sidebar/ListView/index.js +0 -84
- package/dist/cjs/src/components/Designer/Sidebar/ListView/index.js.map +0 -1
- package/dist/cjs/src/components/Designer/Sidebar/index.js +0 -105
- package/dist/cjs/src/components/Designer/Sidebar/index.js.map +0 -1
- package/dist/cjs/src/components/Designer/index.js +0 -235
- package/dist/cjs/src/components/Designer/index.js.map +0 -1
- package/dist/cjs/src/components/Divider.js +0 -9
- package/dist/cjs/src/components/Divider.js.map +0 -1
- package/dist/cjs/src/components/Error.js +0 -41
- package/dist/cjs/src/components/Error.js.map +0 -1
- package/dist/cjs/src/components/Paper.js +0 -63
- package/dist/cjs/src/components/Paper.js.map +0 -1
- package/dist/cjs/src/components/Preview.js +0 -102
- package/dist/cjs/src/components/Preview.js.map +0 -1
- package/dist/cjs/src/components/Root.js +0 -52
- package/dist/cjs/src/components/Root.js.map +0 -1
- package/dist/cjs/src/components/Schemas/BarcodeSchema.js +0 -94
- package/dist/cjs/src/components/Schemas/BarcodeSchema.js.map +0 -1
- package/dist/cjs/src/components/Schemas/ImageSchema.js +0 -72
- package/dist/cjs/src/components/Schemas/ImageSchema.js.map +0 -1
- package/dist/cjs/src/components/Schemas/SchemaUI.js +0 -55
- package/dist/cjs/src/components/Schemas/SchemaUI.js.map +0 -1
- package/dist/cjs/src/components/Schemas/TextSchema.js +0 -54
- package/dist/cjs/src/components/Schemas/TextSchema.js.map +0 -1
- package/dist/cjs/src/components/Spinner.js +0 -31
- package/dist/cjs/src/components/Spinner.js.map +0 -1
- package/dist/cjs/src/components/UnitPager.js +0 -63
- package/dist/cjs/src/components/UnitPager.js.map +0 -1
- package/dist/cjs/src/constants.js +0 -10
- package/dist/cjs/src/constants.js.map +0 -1
- package/dist/cjs/src/contexts.js +0 -10
- package/dist/cjs/src/contexts.js.map +0 -1
- package/dist/cjs/src/helper.js +0 -466
- package/dist/cjs/src/helper.js.map +0 -1
- package/dist/cjs/src/hooks.js +0 -100
- package/dist/cjs/src/hooks.js.map +0 -1
- package/dist/cjs/src/i18n.js +0 -50
- package/dist/cjs/src/i18n.js.map +0 -1
- package/dist/cjs/src/index.js +0 -24
- package/dist/cjs/src/index.js.map +0 -1
- package/dist/esm/__tests__/assets/helper.js +0 -51
- package/dist/esm/__tests__/assets/helper.js.map +0 -1
- package/dist/esm/__tests__/components/Designer.test.js +0 -34
- package/dist/esm/__tests__/components/Designer.test.js.map +0 -1
- package/dist/esm/__tests__/components/Preview.test.js +0 -46
- package/dist/esm/__tests__/components/Preview.test.js.map +0 -1
- package/dist/esm/__tests__/helper.test.js +0 -92
- package/dist/esm/__tests__/helper.test.js.map +0 -1
- package/dist/esm/src/Designer.js +0 -56
- package/dist/esm/src/Designer.js.map +0 -1
- package/dist/esm/src/Form.js +0 -30
- package/dist/esm/src/Form.js.map +0 -1
- package/dist/esm/src/Viewer.js +0 -20
- package/dist/esm/src/Viewer.js.map +0 -1
- package/dist/esm/src/class.js +0 -114
- package/dist/esm/src/class.js.map +0 -1
- package/dist/esm/src/components/CtlBar/Pager.js +0 -24
- package/dist/esm/src/components/CtlBar/Pager.js.map +0 -1
- package/dist/esm/src/components/CtlBar/Zoom.js +0 -26
- package/dist/esm/src/components/CtlBar/Zoom.js.map +0 -1
- package/dist/esm/src/components/CtlBar/index.js +0 -28
- package/dist/esm/src/components/CtlBar/index.js.map +0 -1
- package/dist/esm/src/components/Designer/Main/Guides.js +0 -28
- package/dist/esm/src/components/Designer/Main/Guides.js.map +0 -1
- package/dist/esm/src/components/Designer/Main/Mask.js +0 -13
- package/dist/esm/src/components/Designer/Main/Mask.js.map +0 -1
- package/dist/esm/src/components/Designer/Main/Moveable.js +0 -9
- package/dist/esm/src/components/Designer/Main/Moveable.js.map +0 -1
- package/dist/esm/src/components/Designer/Main/Selecto.js +0 -6
- package/dist/esm/src/components/Designer/Main/Selecto.js.map +0 -1
- package/dist/esm/src/components/Designer/Main/index.js +0 -196
- package/dist/esm/src/components/Designer/Main/index.js.map +0 -1
- package/dist/esm/src/components/Designer/Sidebar/DetailView/ExampleInputEditor.js +0 -44
- package/dist/esm/src/components/Designer/Sidebar/DetailView/ExampleInputEditor.js.map +0 -1
- package/dist/esm/src/components/Designer/Sidebar/DetailView/PositionAndSizeEditor.js +0 -179
- package/dist/esm/src/components/Designer/Sidebar/DetailView/PositionAndSizeEditor.js.map +0 -1
- package/dist/esm/src/components/Designer/Sidebar/DetailView/TextPropEditor.js +0 -91
- package/dist/esm/src/components/Designer/Sidebar/DetailView/TextPropEditor.js.map +0 -1
- package/dist/esm/src/components/Designer/Sidebar/DetailView/TypeAndKeyEditor.js +0 -47
- package/dist/esm/src/components/Designer/Sidebar/DetailView/TypeAndKeyEditor.js.map +0 -1
- package/dist/esm/src/components/Designer/Sidebar/DetailView/index.js +0 -26
- package/dist/esm/src/components/Designer/Sidebar/DetailView/index.js.map +0 -1
- package/dist/esm/src/components/Designer/Sidebar/ListView/Item.js +0 -51
- package/dist/esm/src/components/Designer/Sidebar/ListView/Item.js.map +0 -1
- package/dist/esm/src/components/Designer/Sidebar/ListView/SelectableSortableContainer.js +0 -80
- package/dist/esm/src/components/Designer/Sidebar/ListView/SelectableSortableContainer.js.map +0 -1
- package/dist/esm/src/components/Designer/Sidebar/ListView/SelectableSortableItem.js +0 -34
- package/dist/esm/src/components/Designer/Sidebar/ListView/SelectableSortableItem.js.map +0 -1
- package/dist/esm/src/components/Designer/Sidebar/ListView/index.js +0 -56
- package/dist/esm/src/components/Designer/Sidebar/ListView/index.js.map +0 -1
- package/dist/esm/src/components/Designer/Sidebar/index.js +0 -77
- package/dist/esm/src/components/Designer/Sidebar/index.js.map +0 -1
- package/dist/esm/src/components/Designer/index.js +0 -207
- package/dist/esm/src/components/Designer/index.js.map +0 -1
- package/dist/esm/src/components/Divider.js +0 -4
- package/dist/esm/src/components/Divider.js.map +0 -1
- package/dist/esm/src/components/Error.js +0 -16
- package/dist/esm/src/components/Error.js.map +0 -1
- package/dist/esm/src/components/Paper.js +0 -38
- package/dist/esm/src/components/Paper.js.map +0 -1
- package/dist/esm/src/components/Preview.js +0 -74
- package/dist/esm/src/components/Preview.js.map +0 -1
- package/dist/esm/src/components/Root.js +0 -24
- package/dist/esm/src/components/Root.js.map +0 -1
- package/dist/esm/src/components/Schemas/BarcodeSchema.js +0 -69
- package/dist/esm/src/components/Schemas/BarcodeSchema.js.map +0 -1
- package/dist/esm/src/components/Schemas/ImageSchema.js +0 -47
- package/dist/esm/src/components/Schemas/ImageSchema.js.map +0 -1
- package/dist/esm/src/components/Schemas/SchemaUI.js +0 -27
- package/dist/esm/src/components/Schemas/SchemaUI.js.map +0 -1
- package/dist/esm/src/components/Schemas/TextSchema.js +0 -29
- package/dist/esm/src/components/Schemas/TextSchema.js.map +0 -1
- package/dist/esm/src/components/Spinner.js +0 -26
- package/dist/esm/src/components/Spinner.js.map +0 -1
- package/dist/esm/src/components/UnitPager.js +0 -58
- package/dist/esm/src/components/UnitPager.js.map +0 -1
- package/dist/esm/src/constants.js +0 -7
- package/dist/esm/src/constants.js.map +0 -1
- package/dist/esm/src/contexts.js +0 -7
- package/dist/esm/src/contexts.js.map +0 -1
- package/dist/esm/src/helper.js +0 -439
- package/dist/esm/src/helper.js.map +0 -1
- package/dist/esm/src/hooks.js +0 -93
- package/dist/esm/src/hooks.js.map +0 -1
- package/dist/esm/src/i18n.js +0 -46
- package/dist/esm/src/i18n.js.map +0 -1
- package/dist/esm/src/index.js +0 -6
- package/dist/esm/src/index.js.map +0 -1
- package/dist/types/__tests__/assets/helper.d.ts +0 -3
- package/dist/types/__tests__/components/Designer.test.d.ts +0 -1
- package/dist/types/__tests__/components/Preview.test.d.ts +0 -1
- package/dist/types/__tests__/helper.test.d.ts +0 -1
- package/tsconfig.cjs.json +0 -10
- package/tsconfig.esm.json +0 -10
@@ -1,16 +1,14 @@
|
|
1
|
-
import { Root } from 'react-dom/client';
|
2
1
|
import { Template, Size, UIProps, UIOptions, PreviewProps } from '@pdfme/common';
|
3
2
|
export declare abstract class BaseUIClass {
|
4
3
|
protected domContainer: HTMLElement | null;
|
5
4
|
protected template: Template;
|
6
5
|
protected size: Size;
|
7
|
-
protected root: Root | null;
|
8
6
|
private lang;
|
9
7
|
private font;
|
10
8
|
private readonly setSize;
|
11
9
|
resizeObserver: ResizeObserver;
|
12
10
|
constructor(props: UIProps);
|
13
|
-
protected getI18n(): (key: "type" | "
|
11
|
+
protected getI18n(): (key: "type" | "field" | "cancel" | "fieldName" | "require" | "uniq" | "inputExample" | "edit" | "plsInputName" | "fieldMustUniq" | "notUniq" | "noKeyName" | "fieldsList" | "addNewField" | "editField" | "errorOccurred" | "errorBulkUpdateFieldName" | "commitBulkUpdateFieldName" | "bulkUpdateFieldName") => string;
|
14
12
|
protected getFont(): Record<string, {
|
15
13
|
fallback?: boolean | undefined;
|
16
14
|
subset?: boolean | undefined;
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,6 +1,5 @@
|
|
1
|
-
/// <reference types="react" />
|
2
1
|
import { SchemaForUI } from '@pdfme/common';
|
3
|
-
import { SidebarProps } from '../index
|
2
|
+
import { SidebarProps } from '../index';
|
4
3
|
declare const PositionAndSizeEditor: (props: Pick<SidebarProps, 'pageSize' | 'schemas' | 'changeSchemas' | 'activeElements'> & {
|
5
4
|
activeSchema: SchemaForUI;
|
6
5
|
}) => JSX.Element;
|
package/dist/types/{src/components → components}/Designer/Sidebar/DetailView/TypeAndKeyEditor.d.ts
RENAMED
@@ -1,6 +1,5 @@
|
|
1
|
-
/// <reference types="react" />
|
2
1
|
import { SchemaForUI } from '@pdfme/common';
|
3
|
-
import { SidebarProps } from '../index
|
2
|
+
import { SidebarProps } from '../index';
|
4
3
|
declare const TypeAndKeyEditor: (props: Pick<SidebarProps, 'schemas' | 'changeSchemas'> & {
|
5
4
|
activeSchema: SchemaForUI;
|
6
5
|
}) => JSX.Element;
|
@@ -1,6 +1,5 @@
|
|
1
|
-
/// <reference types="react" />
|
2
1
|
import { SchemaForUI } from '@pdfme/common';
|
3
|
-
import { SidebarProps } from '../index
|
2
|
+
import { SidebarProps } from '../index';
|
4
3
|
declare const DetailView: (props: Pick<SidebarProps, 'schemas' | 'pageSize' | 'changeSchemas' | 'activeElements'> & {
|
5
4
|
activeSchema: SchemaForUI;
|
6
5
|
}) => JSX.Element;
|
File without changes
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
|
-
import { SidebarProps } from '../index.js';
|
1
|
+
import { SidebarProps } from '../index';
|
3
2
|
declare const SelectableSortableContainer: (props: Pick<SidebarProps, 'schemas' | 'onEdit' | 'onSortEnd' | 'height' | 'hoveringSchemaId' | 'onChangeHoveringSchemaId'>) => JSX.Element;
|
4
3
|
export default SelectableSortableContainer;
|
File without changes
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
|
-
import { SidebarProps } from '../index.js';
|
1
|
+
import { SidebarProps } from '../index';
|
3
2
|
declare const ListView: (props: Pick<SidebarProps, 'schemas' | 'onSortEnd' | 'onEdit' | 'size' | 'hoveringSchemaId' | 'onChangeHoveringSchemaId' | 'changeSchemas'>) => JSX.Element;
|
4
3
|
export default ListView;
|
File without changes
|
File without changes
|
@@ -10,5 +10,5 @@ export interface SchemaUIProps {
|
|
10
10
|
declare const _default: React.ForwardRefExoticComponent<SchemaUIProps & {
|
11
11
|
border: string;
|
12
12
|
onChangeHoveringSchemaId?: ((id: string | null) => void) | undefined;
|
13
|
-
} & React.RefAttributes<
|
13
|
+
} & React.RefAttributes<HTMLTextAreaElement | HTMLInputElement>>;
|
14
14
|
export default _default;
|
File without changes
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/// <reference types="react" />
|
2
|
-
export declare const I18nContext: import("react").Context<(key: "type" | "
|
2
|
+
export declare const I18nContext: import("react").Context<(key: "type" | "field" | "cancel" | "fieldName" | "require" | "uniq" | "inputExample" | "edit" | "plsInputName" | "fieldMustUniq" | "notUniq" | "noKeyName" | "fieldsList" | "addNewField" | "editField" | "errorOccurred" | "errorBulkUpdateFieldName" | "commitBulkUpdateFieldName" | "bulkUpdateFieldName") => string>;
|
3
3
|
export declare const FontContext: import("react").Context<Record<string, {
|
4
4
|
fallback?: boolean | undefined;
|
5
5
|
subset?: boolean | undefined;
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import Designer from './Designer
|
2
|
-
import Form from './Form
|
3
|
-
import Viewer from './Viewer
|
1
|
+
import Designer from './Designer';
|
2
|
+
import Form from './Form';
|
3
|
+
import Viewer from './Viewer';
|
4
4
|
export { Designer, Viewer, Form };
|
5
5
|
export type { Lang, Size, Alignment, SchemaType, BarCodeType, TextSchema, ImageSchema, BarcodeSchema, Schema, SchemaForUI, Font, BasePdf, Template, CommonProps, GeneratorOptions, GenerateProps, UIOptions, UIProps, PreviewProps, DesignerProps, } from '@pdfme/common';
|
6
6
|
export { BLANK_PDF, isTextSchema, isImageSchema, isBarcodeSchema, checkTemplate, checkUIProps, checkPreviewProps, checkDesignerProps, checkGenerateProps, validateBarcodeInput, } from '@pdfme/common';
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@pdfme/ui",
|
3
|
-
"version": "1.1.
|
3
|
+
"version": "1.1.5",
|
4
4
|
"sideEffects": false,
|
5
5
|
"author": "hand-dot",
|
6
6
|
"license": "MIT",
|
@@ -21,23 +21,15 @@
|
|
21
21
|
"bugs": {
|
22
22
|
"url": "https://github.com/pdfme/pdfme/issues"
|
23
23
|
},
|
24
|
-
"main": "dist/
|
25
|
-
"module": "dist/
|
26
|
-
"types": "dist/types/
|
27
|
-
"exports": {
|
28
|
-
".": {
|
29
|
-
"import": "./dist/esm/src/index.js",
|
30
|
-
"require": "./dist/cjs/src/index.js"
|
31
|
-
}
|
32
|
-
},
|
24
|
+
"main": "dist/index.js",
|
25
|
+
"module": "dist/index.js",
|
26
|
+
"types": "dist/types/index.d.ts",
|
33
27
|
"engines": {
|
34
28
|
"node": ">=14"
|
35
29
|
},
|
36
30
|
"scripts": {
|
37
|
-
"develop": "
|
38
|
-
"build": "
|
39
|
-
"build:cjs": "tsc -p tsconfig.cjs.json",
|
40
|
-
"build:esm": "tsc -p tsconfig.esm.json",
|
31
|
+
"develop": "webpack --watch --mode development",
|
32
|
+
"build": "NODE_ENV=production webpack --mode production",
|
41
33
|
"clean": "rimraf dist",
|
42
34
|
"lint": "tsc --noEmit",
|
43
35
|
"test": "jest",
|
@@ -53,23 +45,24 @@
|
|
53
45
|
"@scena/react-guides": "^0.16.0",
|
54
46
|
"hotkeys-js": "^3.8.7",
|
55
47
|
"pdfjs-dist": "^2.12.313",
|
56
|
-
"react": "^
|
57
|
-
"react-dom": "^
|
48
|
+
"react": "^17.0.2",
|
49
|
+
"react-dom": "^17.0.2",
|
58
50
|
"react-moveable": "^0.30.3",
|
59
|
-
"react-selecto": "^1.12.0"
|
60
|
-
"worker-loader": "^3.0.8"
|
51
|
+
"react-selecto": "^1.12.0"
|
61
52
|
},
|
62
53
|
"devDependencies": {
|
63
54
|
"@testing-library/jest-dom": "^5.16.1",
|
64
55
|
"@testing-library/react": "^12.1.2",
|
65
|
-
"@types/css-font-loading-module": "^0.0.7",
|
66
56
|
"@types/pdfjs-dist": "^2.7.4",
|
67
|
-
"@types/react": "^
|
68
|
-
"@types/react-dom": "^
|
57
|
+
"@types/react": "^17.0.52",
|
58
|
+
"@types/react-dom": "^17.0.18",
|
69
59
|
"eslint-plugin-react": "^7.28.0",
|
70
60
|
"eslint-plugin-react-hooks": "^4.3.0",
|
71
61
|
"jest-canvas-mock": "^2.3.1",
|
72
|
-
"process": "^0.11.10"
|
62
|
+
"process": "^0.11.10",
|
63
|
+
"webpack": "^5.75.0",
|
64
|
+
"webpack-cli": "^5.0.1",
|
65
|
+
"worker-loader": "^3.0.8"
|
73
66
|
},
|
74
67
|
"jest": {
|
75
68
|
"setupFiles": [
|
@@ -90,7 +83,7 @@
|
|
90
83
|
},
|
91
84
|
"globals": {
|
92
85
|
"ts-jest": {
|
93
|
-
"tsconfig": "tsconfig.
|
86
|
+
"tsconfig": "tsconfig.json"
|
94
87
|
}
|
95
88
|
},
|
96
89
|
"testMatch": [
|
package/src/Designer.tsx
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
import React from 'react';
|
2
|
+
import ReactDOM from 'react-dom';
|
2
3
|
import { Template, DesignerProps, checkDesignerProps, checkTemplate } from '@pdfme/common';
|
3
|
-
import { BaseUIClass } from './class
|
4
|
-
import { DESTROYED_ERR_MSG } from './constants
|
5
|
-
import { I18nContext, FontContext } from './contexts
|
6
|
-
import DesignerComponent from './components/Designer/index
|
7
|
-
import { cloneDeep } from './helper
|
4
|
+
import { BaseUIClass } from './class';
|
5
|
+
import { DESTROYED_ERR_MSG } from './constants';
|
6
|
+
import { I18nContext, FontContext } from './contexts';
|
7
|
+
import DesignerComponent from './components/Designer/index';
|
8
|
+
import { cloneDeep } from './helper';
|
8
9
|
|
9
10
|
class Designer extends BaseUIClass {
|
10
11
|
private onSaveTemplateCallback?: (template: Template) => void;
|
@@ -43,8 +44,8 @@ class Designer extends BaseUIClass {
|
|
43
44
|
}
|
44
45
|
|
45
46
|
protected render() {
|
46
|
-
if (!this.domContainer
|
47
|
-
|
47
|
+
if (!this.domContainer) throw Error(DESTROYED_ERR_MSG);
|
48
|
+
ReactDOM.render(
|
48
49
|
<I18nContext.Provider value={this.getI18n()}>
|
49
50
|
<FontContext.Provider value={this.getFont()}>
|
50
51
|
<DesignerComponent
|
@@ -64,7 +65,8 @@ class Designer extends BaseUIClass {
|
|
64
65
|
size={this.size}
|
65
66
|
/>
|
66
67
|
</FontContext.Provider>
|
67
|
-
</I18nContext.Provider
|
68
|
+
</I18nContext.Provider>,
|
69
|
+
this.domContainer
|
68
70
|
);
|
69
71
|
}
|
70
72
|
}
|
package/src/Form.tsx
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
import React from 'react';
|
2
|
+
import ReactDOM from 'react-dom';
|
2
3
|
import { PreviewProps } from '@pdfme/common';
|
3
|
-
import { PreviewUI } from './class
|
4
|
-
import { DESTROYED_ERR_MSG } from './constants
|
5
|
-
import { I18nContext, FontContext } from './contexts
|
6
|
-
import Preview from './components/Preview
|
4
|
+
import { PreviewUI } from './class';
|
5
|
+
import { DESTROYED_ERR_MSG } from './constants';
|
6
|
+
import { I18nContext, FontContext } from './contexts';
|
7
|
+
import Preview from './components/Preview';
|
7
8
|
|
8
9
|
class Form extends PreviewUI {
|
9
10
|
private onChangeInputCallback?: (arg: { index: number; value: string; key: string }) => void;
|
@@ -18,8 +19,8 @@ class Form extends PreviewUI {
|
|
18
19
|
}
|
19
20
|
|
20
21
|
protected render() {
|
21
|
-
if (!this.domContainer
|
22
|
-
|
22
|
+
if (!this.domContainer) throw Error(DESTROYED_ERR_MSG);
|
23
|
+
ReactDOM.render(
|
23
24
|
<I18nContext.Provider value={this.getI18n()}>
|
24
25
|
<FontContext.Provider value={this.getFont()}>
|
25
26
|
<Preview
|
@@ -36,7 +37,8 @@ class Form extends PreviewUI {
|
|
36
37
|
}}
|
37
38
|
/>
|
38
39
|
</FontContext.Provider>
|
39
|
-
</I18nContext.Provider
|
40
|
+
</I18nContext.Provider>,
|
41
|
+
this.domContainer
|
40
42
|
);
|
41
43
|
}
|
42
44
|
}
|
package/src/Viewer.tsx
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
import React from 'react';
|
2
|
+
import ReactDOM from 'react-dom';
|
2
3
|
import { PreviewProps } from '@pdfme/common';
|
3
|
-
import { PreviewUI } from './class
|
4
|
-
import { DESTROYED_ERR_MSG } from './constants
|
5
|
-
import { I18nContext, FontContext } from './contexts
|
6
|
-
import Preview from './components/Preview
|
4
|
+
import { PreviewUI } from './class';
|
5
|
+
import { DESTROYED_ERR_MSG } from './constants';
|
6
|
+
import { I18nContext, FontContext } from './contexts';
|
7
|
+
import Preview from './components/Preview';
|
7
8
|
|
8
9
|
class Viewer extends PreviewUI {
|
9
10
|
constructor(props: PreviewProps) {
|
@@ -12,13 +13,14 @@ class Viewer extends PreviewUI {
|
|
12
13
|
}
|
13
14
|
|
14
15
|
protected render() {
|
15
|
-
if (!this.domContainer
|
16
|
-
|
16
|
+
if (!this.domContainer) throw Error(DESTROYED_ERR_MSG);
|
17
|
+
ReactDOM.render(
|
17
18
|
<I18nContext.Provider value={this.getI18n()}>
|
18
19
|
<FontContext.Provider value={this.getFont()}>
|
19
20
|
<Preview template={this.template} size={this.size} inputs={this.inputs} />
|
20
21
|
</FontContext.Provider>
|
21
|
-
</I18nContext.Provider
|
22
|
+
</I18nContext.Provider>,
|
23
|
+
this.domContainer
|
22
24
|
);
|
23
25
|
}
|
24
26
|
}
|
package/src/class.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
import
|
2
|
-
import { curriedI18n } from './i18n
|
3
|
-
import { DESTROYED_ERR_MSG, DEFAULT_LANG } from './constants
|
4
|
-
import { debounce, flatten, cloneDeep } from './helper
|
1
|
+
import ReactDOM from 'react-dom';
|
2
|
+
import { curriedI18n } from './i18n';
|
3
|
+
import { DESTROYED_ERR_MSG, DEFAULT_LANG } from './constants';
|
4
|
+
import { debounce, flatten, cloneDeep } from './helper';
|
5
5
|
import {
|
6
6
|
Template,
|
7
7
|
Size,
|
@@ -61,8 +61,6 @@ export abstract class BaseUIClass {
|
|
61
61
|
|
62
62
|
protected size!: Size;
|
63
63
|
|
64
|
-
protected root: Root | null;
|
65
|
-
|
66
64
|
private lang: Lang = DEFAULT_LANG;
|
67
65
|
|
68
66
|
private font: Font = getDefaultFont();
|
@@ -85,7 +83,6 @@ export abstract class BaseUIClass {
|
|
85
83
|
const { lang, font } = options || {};
|
86
84
|
this.domContainer = domContainer;
|
87
85
|
this.template = generateColumnsAndSampledataIfNeeded(cloneDeep(template));
|
88
|
-
this.root = createRoot(this.domContainer!);
|
89
86
|
this.size = {
|
90
87
|
height: this.domContainer!.clientHeight || window.innerHeight,
|
91
88
|
width: this.domContainer!.clientWidth || window.innerWidth,
|
@@ -136,12 +133,11 @@ export abstract class BaseUIClass {
|
|
136
133
|
}
|
137
134
|
|
138
135
|
public destroy() {
|
139
|
-
if (!this.domContainer
|
140
|
-
this.
|
136
|
+
if (!this.domContainer) throw Error(DESTROYED_ERR_MSG);
|
137
|
+
ReactDOM.unmountComponentAtNode(this.domContainer);
|
141
138
|
|
142
139
|
this.resizeObserver.unobserve(this.domContainer);
|
143
140
|
this.domContainer = null;
|
144
|
-
this.root = null;
|
145
141
|
}
|
146
142
|
|
147
143
|
protected abstract render(): void;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React, { useContext } from 'react';
|
2
2
|
import { ChevronLeftIcon, ChevronRightIcon } from '@heroicons/react/24/outline';
|
3
|
-
import { I18nContext } from '../../contexts
|
3
|
+
import { I18nContext } from '../../contexts';
|
4
4
|
|
5
5
|
const btnStyle: React.CSSProperties = {
|
6
6
|
cursor: 'pointer',
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React, { Ref } from 'react';
|
2
2
|
import Guides from '@scena/react-guides';
|
3
3
|
import { Size } from '@pdfme/common';
|
4
|
-
import { ZOOM, RULER_HEIGHT } from '../../../constants
|
4
|
+
import { ZOOM, RULER_HEIGHT } from '../../../constants';
|
5
5
|
|
6
6
|
const _Guides = ({
|
7
7
|
paperSize,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import Selecto, { OnDragStart as _OnDragStart, OnSelect as _OnSelect } from 'react-selecto';
|
3
|
-
import { SELECTABLE_CLASSNAME } from '../../../constants
|
3
|
+
import { SELECTABLE_CLASSNAME } from '../../../constants';
|
4
4
|
|
5
5
|
const _Selecto = ({
|
6
6
|
container,
|
@@ -9,15 +9,15 @@ import React, {
|
|
9
9
|
} from 'react';
|
10
10
|
import { OnDrag, OnResize, OnClick } from 'react-moveable';
|
11
11
|
import { SchemaForUI, Size } from '@pdfme/common';
|
12
|
-
import { ZOOM, RULER_HEIGHT } from '../../../constants
|
13
|
-
import { usePrevious } from '../../../hooks
|
14
|
-
import { uuid, round, flatten } from '../../../helper
|
15
|
-
import Paper from '../../Paper
|
16
|
-
import SchemaUI from '../../Schemas/SchemaUI
|
17
|
-
import Selecto from './Selecto
|
18
|
-
import Moveable from './Moveable
|
19
|
-
import Guides from './Guides
|
20
|
-
import Mask from './Mask
|
12
|
+
import { ZOOM, RULER_HEIGHT } from '../../../constants';
|
13
|
+
import { usePrevious } from '../../../hooks';
|
14
|
+
import { uuid, round, flatten } from '../../../helper';
|
15
|
+
import Paper from '../../Paper';
|
16
|
+
import SchemaUI from '../../Schemas/SchemaUI';
|
17
|
+
import Selecto from './Selecto';
|
18
|
+
import Moveable from './Moveable';
|
19
|
+
import Guides from './Guides';
|
20
|
+
import Mask from './Mask';
|
21
21
|
|
22
22
|
const DELETE_BTN_ID = uuid();
|
23
23
|
const fmt4Num = (prop: string) => Number(prop.replace('px', ''));
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React, { useContext } from 'react';
|
2
2
|
import { SchemaForUI } from '@pdfme/common';
|
3
|
-
import { readFiles } from '../../../../helper
|
4
|
-
import { I18nContext } from '../../../../contexts
|
3
|
+
import { readFiles } from '../../../../helper';
|
4
|
+
import { I18nContext } from '../../../../contexts';
|
5
5
|
import { SidebarProps } from '..';
|
6
6
|
import { XMarkIcon } from '@heroicons/react/24/outline';
|
7
7
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React, { CSSProperties } from 'react';
|
2
2
|
import { SchemaForUI } from '@pdfme/common';
|
3
|
-
import { round } from '../../../../helper
|
4
|
-
import { SidebarProps } from '../index
|
3
|
+
import { round } from '../../../../helper';
|
4
|
+
import { SidebarProps } from '../index';
|
5
5
|
|
6
6
|
const inputSetStyle: CSSProperties = { marginRight: '1rem', display: 'flex', alignItems: 'center' };
|
7
7
|
|
@@ -7,7 +7,7 @@ import {
|
|
7
7
|
DEFAULT_CHARACTER_SPACING,
|
8
8
|
DEFAULT_FONT_COLOR,
|
9
9
|
} from '@pdfme/common';
|
10
|
-
import { FontContext } from '../../../../contexts
|
10
|
+
import { FontContext } from '../../../../contexts';
|
11
11
|
import { SidebarProps } from '..';
|
12
12
|
import { XMarkIcon } from '@heroicons/react/24/outline';
|
13
13
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React, { useContext, useRef, useCallback } from 'react';
|
2
2
|
import { schemaTypes, SchemaForUI } from '@pdfme/common';
|
3
|
-
import { SidebarProps } from '../index
|
4
|
-
import { I18nContext } from '../../../../contexts
|
3
|
+
import { SidebarProps } from '../index';
|
4
|
+
import { I18nContext } from '../../../../contexts';
|
5
5
|
|
6
6
|
const ErrorLabel = ({ isError, msg }: { isError: boolean; msg: string }) => (
|
7
7
|
<span
|
@@ -1,12 +1,12 @@
|
|
1
1
|
import React, { useContext } from 'react';
|
2
2
|
import { SchemaForUI } from '@pdfme/common';
|
3
|
-
import { I18nContext } from '../../../../contexts
|
4
|
-
import Divider from '../../../Divider
|
5
|
-
import { SidebarProps } from '../index
|
6
|
-
import TextPropEditor from './TextPropEditor
|
7
|
-
import ExampleInputEditor from './ExampleInputEditor
|
8
|
-
import PositionAndSizeEditor from './PositionAndSizeEditor
|
9
|
-
import TypeAndKeyEditor from './TypeAndKeyEditor
|
3
|
+
import { I18nContext } from '../../../../contexts';
|
4
|
+
import Divider from '../../../Divider';
|
5
|
+
import { SidebarProps } from '../index';
|
6
|
+
import TextPropEditor from './TextPropEditor';
|
7
|
+
import ExampleInputEditor from './ExampleInputEditor';
|
8
|
+
import PositionAndSizeEditor from './PositionAndSizeEditor';
|
9
|
+
import TypeAndKeyEditor from './TypeAndKeyEditor';
|
10
10
|
|
11
11
|
const DetailView = (
|
12
12
|
props: Pick<SidebarProps, 'schemas' | 'pageSize' | 'changeSchemas' | 'activeElements'> & {
|