@pdfme/schemas 5.3.8-dev.29 → 5.3.8-dev.36
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__/barcode.test.js +115 -113
- package/dist/cjs/__tests__/barcode.test.js.map +1 -1
- package/dist/cjs/__tests__/multiVariableText.test.js +15 -15
- package/dist/cjs/__tests__/multiVariableText.test.js.map +1 -1
- package/dist/cjs/__tests__/text.test.js +71 -71
- package/dist/cjs/__tests__/text.test.js.map +1 -1
- package/dist/cjs/src/date/helper.js +99 -67
- package/dist/cjs/src/date/helper.js.map +1 -1
- package/dist/cjs/src/graphics/svg.js +25 -2
- package/dist/cjs/src/graphics/svg.js.map +1 -1
- package/dist/cjs/src/multiVariableText/propPanel.js +5 -5
- package/dist/cjs/src/multiVariableText/propPanel.js.map +1 -1
- package/dist/cjs/src/select/index.js +9 -9
- package/dist/cjs/src/select/index.js.map +1 -1
- package/dist/cjs/src/text/extraFormatter.js +14 -14
- package/dist/cjs/src/text/extraFormatter.js.map +1 -1
- package/dist/cjs/src/utils.js +52 -13
- package/dist/cjs/src/utils.js.map +1 -1
- package/dist/esm/__tests__/barcode.test.js +8 -6
- package/dist/esm/__tests__/barcode.test.js.map +1 -1
- package/dist/esm/__tests__/multiVariableText.test.js +1 -1
- package/dist/esm/__tests__/multiVariableText.test.js.map +1 -1
- package/dist/esm/__tests__/text.test.js +2 -2
- package/dist/esm/__tests__/text.test.js.map +1 -1
- package/dist/esm/src/date/helper.js +66 -34
- package/dist/esm/src/date/helper.js.map +1 -1
- package/dist/esm/src/graphics/svg.js +25 -2
- package/dist/esm/src/graphics/svg.js.map +1 -1
- package/dist/esm/src/multiVariableText/propPanel.js +1 -1
- package/dist/esm/src/multiVariableText/propPanel.js.map +1 -1
- package/dist/esm/src/select/index.js +2 -2
- package/dist/esm/src/select/index.js.map +1 -1
- package/dist/esm/src/text/extraFormatter.js +2 -2
- package/dist/esm/src/text/extraFormatter.js.map +1 -1
- package/dist/esm/src/utils.js +52 -13
- package/dist/esm/src/utils.js.map +1 -1
- package/dist/node/__tests__/barcode.test.js +121 -124
- package/dist/node/__tests__/barcode.test.js.map +1 -1
- package/dist/node/__tests__/multiVariableText.test.js +15 -17
- package/dist/node/__tests__/multiVariableText.test.js.map +1 -1
- package/dist/node/__tests__/text.test.js +77 -102
- package/dist/node/__tests__/text.test.js.map +1 -1
- package/dist/node/__tests__/utils.test.js +33 -35
- package/dist/node/__tests__/utils.test.js.map +1 -1
- package/dist/node/src/barcodes/constants.js +4 -7
- package/dist/node/src/barcodes/constants.js.map +1 -1
- package/dist/node/src/barcodes/helper.js +16 -26
- package/dist/node/src/barcodes/helper.js.map +1 -1
- package/dist/node/src/barcodes/index.js +12 -14
- package/dist/node/src/barcodes/index.js.map +1 -1
- package/dist/node/src/barcodes/pdfRender.js +6 -10
- package/dist/node/src/barcodes/pdfRender.js.map +1 -1
- package/dist/node/src/barcodes/propPanel.js +20 -24
- package/dist/node/src/barcodes/propPanel.js.map +1 -1
- package/dist/node/src/barcodes/types.js +1 -2
- package/dist/node/src/barcodes/uiRender.js +8 -12
- package/dist/node/src/barcodes/uiRender.js.map +1 -1
- package/dist/node/src/checkbox/index.js +12 -17
- package/dist/node/src/checkbox/index.js.map +1 -1
- package/dist/node/src/constants.js +2 -5
- package/dist/node/src/constants.js.map +1 -1
- package/dist/node/src/date/date.js +5 -7
- package/dist/node/src/date/date.js.map +1 -1
- package/dist/node/src/date/dateTime.js +5 -7
- package/dist/node/src/date/dateTime.js.map +1 -1
- package/dist/node/src/date/helper.js +135 -133
- package/dist/node/src/date/helper.js.map +1 -1
- package/dist/node/src/date/time.js +5 -7
- package/dist/node/src/date/time.js.map +1 -1
- package/dist/node/src/date/types.js +1 -2
- package/dist/node/src/graphics/cacheKey.js +1 -5
- package/dist/node/src/graphics/cacheKey.js.map +1 -1
- package/dist/node/src/graphics/image.js +15 -17
- package/dist/node/src/graphics/image.js.map +1 -1
- package/dist/node/src/graphics/imagehelper.js +3 -7
- package/dist/node/src/graphics/imagehelper.js.map +1 -1
- package/dist/node/src/graphics/svg.js +35 -14
- package/dist/node/src/graphics/svg.js.map +1 -1
- package/dist/node/src/index.js +18 -37
- package/dist/node/src/index.js.map +1 -1
- package/dist/node/src/multiVariableText/helper.js +2 -7
- package/dist/node/src/multiVariableText/helper.js.map +1 -1
- package/dist/node/src/multiVariableText/index.js +10 -12
- package/dist/node/src/multiVariableText/index.js.map +1 -1
- package/dist/node/src/multiVariableText/pdfRender.js +6 -10
- package/dist/node/src/multiVariableText/pdfRender.js.map +1 -1
- package/dist/node/src/multiVariableText/propPanel.js +6 -9
- package/dist/node/src/multiVariableText/propPanel.js.map +1 -1
- package/dist/node/src/multiVariableText/types.js +1 -2
- package/dist/node/src/multiVariableText/uiRender.js +13 -17
- package/dist/node/src/multiVariableText/uiRender.js.map +1 -1
- package/dist/node/src/radioGroup/index.js +11 -16
- package/dist/node/src/radioGroup/index.js.map +1 -1
- package/dist/node/src/select/index.js +13 -18
- package/dist/node/src/select/index.js.map +1 -1
- package/dist/node/src/shapes/line.js +10 -12
- package/dist/node/src/shapes/line.js.map +1 -1
- package/dist/node/src/shapes/rectAndEllipse.js +18 -21
- package/dist/node/src/shapes/rectAndEllipse.js.map +1 -1
- package/dist/node/src/tables/cell.js +15 -20
- package/dist/node/src/tables/cell.js.map +1 -1
- package/dist/node/src/tables/classes.js +11 -18
- package/dist/node/src/tables/classes.js.map +1 -1
- package/dist/node/src/tables/dynamicTemplate.js +5 -9
- package/dist/node/src/tables/dynamicTemplate.js.map +1 -1
- package/dist/node/src/tables/helper.js +27 -35
- package/dist/node/src/tables/helper.js.map +1 -1
- package/dist/node/src/tables/index.js +10 -12
- package/dist/node/src/tables/index.js.map +1 -1
- package/dist/node/src/tables/pdfRender.js +9 -16
- package/dist/node/src/tables/pdfRender.js.map +1 -1
- package/dist/node/src/tables/propPanel.js +12 -15
- package/dist/node/src/tables/propPanel.js.map +1 -1
- package/dist/node/src/tables/tableHelper.js +11 -15
- package/dist/node/src/tables/tableHelper.js.map +1 -1
- package/dist/node/src/tables/types.js +1 -2
- package/dist/node/src/tables/uiRender.js +15 -22
- package/dist/node/src/tables/uiRender.js.map +1 -1
- package/dist/node/src/text/constants.js +22 -25
- package/dist/node/src/text/constants.js.map +1 -1
- package/dist/node/src/text/extraFormatter.js +17 -21
- package/dist/node/src/text/extraFormatter.js.map +1 -1
- package/dist/node/src/text/helper.js +48 -85
- package/dist/node/src/text/helper.js.map +1 -1
- package/dist/node/src/text/icons/index.js +11 -14
- package/dist/node/src/text/icons/index.js.map +1 -1
- package/dist/node/src/text/index.js +10 -12
- package/dist/node/src/text/index.js.map +1 -1
- package/dist/node/src/text/pdfRender.js +32 -36
- package/dist/node/src/text/pdfRender.js.map +1 -1
- package/dist/node/src/text/propPanel.js +22 -25
- package/dist/node/src/text/propPanel.js.map +1 -1
- package/dist/node/src/text/types.js +1 -2
- package/dist/node/src/text/uiRender.js +34 -42
- package/dist/node/src/text/uiRender.js.map +1 -1
- package/dist/node/src/utils.js +78 -51
- package/dist/node/src/utils.js.map +1 -1
- package/dist/types/src/barcodes/helper.d.ts +1 -1
- package/dist/types/src/barcodes/index.d.ts +1 -1
- package/dist/types/src/date/types.d.ts +5 -0
- package/dist/types/src/multiVariableText/propPanel.d.ts +1 -1
- package/dist/types/src/select/index.d.ts +1 -1
- package/dist/types/src/text/constants.d.ts +1 -1
- package/dist/types/src/text/helper.d.ts +1 -1
- package/dist/types/src/text/index.d.ts +1 -1
- package/dist/types/src/text/pdfRender.d.ts +1 -1
- package/dist/types/src/text/uiRender.d.ts +1 -1
- package/package.json +3 -3
- package/src/barcodes/helper.ts +1 -1
- package/src/barcodes/index.ts +1 -1
- package/src/date/helper.ts +79 -38
- package/src/date/types.ts +6 -0
- package/src/graphics/svg.ts +27 -2
- package/src/multiVariableText/propPanel.ts +2 -2
- package/src/select/index.ts +3 -3
- package/src/tables/uiRender.ts +1 -1
- package/src/text/constants.ts +1 -1
- package/src/text/extraFormatter.ts +2 -2
- package/src/text/helper.ts +1 -1
- package/src/text/index.ts +1 -1
- package/src/text/pdfRender.ts +1 -1
- package/src/text/uiRender.ts +1 -1
- package/src/utils.ts +62 -19
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/utils.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,EAAE,GAAG,EAAS,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAU,KAAK,EAAQ,UAAU,EAAa,MAAM,eAAe,CAAC;AAE3E,OAAO,EAAE,yBAAyB,IAAI,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AACtG,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,EACvC,MAAM,EACN,UAAU,EACV,oBAAoB,GAAG,IAAI,GAK5B,EAAE,EAAE;IACH,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IAC/E,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,QAAQ,CAAC;IAEpC,MAAM,aAAa,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3C,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;IAC7B,MAAM,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC/B,IAAI,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;IACnB,2FAA2F;IAC3F,IAAI,CAAC,GAAG,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC;IAEzC,IAAI,aAAa,IAAI,oBAAoB,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3
|
export declare const validateBarcodeInput: (type: BarcodeTypes, input: string) => boolean;
|
4
4
|
/**
|
5
5
|
* The bwip.js lib has a different name for nw7 type barcodes
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { BarcodeSchema } from './types';
|
1
|
+
import type { BarcodeSchema } from './types.js';
|
2
2
|
import { Plugin } from '@pdfme/common';
|
3
3
|
declare const barcodes: Record<"qrcode" | "japanpost" | "ean13" | "ean8" | "code39" | "code128" | "nw7" | "itf14" | "upca" | "upce" | "gs1datamatrix", Plugin<BarcodeSchema>>;
|
4
4
|
export default barcodes;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ALIGNMENT, VERTICAL_ALIGNMENT, DYNAMIC_FONT_SIZE_FIT } from './types';
|
1
|
+
import { ALIGNMENT, VERTICAL_ALIGNMENT, DYNAMIC_FONT_SIZE_FIT } from './types.js';
|
2
2
|
export declare const DEFAULT_FONT_SIZE = 13;
|
3
3
|
export declare const ALIGN_LEFT: ALIGNMENT;
|
4
4
|
export declare const ALIGN_CENTER: ALIGNMENT;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import * as fontkit from 'fontkit';
|
2
2
|
import type { Font as FontKitFont } from 'fontkit';
|
3
3
|
import { Font } from '@pdfme/common';
|
4
|
-
import type { TextSchema, FontWidthCalcValues } from './types';
|
4
|
+
import type { TextSchema, FontWidthCalcValues } from './types.js';
|
5
5
|
export declare const getBrowserVerticalFontAdjustments: (fontKitFont: FontKitFont, fontSize: number, lineHeight: number, verticalAlignment: string) => {
|
6
6
|
topAdj: number;
|
7
7
|
bottomAdj: number;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { Font as FontKitFont } from 'fontkit';
|
2
2
|
import { UIRenderProps } from '@pdfme/common';
|
3
|
-
import type { TextSchema } from './types';
|
3
|
+
import type { TextSchema } from './types.js';
|
4
4
|
export declare const uiRender: (arg: UIRenderProps<TextSchema>) => Promise<void>;
|
5
5
|
export declare const buildStyledTextContainer: (arg: UIRenderProps<TextSchema>, fontKitFont: FontKitFont, value: string) => HTMLDivElement;
|
6
6
|
/**
|
package/package.json
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
{
|
2
|
+
"type": "module",
|
2
3
|
"name": "@pdfme/schemas",
|
3
|
-
"version": "5.3.8-dev.
|
4
|
+
"version": "5.3.8-dev.36",
|
4
5
|
"sideEffects": false,
|
5
6
|
"author": "hand-dot",
|
6
7
|
"license": "MIT",
|
@@ -59,9 +60,8 @@
|
|
59
60
|
"air-datepicker": "^3.5.3",
|
60
61
|
"bwip-js": "^4.1.1",
|
61
62
|
"date-fns": "^4.1.0",
|
62
|
-
"fast-xml-parser": "^4.3.2",
|
63
63
|
"fontkit": "^2.0.2",
|
64
|
-
"lucide": "^0.
|
64
|
+
"lucide": "^0.476.0"
|
65
65
|
},
|
66
66
|
"devDependencies": {
|
67
67
|
"@pdfme/common": "file:../common",
|
package/src/barcodes/helper.ts
CHANGED
@@ -2,7 +2,7 @@ import { b64toUint8Array } from '@pdfme/common';
|
|
2
2
|
import bwipjs, { RenderOptions } from 'bwip-js';
|
3
3
|
import { Buffer } from 'buffer';
|
4
4
|
import { BARCODE_TYPES, DEFAULT_BARCODE_INCLUDETEXT } from './constants.js';
|
5
|
-
import { BarcodeTypes } from './types';
|
5
|
+
import { BarcodeTypes } from './types.js';
|
6
6
|
|
7
7
|
// GTIN-13, GTIN-8, GTIN-12, GTIN-14
|
8
8
|
const validateCheckDigit = (input: string, checkDigitPos: number) => {
|
package/src/barcodes/index.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { pdfRender } from './pdfRender.js';
|
2
2
|
import { getPropPanelByBarcodeType } from './propPanel.js';
|
3
3
|
import { uiRender } from './uiRender.js';
|
4
|
-
import type { BarcodeSchema, BarcodeTypes } from './types';
|
4
|
+
import type { BarcodeSchema, BarcodeTypes } from './types.js';
|
5
5
|
import { BARCODE_TYPES } from './constants.js';
|
6
6
|
import { createSvgStr } from '../utils.js';
|
7
7
|
import { Plugin } from '@pdfme/common';
|
package/src/date/helper.ts
CHANGED
@@ -2,39 +2,81 @@ import type * as CSS from 'csstype';
|
|
2
2
|
|
3
3
|
import AirDatepicker from 'air-datepicker';
|
4
4
|
import type { AirDatepickerLocale, AirDatepickerButton } from 'air-datepicker';
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
import
|
16
|
-
|
17
|
-
import
|
18
|
-
|
19
|
-
import
|
20
|
-
|
21
|
-
import
|
22
|
-
|
23
|
-
import
|
24
|
-
|
25
|
-
import
|
26
|
-
|
27
|
-
import
|
28
|
-
|
29
|
-
import
|
30
|
-
|
31
|
-
import
|
32
|
-
|
33
|
-
import
|
34
|
-
|
35
|
-
import
|
36
|
-
|
37
|
-
import
|
5
|
+
|
6
|
+
// Define custom interfaces for AirDatepicker types
|
7
|
+
interface AirDatepickerDate extends Date {}
|
8
|
+
interface AirDatepickerInstance {
|
9
|
+
selectedDates: Date[];
|
10
|
+
hide: () => void;
|
11
|
+
destroy: () => void;
|
12
|
+
show: () => void;
|
13
|
+
}
|
14
|
+
// @ts-ignore
|
15
|
+
import localeAr from 'air-datepicker/locale/ar.js';
|
16
|
+
// @ts-ignore
|
17
|
+
import localeBg from 'air-datepicker/locale/bg.js';
|
18
|
+
// @ts-ignore
|
19
|
+
import localeCa from 'air-datepicker/locale/ca.js';
|
20
|
+
// @ts-ignore
|
21
|
+
import localeCs from 'air-datepicker/locale/cs.js';
|
22
|
+
// @ts-ignore
|
23
|
+
import localeDa from 'air-datepicker/locale/da.js';
|
24
|
+
// @ts-ignore
|
25
|
+
import localeDe from 'air-datepicker/locale/de.js';
|
26
|
+
// @ts-ignore
|
27
|
+
import localeEl from 'air-datepicker/locale/el.js';
|
28
|
+
// @ts-ignore
|
29
|
+
import localeEn from 'air-datepicker/locale/en.js';
|
30
|
+
// @ts-ignore
|
31
|
+
import localeEs from 'air-datepicker/locale/es.js';
|
32
|
+
// @ts-ignore
|
33
|
+
import localeEu from 'air-datepicker/locale/eu.js';
|
34
|
+
// @ts-ignore
|
35
|
+
import localeFi from 'air-datepicker/locale/fi.js';
|
36
|
+
// @ts-ignore
|
37
|
+
import localeFr from 'air-datepicker/locale/fr.js';
|
38
|
+
// @ts-ignore
|
39
|
+
import localeHr from 'air-datepicker/locale/hr.js';
|
40
|
+
// @ts-ignore
|
41
|
+
import localeHu from 'air-datepicker/locale/hu.js';
|
42
|
+
// @ts-ignore
|
43
|
+
import localeId from 'air-datepicker/locale/id.js';
|
44
|
+
// @ts-ignore
|
45
|
+
import localeIt from 'air-datepicker/locale/it.js';
|
46
|
+
// @ts-ignore
|
47
|
+
import localeJa from 'air-datepicker/locale/ja.js';
|
48
|
+
// @ts-ignore
|
49
|
+
import localeKo from 'air-datepicker/locale/ko.js';
|
50
|
+
// @ts-ignore
|
51
|
+
import localeNb from 'air-datepicker/locale/nb.js';
|
52
|
+
// @ts-ignore
|
53
|
+
import localeNl from 'air-datepicker/locale/nl.js';
|
54
|
+
// @ts-ignore
|
55
|
+
import localeTh from 'air-datepicker/locale/th.js';
|
56
|
+
// @ts-ignore
|
57
|
+
import localePl from 'air-datepicker/locale/pl.js';
|
58
|
+
// @ts-ignore
|
59
|
+
import localePtBR from 'air-datepicker/locale/pt-BR.js';
|
60
|
+
// @ts-ignore
|
61
|
+
import localePt from 'air-datepicker/locale/pt.js';
|
62
|
+
// @ts-ignore
|
63
|
+
import localeRo from 'air-datepicker/locale/ro.js';
|
64
|
+
// @ts-ignore
|
65
|
+
import localeRu from 'air-datepicker/locale/ru.js';
|
66
|
+
// @ts-ignore
|
67
|
+
import localeSi from 'air-datepicker/locale/si.js';
|
68
|
+
// @ts-ignore
|
69
|
+
import localeSk from 'air-datepicker/locale/sk.js';
|
70
|
+
// @ts-ignore
|
71
|
+
import localeSl from 'air-datepicker/locale/sl.js';
|
72
|
+
// @ts-ignore
|
73
|
+
import localeSv from 'air-datepicker/locale/sv.js';
|
74
|
+
// @ts-ignore
|
75
|
+
import localeTr from 'air-datepicker/locale/tr.js';
|
76
|
+
// @ts-ignore
|
77
|
+
import localeUk from 'air-datepicker/locale/uk.js';
|
78
|
+
// @ts-ignore
|
79
|
+
import localeZh from 'air-datepicker/locale/zh.js';
|
38
80
|
|
39
81
|
import * as dateFns from 'date-fns/locale';
|
40
82
|
import { format } from 'date-fns';
|
@@ -260,15 +302,15 @@ export const getPlugin = ({ type, icon }: { type: PickerType; icon: string }) =>
|
|
260
302
|
});
|
261
303
|
}
|
262
304
|
|
263
|
-
const airDatepicker = new AirDatepicker(input, {
|
305
|
+
const airDatepicker = new (AirDatepicker as any)(input, {
|
264
306
|
locale: locale.adLocale,
|
265
307
|
selectedDates: [strDateToDate(value, type)],
|
266
|
-
dateFormat: (date) => format(date, schema.format, { locale: locale.formatLocale }),
|
308
|
+
dateFormat: (date: AirDatepickerDate) => format(date, schema.format, { locale: locale.formatLocale }),
|
267
309
|
timepicker: type !== 'date',
|
268
310
|
onlyTimepicker: type === 'time',
|
269
311
|
isMobile: window.innerWidth < 768,
|
270
312
|
buttons: adButtons,
|
271
|
-
onSelect: ({ datepicker }) => {
|
313
|
+
onSelect: ({ datepicker }: { datepicker: AirDatepickerInstance }) => {
|
272
314
|
if (type === 'date') {
|
273
315
|
commitChange(datepicker.selectedDates.length ? datepicker.selectedDates[0] : null);
|
274
316
|
datepicker.hide();
|
@@ -429,7 +471,6 @@ export const getPlugin = ({ type, icon }: { type: PickerType; icon: string }) =>
|
|
429
471
|
format: defaultFormat,
|
430
472
|
type,
|
431
473
|
content: getFmtContent(new Date(), type),
|
432
|
-
position: { x: 0, y: 0 },
|
433
474
|
width: 50,
|
434
475
|
height: 10,
|
435
476
|
rotate: 0,
|
@@ -441,7 +482,7 @@ export const getPlugin = ({ type, icon }: { type: PickerType; icon: string }) =>
|
|
441
482
|
backgroundColor: '',
|
442
483
|
locale: undefined,
|
443
484
|
opacity: DEFAULT_OPACITY,
|
444
|
-
},
|
485
|
+
} as DateSchema,
|
445
486
|
},
|
446
487
|
icon,
|
447
488
|
};
|
package/src/date/types.ts
CHANGED
@@ -10,4 +10,10 @@ export interface DateSchema extends Schema {
|
|
10
10
|
fontColor: string;
|
11
11
|
backgroundColor: string;
|
12
12
|
locale?: string;
|
13
|
+
// Explicitly include these properties from Schema for TypeScript
|
14
|
+
width: number;
|
15
|
+
height: number;
|
16
|
+
name: string;
|
17
|
+
type: string;
|
18
|
+
content?: string;
|
13
19
|
}
|
package/src/graphics/svg.ts
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
import { Plugin, Schema } from '@pdfme/common';
|
2
|
-
import { XMLValidator } from 'fast-xml-parser';
|
3
2
|
import {
|
4
3
|
convertForPdfLayoutProps,
|
5
4
|
isEditable,
|
@@ -9,7 +8,33 @@ import {
|
|
9
8
|
} from '../utils.js';
|
10
9
|
import { Route } from 'lucide';
|
11
10
|
|
12
|
-
const isValidSVG = (svgString: string) =>
|
11
|
+
const isValidSVG = (svgString: string): boolean => {
|
12
|
+
try {
|
13
|
+
// Basic validation checks that work in both Node.js and browser
|
14
|
+
if (!svgString || typeof svgString !== 'string') {
|
15
|
+
return false;
|
16
|
+
}
|
17
|
+
|
18
|
+
// Check for basic SVG structure
|
19
|
+
if (!svgString.includes('<svg') || !svgString.includes('</svg>')) {
|
20
|
+
return false;
|
21
|
+
}
|
22
|
+
|
23
|
+
// Additional browser-specific validation if DOMParser is available
|
24
|
+
if (typeof DOMParser !== 'undefined') {
|
25
|
+
const parser = new DOMParser();
|
26
|
+
const doc = parser.parseFromString(svgString, 'image/svg+xml');
|
27
|
+
const parserError = doc.querySelector('parsererror');
|
28
|
+
if (parserError !== null) {
|
29
|
+
return false;
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
return true;
|
34
|
+
} catch (error) {
|
35
|
+
return false;
|
36
|
+
}
|
37
|
+
};
|
13
38
|
|
14
39
|
const defaultValue = `<svg viewBox="0 0 488 600" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
15
40
|
<g transform="matrix(1,0,0,1,-56,0)" fill="#000000" stroke="none">
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { propPanel as parentPropPanel } from '../text/propPanel';
|
1
|
+
import { propPanel as parentPropPanel } from '../text/propPanel.js';
|
2
2
|
import { PropPanel, PropPanelWidgetProps } from '@pdfme/common';
|
3
|
-
import { MultiVariableTextSchema } from './types';
|
3
|
+
import { MultiVariableTextSchema } from './types.js';
|
4
4
|
|
5
5
|
const mapDynamicVariables = (props: PropPanelWidgetProps) => {
|
6
6
|
const { rootElement, changeSchemas, activeSchema, i18n, options } = props;
|
package/src/select/index.ts
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
import type * as CSS from 'csstype';
|
2
|
-
import { propPanel as parentPropPanel } from '../text/propPanel';
|
2
|
+
import { propPanel as parentPropPanel } from '../text/propPanel.js';
|
3
3
|
import { Plugin, PropPanelWidgetProps, SchemaForUI } from '@pdfme/common';
|
4
|
-
import text from '../text';
|
5
|
-
import { TextSchema } from '../text/types';
|
4
|
+
import text from '../text/index.js';
|
5
|
+
import { TextSchema } from '../text/types.js';
|
6
6
|
import { ChevronDown } from 'lucide';
|
7
7
|
import { createSvgStr } from '../utils.js';
|
8
8
|
|
package/src/tables/uiRender.ts
CHANGED
@@ -4,7 +4,7 @@ import { px2mm } from '@pdfme/common';
|
|
4
4
|
import { createSingleTable } from './tableHelper.js';
|
5
5
|
import { getBody, getBodyWithRange } from './helper.js';
|
6
6
|
import cell from './cell.js';
|
7
|
-
import { Row } from './classes';
|
7
|
+
import { Row } from './classes.js';
|
8
8
|
|
9
9
|
const buttonSize = 30;
|
10
10
|
|
package/src/text/constants.ts
CHANGED
@@ -9,7 +9,7 @@ import {
|
|
9
9
|
TextVerticalAlignBottomIcon,
|
10
10
|
TextVerticalAlignMiddleIcon,
|
11
11
|
TextVerticalAlignTopIcon,
|
12
|
-
} from './icons';
|
12
|
+
} from './icons/index.js';
|
13
13
|
import {
|
14
14
|
ALIGN_CENTER,
|
15
15
|
ALIGN_RIGHT,
|
@@ -18,7 +18,7 @@ import {
|
|
18
18
|
VERTICAL_ALIGN_BOTTOM,
|
19
19
|
VERTICAL_ALIGN_MIDDLE,
|
20
20
|
ALIGN_JUSTIFY,
|
21
|
-
} from './constants';
|
21
|
+
} from './constants.js';
|
22
22
|
|
23
23
|
export enum Formatter {
|
24
24
|
STRIKETHROUGH = 'strikethrough',
|
package/src/text/helper.ts
CHANGED
@@ -11,7 +11,7 @@ import {
|
|
11
11
|
DEFAULT_FONT_NAME,
|
12
12
|
} from '@pdfme/common';
|
13
13
|
import { Buffer } from 'buffer';
|
14
|
-
import type { TextSchema, FontWidthCalcValues } from './types';
|
14
|
+
import type { TextSchema, FontWidthCalcValues } from './types.js';
|
15
15
|
import {
|
16
16
|
DEFAULT_FONT_SIZE,
|
17
17
|
DEFAULT_CHARACTER_SPACING,
|
package/src/text/index.ts
CHANGED
@@ -2,7 +2,7 @@ import type { Plugin } from '@pdfme/common';
|
|
2
2
|
import { pdfRender } from './pdfRender.js';
|
3
3
|
import { propPanel } from './propPanel.js';
|
4
4
|
import { uiRender } from './uiRender.js';
|
5
|
-
import type { TextSchema } from './types';
|
5
|
+
import type { TextSchema } from './types.js';
|
6
6
|
import { TextCursorInput } from 'lucide';
|
7
7
|
import { createSvgStr } from '../utils.js';
|
8
8
|
|
package/src/text/pdfRender.ts
CHANGED
package/src/text/uiRender.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import type * as CSS from 'csstype';
|
2
2
|
import type { Font as FontKitFont } from 'fontkit';
|
3
3
|
import { UIRenderProps, getDefaultFont } from '@pdfme/common';
|
4
|
-
import type { TextSchema } from './types';
|
4
|
+
import type { TextSchema } from './types.js';
|
5
5
|
import {
|
6
6
|
DEFAULT_FONT_SIZE,
|
7
7
|
DEFAULT_ALIGNMENT,
|
package/src/utils.ts
CHANGED
@@ -212,27 +212,70 @@ export const createErrorElm = () => {
|
|
212
212
|
};
|
213
213
|
|
214
214
|
export const createSvgStr = (icon: IconNode, attrs?: Record<string, string>): string => {
|
215
|
-
|
216
|
-
|
217
|
-
|
215
|
+
// In lucide 0.475.0, the icon is an array of elements, not a single SVG element
|
216
|
+
// We need to create an SVG wrapper and add the elements as children
|
217
|
+
|
218
|
+
// Handle non-array input
|
219
|
+
if (!Array.isArray(icon)) {
|
220
|
+
return String(icon);
|
221
|
+
}
|
222
|
+
|
223
|
+
// Create default SVG attributes
|
224
|
+
const svgAttrs = {
|
225
|
+
xmlns: "http://www.w3.org/2000/svg",
|
226
|
+
width: "24",
|
227
|
+
height: "24",
|
228
|
+
viewBox: "0 0 24 24",
|
229
|
+
fill: "none",
|
230
|
+
stroke: "currentColor",
|
231
|
+
"stroke-width": "2",
|
232
|
+
"stroke-linecap": "round",
|
233
|
+
"stroke-linejoin": "round",
|
234
|
+
...(attrs || {})
|
235
|
+
};
|
236
|
+
|
237
|
+
// Format SVG attributes string
|
238
|
+
const svgAttrString = Object.entries(svgAttrs)
|
239
|
+
.map(([key, value]) => `${key}="${value}"`)
|
240
|
+
.join(' ');
|
241
|
+
|
242
|
+
// Helper function to process a single element
|
243
|
+
const processElement = (element: any): string => {
|
244
|
+
if (!Array.isArray(element)) {
|
245
|
+
return String(element);
|
218
246
|
}
|
219
|
-
|
220
|
-
const [tag, attributes = {}, children = []] =
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
const
|
225
|
-
|
226
|
-
const attrString = Object.entries(mergedAttributes || {})
|
247
|
+
|
248
|
+
const [tag, attributes = {}, children = []] = element;
|
249
|
+
const tagName = String(tag);
|
250
|
+
|
251
|
+
// Format attributes string
|
252
|
+
const attrString = Object.entries(attributes)
|
227
253
|
.map(([key, value]) => `${key}="${value}"`)
|
228
254
|
.join(' ');
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
255
|
+
|
256
|
+
// Process children recursively
|
257
|
+
let childrenString = '';
|
258
|
+
|
259
|
+
if (Array.isArray(children) && children.length > 0) {
|
260
|
+
childrenString = children
|
261
|
+
.map(child => processElement(child))
|
262
|
+
.join('');
|
263
|
+
}
|
264
|
+
|
265
|
+
// Return properly formatted element string
|
266
|
+
if (childrenString) {
|
267
|
+
return `<${tagName}${attrString ? ' ' + attrString : ''}>${childrenString}</${tagName}>`;
|
268
|
+
} else {
|
269
|
+
// Self-closing tag for empty children
|
270
|
+
return `<${tagName}${attrString ? ' ' + attrString : ''}/>`;
|
271
|
+
}
|
235
272
|
};
|
236
|
-
|
237
|
-
|
273
|
+
|
274
|
+
// Process all elements and join them
|
275
|
+
const elementsString = Array.isArray(icon)
|
276
|
+
? icon.map(element => processElement(element)).join('')
|
277
|
+
: processElement(icon);
|
278
|
+
|
279
|
+
// Return the complete SVG string
|
280
|
+
return `<svg ${svgAttrString}>${elementsString}</svg>`;
|
238
281
|
};
|