@pdfme/ui 1.1.5 → 1.1.7
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.js +1 -1
- package/dist/index.js.LICENSE.txt +1 -1
- package/dist/index.js.map +1 -1
- package/dist/types/class.d.ts +1 -1
- package/dist/types/components/Designer/index.d.ts +1 -1
- package/dist/types/contexts.d.ts +1 -1
- package/dist/types/index.d.ts +4 -3
- package/package.json +1 -1
- package/src/components/Designer/Main/index.tsx +2 -10
- package/src/components/Designer/Sidebar/DetailView/ExampleInputEditor.tsx +3 -3
- package/src/components/Designer/Sidebar/DetailView/TextPropEditor.tsx +2 -1
- package/src/components/Root.tsx +11 -10
- package/src/components/Schemas/ImageSchema.tsx +2 -2
- package/src/index.ts +42 -3
- package/webpack.config.js +4 -18
- package/vite.config.ts +0 -0
package/dist/types/class.d.ts
CHANGED
@@ -12,7 +12,7 @@ export declare abstract class BaseUIClass {
|
|
12
12
|
protected getFont(): Record<string, {
|
13
13
|
fallback?: boolean | undefined;
|
14
14
|
subset?: boolean | undefined;
|
15
|
-
data: ArrayBuffer | Uint8Array;
|
15
|
+
data: string | ArrayBuffer | Uint8Array;
|
16
16
|
}>;
|
17
17
|
getTemplate(): {
|
18
18
|
columns?: string[] | undefined;
|
@@ -4,7 +4,7 @@ declare const TemplateEditor: ({ template, size, onSaveTemplate, onChangeTemplat
|
|
4
4
|
font?: Record<string, {
|
5
5
|
fallback?: boolean | undefined;
|
6
6
|
subset?: boolean | undefined;
|
7
|
-
data: ArrayBuffer | Uint8Array;
|
7
|
+
data: string | ArrayBuffer | Uint8Array;
|
8
8
|
}> | undefined;
|
9
9
|
lang?: "en" | "ja" | undefined;
|
10
10
|
} | undefined;
|
package/dist/types/contexts.d.ts
CHANGED
@@ -3,5 +3,5 @@ export declare const I18nContext: import("react").Context<(key: "type" | "field"
|
|
3
3
|
export declare const FontContext: import("react").Context<Record<string, {
|
4
4
|
fallback?: boolean | undefined;
|
5
5
|
subset?: boolean | undefined;
|
6
|
-
data: ArrayBuffer | Uint8Array;
|
6
|
+
data: string | ArrayBuffer | Uint8Array;
|
7
7
|
}>>;
|
package/dist/types/index.d.ts
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
import Designer from './Designer';
|
2
2
|
import Form from './Form';
|
3
3
|
import Viewer from './Viewer';
|
4
|
-
|
5
|
-
|
6
|
-
export { BLANK_PDF, isTextSchema, isImageSchema, isBarcodeSchema, checkTemplate, checkUIProps, checkPreviewProps, checkDesignerProps, checkGenerateProps, validateBarcodeInput, }
|
4
|
+
import { BLANK_PDF, HELVETICA, isTextSchema, isImageSchema, isBarcodeSchema, checkTemplate, checkUIProps, checkPreviewProps, checkDesignerProps, checkGenerateProps, validateBarcodeInput } from '@pdfme/common';
|
5
|
+
import 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
|
+
export { Designer, Viewer, Form, BLANK_PDF, HELVETICA, isTextSchema, isImageSchema, isBarcodeSchema, checkTemplate, checkUIProps, checkPreviewProps, checkDesignerProps, checkGenerateProps, validateBarcodeInput, };
|
7
|
+
export type { Lang, Size, Alignment, SchemaType, BarCodeType, TextSchema, ImageSchema, BarcodeSchema, Schema, SchemaForUI, Font, BasePdf, Template, CommonProps, GeneratorOptions, GenerateProps, UIOptions, UIProps, PreviewProps, DesignerProps, };
|
package/package.json
CHANGED
@@ -9,6 +9,7 @@ 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 { XMarkIcon } from '@heroicons/react/24/outline';
|
12
13
|
import { ZOOM, RULER_HEIGHT } from '../../../constants';
|
13
14
|
import { usePrevious } from '../../../hooks';
|
14
15
|
import { uuid, round, flatten } from '../../../helper';
|
@@ -49,16 +50,7 @@ const DeleteButton = ({ activeElements: aes }: { activeElements: HTMLElement[] }
|
|
49
50
|
justifyContent: 'center',
|
50
51
|
}}
|
51
52
|
>
|
52
|
-
<
|
53
|
-
style={{ pointerEvents: 'none' }}
|
54
|
-
xmlns="http://www.w3.org/2000/svg"
|
55
|
-
fill="none"
|
56
|
-
viewBox="0 0 24 24"
|
57
|
-
strokeWidth="1.5"
|
58
|
-
stroke="currentColor"
|
59
|
-
>
|
60
|
-
<path strokeLinecap="round" strokeLinejoin="round" d="M6 18L18 6M6 6l12 12" />
|
61
|
-
</svg>
|
53
|
+
<XMarkIcon width={10} height={10} />
|
62
54
|
</button>
|
63
55
|
);
|
64
56
|
};
|
@@ -24,15 +24,15 @@ const ExampleInputEditor = (
|
|
24
24
|
top: 0,
|
25
25
|
left: 0,
|
26
26
|
display: 'flex',
|
27
|
-
justifyContent: 'center',
|
28
27
|
alignItems: 'center',
|
28
|
+
justifyContent: 'center',
|
29
29
|
color: '#333',
|
30
30
|
background: '#f2f2f2',
|
31
31
|
cursor: 'pointer',
|
32
32
|
borderRadius: 2,
|
33
33
|
border: '1px solid #767676',
|
34
|
-
height:
|
35
|
-
width:
|
34
|
+
height: 24,
|
35
|
+
width: 24,
|
36
36
|
}}
|
37
37
|
aria-label="close"
|
38
38
|
onClick={() =>
|
@@ -53,8 +53,9 @@ const ColorInputSet = (props: {
|
|
53
53
|
onClick={onClear}
|
54
54
|
style={{
|
55
55
|
display: 'flex',
|
56
|
-
background: 'none',
|
57
56
|
alignItems: 'center',
|
57
|
+
justifyContent: 'center',
|
58
|
+
background: 'none',
|
58
59
|
borderRadius: 2,
|
59
60
|
border: '1px solid #767676',
|
60
61
|
cursor: 'pointer',
|
package/src/components/Root.tsx
CHANGED
@@ -9,19 +9,20 @@ const Root = ({ size, scale, children }: Props, ref: Ref<HTMLDivElement>) => {
|
|
9
9
|
const font = useContext(FontContext);
|
10
10
|
|
11
11
|
useEffect(() => {
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
if (!document || !document.fonts) return;
|
13
|
+
const fontFaces = Object.entries(font).map(
|
14
|
+
([key, { data }]) =>
|
15
|
+
new FontFace(key, typeof data === 'string' ? `url(${data})` : data, {
|
16
|
+
display: 'swap',
|
17
|
+
})
|
18
|
+
);
|
19
|
+
// @ts-ignore
|
20
|
+
const newFontFaces = fontFaces.filter((fontFace) => !document.fonts.has(fontFace));
|
15
21
|
|
16
|
-
|
17
|
-
});
|
18
|
-
Promise.all(fontFaces).then((loadedFontFaces) => {
|
22
|
+
Promise.all(newFontFaces.map((f) => f.load())).then((loadedFontFaces) => {
|
19
23
|
loadedFontFaces.forEach((loadedFontFace) => {
|
20
24
|
// @ts-ignore
|
21
|
-
|
22
|
-
// @ts-ignore
|
23
|
-
document.fonts.add(loadedFontFace);
|
24
|
-
}
|
25
|
+
document.fonts.add(loadedFontFace);
|
25
26
|
});
|
26
27
|
});
|
27
28
|
}, [font]);
|
package/src/index.ts
CHANGED
@@ -2,9 +2,21 @@ import Designer from './Designer';
|
|
2
2
|
import Form from './Form';
|
3
3
|
import Viewer from './Viewer';
|
4
4
|
|
5
|
-
|
5
|
+
import {
|
6
|
+
BLANK_PDF,
|
7
|
+
HELVETICA,
|
8
|
+
isTextSchema,
|
9
|
+
isImageSchema,
|
10
|
+
isBarcodeSchema,
|
11
|
+
checkTemplate,
|
12
|
+
checkUIProps,
|
13
|
+
checkPreviewProps,
|
14
|
+
checkDesignerProps,
|
15
|
+
checkGenerateProps,
|
16
|
+
validateBarcodeInput,
|
17
|
+
} from '@pdfme/common';
|
6
18
|
|
7
|
-
|
19
|
+
import type {
|
8
20
|
Lang,
|
9
21
|
Size,
|
10
22
|
Alignment,
|
@@ -28,7 +40,11 @@ export type {
|
|
28
40
|
} from '@pdfme/common';
|
29
41
|
|
30
42
|
export {
|
43
|
+
Designer,
|
44
|
+
Viewer,
|
45
|
+
Form,
|
31
46
|
BLANK_PDF,
|
47
|
+
HELVETICA,
|
32
48
|
isTextSchema,
|
33
49
|
isImageSchema,
|
34
50
|
isBarcodeSchema,
|
@@ -38,4 +54,27 @@ export {
|
|
38
54
|
checkDesignerProps,
|
39
55
|
checkGenerateProps,
|
40
56
|
validateBarcodeInput,
|
41
|
-
}
|
57
|
+
};
|
58
|
+
|
59
|
+
export type {
|
60
|
+
Lang,
|
61
|
+
Size,
|
62
|
+
Alignment,
|
63
|
+
SchemaType,
|
64
|
+
BarCodeType,
|
65
|
+
TextSchema,
|
66
|
+
ImageSchema,
|
67
|
+
BarcodeSchema,
|
68
|
+
Schema,
|
69
|
+
SchemaForUI,
|
70
|
+
Font,
|
71
|
+
BasePdf,
|
72
|
+
Template,
|
73
|
+
CommonProps,
|
74
|
+
GeneratorOptions,
|
75
|
+
GenerateProps,
|
76
|
+
UIOptions,
|
77
|
+
UIProps,
|
78
|
+
PreviewProps,
|
79
|
+
DesignerProps,
|
80
|
+
};
|
package/webpack.config.js
CHANGED
@@ -19,13 +19,8 @@ const config = {
|
|
19
19
|
},
|
20
20
|
plugins: [
|
21
21
|
// new BundleAnalyzerPlugin(),
|
22
|
-
new webpack.ProvidePlugin({
|
23
|
-
|
24
|
-
}),
|
25
|
-
new webpack.BannerPlugin({
|
26
|
-
banner: BANNER,
|
27
|
-
entryOnly: true,
|
28
|
-
}),
|
22
|
+
new webpack.ProvidePlugin({ process: 'process/browser' }),
|
23
|
+
new webpack.BannerPlugin({ banner: BANNER, entryOnly: true }),
|
29
24
|
],
|
30
25
|
devtool: 'source-map',
|
31
26
|
entry: './src/index.ts',
|
@@ -33,17 +28,8 @@ const config = {
|
|
33
28
|
path: path.resolve(__dirname, 'dist'),
|
34
29
|
filename: 'index.js',
|
35
30
|
globalObject: 'this',
|
36
|
-
library: {
|
37
|
-
type: 'umd',
|
38
|
-
},
|
39
|
-
},
|
40
|
-
module: {
|
41
|
-
rules: [
|
42
|
-
{
|
43
|
-
test: /\.tsx?$/,
|
44
|
-
use: 'ts-loader',
|
45
|
-
},
|
46
|
-
],
|
31
|
+
library: { type: 'umd' },
|
47
32
|
},
|
33
|
+
module: { rules: [{ test: /\.tsx?$/, use: 'ts-loader' }] },
|
48
34
|
};
|
49
35
|
module.exports = config;
|
package/vite.config.ts
DELETED
File without changes
|