@pdfme/common 3.2.3-dev.1 → 4.0.0-alpha.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.
@@ -2,7 +2,7 @@ import { z } from 'zod';
2
2
  import type { PDFPage, PDFDocument } from '@pdfme/pdf-lib';
3
3
  import type { ThemeConfig, GlobalToken } from 'antd';
4
4
  import type { WidgetProps as _PropPanelWidgetProps, Schema as _PropPanelSchema } from 'form-render';
5
- import { Lang, Dict, Mode, Size, Schema, Font, SchemaForUI, BasePdf, Template, GeneratorOptions, GenerateProps, UIOptions, UIProps, PreviewProps, DesignerProps } from './schema.js';
5
+ import { Lang, Dict, Mode, Size, Schema, Font, SchemaForUI, BasePdf, BlankPdf, CommonOptions, Template, GeneratorOptions, GenerateProps, UIOptions, UIProps, PreviewProps, DesignerProps } from './schema.js';
6
6
  export type PropPanelSchema = _PropPanelSchema;
7
7
  export type ChangeSchemas = (objs: {
8
8
  key: string;
@@ -15,6 +15,7 @@ export type ChangeSchemas = (objs: {
15
15
  * @property {string} key The key of the schema object.
16
16
  * @property {string} value The string used for PDF rendering.
17
17
  * @property {T} schema Extended Schema object for rendering.
18
+ * @property {BasePdf} basePdf Base PDF object for rendering.
18
19
  * @property {typeof import('@pdfme/pdf-lib')} pdfLib The pdf-lib library used for rendering.
19
20
  * @property {PDFDocument} pdfDoc PDFDocument object from pdf-lib.
20
21
  * @property {PDFPage} page PDFPage object from pdf-lib.
@@ -25,6 +26,7 @@ export interface PDFRenderProps<T extends Schema> {
25
26
  key: string;
26
27
  value: string;
27
28
  schema: T;
29
+ basePdf: BasePdf;
28
30
  pdfLib: typeof import('@pdfme/pdf-lib');
29
31
  pdfDoc: PDFDocument;
30
32
  page: PDFPage;
@@ -36,28 +38,37 @@ export interface PDFRenderProps<T extends Schema> {
36
38
  *
37
39
  * @template T - Type of the extended Schema object.
38
40
  * @property {T} schema - Extended Schema object for rendering.
41
+ * @property {BasePdf} basePdf Base PDF object for rendering.
39
42
  * @property {Mode} mode - String indicating the rendering state. 'designer' is only used when the field is in edit mode in the Designer.
40
43
  * @property {number} [tabIndex] - Tab index for Form.
41
44
  * @property {string} [placeholder] - Placeholder text for Form.
42
45
  * @property {() => void} [stopEditing] - Stops editing mode, can be used when the mode is 'designer'.
43
46
  * @property {string} key - The key of the schema object.
44
47
  * @property {string} value - The string used for UI rendering.
45
- * @property {(value: string) => void} [onChange] - Used to change the value. Only applicable when the mode is 'form' or 'designer'.
48
+ * @property {(arg: { key: string; value: any } | { key: string; value: any }[]) => void} [onChange] - Used to change the value and schema properties. Only applicable when the mode is 'form' or 'designer'.
46
49
  * @property {HTMLDivElement} rootElement - The root HTMLDivElement for the UI.
47
50
  * @property {UIOptions} options - Options object passed from the Viewer, Form, or Designer.
48
51
  * @property {ThemeConfig} theme - An object that merges the 'theme' passed as an options with the default theme.
49
52
  * @property {(key: keyof Dict | string) => string} i18n - An object merged based on the options 'lang' and 'labels'.
53
+ * @property {Size} pageSize - The size of the page being edited.
50
54
  * @property {Map<any, any>} _cache - Cache shared only during the execution of the render function (useful for caching images, etc. if needed).
51
55
  */
52
56
  export type UIRenderProps<T extends Schema> = {
53
57
  schema: T;
58
+ basePdf: BasePdf;
54
59
  mode: Mode;
55
60
  tabIndex?: number;
56
61
  placeholder?: string;
57
62
  stopEditing?: () => void;
58
63
  key: string;
59
64
  value: string;
60
- onChange?: (value: string) => void;
65
+ onChange?: (arg: {
66
+ key: string;
67
+ value: any;
68
+ } | {
69
+ key: string;
70
+ value: any;
71
+ }[]) => void;
61
72
  rootElement: HTMLDivElement;
62
73
  options: UIOptions;
63
74
  theme: GlobalToken;
@@ -83,7 +94,6 @@ type PropPanelProps = {
83
94
  activeElements: HTMLElement[];
84
95
  changeSchemas: ChangeSchemas;
85
96
  schemas: SchemaForUI[];
86
- pageSize: Size;
87
97
  options: UIOptions;
88
98
  theme: GlobalToken;
89
99
  i18n: (key: keyof Dict | string) => string;
@@ -94,13 +104,11 @@ export type PropPanelWidgetProps = _PropPanelWidgetProps & PropPanelProps;
94
104
  * @template T - Type of the extended Schema object.
95
105
  * @property {Record<string, PropPanelSchema> | ((propPanelProps: Omit<PropPanelProps, 'rootElement'>) => Record<string, PropPanelSchema>)} schema - A function returning a form-render schema object or the schema object itself. When a function, it takes properties passed from the designer as arguments.
96
106
  * @property {Record<string, (props: PropPanelWidgetProps) => void>} [widgets] - An object of functions returning form-render widgets. The functions take, as arguments, both form-render's WidgetProps and properties passed from the designer.
97
- * @property {string} defaultValue - The default input value set when adding the schema.
98
107
  * @property {T} defaultSchema - The default schema set when adding the schema.
99
108
  */
100
109
  export interface PropPanel<T extends Schema> {
101
110
  schema: ((propPanelProps: Omit<PropPanelProps, 'rootElement'>) => Record<string, PropPanelSchema>) | Record<string, PropPanelSchema>;
102
111
  widgets?: Record<string, (props: PropPanelWidgetProps) => void>;
103
- defaultValue: string;
104
112
  defaultSchema: T;
105
113
  }
106
114
  /**
@@ -137,7 +145,9 @@ export type SchemaForUI = z.infer<typeof SchemaForUI>;
137
145
  */
138
146
  export type Font = z.infer<typeof Font>;
139
147
  export type BasePdf = z.infer<typeof BasePdf>;
148
+ export type BlankPdf = z.infer<typeof BlankPdf>;
140
149
  export type Template = z.infer<typeof Template>;
150
+ export type CommonOptions = z.infer<typeof CommonOptions>;
141
151
  export type GeneratorOptions = z.infer<typeof GeneratorOptions>;
142
152
  export type GenerateProps = z.infer<typeof GenerateProps> & {
143
153
  plugins?: Plugins;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pdfme/common",
3
- "version": "3.2.3-dev.1",
3
+ "version": "4.0.0-alpha.0",
4
4
  "sideEffects": false,
5
5
  "author": "hand-dot",
6
6
  "license": "MIT",
package/src/constants.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export const PDFME_VERSION = '4-dev';
1
2
  export const PT_TO_PX_RATIO = 1.333;
2
3
  export const PT_TO_MM_RATIO = 0.3528;
3
4
  export const MM_TO_PT_RATIO = 2.8346; // https://www.ddc.co.jp/words/archives/20090701114500.html
package/src/helper.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { Buffer } from 'buffer';
3
- import { Schema, Template, Font, BasePdf, Plugins } from './types';
3
+ import { Schema, Template, Font, BasePdf, Plugins, BlankPdf, CommonOptions } from './types';
4
4
  import {
5
5
  Inputs as InputsSchema,
6
6
  UIOptions as UIOptionsSchema,
@@ -9,6 +9,7 @@ import {
9
9
  DesignerProps as DesignerPropsSchema,
10
10
  GenerateProps as GeneratePropsSchema,
11
11
  UIProps as UIPropsSchema,
12
+ BlankPdf as BlankPdfSchema,
12
13
  } from './schema.js';
13
14
  import {
14
15
  MM_TO_PT_RATIO,
@@ -70,6 +71,19 @@ export const isHexValid = (hex: string): boolean => {
70
71
  return /^#(?:[A-Fa-f0-9]{3,4}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{8})$/i.test(hex);
71
72
  };
72
73
 
74
+ export const getInputFromTemplate = (template: Template): { [key: string]: string }[] => {
75
+ const input: { [key: string]: string } = {};
76
+ template.schemas.forEach((schema) => {
77
+ Object.entries(schema).forEach(([key, value]) => {
78
+ if (!value.readOnly) {
79
+ input[key] = value.content || '';
80
+ }
81
+ });
82
+ });
83
+
84
+ return [input];
85
+ };
86
+
73
87
  export const getB64BasePdf = (basePdf: BasePdf) => {
74
88
  const needFetchFromNetwork =
75
89
  typeof basePdf === 'string' && !basePdf.startsWith('data:application/pdf;');
@@ -85,6 +99,9 @@ export const getB64BasePdf = (basePdf: BasePdf) => {
85
99
  return basePdf as string;
86
100
  };
87
101
 
102
+ export const isBlankPdf = (basePdf: BasePdf): basePdf is BlankPdf =>
103
+ BlankPdfSchema.safeParse(basePdf).success;
104
+
88
105
  const getByteString = (base64: string) => Buffer.from(base64, 'base64').toString('binary');
89
106
 
90
107
  export const b64toUint8Array = (base64: string) => {
@@ -199,3 +216,118 @@ export const checkUIProps = (data: unknown) => checkProps(data, UIPropsSchema);
199
216
  export const checkPreviewProps = (data: unknown) => checkProps(data, PreviewPropsSchema);
200
217
  export const checkDesignerProps = (data: unknown) => checkProps(data, DesignerPropsSchema);
201
218
  export const checkGenerateProps = (data: unknown) => checkProps(data, GeneratePropsSchema);
219
+
220
+ interface ModifyTemplateForDynamicTableArg {
221
+ template: Template;
222
+ input: Record<string, string>;
223
+ _cache: Map<any, any>;
224
+ options: CommonOptions;
225
+ modifyTemplate: (arg: {
226
+ template: Template;
227
+ input: Record<string, string>;
228
+ _cache: Map<any, any>;
229
+ options: CommonOptions;
230
+ }) => Promise<Template>;
231
+ getDynamicHeight: (
232
+ value: string,
233
+ args: { schema: Schema; basePdf: BasePdf; options: CommonOptions; _cache: Map<any, any> }
234
+ ) => Promise<number>;
235
+ }
236
+
237
+ export const getDynamicTemplate = async (
238
+ arg: ModifyTemplateForDynamicTableArg
239
+ ): Promise<Template> => {
240
+ const { template, modifyTemplate } = arg;
241
+ if (!isBlankPdf(template.basePdf)) {
242
+ return template;
243
+ }
244
+
245
+ const modifiedTemplate = await modifyTemplate(arg);
246
+
247
+ const diffMap = await calculateDiffMap({ ...arg, template: modifiedTemplate });
248
+
249
+ return normalizePositionsAndPageBreak(modifiedTemplate, diffMap);
250
+ };
251
+
252
+ export const calculateDiffMap = async (arg: ModifyTemplateForDynamicTableArg) => {
253
+ const { template, input, _cache, options, getDynamicHeight } = arg;
254
+ const basePdf = template.basePdf;
255
+ const tmpDiffMap = new Map<number, number>();
256
+ if (!isBlankPdf(basePdf)) {
257
+ return tmpDiffMap;
258
+ }
259
+ const pageHeight = basePdf.height;
260
+ let pageIndex = 0;
261
+ for (const schemaObj of template.schemas) {
262
+ for (const [key, schema] of Object.entries(schemaObj)) {
263
+ const dynamicHeight = await getDynamicHeight(input?.[key] || '', {
264
+ schema,
265
+ basePdf,
266
+ options,
267
+ _cache,
268
+ });
269
+ if (schema.height !== dynamicHeight) {
270
+ tmpDiffMap.set(
271
+ schema.position.y + schema.height + pageHeight * pageIndex,
272
+ dynamicHeight - schema.height
273
+ );
274
+ }
275
+ }
276
+ pageIndex++;
277
+ }
278
+
279
+ const diffMap = new Map<number, number>();
280
+ const keys = Array.from(tmpDiffMap.keys()).sort((a, b) => a - b);
281
+ let additionalHeight = 0;
282
+
283
+ for (const key of keys) {
284
+ const value = tmpDiffMap.get(key) as number;
285
+ const newValue = value + additionalHeight;
286
+ diffMap.set(key + additionalHeight, newValue);
287
+ additionalHeight += newValue;
288
+ }
289
+
290
+ return diffMap;
291
+ };
292
+
293
+ export const normalizePositionsAndPageBreak = (
294
+ template: Template,
295
+ diffMap: Map<number, number>
296
+ ): Template => {
297
+ if (!isBlankPdf(template.basePdf) || diffMap.size === 0) {
298
+ return template;
299
+ }
300
+
301
+ const returnTemplate: Template = { schemas: [{}], basePdf: template.basePdf };
302
+ const pages = returnTemplate.schemas;
303
+ const pageHeight = template.basePdf.height;
304
+ const paddingTop = template.basePdf.padding[0];
305
+ const paddingBottom = template.basePdf.padding[2];
306
+
307
+ for (let i = 0; i < template.schemas.length; i += 1) {
308
+ const schemaObj = template.schemas[i];
309
+ if (!pages[i]) pages[i] = {};
310
+
311
+ for (const [key, schema] of Object.entries(schemaObj)) {
312
+ const { position, height } = schema;
313
+ let newY = position.y;
314
+ let pageCursor = i;
315
+
316
+ for (const [diffKey, diffValue] of diffMap) {
317
+ if (newY > diffKey) {
318
+ newY += diffValue;
319
+ }
320
+ }
321
+
322
+ while (newY + height >= pageHeight - paddingBottom) {
323
+ newY = newY + paddingTop - (pageHeight - paddingBottom) + paddingTop;
324
+ pageCursor++;
325
+ }
326
+
327
+ if (!pages[pageCursor]) pages[pageCursor] = {};
328
+ pages[pageCursor][key] = { ...schema, position: { ...position, y: newY } };
329
+ }
330
+ }
331
+
332
+ return returnTemplate;
333
+ };
package/src/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import {
2
+ PDFME_VERSION,
2
3
  MM_TO_PT_RATIO,
3
4
  PT_TO_MM_RATIO,
4
5
  PT_TO_PX_RATIO,
@@ -22,7 +23,9 @@ import type {
22
23
  SchemaForUI,
23
24
  Font,
24
25
  BasePdf,
26
+ BlankPdf,
25
27
  Template,
28
+ CommonOptions,
26
29
  GeneratorOptions,
27
30
  Plugins,
28
31
  GenerateProps,
@@ -48,9 +51,13 @@ import {
48
51
  pt2mm,
49
52
  pt2px,
50
53
  isHexValid,
54
+ getInputFromTemplate,
55
+ isBlankPdf,
56
+ getDynamicTemplate,
51
57
  } from './helper.js';
52
58
 
53
59
  export {
60
+ PDFME_VERSION,
54
61
  MM_TO_PT_RATIO,
55
62
  PT_TO_MM_RATIO,
56
63
  PT_TO_PX_RATIO,
@@ -65,6 +72,9 @@ export {
65
72
  pt2mm,
66
73
  pt2px,
67
74
  isHexValid,
75
+ getInputFromTemplate,
76
+ isBlankPdf,
77
+ getDynamicTemplate,
68
78
  checkFont,
69
79
  checkInputs,
70
80
  checkUIOptions,
@@ -83,7 +93,9 @@ export type {
83
93
  SchemaForUI,
84
94
  Font,
85
95
  BasePdf,
96
+ BlankPdf,
86
97
  Template,
98
+ CommonOptions,
87
99
  GeneratorOptions,
88
100
  Plugins,
89
101
  GenerateProps,
package/src/schema.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
 
3
- const langs = ['en', 'ja', 'ar', 'th', 'pl', 'it', 'de'] as const;
3
+ const langs = ['en', 'ja', 'ar', 'th', 'it', 'pl', 'de'] as const;
4
4
 
5
5
  export const Lang = z.enum(langs);
6
6
  export const Dict = z.object({
@@ -26,11 +26,15 @@ export const Dict = z.object({
26
26
  errorBulkUpdateFieldName: z.string(),
27
27
  commitBulkUpdateFieldName: z.string(),
28
28
  bulkUpdateFieldName: z.string(),
29
+ addPageAfter: z.string(),
30
+ removePage: z.string(),
31
+ removePageConfirm: z.string(),
29
32
  hexColorPrompt: z.string(),
30
33
  // -----------------used in schemas-----------------
31
34
  'schemas.color': z.string(),
32
35
  'schemas.borderWidth': z.string(),
33
36
  'schemas.borderColor': z.string(),
37
+ 'schemas.backgroundColor': z.string(),
34
38
  'schemas.textColor': z.string(),
35
39
  'schemas.bgColor': z.string(),
36
40
  'schemas.horizontal': z.string(),
@@ -41,6 +45,7 @@ export const Dict = z.object({
41
45
  'schemas.top': z.string(),
42
46
  'schemas.middle': z.string(),
43
47
  'schemas.bottom': z.string(),
48
+ 'schemas.padding': z.string(),
44
49
 
45
50
  'schemas.text.fontName': z.string(),
46
51
  'schemas.text.size': z.string(),
@@ -55,6 +60,12 @@ export const Dict = z.object({
55
60
 
56
61
  'schemas.barcodes.barColor': z.string(),
57
62
  'schemas.barcodes.includetext': z.string(),
63
+
64
+ 'schemas.table.alternateBackgroundColor': z.string(),
65
+ 'schemas.table.tableStyle': z.string(),
66
+ 'schemas.table.headStyle': z.string(),
67
+ 'schemas.table.bodyStyle': z.string(),
68
+ 'schemas.table.columnStyle': z.string(),
58
69
  });
59
70
  export const Mode = z.enum(['viewer', 'form', 'designer']);
60
71
 
@@ -63,25 +74,41 @@ export const Size = z.object({ height: z.number(), width: z.number() });
63
74
  export const Schema = z
64
75
  .object({
65
76
  type: z.string(),
66
- readOnly: z.boolean().optional(),
67
- readOnlyValue: z.string().optional(),
77
+ content: z.string().optional(),
68
78
  position: z.object({ x: z.number(), y: z.number() }),
69
79
  width: z.number(),
70
80
  height: z.number(),
71
81
  rotate: z.number().optional(),
72
82
  opacity: z.number().optional(),
83
+ readOnly: z.boolean().optional(),
73
84
  })
74
85
  .passthrough();
75
86
 
76
87
  const SchemaForUIAdditionalInfo = z.object({
77
88
  id: z.string(),
78
89
  key: z.string(),
79
- data: z.string(),
80
90
  });
81
91
  export const SchemaForUI = Schema.merge(SchemaForUIAdditionalInfo);
82
92
 
83
93
  const ArrayBufferSchema: z.ZodSchema<ArrayBuffer> = z.any().refine((v) => v instanceof ArrayBuffer);
84
94
  const Uint8ArraySchema: z.ZodSchema<Uint8Array> = z.any().refine((v) => v instanceof Uint8Array);
95
+ export const BlankPdf = z.object({
96
+ width: z.number(),
97
+ height: z.number(),
98
+ padding: z.tuple([z.number(), z.number(), z.number(), z.number()]),
99
+ });
100
+
101
+ export const BasePdf = z.union([z.string(), ArrayBufferSchema, Uint8ArraySchema, BlankPdf]);
102
+
103
+ export const Template = z
104
+ .object({
105
+ schemas: z.array(z.record(Schema)),
106
+ basePdf: BasePdf,
107
+ pdfmeVersion: z.string().optional(),
108
+ })
109
+ .passthrough();
110
+
111
+ export const Inputs = z.array(z.record(z.any())).min(1);
85
112
 
86
113
  export const Font = z.record(
87
114
  z.object({
@@ -91,18 +118,7 @@ export const Font = z.record(
91
118
  })
92
119
  );
93
120
 
94
- export const BasePdf = z.union([z.string(), ArrayBufferSchema, Uint8ArraySchema]);
95
-
96
- export const Template = z.object({
97
- schemas: z.array(z.record(Schema)),
98
- basePdf: BasePdf,
99
- sampledata: z.array(z.record(z.string())).length(1).optional(),
100
- columns: z.array(z.string()).optional(),
101
- });
102
-
103
- export const Inputs = z.array(z.record(z.string())).min(1);
104
-
105
- const CommonOptions = z.object({ font: Font.optional() }).passthrough();
121
+ export const CommonOptions = z.object({ font: Font.optional() }).passthrough();
106
122
 
107
123
  const CommonProps = z.object({
108
124
  template: Template,
package/src/types.ts CHANGED
@@ -11,6 +11,8 @@ import {
11
11
  Font,
12
12
  SchemaForUI,
13
13
  BasePdf,
14
+ BlankPdf,
15
+ CommonOptions,
14
16
  Template,
15
17
  GeneratorOptions,
16
18
  GenerateProps,
@@ -29,6 +31,7 @@ export type ChangeSchemas = (objs: { key: string; value: any; schemaId: string }
29
31
  * @property {string} key The key of the schema object.
30
32
  * @property {string} value The string used for PDF rendering.
31
33
  * @property {T} schema Extended Schema object for rendering.
34
+ * @property {BasePdf} basePdf Base PDF object for rendering.
32
35
  * @property {typeof import('@pdfme/pdf-lib')} pdfLib The pdf-lib library used for rendering.
33
36
  * @property {PDFDocument} pdfDoc PDFDocument object from pdf-lib.
34
37
  * @property {PDFPage} page PDFPage object from pdf-lib.
@@ -39,6 +42,7 @@ export interface PDFRenderProps<T extends Schema> {
39
42
  key: string;
40
43
  value: string;
41
44
  schema: T;
45
+ basePdf: BasePdf;
42
46
  pdfLib: typeof import('@pdfme/pdf-lib');
43
47
  pdfDoc: PDFDocument;
44
48
  page: PDFPage;
@@ -52,28 +56,31 @@ export interface PDFRenderProps<T extends Schema> {
52
56
  *
53
57
  * @template T - Type of the extended Schema object.
54
58
  * @property {T} schema - Extended Schema object for rendering.
59
+ * @property {BasePdf} basePdf Base PDF object for rendering.
55
60
  * @property {Mode} mode - String indicating the rendering state. 'designer' is only used when the field is in edit mode in the Designer.
56
61
  * @property {number} [tabIndex] - Tab index for Form.
57
62
  * @property {string} [placeholder] - Placeholder text for Form.
58
63
  * @property {() => void} [stopEditing] - Stops editing mode, can be used when the mode is 'designer'.
59
64
  * @property {string} key - The key of the schema object.
60
65
  * @property {string} value - The string used for UI rendering.
61
- * @property {(value: string) => void} [onChange] - Used to change the value. Only applicable when the mode is 'form' or 'designer'.
66
+ * @property {(arg: { key: string; value: any } | { key: string; value: any }[]) => void} [onChange] - Used to change the value and schema properties. Only applicable when the mode is 'form' or 'designer'.
62
67
  * @property {HTMLDivElement} rootElement - The root HTMLDivElement for the UI.
63
68
  * @property {UIOptions} options - Options object passed from the Viewer, Form, or Designer.
64
69
  * @property {ThemeConfig} theme - An object that merges the 'theme' passed as an options with the default theme.
65
70
  * @property {(key: keyof Dict | string) => string} i18n - An object merged based on the options 'lang' and 'labels'.
71
+ * @property {Size} pageSize - The size of the page being edited.
66
72
  * @property {Map<any, any>} _cache - Cache shared only during the execution of the render function (useful for caching images, etc. if needed).
67
73
  */
68
74
  export type UIRenderProps<T extends Schema> = {
69
75
  schema: T;
76
+ basePdf: BasePdf;
70
77
  mode: Mode;
71
78
  tabIndex?: number;
72
79
  placeholder?: string;
73
80
  stopEditing?: () => void;
74
81
  key: string;
75
82
  value: string;
76
- onChange?: (value: string) => void;
83
+ onChange?: (arg: { key: string; value: any } | { key: string; value: any }[]) => void;
77
84
  rootElement: HTMLDivElement;
78
85
  options: UIOptions;
79
86
  theme: GlobalToken;
@@ -100,7 +107,6 @@ type PropPanelProps = {
100
107
  activeElements: HTMLElement[];
101
108
  changeSchemas: ChangeSchemas;
102
109
  schemas: SchemaForUI[];
103
- pageSize: Size;
104
110
  options: UIOptions;
105
111
  theme: GlobalToken;
106
112
  i18n: (key: keyof Dict | string) => string;
@@ -113,7 +119,6 @@ export type PropPanelWidgetProps = _PropPanelWidgetProps & PropPanelProps;
113
119
  * @template T - Type of the extended Schema object.
114
120
  * @property {Record<string, PropPanelSchema> | ((propPanelProps: Omit<PropPanelProps, 'rootElement'>) => Record<string, PropPanelSchema>)} schema - A function returning a form-render schema object or the schema object itself. When a function, it takes properties passed from the designer as arguments.
115
121
  * @property {Record<string, (props: PropPanelWidgetProps) => void>} [widgets] - An object of functions returning form-render widgets. The functions take, as arguments, both form-render's WidgetProps and properties passed from the designer.
116
- * @property {string} defaultValue - The default input value set when adding the schema.
117
122
  * @property {T} defaultSchema - The default schema set when adding the schema.
118
123
  */
119
124
  export interface PropPanel<T extends Schema> {
@@ -122,7 +127,6 @@ export interface PropPanel<T extends Schema> {
122
127
  | Record<string, PropPanelSchema>;
123
128
 
124
129
  widgets?: Record<string, (props: PropPanelWidgetProps) => void>;
125
- defaultValue: string;
126
130
  defaultSchema: T;
127
131
  }
128
132
 
@@ -159,7 +163,9 @@ export type SchemaForUI = z.infer<typeof SchemaForUI>;
159
163
  */
160
164
  export type Font = z.infer<typeof Font>;
161
165
  export type BasePdf = z.infer<typeof BasePdf>;
166
+ export type BlankPdf = z.infer<typeof BlankPdf>;
162
167
  export type Template = z.infer<typeof Template>;
168
+ export type CommonOptions = z.infer<typeof CommonOptions>;
163
169
  export type GeneratorOptions = z.infer<typeof GeneratorOptions>;
164
170
  export type GenerateProps = z.infer<typeof GenerateProps> & { plugins?: Plugins };
165
171
  export type UIOptions = z.infer<typeof UIOptions> & { theme?: ThemeConfig };