@pdfme/common 3.0.1 → 3.1.0
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/cjs/__tests__/helper.test.js +4 -13
- package/dist/cjs/__tests__/helper.test.js.map +1 -1
- package/dist/cjs/src/helper.js +15 -15
- package/dist/cjs/src/helper.js.map +1 -1
- package/dist/cjs/src/index.js.map +1 -1
- package/dist/cjs/src/schema.js +51 -2
- package/dist/cjs/src/schema.js.map +1 -1
- package/dist/esm/__tests__/helper.test.js +4 -13
- package/dist/esm/__tests__/helper.test.js.map +1 -1
- package/dist/esm/src/helper.js +4 -4
- package/dist/esm/src/helper.js.map +1 -1
- package/dist/esm/src/index.js.map +1 -1
- package/dist/esm/src/schema.js +50 -1
- package/dist/esm/src/schema.js.map +1 -1
- package/dist/types/src/index.d.ts +2 -2
- package/dist/types/src/schema.d.ts +169 -6
- package/dist/types/src/types.d.ts +25 -2
- package/package.json +6 -3
- package/src/helper.ts +2 -2
- package/src/index.ts +2 -0
- package/src/schema.ts +52 -1
- package/src/types.ts +24 -2
@@ -22,15 +22,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
22
|
__setModuleDefault(result, mod);
|
23
23
|
return result;
|
24
24
|
};
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
32
|
-
});
|
33
|
-
};
|
34
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
35
26
|
const fs_1 = require("fs");
|
36
27
|
const path = __importStar(require("path"));
|
@@ -230,8 +221,8 @@ Check this document: https://pdfme.com/docs/custom-fonts`);
|
|
230
221
|
describe('checkPlugins test', () => {
|
231
222
|
const plugins = {
|
232
223
|
myText: {
|
233
|
-
pdf: () =>
|
234
|
-
ui: () =>
|
224
|
+
pdf: async () => { },
|
225
|
+
ui: async () => { },
|
235
226
|
propPanel: {
|
236
227
|
schema: {},
|
237
228
|
defaultValue: '',
|
@@ -239,8 +230,8 @@ describe('checkPlugins test', () => {
|
|
239
230
|
},
|
240
231
|
},
|
241
232
|
myImage: {
|
242
|
-
pdf: () =>
|
243
|
-
ui: () =>
|
233
|
+
pdf: async () => { },
|
234
|
+
ui: async () => { },
|
244
235
|
propPanel: {
|
245
236
|
schema: {},
|
246
237
|
defaultValue: '',
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"helper.test.js","sourceRoot":"","sources":["../../../__tests__/helper.test.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"helper.test.js","sourceRoot":"","sources":["../../../__tests__/helper.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2BAAkC;AAClC,2CAA6B;AAC7B,0CAA6E;AAC7E,gCAA4E;AAE5E,MAAM,QAAQ,GAAG,IAAA,iBAAY,EAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,kCAAkC,CAAC,CAAC,CAAC;AACxF,MAAM,SAAS,GAAG,IAAA,iBAAY,EAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,mCAAmC,CAAC,CAAC,CAAC;AAE1F,MAAM,aAAa,GAAG,GAAS,EAAE,CAAC,CAAC;IACjC,cAAc,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE;IAClD,eAAe,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;CACrC,CAAC,CAAC;AAEH,MAAM,WAAW,GAAG,GAAa,EAAE,CAAC,CAAC;IACnC,OAAO,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AG,EAAE;QACnE,IAAI;YACF,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;YAC/B,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,MAAM,CAAC;YACpC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,SAAS,CAAC;YACvC,IAAA,qBAAY,EAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;YACpC,IAAI,EAAE,CAAC;SACR;QAAC,OAAO,CAAM,EAAE;YACf,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,CACvB,mEAAmE,CACpE,CAAC;SACH;IACH,CAAC,CAAC,CAAC;IACH,IAAI,CAAC,2DAA2D,EAAE,GAAG,EAAE;QACrE,IAAI;YACF,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;YAC/B,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,MAAM,CAAC;YACpC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,OAAO,CAAC;YACrC,IAAA,qBAAY,EAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;YACpC,IAAI,EAAE,CAAC;SACR;QAAC,OAAO,CAAM,EAAE;YACf,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,CACvB,yEAAyE,CAC1E,CAAC;SACH;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/cjs/src/helper.js
CHANGED
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.checkGenerateProps = exports.checkDesignerProps = exports.checkPreviewProps = exports.checkUIProps = exports.checkTemplate = exports.checkUIOptions = exports.checkInputs = exports.checkPlugins = exports.checkFont = exports.b64toUint8Array = exports.getB64BasePdf = exports.pt2px = exports.pt2mm = exports.mm2pt = exports.getDefaultFont = exports.getFallbackFontName = void 0;
|
4
4
|
const zod_1 = require("zod");
|
5
5
|
const buffer_1 = require("buffer");
|
6
|
-
const
|
7
|
-
const
|
6
|
+
const schema_js_1 = require("./schema.js");
|
7
|
+
const constants_js_1 = require("./constants.js");
|
8
8
|
const uniq = (array) => Array.from(new Set(array));
|
9
9
|
const getFallbackFontName = (font) => {
|
10
10
|
const initial = '';
|
@@ -19,19 +19,19 @@ const getFallbackFontName = (font) => {
|
|
19
19
|
};
|
20
20
|
exports.getFallbackFontName = getFallbackFontName;
|
21
21
|
const getDefaultFont = () => ({
|
22
|
-
[
|
22
|
+
[constants_js_1.DEFAULT_FONT_NAME]: { data: (0, exports.b64toUint8Array)(constants_js_1.DEFAULT_FONT_VALUE), fallback: true },
|
23
23
|
});
|
24
24
|
exports.getDefaultFont = getDefaultFont;
|
25
25
|
const mm2pt = (mm) => {
|
26
|
-
return parseFloat(String(mm)) *
|
26
|
+
return parseFloat(String(mm)) * constants_js_1.MM_TO_PT_RATIO;
|
27
27
|
};
|
28
28
|
exports.mm2pt = mm2pt;
|
29
29
|
const pt2mm = (pt) => {
|
30
|
-
return pt *
|
30
|
+
return pt * constants_js_1.PT_TO_MM_RATIO;
|
31
31
|
};
|
32
32
|
exports.pt2mm = pt2mm;
|
33
33
|
const pt2px = (pt) => {
|
34
|
-
return pt *
|
34
|
+
return pt * constants_js_1.PT_TO_PX_RATIO;
|
35
35
|
};
|
36
36
|
exports.pt2px = pt2px;
|
37
37
|
const blob2Base64Pdf = (blob) => {
|
@@ -73,7 +73,7 @@ const b64toUint8Array = (base64) => {
|
|
73
73
|
};
|
74
74
|
exports.b64toUint8Array = b64toUint8Array;
|
75
75
|
const getFontNamesInSchemas = (schemas) => uniq(schemas
|
76
|
-
.map((s) => Object.values(s).map((v) =>
|
76
|
+
.map((s) => Object.values(s).map((v) => v.fontName ?? ''))
|
77
77
|
.reduce((acc, cur) => acc.concat(cur), [])
|
78
78
|
.filter(Boolean));
|
79
79
|
const checkFont = (arg) => {
|
@@ -101,7 +101,7 @@ exports.checkFont = checkFont;
|
|
101
101
|
const checkPlugins = (arg) => {
|
102
102
|
const { plugins, template: { schemas }, } = arg;
|
103
103
|
const allSchemaTypes = uniq(schemas.map((s) => Object.values(s).map((v) => v.type)).flat());
|
104
|
-
const pluginsSchemaTypes = Object.values(plugins).map((p) => p
|
104
|
+
const pluginsSchemaTypes = Object.values(plugins).map((p) => p?.propPanel.defaultSchema.type);
|
105
105
|
if (allSchemaTypes.some((s) => !pluginsSchemaTypes.includes(s))) {
|
106
106
|
throw Error(`[@pdfme/common] ${allSchemaTypes
|
107
107
|
.filter((s) => !pluginsSchemaTypes.includes(s))
|
@@ -139,18 +139,18 @@ ${message}`);
|
|
139
139
|
}
|
140
140
|
}
|
141
141
|
};
|
142
|
-
const checkInputs = (data) => checkProps(data,
|
142
|
+
const checkInputs = (data) => checkProps(data, schema_js_1.Inputs);
|
143
143
|
exports.checkInputs = checkInputs;
|
144
|
-
const checkUIOptions = (data) => checkProps(data,
|
144
|
+
const checkUIOptions = (data) => checkProps(data, schema_js_1.UIOptions);
|
145
145
|
exports.checkUIOptions = checkUIOptions;
|
146
|
-
const checkTemplate = (data) => checkProps(data,
|
146
|
+
const checkTemplate = (data) => checkProps(data, schema_js_1.Template);
|
147
147
|
exports.checkTemplate = checkTemplate;
|
148
|
-
const checkUIProps = (data) => checkProps(data,
|
148
|
+
const checkUIProps = (data) => checkProps(data, schema_js_1.UIProps);
|
149
149
|
exports.checkUIProps = checkUIProps;
|
150
|
-
const checkPreviewProps = (data) => checkProps(data,
|
150
|
+
const checkPreviewProps = (data) => checkProps(data, schema_js_1.PreviewProps);
|
151
151
|
exports.checkPreviewProps = checkPreviewProps;
|
152
|
-
const checkDesignerProps = (data) => checkProps(data,
|
152
|
+
const checkDesignerProps = (data) => checkProps(data, schema_js_1.DesignerProps);
|
153
153
|
exports.checkDesignerProps = checkDesignerProps;
|
154
|
-
const checkGenerateProps = (data) => checkProps(data,
|
154
|
+
const checkGenerateProps = (data) => checkProps(data, schema_js_1.GenerateProps);
|
155
155
|
exports.checkGenerateProps = checkGenerateProps;
|
156
156
|
//# sourceMappingURL=helper.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../../../src/helper.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,mCAAgC;AAEhC,
|
1
|
+
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../../../src/helper.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,mCAAgC;AAEhC,2CAQqB;AACrB,iDAMwB;AAExB,MAAM,IAAI,GAAG,CAAI,KAAe,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;AAEzD,MAAM,mBAAmB,GAAG,CAAC,IAAU,EAAE,EAAE;IAChD,MAAM,OAAO,GAAG,EAAE,CAAC;IACnB,MAAM,gBAAgB,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QAChE,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,GAAG,GAAG,CAAC;QAElC,OAAO,CAAC,GAAG,IAAI,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC;IACrD,CAAC,EAAE,OAAO,CAAC,CAAC;IACZ,IAAI,gBAAgB,KAAK,OAAO,EAAE;QAChC,MAAM,KAAK,CACT,0FAA0F,CAC3F,CAAC;KACH;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC,CAAC;AAdW,QAAA,mBAAmB,uBAc9B;AAEK,MAAM,cAAc,GAAG,GAAS,EAAE,CAAC,CAAC;IACzC,CAAC,gCAAiB,CAAC,EAAE,EAAE,IAAI,EAAE,IAAA,uBAAe,EAAC,iCAAkB,CAAC,EAAE,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AAApE,QAAA,aAAa,iBAAuD;AAC1E,MAAM,YAAY,GAAG,CAAC,IAAa,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,mBAAa,CAAC,CAAC;AAAlE,QAAA,YAAY,gBAAsD;AACxE,MAAM,iBAAiB,GAAG,CAAC,IAAa,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,wBAAkB,CAAC,CAAC;AAA5E,QAAA,iBAAiB,qBAA2D;AAClF,MAAM,kBAAkB,GAAG,CAAC,IAAa,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,yBAAmB,CAAC,CAAC;AAA9E,QAAA,kBAAkB,sBAA4D;AACpF,MAAM,kBAAkB,GAAG,CAAC,IAAa,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,yBAAmB,CAAC,CAAC;AAA9E,QAAA,kBAAkB,sBAA4D"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":";;;AAAA,iDAOwB;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":";;;AAAA,iDAOwB;AA4CtB,+FAlDA,6BAAc,OAkDA;AACd,+FAlDA,6BAAc,OAkDA;AACd,+FAlDA,6BAAc,OAkDA;AACd,0FAlDA,wBAAS,OAkDA;AACT,qFAlDA,mBAAI,OAkDA;AACJ,kGAlDA,gCAAiB,OAkDA;AAxBnB,2CAgBqB;AASnB,oGAxBA,+BAAmB,OAwBA;AACnB,+FAxBA,0BAAc,OAwBA;AACd,8FAxBA,yBAAa,OAwBA;AACb,gGAxBA,2BAAe,OAwBA;AAIf,0FA3BA,qBAAS,OA2BA;AACT,4FA3BA,uBAAW,OA2BA;AACX,+FA3BA,0BAAc,OA2BA;AACd,8FA3BA,yBAAa,OA2BA;AACb,6FA3BA,wBAAY,OA2BA;AACZ,kGA3BA,6BAAiB,OA2BA;AACjB,mGA3BA,8BAAkB,OA2BA;AAClB,mGA3BA,8BAAkB,OA2BA;AAVlB,sFAhBA,iBAAK,OAgBA;AACL,sFAhBA,iBAAK,OAgBA;AACL,sFAhBA,iBAAK,OAgBA"}
|
package/dist/cjs/src/schema.js
CHANGED
@@ -1,9 +1,54 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.DesignerProps = exports.PreviewProps = exports.UIProps = exports.UIOptions = exports.GenerateProps = exports.GeneratorOptions = exports.Inputs = exports.Template = exports.BasePdf = exports.Font = exports.SchemaForUI = exports.Schema = exports.Size = exports.Lang = void 0;
|
3
|
+
exports.DesignerProps = exports.PreviewProps = exports.UIProps = exports.UIOptions = exports.GenerateProps = exports.GeneratorOptions = exports.Inputs = exports.Template = exports.BasePdf = exports.Font = exports.SchemaForUI = exports.Schema = exports.Size = exports.Dict = exports.Lang = void 0;
|
4
4
|
const zod_1 = require("zod");
|
5
5
|
const langs = ['en', 'ja', 'ar', 'th', 'pl', 'it'];
|
6
6
|
exports.Lang = zod_1.z.enum(langs);
|
7
|
+
exports.Dict = zod_1.z.object({
|
8
|
+
// -----------------used in ui-----------------
|
9
|
+
cancel: zod_1.z.string(),
|
10
|
+
field: zod_1.z.string(),
|
11
|
+
fieldName: zod_1.z.string(),
|
12
|
+
align: zod_1.z.string(),
|
13
|
+
width: zod_1.z.string(),
|
14
|
+
height: zod_1.z.string(),
|
15
|
+
rotate: zod_1.z.string(),
|
16
|
+
edit: zod_1.z.string(),
|
17
|
+
plsInputName: zod_1.z.string(),
|
18
|
+
fieldMustUniq: zod_1.z.string(),
|
19
|
+
notUniq: zod_1.z.string(),
|
20
|
+
noKeyName: zod_1.z.string(),
|
21
|
+
fieldsList: zod_1.z.string(),
|
22
|
+
addNewField: zod_1.z.string(),
|
23
|
+
editField: zod_1.z.string(),
|
24
|
+
type: zod_1.z.string(),
|
25
|
+
errorOccurred: zod_1.z.string(),
|
26
|
+
errorBulkUpdateFieldName: zod_1.z.string(),
|
27
|
+
commitBulkUpdateFieldName: zod_1.z.string(),
|
28
|
+
bulkUpdateFieldName: zod_1.z.string(),
|
29
|
+
// -----------------used in schemas-----------------
|
30
|
+
'schemas.textColor': zod_1.z.string(),
|
31
|
+
'schemas.bgColor': zod_1.z.string(),
|
32
|
+
'schemas.horizontal': zod_1.z.string(),
|
33
|
+
'schemas.vertical': zod_1.z.string(),
|
34
|
+
'schemas.left': zod_1.z.string(),
|
35
|
+
'schemas.center': zod_1.z.string(),
|
36
|
+
'schemas.right': zod_1.z.string(),
|
37
|
+
'schemas.top': zod_1.z.string(),
|
38
|
+
'schemas.middle': zod_1.z.string(),
|
39
|
+
'schemas.bottom': zod_1.z.string(),
|
40
|
+
'schemas.text.fontName': zod_1.z.string(),
|
41
|
+
'schemas.text.size': zod_1.z.string(),
|
42
|
+
'schemas.text.spacing': zod_1.z.string(),
|
43
|
+
'schemas.text.textAlign': zod_1.z.string(),
|
44
|
+
'schemas.text.verticalAlign': zod_1.z.string(),
|
45
|
+
'schemas.text.lineHeight': zod_1.z.string(),
|
46
|
+
'schemas.text.min': zod_1.z.string(),
|
47
|
+
'schemas.text.max': zod_1.z.string(),
|
48
|
+
'schemas.text.fit': zod_1.z.string(),
|
49
|
+
'schemas.text.dynamicFontSize': zod_1.z.string(),
|
50
|
+
'schemas.barcodes.barColor': zod_1.z.string(),
|
51
|
+
});
|
7
52
|
exports.Size = zod_1.z.object({ height: zod_1.z.number(), width: zod_1.z.number() });
|
8
53
|
exports.Schema = zod_1.z
|
9
54
|
.object({
|
@@ -48,7 +93,11 @@ exports.GenerateProps = CommonProps.extend({
|
|
48
93
|
options: exports.GeneratorOptions.optional(),
|
49
94
|
}).strict();
|
50
95
|
// ---------------------ui------------------------
|
51
|
-
exports.UIOptions = CommonOptions.extend({
|
96
|
+
exports.UIOptions = CommonOptions.extend({
|
97
|
+
lang: exports.Lang.optional(),
|
98
|
+
labels: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional(),
|
99
|
+
theme: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional(),
|
100
|
+
});
|
52
101
|
const HTMLElementSchema = zod_1.z.any().refine((v) => v instanceof HTMLElement);
|
53
102
|
exports.UIProps = CommonProps.extend({
|
54
103
|
domContainer: HTMLElementSchema,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/schema.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAExB,MAAM,KAAK,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAU,CAAC;AAE/C,QAAA,IAAI,GAAG,OAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/schema.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAExB,MAAM,KAAK,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAU,CAAC;AAE/C,QAAA,IAAI,GAAG,OAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACrB,QAAA,IAAI,GAAG,OAAC,CAAC,MAAM,CAAC;IAC3B,+CAA+C;IAC/C,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE;IAClB,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE;IACjB,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE;IACrB,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE;IACjB,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE;IACjB,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE;IAClB,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE;IAClB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;IAChB,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE;IACxB,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE;IACzB,OAAO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,EAAE,MAAM,EAAE,cAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;AAE3D,QAAA,aAAa,GAAG,eAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC"}
|
@@ -1,12 +1,3 @@
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
8
|
-
});
|
9
|
-
};
|
10
1
|
import { readFileSync } from 'fs';
|
11
2
|
import * as path from 'path';
|
12
3
|
import { mm2pt, pt2mm, pt2px, checkFont, checkPlugins } from '../src/helper';
|
@@ -205,8 +196,8 @@ Check this document: https://pdfme.com/docs/custom-fonts`);
|
|
205
196
|
describe('checkPlugins test', () => {
|
206
197
|
const plugins = {
|
207
198
|
myText: {
|
208
|
-
pdf: () =>
|
209
|
-
ui: () =>
|
199
|
+
pdf: async () => { },
|
200
|
+
ui: async () => { },
|
210
201
|
propPanel: {
|
211
202
|
schema: {},
|
212
203
|
defaultValue: '',
|
@@ -214,8 +205,8 @@ describe('checkPlugins test', () => {
|
|
214
205
|
},
|
215
206
|
},
|
216
207
|
myImage: {
|
217
|
-
pdf: () =>
|
218
|
-
ui: () =>
|
208
|
+
pdf: async () => { },
|
209
|
+
ui: async () => { },
|
219
210
|
propPanel: {
|
220
211
|
schema: {},
|
221
212
|
defaultValue: '',
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"helper.test.js","sourceRoot":"","sources":["../../../__tests__/helper.test.ts"],"names":[],"mappings":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AC,CAAC,CAAC,IAAI,GAAG,MAAM,CAAC;YACpC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,OAAO,CAAC;YACrC,YAAY,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;YACpC,IAAI,EAAE,CAAC;SACR;QAAC,OAAO,CAAM,EAAE;YACf,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,CACvB,yEAAyE,CAC1E,CAAC;SACH;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/esm/src/helper.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { z } from 'zod';
|
2
2
|
import { Buffer } from 'buffer';
|
3
|
-
import { Inputs as InputsSchema, UIOptions as UIOptionsSchema, Template as TemplateSchema, PreviewProps as PreviewPropsSchema, DesignerProps as DesignerPropsSchema, GenerateProps as GeneratePropsSchema, UIProps as UIPropsSchema, } from './schema';
|
4
|
-
import { MM_TO_PT_RATIO, PT_TO_MM_RATIO, PT_TO_PX_RATIO, DEFAULT_FONT_NAME, DEFAULT_FONT_VALUE, } from './constants';
|
3
|
+
import { Inputs as InputsSchema, UIOptions as UIOptionsSchema, Template as TemplateSchema, PreviewProps as PreviewPropsSchema, DesignerProps as DesignerPropsSchema, GenerateProps as GeneratePropsSchema, UIProps as UIPropsSchema, } from './schema.js';
|
4
|
+
import { MM_TO_PT_RATIO, PT_TO_MM_RATIO, PT_TO_PX_RATIO, DEFAULT_FONT_NAME, DEFAULT_FONT_VALUE, } from './constants.js';
|
5
5
|
const uniq = (array) => Array.from(new Set(array));
|
6
6
|
export const getFallbackFontName = (font) => {
|
7
7
|
const initial = '';
|
@@ -63,7 +63,7 @@ export const b64toUint8Array = (base64) => {
|
|
63
63
|
return unit8arr;
|
64
64
|
};
|
65
65
|
const getFontNamesInSchemas = (schemas) => uniq(schemas
|
66
|
-
.map((s) => Object.values(s).map((v) =>
|
66
|
+
.map((s) => Object.values(s).map((v) => v.fontName ?? ''))
|
67
67
|
.reduce((acc, cur) => acc.concat(cur), [])
|
68
68
|
.filter(Boolean));
|
69
69
|
export const checkFont = (arg) => {
|
@@ -90,7 +90,7 @@ Check this document: https://pdfme.com/docs/custom-fonts`);
|
|
90
90
|
export const checkPlugins = (arg) => {
|
91
91
|
const { plugins, template: { schemas }, } = arg;
|
92
92
|
const allSchemaTypes = uniq(schemas.map((s) => Object.values(s).map((v) => v.type)).flat());
|
93
|
-
const pluginsSchemaTypes = Object.values(plugins).map((p) => p
|
93
|
+
const pluginsSchemaTypes = Object.values(plugins).map((p) => p?.propPanel.defaultSchema.type);
|
94
94
|
if (allSchemaTypes.some((s) => !pluginsSchemaTypes.includes(s))) {
|
95
95
|
throw Error(`[@pdfme/common] ${allSchemaTypes
|
96
96
|
.filter((s) => !pluginsSchemaTypes.includes(s))
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../../../src/helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EACL,MAAM,IAAI,YAAY,EACtB,SAAS,IAAI,eAAe,EAC5B,QAAQ,IAAI,cAAc,EAC1B,YAAY,IAAI,kBAAkB,EAClC,aAAa,IAAI,mBAAmB,EACpC,aAAa,IAAI,mBAAmB,EACpC,OAAO,IAAI,aAAa,GACzB,MAAM,
|
1
|
+
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../../../src/helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EACL,MAAM,IAAI,YAAY,EACtB,SAAS,IAAI,eAAe,EAC5B,QAAQ,IAAI,cAAc,EAC1B,YAAY,IAAI,kBAAkB,EACl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,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,cAAc,EACd,cAAc,EACd,SAAS,EACT,IAAI,EACJ,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,cAAc,EACd,cAAc,EACd,SAAS,EACT,IAAI,EACJ,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AAyBxB,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,aAAa,EACb,eAAe,EACf,SAAS,EACT,WAAW,EACX,cAAc,EACd,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,KAAK,EACL,KAAK,EACL,KAAK,GACN,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,cAAc,EACd,cAAc,EACd,cAAc,EACd,SAAS,EACT,IAAI,EACJ,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,aAAa,EACb,eAAe,EACf,KAAK,EACL,KAAK,EACL,KAAK,EACL,SAAS,EACT,WAAW,EACX,cAAc,EACd,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,GACnB,CAAC"}
|
package/dist/esm/src/schema.js
CHANGED
@@ -1,6 +1,51 @@
|
|
1
1
|
import { z } from 'zod';
|
2
2
|
const langs = ['en', 'ja', 'ar', 'th', 'pl', 'it'];
|
3
3
|
export const Lang = z.enum(langs);
|
4
|
+
export const Dict = z.object({
|
5
|
+
// -----------------used in ui-----------------
|
6
|
+
cancel: z.string(),
|
7
|
+
field: z.string(),
|
8
|
+
fieldName: z.string(),
|
9
|
+
align: z.string(),
|
10
|
+
width: z.string(),
|
11
|
+
height: z.string(),
|
12
|
+
rotate: z.string(),
|
13
|
+
edit: z.string(),
|
14
|
+
plsInputName: z.string(),
|
15
|
+
fieldMustUniq: z.string(),
|
16
|
+
notUniq: z.string(),
|
17
|
+
noKeyName: z.string(),
|
18
|
+
fieldsList: z.string(),
|
19
|
+
addNewField: z.string(),
|
20
|
+
editField: z.string(),
|
21
|
+
type: z.string(),
|
22
|
+
errorOccurred: z.string(),
|
23
|
+
errorBulkUpdateFieldName: z.string(),
|
24
|
+
commitBulkUpdateFieldName: z.string(),
|
25
|
+
bulkUpdateFieldName: z.string(),
|
26
|
+
// -----------------used in schemas-----------------
|
27
|
+
'schemas.textColor': z.string(),
|
28
|
+
'schemas.bgColor': z.string(),
|
29
|
+
'schemas.horizontal': z.string(),
|
30
|
+
'schemas.vertical': z.string(),
|
31
|
+
'schemas.left': z.string(),
|
32
|
+
'schemas.center': z.string(),
|
33
|
+
'schemas.right': z.string(),
|
34
|
+
'schemas.top': z.string(),
|
35
|
+
'schemas.middle': z.string(),
|
36
|
+
'schemas.bottom': z.string(),
|
37
|
+
'schemas.text.fontName': z.string(),
|
38
|
+
'schemas.text.size': z.string(),
|
39
|
+
'schemas.text.spacing': z.string(),
|
40
|
+
'schemas.text.textAlign': z.string(),
|
41
|
+
'schemas.text.verticalAlign': z.string(),
|
42
|
+
'schemas.text.lineHeight': z.string(),
|
43
|
+
'schemas.text.min': z.string(),
|
44
|
+
'schemas.text.max': z.string(),
|
45
|
+
'schemas.text.fit': z.string(),
|
46
|
+
'schemas.text.dynamicFontSize': z.string(),
|
47
|
+
'schemas.barcodes.barColor': z.string(),
|
48
|
+
});
|
4
49
|
export const Size = z.object({ height: z.number(), width: z.number() });
|
5
50
|
export const Schema = z
|
6
51
|
.object({
|
@@ -45,7 +90,11 @@ export const GenerateProps = CommonProps.extend({
|
|
45
90
|
options: GeneratorOptions.optional(),
|
46
91
|
}).strict();
|
47
92
|
// ---------------------ui------------------------
|
48
|
-
export const UIOptions = CommonOptions.extend({
|
93
|
+
export const UIOptions = CommonOptions.extend({
|
94
|
+
lang: Lang.optional(),
|
95
|
+
labels: z.record(z.string(), z.string()).optional(),
|
96
|
+
theme: z.record(z.string(), z.unknown()).optional(),
|
97
|
+
});
|
49
98
|
const HTMLElementSchema = z.any().refine((v) => v instanceof HTMLElement);
|
50
99
|
export const UIProps = CommonProps.extend({
|
51
100
|
domContainer: HTMLElementSchema,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,KAAK,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAU,CAAC;AAE5D,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,KAAK,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAU,CAAC;AAE5D,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAClC,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,+CAA+C;IAC/C,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,MAAM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C,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,YAAY,WAAW,CAAC,CAAC;AAEpG,MAAM,CAAC,MAAM,OAAO,GAAG,WAAW,CAAC,MAAM,CAAC;IACxC,YAAY,EAAE,iBAAiB;IAC/B,OAAO,EAAE,SAAS,CAAC,QAAQ,EAAE;CAC9B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;AAExE,MAAM,CAAC,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { MM_TO_PT_RATIO, PT_TO_MM_RATIO, PT_TO_PX_RATIO, BLANK_PDF, ZOOM, DEFAULT_FONT_NAME } from './constants.js';
|
2
|
-
import type { ChangeSchemas, PropPanel, PropPanelSchema, PropPanelWidgetProps, PDFRenderProps, UIRenderProps, Plugin, Lang, Size, Schema, SchemaForUI, Font, BasePdf, Template, GeneratorOptions, Plugins, GenerateProps, UIOptions, UIProps, PreviewProps, DesignerProps } from './types.js';
|
2
|
+
import type { ChangeSchemas, PropPanel, PropPanelSchema, PropPanelWidgetProps, PDFRenderProps, UIRenderProps, Plugin, Lang, Dict, Size, Schema, SchemaForUI, Font, BasePdf, Template, GeneratorOptions, Plugins, GenerateProps, UIOptions, UIProps, PreviewProps, DesignerProps } from './types.js';
|
3
3
|
import { getFallbackFontName, getDefaultFont, getB64BasePdf, b64toUint8Array, checkFont, checkInputs, checkUIOptions, checkTemplate, checkUIProps, checkPreviewProps, checkDesignerProps, checkGenerateProps, mm2pt, pt2mm, pt2px } from './helper.js';
|
4
4
|
export { MM_TO_PT_RATIO, PT_TO_MM_RATIO, PT_TO_PX_RATIO, BLANK_PDF, ZOOM, DEFAULT_FONT_NAME, getFallbackFontName, getDefaultFont, getB64BasePdf, b64toUint8Array, mm2pt, pt2mm, pt2px, checkFont, checkInputs, checkUIOptions, checkTemplate, checkUIProps, checkPreviewProps, checkDesignerProps, checkGenerateProps, };
|
5
|
-
export type { Lang, Size, Schema, SchemaForUI, Font, BasePdf, Template, GeneratorOptions, Plugins, GenerateProps, UIOptions, UIProps, PreviewProps, DesignerProps, ChangeSchemas, PropPanel, PropPanelSchema, PropPanelWidgetProps, PDFRenderProps, UIRenderProps, Plugin, };
|
5
|
+
export type { Lang, Dict, Size, Schema, SchemaForUI, Font, BasePdf, Template, GeneratorOptions, Plugins, GenerateProps, UIOptions, UIProps, PreviewProps, DesignerProps, ChangeSchemas, PropPanel, PropPanelSchema, PropPanelWidgetProps, PDFRenderProps, UIRenderProps, Plugin, };
|
@@ -1,14 +1,141 @@
|
|
1
1
|
import { z } from 'zod';
|
2
2
|
export declare const Lang: z.ZodEnum<["en", "ja", "ar", "th", "pl", "it"]>;
|
3
|
+
export declare const Dict: z.ZodObject<{
|
4
|
+
cancel: z.ZodString;
|
5
|
+
field: z.ZodString;
|
6
|
+
fieldName: z.ZodString;
|
7
|
+
align: z.ZodString;
|
8
|
+
width: z.ZodString;
|
9
|
+
height: z.ZodString;
|
10
|
+
rotate: z.ZodString;
|
11
|
+
edit: z.ZodString;
|
12
|
+
plsInputName: z.ZodString;
|
13
|
+
fieldMustUniq: z.ZodString;
|
14
|
+
notUniq: z.ZodString;
|
15
|
+
noKeyName: z.ZodString;
|
16
|
+
fieldsList: z.ZodString;
|
17
|
+
addNewField: z.ZodString;
|
18
|
+
editField: z.ZodString;
|
19
|
+
type: z.ZodString;
|
20
|
+
errorOccurred: z.ZodString;
|
21
|
+
errorBulkUpdateFieldName: z.ZodString;
|
22
|
+
commitBulkUpdateFieldName: z.ZodString;
|
23
|
+
bulkUpdateFieldName: z.ZodString;
|
24
|
+
'schemas.textColor': z.ZodString;
|
25
|
+
'schemas.bgColor': z.ZodString;
|
26
|
+
'schemas.horizontal': z.ZodString;
|
27
|
+
'schemas.vertical': z.ZodString;
|
28
|
+
'schemas.left': z.ZodString;
|
29
|
+
'schemas.center': z.ZodString;
|
30
|
+
'schemas.right': z.ZodString;
|
31
|
+
'schemas.top': z.ZodString;
|
32
|
+
'schemas.middle': z.ZodString;
|
33
|
+
'schemas.bottom': z.ZodString;
|
34
|
+
'schemas.text.fontName': z.ZodString;
|
35
|
+
'schemas.text.size': z.ZodString;
|
36
|
+
'schemas.text.spacing': z.ZodString;
|
37
|
+
'schemas.text.textAlign': z.ZodString;
|
38
|
+
'schemas.text.verticalAlign': z.ZodString;
|
39
|
+
'schemas.text.lineHeight': z.ZodString;
|
40
|
+
'schemas.text.min': z.ZodString;
|
41
|
+
'schemas.text.max': z.ZodString;
|
42
|
+
'schemas.text.fit': z.ZodString;
|
43
|
+
'schemas.text.dynamicFontSize': z.ZodString;
|
44
|
+
'schemas.barcodes.barColor': z.ZodString;
|
45
|
+
}, "strip", z.ZodTypeAny, {
|
46
|
+
cancel: string;
|
47
|
+
field: string;
|
48
|
+
fieldName: string;
|
49
|
+
align: string;
|
50
|
+
width: string;
|
51
|
+
height: string;
|
52
|
+
rotate: string;
|
53
|
+
edit: string;
|
54
|
+
plsInputName: string;
|
55
|
+
fieldMustUniq: string;
|
56
|
+
notUniq: string;
|
57
|
+
noKeyName: string;
|
58
|
+
fieldsList: string;
|
59
|
+
addNewField: string;
|
60
|
+
editField: string;
|
61
|
+
type: string;
|
62
|
+
errorOccurred: string;
|
63
|
+
errorBulkUpdateFieldName: string;
|
64
|
+
commitBulkUpdateFieldName: string;
|
65
|
+
bulkUpdateFieldName: string;
|
66
|
+
'schemas.textColor': string;
|
67
|
+
'schemas.bgColor': string;
|
68
|
+
'schemas.horizontal': string;
|
69
|
+
'schemas.vertical': string;
|
70
|
+
'schemas.left': string;
|
71
|
+
'schemas.center': string;
|
72
|
+
'schemas.right': string;
|
73
|
+
'schemas.top': string;
|
74
|
+
'schemas.middle': string;
|
75
|
+
'schemas.bottom': string;
|
76
|
+
'schemas.text.fontName': string;
|
77
|
+
'schemas.text.size': string;
|
78
|
+
'schemas.text.spacing': string;
|
79
|
+
'schemas.text.textAlign': string;
|
80
|
+
'schemas.text.verticalAlign': string;
|
81
|
+
'schemas.text.lineHeight': string;
|
82
|
+
'schemas.text.min': string;
|
83
|
+
'schemas.text.max': string;
|
84
|
+
'schemas.text.fit': string;
|
85
|
+
'schemas.text.dynamicFontSize': string;
|
86
|
+
'schemas.barcodes.barColor': string;
|
87
|
+
}, {
|
88
|
+
cancel: string;
|
89
|
+
field: string;
|
90
|
+
fieldName: string;
|
91
|
+
align: string;
|
92
|
+
width: string;
|
93
|
+
height: string;
|
94
|
+
rotate: string;
|
95
|
+
edit: string;
|
96
|
+
plsInputName: string;
|
97
|
+
fieldMustUniq: string;
|
98
|
+
notUniq: string;
|
99
|
+
noKeyName: string;
|
100
|
+
fieldsList: string;
|
101
|
+
addNewField: string;
|
102
|
+
editField: string;
|
103
|
+
type: string;
|
104
|
+
errorOccurred: string;
|
105
|
+
errorBulkUpdateFieldName: string;
|
106
|
+
commitBulkUpdateFieldName: string;
|
107
|
+
bulkUpdateFieldName: string;
|
108
|
+
'schemas.textColor': string;
|
109
|
+
'schemas.bgColor': string;
|
110
|
+
'schemas.horizontal': string;
|
111
|
+
'schemas.vertical': string;
|
112
|
+
'schemas.left': string;
|
113
|
+
'schemas.center': string;
|
114
|
+
'schemas.right': string;
|
115
|
+
'schemas.top': string;
|
116
|
+
'schemas.middle': string;
|
117
|
+
'schemas.bottom': string;
|
118
|
+
'schemas.text.fontName': string;
|
119
|
+
'schemas.text.size': string;
|
120
|
+
'schemas.text.spacing': string;
|
121
|
+
'schemas.text.textAlign': string;
|
122
|
+
'schemas.text.verticalAlign': string;
|
123
|
+
'schemas.text.lineHeight': string;
|
124
|
+
'schemas.text.min': string;
|
125
|
+
'schemas.text.max': string;
|
126
|
+
'schemas.text.fit': string;
|
127
|
+
'schemas.text.dynamicFontSize': string;
|
128
|
+
'schemas.barcodes.barColor': string;
|
129
|
+
}>;
|
3
130
|
export declare const Size: z.ZodObject<{
|
4
131
|
height: z.ZodNumber;
|
5
132
|
width: z.ZodNumber;
|
6
133
|
}, "strip", z.ZodTypeAny, {
|
7
|
-
height: number;
|
8
134
|
width: number;
|
9
|
-
}, {
|
10
135
|
height: number;
|
136
|
+
}, {
|
11
137
|
width: number;
|
138
|
+
height: number;
|
12
139
|
}>;
|
13
140
|
export declare const Schema: z.ZodObject<{
|
14
141
|
type: z.ZodString;
|
@@ -57,8 +184,9 @@ export declare const Schema: z.ZodObject<{
|
|
57
184
|
rotate: z.ZodOptional<z.ZodNumber>;
|
58
185
|
}, z.ZodTypeAny, "passthrough">>;
|
59
186
|
export declare const SchemaForUI: z.ZodObject<{
|
60
|
-
height: z.ZodNumber;
|
61
187
|
width: z.ZodNumber;
|
188
|
+
height: z.ZodNumber;
|
189
|
+
rotate: z.ZodOptional<z.ZodNumber>;
|
62
190
|
type: z.ZodString;
|
63
191
|
position: z.ZodObject<{
|
64
192
|
x: z.ZodNumber;
|
@@ -70,13 +198,12 @@ export declare const SchemaForUI: z.ZodObject<{
|
|
70
198
|
x: number;
|
71
199
|
y: number;
|
72
200
|
}>;
|
73
|
-
rotate: z.ZodOptional<z.ZodNumber>;
|
74
201
|
id: z.ZodString;
|
75
202
|
key: z.ZodString;
|
76
203
|
data: z.ZodString;
|
77
204
|
}, "strip", z.ZodTypeAny, {
|
78
|
-
height: number;
|
79
205
|
width: number;
|
206
|
+
height: number;
|
80
207
|
type: string;
|
81
208
|
position: {
|
82
209
|
x: number;
|
@@ -87,8 +214,8 @@ export declare const SchemaForUI: z.ZodObject<{
|
|
87
214
|
key: string;
|
88
215
|
rotate?: number | undefined;
|
89
216
|
}, {
|
90
|
-
height: number;
|
91
217
|
width: number;
|
218
|
+
height: number;
|
92
219
|
type: string;
|
93
220
|
position: {
|
94
221
|
x: number;
|
@@ -499,6 +626,8 @@ export declare const UIOptions: z.ZodObject<{
|
|
499
626
|
subset?: boolean | undefined;
|
500
627
|
}>>>;
|
501
628
|
lang: z.ZodOptional<z.ZodEnum<["en", "ja", "ar", "th", "pl", "it"]>>;
|
629
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
630
|
+
theme: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
502
631
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
503
632
|
font: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
504
633
|
data: z.ZodUnion<[z.ZodString, z.ZodType<ArrayBuffer, z.ZodTypeDef, ArrayBuffer>, z.ZodType<Uint8Array, z.ZodTypeDef, Uint8Array>]>;
|
@@ -514,6 +643,8 @@ export declare const UIOptions: z.ZodObject<{
|
|
514
643
|
subset?: boolean | undefined;
|
515
644
|
}>>>;
|
516
645
|
lang: z.ZodOptional<z.ZodEnum<["en", "ja", "ar", "th", "pl", "it"]>>;
|
646
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
647
|
+
theme: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
517
648
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
518
649
|
font: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
519
650
|
data: z.ZodUnion<[z.ZodString, z.ZodType<ArrayBuffer, z.ZodTypeDef, ArrayBuffer>, z.ZodType<Uint8Array, z.ZodTypeDef, Uint8Array>]>;
|
@@ -529,6 +660,8 @@ export declare const UIOptions: z.ZodObject<{
|
|
529
660
|
subset?: boolean | undefined;
|
530
661
|
}>>>;
|
531
662
|
lang: z.ZodOptional<z.ZodEnum<["en", "ja", "ar", "th", "pl", "it"]>>;
|
663
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
664
|
+
theme: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
532
665
|
}, z.ZodTypeAny, "passthrough">>;
|
533
666
|
export declare const UIProps: z.ZodObject<{
|
534
667
|
template: z.ZodObject<{
|
@@ -651,6 +784,8 @@ export declare const UIProps: z.ZodObject<{
|
|
651
784
|
subset?: boolean | undefined;
|
652
785
|
}>>>;
|
653
786
|
lang: z.ZodOptional<z.ZodEnum<["en", "ja", "ar", "th", "pl", "it"]>>;
|
787
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
788
|
+
theme: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
654
789
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
655
790
|
font: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
656
791
|
data: z.ZodUnion<[z.ZodString, z.ZodType<ArrayBuffer, z.ZodTypeDef, ArrayBuffer>, z.ZodType<Uint8Array, z.ZodTypeDef, Uint8Array>]>;
|
@@ -666,6 +801,8 @@ export declare const UIProps: z.ZodObject<{
|
|
666
801
|
subset?: boolean | undefined;
|
667
802
|
}>>>;
|
668
803
|
lang: z.ZodOptional<z.ZodEnum<["en", "ja", "ar", "th", "pl", "it"]>>;
|
804
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
805
|
+
theme: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
669
806
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
670
807
|
font: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
671
808
|
data: z.ZodUnion<[z.ZodString, z.ZodType<ArrayBuffer, z.ZodTypeDef, ArrayBuffer>, z.ZodType<Uint8Array, z.ZodTypeDef, Uint8Array>]>;
|
@@ -681,6 +818,8 @@ export declare const UIProps: z.ZodObject<{
|
|
681
818
|
subset?: boolean | undefined;
|
682
819
|
}>>>;
|
683
820
|
lang: z.ZodOptional<z.ZodEnum<["en", "ja", "ar", "th", "pl", "it"]>>;
|
821
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
822
|
+
theme: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
684
823
|
}, z.ZodTypeAny, "passthrough">>>;
|
685
824
|
}, "strip", z.ZodTypeAny, {
|
686
825
|
template: {
|
@@ -725,6 +864,8 @@ export declare const UIProps: z.ZodObject<{
|
|
725
864
|
subset?: boolean | undefined;
|
726
865
|
}>>>;
|
727
866
|
lang: z.ZodOptional<z.ZodEnum<["en", "ja", "ar", "th", "pl", "it"]>>;
|
867
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
868
|
+
theme: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
728
869
|
}, z.ZodTypeAny, "passthrough"> | undefined;
|
729
870
|
}, {
|
730
871
|
template: {
|
@@ -769,6 +910,8 @@ export declare const UIProps: z.ZodObject<{
|
|
769
910
|
subset?: boolean | undefined;
|
770
911
|
}>>>;
|
771
912
|
lang: z.ZodOptional<z.ZodEnum<["en", "ja", "ar", "th", "pl", "it"]>>;
|
913
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
914
|
+
theme: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
772
915
|
}, z.ZodTypeAny, "passthrough"> | undefined;
|
773
916
|
}>;
|
774
917
|
export declare const PreviewProps: z.ZodObject<{
|
@@ -787,6 +930,8 @@ export declare const PreviewProps: z.ZodObject<{
|
|
787
930
|
subset?: boolean | undefined;
|
788
931
|
}>>>;
|
789
932
|
lang: z.ZodOptional<z.ZodEnum<["en", "ja", "ar", "th", "pl", "it"]>>;
|
933
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
934
|
+
theme: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
790
935
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
791
936
|
font: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
792
937
|
data: z.ZodUnion<[z.ZodString, z.ZodType<ArrayBuffer, z.ZodTypeDef, ArrayBuffer>, z.ZodType<Uint8Array, z.ZodTypeDef, Uint8Array>]>;
|
@@ -802,6 +947,8 @@ export declare const PreviewProps: z.ZodObject<{
|
|
802
947
|
subset?: boolean | undefined;
|
803
948
|
}>>>;
|
804
949
|
lang: z.ZodOptional<z.ZodEnum<["en", "ja", "ar", "th", "pl", "it"]>>;
|
950
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
951
|
+
theme: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
805
952
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
806
953
|
font: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
807
954
|
data: z.ZodUnion<[z.ZodString, z.ZodType<ArrayBuffer, z.ZodTypeDef, ArrayBuffer>, z.ZodType<Uint8Array, z.ZodTypeDef, Uint8Array>]>;
|
@@ -817,6 +964,8 @@ export declare const PreviewProps: z.ZodObject<{
|
|
817
964
|
subset?: boolean | undefined;
|
818
965
|
}>>>;
|
819
966
|
lang: z.ZodOptional<z.ZodEnum<["en", "ja", "ar", "th", "pl", "it"]>>;
|
967
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
968
|
+
theme: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
820
969
|
}, z.ZodTypeAny, "passthrough">>>;
|
821
970
|
template: z.ZodObject<{
|
822
971
|
schemas: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodObject<{
|
@@ -963,6 +1112,8 @@ export declare const PreviewProps: z.ZodObject<{
|
|
963
1112
|
subset?: boolean | undefined;
|
964
1113
|
}>>>;
|
965
1114
|
lang: z.ZodOptional<z.ZodEnum<["en", "ja", "ar", "th", "pl", "it"]>>;
|
1115
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
1116
|
+
theme: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
966
1117
|
}, z.ZodTypeAny, "passthrough"> | undefined;
|
967
1118
|
plugins?: Record<string, {
|
968
1119
|
ui?: any;
|
@@ -1008,6 +1159,8 @@ export declare const PreviewProps: z.ZodObject<{
|
|
1008
1159
|
subset?: boolean | undefined;
|
1009
1160
|
}>>>;
|
1010
1161
|
lang: z.ZodOptional<z.ZodEnum<["en", "ja", "ar", "th", "pl", "it"]>>;
|
1162
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
1163
|
+
theme: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
1011
1164
|
}, z.ZodTypeAny, "passthrough"> | undefined;
|
1012
1165
|
plugins?: Record<string, {
|
1013
1166
|
ui?: any;
|
@@ -1031,6 +1184,8 @@ export declare const DesignerProps: z.ZodObject<{
|
|
1031
1184
|
subset?: boolean | undefined;
|
1032
1185
|
}>>>;
|
1033
1186
|
lang: z.ZodOptional<z.ZodEnum<["en", "ja", "ar", "th", "pl", "it"]>>;
|
1187
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
1188
|
+
theme: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
1034
1189
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
1035
1190
|
font: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
1036
1191
|
data: z.ZodUnion<[z.ZodString, z.ZodType<ArrayBuffer, z.ZodTypeDef, ArrayBuffer>, z.ZodType<Uint8Array, z.ZodTypeDef, Uint8Array>]>;
|
@@ -1046,6 +1201,8 @@ export declare const DesignerProps: z.ZodObject<{
|
|
1046
1201
|
subset?: boolean | undefined;
|
1047
1202
|
}>>>;
|
1048
1203
|
lang: z.ZodOptional<z.ZodEnum<["en", "ja", "ar", "th", "pl", "it"]>>;
|
1204
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
1205
|
+
theme: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
1049
1206
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
1050
1207
|
font: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
1051
1208
|
data: z.ZodUnion<[z.ZodString, z.ZodType<ArrayBuffer, z.ZodTypeDef, ArrayBuffer>, z.ZodType<Uint8Array, z.ZodTypeDef, Uint8Array>]>;
|
@@ -1061,6 +1218,8 @@ export declare const DesignerProps: z.ZodObject<{
|
|
1061
1218
|
subset?: boolean | undefined;
|
1062
1219
|
}>>>;
|
1063
1220
|
lang: z.ZodOptional<z.ZodEnum<["en", "ja", "ar", "th", "pl", "it"]>>;
|
1221
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
1222
|
+
theme: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
1064
1223
|
}, z.ZodTypeAny, "passthrough">>>;
|
1065
1224
|
template: z.ZodObject<{
|
1066
1225
|
schemas: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodObject<{
|
@@ -1205,6 +1364,8 @@ export declare const DesignerProps: z.ZodObject<{
|
|
1205
1364
|
subset?: boolean | undefined;
|
1206
1365
|
}>>>;
|
1207
1366
|
lang: z.ZodOptional<z.ZodEnum<["en", "ja", "ar", "th", "pl", "it"]>>;
|
1367
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
1368
|
+
theme: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
1208
1369
|
}, z.ZodTypeAny, "passthrough"> | undefined;
|
1209
1370
|
plugins?: Record<string, {
|
1210
1371
|
ui?: any;
|
@@ -1249,6 +1410,8 @@ export declare const DesignerProps: z.ZodObject<{
|
|
1249
1410
|
subset?: boolean | undefined;
|
1250
1411
|
}>>>;
|
1251
1412
|
lang: z.ZodOptional<z.ZodEnum<["en", "ja", "ar", "th", "pl", "it"]>>;
|
1413
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
1414
|
+
theme: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
1252
1415
|
}, z.ZodTypeAny, "passthrough"> | undefined;
|
1253
1416
|
plugins?: Record<string, {
|
1254
1417
|
ui?: any;
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import { z } from 'zod';
|
2
2
|
import type { PDFPage, PDFDocument } from '@pdfme/pdf-lib';
|
3
|
+
import type { ThemeConfig, GlobalToken } from 'antd';
|
3
4
|
import type { WidgetProps as _PropPanelWidgetProps, Schema as _PropPanelSchema } from 'form-render';
|
4
|
-
import { Lang, Size, Schema, Font, SchemaForUI, BasePdf, Template, GeneratorOptions, GenerateProps, UIOptions, UIProps, PreviewProps, DesignerProps } from './schema.js';
|
5
|
+
import { Lang, Dict, Size, Schema, Font, SchemaForUI, BasePdf, Template, GeneratorOptions, GenerateProps, UIOptions, UIProps, PreviewProps, DesignerProps } from './schema.js';
|
5
6
|
export type PropPanelSchema = _PropPanelSchema;
|
6
7
|
export type ChangeSchemas = (objs: {
|
7
8
|
key: string;
|
@@ -41,6 +42,8 @@ export interface PDFRenderProps<T extends Schema> {
|
|
41
42
|
* @property {(value: string) => void} [onChange] - Used to change the value. Only applicable when the mode is 'form' or 'designer'.
|
42
43
|
* @property {HTMLDivElement} rootElement - The root HTMLDivElement for the UI.
|
43
44
|
* @property {UIOptions} options - Options object passed from the Viewer, Form, or Designer.
|
45
|
+
* @property {ThemeConfig} theme - An object that merges the 'theme' passed as an options with the default theme.
|
46
|
+
* @property {(key: keyof Dict | string) => string} i18n - An object merged based on the options 'lang' and 'labels'.
|
44
47
|
*/
|
45
48
|
export type UIRenderProps<T extends Schema> = {
|
46
49
|
schema: T;
|
@@ -52,7 +55,22 @@ export type UIRenderProps<T extends Schema> = {
|
|
52
55
|
onChange?: (value: string) => void;
|
53
56
|
rootElement: HTMLDivElement;
|
54
57
|
options: UIOptions;
|
58
|
+
theme: GlobalToken;
|
59
|
+
i18n: (key: keyof Dict | string) => string;
|
55
60
|
};
|
61
|
+
/**
|
62
|
+
* Type for properties used in configuring the property panel.
|
63
|
+
*
|
64
|
+
* @property {HTMLDivElement} rootElement - The root HTML element of the property panel.
|
65
|
+
* @property {SchemaForUI} activeSchema - The currently active schema for UI rendering.
|
66
|
+
* @property {HTMLElement[]} activeElements - Array of currently active HTML elements in the UI.
|
67
|
+
* @property {ChangeSchemas} changeSchemas - Function to change multiple schemas simultaneously.
|
68
|
+
* @property {SchemaForUI[]} schemas - Array of schemas for UI rendering.
|
69
|
+
* @property {Size} pageSize - The size of the page being edited.
|
70
|
+
* @property {UIOptions} options - UI options for the property panel.
|
71
|
+
* @property {GlobalToken} theme - The theme configuration used in the UI.
|
72
|
+
* @property {(key: keyof Dict | string) => string} i18n - Internationalization dictionary for UI labels and texts.
|
73
|
+
*/
|
56
74
|
type PropPanelProps = {
|
57
75
|
rootElement: HTMLDivElement;
|
58
76
|
activeSchema: SchemaForUI;
|
@@ -61,6 +79,8 @@ type PropPanelProps = {
|
|
61
79
|
schemas: SchemaForUI[];
|
62
80
|
pageSize: Size;
|
63
81
|
options: UIOptions;
|
82
|
+
theme: GlobalToken;
|
83
|
+
i18n: (key: keyof Dict | string) => string;
|
64
84
|
};
|
65
85
|
export type PropPanelWidgetProps = _PropPanelWidgetProps & PropPanelProps;
|
66
86
|
/**
|
@@ -97,6 +117,7 @@ export type Plugins = {
|
|
97
117
|
[key: string]: Plugin<any> | undefined;
|
98
118
|
};
|
99
119
|
export type Lang = z.infer<typeof Lang>;
|
120
|
+
export type Dict = z.infer<typeof Dict>;
|
100
121
|
export type Size = z.infer<typeof Size>;
|
101
122
|
export type Schema = z.infer<typeof Schema>;
|
102
123
|
export type SchemaForUI = z.infer<typeof SchemaForUI>;
|
@@ -114,7 +135,9 @@ export type GeneratorOptions = z.infer<typeof GeneratorOptions>;
|
|
114
135
|
export type GenerateProps = z.infer<typeof GenerateProps> & {
|
115
136
|
plugins?: Plugins;
|
116
137
|
};
|
117
|
-
export type UIOptions = z.infer<typeof UIOptions
|
138
|
+
export type UIOptions = z.infer<typeof UIOptions> & {
|
139
|
+
theme?: ThemeConfig;
|
140
|
+
};
|
118
141
|
export type UIProps = z.infer<typeof UIProps> & {
|
119
142
|
plugins?: Plugins;
|
120
143
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@pdfme/common",
|
3
|
-
"version": "3.0
|
3
|
+
"version": "3.1.0",
|
4
4
|
"sideEffects": false,
|
5
5
|
"author": "hand-dot",
|
6
6
|
"license": "MIT",
|
@@ -21,13 +21,15 @@
|
|
21
21
|
"bugs": {
|
22
22
|
"url": "https://github.com/pdfme/pdfme/issues"
|
23
23
|
},
|
24
|
+
"type": "module",
|
24
25
|
"main": "dist/cjs/src/index.js",
|
25
26
|
"module": "dist/esm/src/index.js",
|
26
27
|
"types": "dist/types/src/index.d.ts",
|
27
28
|
"exports": {
|
28
29
|
".": {
|
29
30
|
"import": "./dist/esm/src/index.js",
|
30
|
-
"require": "./dist/cjs/src/index.js"
|
31
|
+
"require": "./dist/cjs/src/index.js",
|
32
|
+
"types": "./dist/types/src/index.d.ts"
|
31
33
|
}
|
32
34
|
},
|
33
35
|
"engines": {
|
@@ -35,7 +37,7 @@
|
|
35
37
|
},
|
36
38
|
"scripts": {
|
37
39
|
"develop": "tsc -p tsconfig.esm.json -w",
|
38
|
-
"build": "npm
|
40
|
+
"build": "npm-run-all --parallel build:cjs build:esm",
|
39
41
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|
40
42
|
"build:esm": "tsc -p tsconfig.esm.json",
|
41
43
|
"clean": "rimraf dist",
|
@@ -48,6 +50,7 @@
|
|
48
50
|
},
|
49
51
|
"dependencies": {
|
50
52
|
"@pdfme/pdf-lib": "^1.17.3",
|
53
|
+
"antd": "^5.11.2",
|
51
54
|
"buffer": "^6.0.3",
|
52
55
|
"form-render": "^2.2.20",
|
53
56
|
"zod": "^3.20.2"
|
package/src/helper.ts
CHANGED
@@ -9,14 +9,14 @@ import {
|
|
9
9
|
DesignerProps as DesignerPropsSchema,
|
10
10
|
GenerateProps as GeneratePropsSchema,
|
11
11
|
UIProps as UIPropsSchema,
|
12
|
-
} from './schema';
|
12
|
+
} from './schema.js';
|
13
13
|
import {
|
14
14
|
MM_TO_PT_RATIO,
|
15
15
|
PT_TO_MM_RATIO,
|
16
16
|
PT_TO_PX_RATIO,
|
17
17
|
DEFAULT_FONT_NAME,
|
18
18
|
DEFAULT_FONT_VALUE,
|
19
|
-
} from './constants';
|
19
|
+
} from './constants.js';
|
20
20
|
|
21
21
|
const uniq = <T>(array: Array<T>) => Array.from(new Set(array));
|
22
22
|
|
package/src/index.ts
CHANGED
package/src/schema.ts
CHANGED
@@ -3,6 +3,53 @@ import { z } from 'zod';
|
|
3
3
|
const langs = ['en', 'ja', 'ar', 'th', 'pl', 'it'] as const;
|
4
4
|
|
5
5
|
export const Lang = z.enum(langs);
|
6
|
+
export const Dict = z.object({
|
7
|
+
// -----------------used in ui-----------------
|
8
|
+
cancel: z.string(),
|
9
|
+
field: z.string(),
|
10
|
+
fieldName: z.string(),
|
11
|
+
align: z.string(),
|
12
|
+
width: z.string(),
|
13
|
+
height: z.string(),
|
14
|
+
rotate: z.string(),
|
15
|
+
edit: z.string(),
|
16
|
+
plsInputName: z.string(),
|
17
|
+
fieldMustUniq: z.string(),
|
18
|
+
notUniq: z.string(),
|
19
|
+
noKeyName: z.string(),
|
20
|
+
fieldsList: z.string(),
|
21
|
+
addNewField: z.string(),
|
22
|
+
editField: z.string(),
|
23
|
+
type: z.string(),
|
24
|
+
errorOccurred: z.string(),
|
25
|
+
errorBulkUpdateFieldName: z.string(),
|
26
|
+
commitBulkUpdateFieldName: z.string(),
|
27
|
+
bulkUpdateFieldName: z.string(),
|
28
|
+
// -----------------used in schemas-----------------
|
29
|
+
'schemas.textColor': z.string(),
|
30
|
+
'schemas.bgColor': z.string(),
|
31
|
+
'schemas.horizontal': z.string(),
|
32
|
+
'schemas.vertical': z.string(),
|
33
|
+
'schemas.left': z.string(),
|
34
|
+
'schemas.center': z.string(),
|
35
|
+
'schemas.right': z.string(),
|
36
|
+
'schemas.top': z.string(),
|
37
|
+
'schemas.middle': z.string(),
|
38
|
+
'schemas.bottom': z.string(),
|
39
|
+
|
40
|
+
'schemas.text.fontName': z.string(),
|
41
|
+
'schemas.text.size': z.string(),
|
42
|
+
'schemas.text.spacing': z.string(),
|
43
|
+
'schemas.text.textAlign': z.string(),
|
44
|
+
'schemas.text.verticalAlign': z.string(),
|
45
|
+
'schemas.text.lineHeight': z.string(),
|
46
|
+
'schemas.text.min': z.string(),
|
47
|
+
'schemas.text.max': z.string(),
|
48
|
+
'schemas.text.fit': z.string(),
|
49
|
+
'schemas.text.dynamicFontSize': z.string(),
|
50
|
+
|
51
|
+
'schemas.barcodes.barColor': z.string(),
|
52
|
+
});
|
6
53
|
|
7
54
|
export const Size = z.object({ height: z.number(), width: z.number() });
|
8
55
|
|
@@ -64,7 +111,11 @@ export const GenerateProps = CommonProps.extend({
|
|
64
111
|
|
65
112
|
// ---------------------ui------------------------
|
66
113
|
|
67
|
-
export const UIOptions = CommonOptions.extend({
|
114
|
+
export const UIOptions = CommonOptions.extend({
|
115
|
+
lang: Lang.optional(),
|
116
|
+
labels: z.record(z.string(), z.string()).optional(),
|
117
|
+
theme: z.record(z.string(), z.unknown()).optional(),
|
118
|
+
});
|
68
119
|
|
69
120
|
const HTMLElementSchema: z.ZodSchema<HTMLElement> = z.any().refine((v) => v instanceof HTMLElement);
|
70
121
|
|
package/src/types.ts
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
import { z } from 'zod';
|
2
2
|
import type { PDFPage, PDFDocument } from '@pdfme/pdf-lib';
|
3
|
+
import type { ThemeConfig, GlobalToken } from 'antd';
|
3
4
|
import type { WidgetProps as _PropPanelWidgetProps, Schema as _PropPanelSchema } from 'form-render';
|
4
5
|
// prettier-ignore
|
5
|
-
import {Lang, Size, Schema, Font, SchemaForUI, BasePdf, Template, GeneratorOptions, GenerateProps, UIOptions, UIProps, PreviewProps, DesignerProps} from './schema.js';
|
6
|
+
import {Lang, Dict, Size, Schema, Font, SchemaForUI, BasePdf, Template, GeneratorOptions, GenerateProps, UIOptions, UIProps, PreviewProps, DesignerProps} from './schema.js';
|
6
7
|
|
7
8
|
export type PropPanelSchema = _PropPanelSchema;
|
8
9
|
export type ChangeSchemas = (objs: { key: string; value: any; schemaId: string }[]) => void;
|
@@ -42,6 +43,8 @@ export interface PDFRenderProps<T extends Schema> {
|
|
42
43
|
* @property {(value: string) => void} [onChange] - Used to change the value. Only applicable when the mode is 'form' or 'designer'.
|
43
44
|
* @property {HTMLDivElement} rootElement - The root HTMLDivElement for the UI.
|
44
45
|
* @property {UIOptions} options - Options object passed from the Viewer, Form, or Designer.
|
46
|
+
* @property {ThemeConfig} theme - An object that merges the 'theme' passed as an options with the default theme.
|
47
|
+
* @property {(key: keyof Dict | string) => string} i18n - An object merged based on the options 'lang' and 'labels'.
|
45
48
|
*/
|
46
49
|
export type UIRenderProps<T extends Schema> = {
|
47
50
|
schema: T;
|
@@ -53,8 +56,23 @@ export type UIRenderProps<T extends Schema> = {
|
|
53
56
|
onChange?: (value: string) => void;
|
54
57
|
rootElement: HTMLDivElement;
|
55
58
|
options: UIOptions;
|
59
|
+
theme: GlobalToken;
|
60
|
+
i18n: (key: keyof Dict | string) => string;
|
56
61
|
};
|
57
62
|
|
63
|
+
/**
|
64
|
+
* Type for properties used in configuring the property panel.
|
65
|
+
*
|
66
|
+
* @property {HTMLDivElement} rootElement - The root HTML element of the property panel.
|
67
|
+
* @property {SchemaForUI} activeSchema - The currently active schema for UI rendering.
|
68
|
+
* @property {HTMLElement[]} activeElements - Array of currently active HTML elements in the UI.
|
69
|
+
* @property {ChangeSchemas} changeSchemas - Function to change multiple schemas simultaneously.
|
70
|
+
* @property {SchemaForUI[]} schemas - Array of schemas for UI rendering.
|
71
|
+
* @property {Size} pageSize - The size of the page being edited.
|
72
|
+
* @property {UIOptions} options - UI options for the property panel.
|
73
|
+
* @property {GlobalToken} theme - The theme configuration used in the UI.
|
74
|
+
* @property {(key: keyof Dict | string) => string} i18n - Internationalization dictionary for UI labels and texts.
|
75
|
+
*/
|
58
76
|
type PropPanelProps = {
|
59
77
|
rootElement: HTMLDivElement;
|
60
78
|
activeSchema: SchemaForUI;
|
@@ -63,7 +81,10 @@ type PropPanelProps = {
|
|
63
81
|
schemas: SchemaForUI[];
|
64
82
|
pageSize: Size;
|
65
83
|
options: UIOptions;
|
84
|
+
theme: GlobalToken;
|
85
|
+
i18n: (key: keyof Dict | string) => string;
|
66
86
|
};
|
87
|
+
|
67
88
|
export type PropPanelWidgetProps = _PropPanelWidgetProps & PropPanelProps;
|
68
89
|
|
69
90
|
/**
|
@@ -102,6 +123,7 @@ export type Plugin<T extends Schema & { [key: string]: any }> = {
|
|
102
123
|
export type Plugins = { [key: string]: Plugin<any> | undefined };
|
103
124
|
|
104
125
|
export type Lang = z.infer<typeof Lang>;
|
126
|
+
export type Dict = z.infer<typeof Dict>;
|
105
127
|
export type Size = z.infer<typeof Size>;
|
106
128
|
export type Schema = z.infer<typeof Schema>;
|
107
129
|
export type SchemaForUI = z.infer<typeof SchemaForUI>;
|
@@ -118,7 +140,7 @@ export type BasePdf = z.infer<typeof BasePdf>;
|
|
118
140
|
export type Template = z.infer<typeof Template>;
|
119
141
|
export type GeneratorOptions = z.infer<typeof GeneratorOptions>;
|
120
142
|
export type GenerateProps = z.infer<typeof GenerateProps> & { plugins?: Plugins };
|
121
|
-
export type UIOptions = z.infer<typeof UIOptions
|
143
|
+
export type UIOptions = z.infer<typeof UIOptions> & { theme?: ThemeConfig };
|
122
144
|
export type UIProps = z.infer<typeof UIProps> & { plugins?: Plugins };
|
123
145
|
export type PreviewProps = z.infer<typeof PreviewProps> & { plugins?: Plugins };
|
124
146
|
export type DesignerProps = z.infer<typeof DesignerProps> & { plugins?: Plugins };
|