@pdfme/schemas 5.2.5-dev.1 → 5.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/src/barcodes/helper.js +1 -9
- package/dist/cjs/src/barcodes/helper.js.map +1 -1
- package/dist/cjs/src/barcodes/index.js +3 -3
- package/dist/cjs/src/barcodes/index.js.map +1 -1
- package/dist/cjs/src/checkbox/index.js +2 -4
- package/dist/cjs/src/checkbox/index.js.map +1 -1
- package/dist/cjs/src/date/date.js +6 -3
- package/dist/cjs/src/date/date.js.map +1 -1
- package/dist/cjs/src/date/dateTime.js +1 -3
- package/dist/cjs/src/date/dateTime.js.map +1 -1
- package/dist/cjs/src/date/time.js +5 -3
- package/dist/cjs/src/date/time.js.map +1 -1
- package/dist/cjs/src/graphics/image.js +1 -2
- package/dist/cjs/src/graphics/image.js.map +1 -1
- package/dist/cjs/src/graphics/svg.js +1 -2
- package/dist/cjs/src/graphics/svg.js.map +1 -1
- package/dist/cjs/src/multiVariableText/index.js +2 -4
- package/dist/cjs/src/multiVariableText/index.js.map +1 -1
- package/dist/cjs/src/radioGroup/index.js +2 -3
- package/dist/cjs/src/radioGroup/index.js.map +1 -1
- package/dist/cjs/src/select/index.js +1 -3
- package/dist/cjs/src/select/index.js.map +1 -1
- package/dist/cjs/src/shapes/line.js +1 -2
- package/dist/cjs/src/shapes/line.js.map +1 -1
- package/dist/cjs/src/shapes/rectAndEllipse.js +4 -3
- package/dist/cjs/src/shapes/rectAndEllipse.js.map +1 -1
- package/dist/cjs/src/tables/index.js +1 -3
- package/dist/cjs/src/tables/index.js.map +1 -1
- package/dist/cjs/src/text/icons/index.js +8 -10
- package/dist/cjs/src/text/icons/index.js.map +1 -1
- package/dist/cjs/src/text/index.js +1 -3
- package/dist/cjs/src/text/index.js.map +1 -1
- package/dist/cjs/src/utils.js +1 -15
- package/dist/cjs/src/utils.js.map +1 -1
- package/dist/esm/src/barcodes/helper.js +1 -9
- package/dist/esm/src/barcodes/helper.js.map +1 -1
- package/dist/esm/src/barcodes/index.js +3 -3
- package/dist/esm/src/barcodes/index.js.map +1 -1
- package/dist/esm/src/checkbox/index.js +2 -4
- package/dist/esm/src/checkbox/index.js.map +1 -1
- package/dist/esm/src/date/date.js +6 -3
- package/dist/esm/src/date/date.js.map +1 -1
- package/dist/esm/src/date/dateTime.js +1 -3
- package/dist/esm/src/date/dateTime.js.map +1 -1
- package/dist/esm/src/date/time.js +5 -3
- package/dist/esm/src/date/time.js.map +1 -1
- package/dist/esm/src/graphics/image.js +2 -3
- package/dist/esm/src/graphics/image.js.map +1 -1
- package/dist/esm/src/graphics/svg.js +2 -3
- package/dist/esm/src/graphics/svg.js.map +1 -1
- package/dist/esm/src/multiVariableText/index.js +2 -4
- package/dist/esm/src/multiVariableText/index.js.map +1 -1
- package/dist/esm/src/radioGroup/index.js +3 -4
- package/dist/esm/src/radioGroup/index.js.map +1 -1
- package/dist/esm/src/select/index.js +1 -3
- package/dist/esm/src/select/index.js.map +1 -1
- package/dist/esm/src/shapes/line.js +2 -3
- package/dist/esm/src/shapes/line.js.map +1 -1
- package/dist/esm/src/shapes/rectAndEllipse.js +5 -4
- package/dist/esm/src/shapes/rectAndEllipse.js.map +1 -1
- package/dist/esm/src/tables/index.js +1 -3
- package/dist/esm/src/tables/index.js.map +1 -1
- package/dist/esm/src/text/icons/index.js +7 -9
- package/dist/esm/src/text/icons/index.js.map +1 -1
- package/dist/esm/src/text/index.js +1 -3
- package/dist/esm/src/text/index.js.map +1 -1
- package/dist/esm/src/utils.js +0 -13
- package/dist/esm/src/utils.js.map +1 -1
- package/dist/types/src/text/icons/index.d.ts +7 -7
- package/dist/types/src/utils.d.ts +0 -2
- package/package.json +2 -3
- package/src/barcodes/helper.ts +1 -10
- package/src/barcodes/index.ts +4 -3
- package/src/checkbox/index.ts +4 -4
- package/src/date/date.ts +7 -3
- package/src/date/dateTime.ts +2 -3
- package/src/date/time.ts +6 -3
- package/src/graphics/image.ts +3 -10
- package/src/graphics/svg.ts +2 -9
- package/src/multiVariableText/index.ts +5 -7
- package/src/radioGroup/index.ts +6 -5
- package/src/select/index.ts +2 -3
- package/src/shapes/line.ts +2 -8
- package/src/shapes/rectAndEllipse.ts +8 -4
- package/src/tables/index.ts +1 -3
- package/src/text/icons/index.ts +8 -18
- package/src/text/index.ts +2 -4
- package/src/utils.ts +1 -14
package/dist/esm/src/utils.js
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
import { cmyk, degrees, degreesToRadians, rgb } from '@pdfme/pdf-lib';
|
2
2
|
import { mm2pt, isHexValid } from '@pdfme/common';
|
3
|
-
import { createElement } from 'lucide';
|
4
3
|
import { getDynamicHeightsForTable as _getDynamicHeightsForTable } from './tables/dynamicTemplate.js';
|
5
4
|
export const convertForPdfLayoutProps = ({ schema, pageHeight, applyRotateTranslate = true, }) => {
|
6
5
|
const { width: mmWidth, height: mmHeight, position, rotate, opacity } = schema;
|
@@ -159,16 +158,4 @@ export const createErrorElm = () => {
|
|
159
158
|
container.appendChild(span);
|
160
159
|
return container;
|
161
160
|
};
|
162
|
-
export const createSvgStr = (icon, attrs) => {
|
163
|
-
if (typeof window === 'undefined') {
|
164
|
-
return '';
|
165
|
-
}
|
166
|
-
const svg = createElement(icon);
|
167
|
-
if (attrs) {
|
168
|
-
Object.entries(attrs).forEach(([key, value]) => {
|
169
|
-
svg.setAttribute(key, value);
|
170
|
-
});
|
171
|
-
}
|
172
|
-
return new XMLSerializer().serializeToString(svg);
|
173
|
-
};
|
174
161
|
//# sourceMappingURL=utils.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAU,KAAK,EAAQ,UAAU,EAAa,MAAM,eAAe,CAAC;AAC3E,OAAO,
|
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KACd;IAED,IAAI,IAAI,EAAE;QACR,UAAU,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;KAChC;SAAM;QACL,MAAM,CAAC,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC,CAAC;KACzD;AACH,CAAC,CAAC,CAAC;AAEL,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,EAAE;IACjC,MAAM,SAAS,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAChD,MAAM,cAAc,GAAmB;QACrC,OAAO,EAAE,MAAM;QACf,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,QAAQ;QACxB,KAAK,EAAE,MAAM;QACb,MAAM,EAAE,MAAM;KACf,CAAC;IACF,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;IAE/C,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IAC5C,MAAM,SAAS,GAAmB;QAChC,KAAK,EAAE,OAAO;QACd,UAAU,EAAE,KAAK;QACjB,OAAO,EAAE,SAAS;QAClB,QAAQ,EAAE,MAAM;QAChB,UAAU,EAAE,MAAM;QAClB,YAAY,EAAE,KAAK;QACnB,UAAU,EAAE,yBAAyB;KACtC,CAAC;IACF,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IAErC,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC;IAC3B,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAE5B,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC"}
|
@@ -1,8 +1,8 @@
|
|
1
|
-
export declare const TextStrikethroughIcon:
|
2
|
-
export declare const TextUnderlineIcon:
|
3
|
-
export declare const TextAlignLeftIcon:
|
4
|
-
export declare const TextAlignCenterIcon:
|
5
|
-
export declare const TextAlignRightIcon:
|
6
|
-
export declare const TextVerticalAlignTopIcon:
|
1
|
+
export declare const TextStrikethroughIcon = "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" viewBox=\"0 0 24 24\"><path d=\"M6.85 7.08C6.85 4.37 9.45 3 12.24 3c1.64 0 3 .49 3.9 1.28c.77.65 1.46 1.73 1.46 3.24h-3.01c0-.31-.05-.59-.15-.85c-.29-.86-1.2-1.28-2.25-1.28c-1.86 0-2.34 1.02-2.34 1.7c0 .48.25.88.74 1.21c.38.25.77.48 1.41.7H7.39c-.21-.34-.54-.89-.54-1.92zM21 12v-2H3v2h9.62c1.15.45 1.96.75 1.96 1.97c0 1-.81 1.67-2.28 1.67c-1.54 0-2.93-.54-2.93-2.51H6.4c0 .55.08 1.13.24 1.58c.81 2.29 3.29 3.3 5.67 3.3c2.27 0 5.3-.89 5.3-4.05c0-.3-.01-1.16-.48-1.94H21V12z\" fill=\"currentColor\"></path></svg>";
|
2
|
+
export declare const TextUnderlineIcon = "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" viewBox=\"0 0 24 24\"><path d=\"M12 17c3.31 0 6-2.69 6-6V3h-2.5v8c0 1.93-1.57 3.5-3.5 3.5S8.5 12.93 8.5 11V3H6v8c0 3.31 2.69 6 6 6zm-7 2v2h14v-2H5z\" fill=\"currentColor\"></path></svg>";
|
3
|
+
export declare const TextAlignLeftIcon = "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" viewBox=\"0 0 24 24\"><path d=\"M15 15H3v2h12v-2zm0-8H3v2h12V7zM3 13h18v-2H3v2zm0 8h18v-2H3v2zM3 3v2h18V3H3z\" fill=\"currentColor\"></path></svg>";
|
4
|
+
export declare const TextAlignCenterIcon = "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" viewBox=\"0 0 24 24\"><path d=\"M7 15v2h10v-2H7zm-4 6h18v-2H3v2zm0-8h18v-2H3v2zm4-6v2h10V7H7zM3 3v2h18V3H3z\" fill=\"currentColor\"></path></svg>";
|
5
|
+
export declare const TextAlignRightIcon = "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" viewBox=\"0 0 24 24\"><path d=\"M3 21h18v-2H3v2zm6-4h12v-2H9v2zm-6-4h18v-2H3v2zm6-4h12V7H9v2zM3 3v2h18V3H3z\" fill=\"currentColor\"></path></svg>";
|
6
|
+
export declare const TextVerticalAlignTopIcon = "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" viewBox=\"0 0 24 24\"><path d=\"M8 11h3v10h2V11h3l-4-4l-4 4zM4 3v2h16V3H4z\" fill=\"currentColor\"></path></svg>";
|
7
7
|
export declare const TextVerticalAlignMiddleIcon = "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" viewBox=\"0 0 24 24\"><path d=\"M8 19h3v4h2v-4h3l-4-4l-4 4zm8-14h-3V1h-2v4H8l4 4l4-4zM4 11v2h16v-2H4z\" fill=\"currentColor\"></path></svg>";
|
8
|
-
export declare const TextVerticalAlignBottomIcon:
|
8
|
+
export declare const TextVerticalAlignBottomIcon = "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" viewBox=\"0 0 24 24\"><path d=\"M16 13h-3V3h-2v10H8l4 4l4-4zM4 19v2h16v-2H4z\" fill=\"currentColor\"></path></svg>";
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import { Schema, Mode, ColorType } from '@pdfme/common';
|
2
|
-
import { IconNode } from 'lucide';
|
3
2
|
export declare const convertForPdfLayoutProps: ({ schema, pageHeight, applyRotateTranslate, }: {
|
4
3
|
schema: Schema;
|
5
4
|
pageHeight: number;
|
@@ -117,4 +116,3 @@ export declare const hex2RgbColor: (hexString: string | undefined) => import("@p
|
|
117
116
|
export declare const hex2PrintingColor: (hexString: string | undefined, colorType?: ColorType) => import("@pdfme/pdf-lib").RGB | import("@pdfme/pdf-lib").CMYK | undefined;
|
118
117
|
export declare const readFile: (input: File | FileList | null) => Promise<string | ArrayBuffer>;
|
119
118
|
export declare const createErrorElm: () => HTMLDivElement;
|
120
|
-
export declare const createSvgStr: (icon: IconNode, attrs?: Record<string, string>) => string;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@pdfme/schemas",
|
3
|
-
"version": "5.2.5
|
3
|
+
"version": "5.2.5",
|
4
4
|
"sideEffects": false,
|
5
5
|
"author": "hand-dot",
|
6
6
|
"license": "MIT",
|
@@ -53,8 +53,7 @@
|
|
53
53
|
"bwip-js": "^4.1.1",
|
54
54
|
"date-fns": "^4.1.0",
|
55
55
|
"fast-xml-parser": "^4.3.2",
|
56
|
-
"fontkit": "^2.0.2"
|
57
|
-
"lucide": "^0.460.0"
|
56
|
+
"fontkit": "^2.0.2"
|
58
57
|
},
|
59
58
|
"devDependencies": {
|
60
59
|
"@pdfme/common": "file:../common",
|
package/src/barcodes/helper.ts
CHANGED
@@ -148,15 +148,7 @@ export const createBarCode = async (arg: {
|
|
148
148
|
|
149
149
|
const bcid = barCodeType2Bcid(type);
|
150
150
|
const scale = 5;
|
151
|
-
const bwipjsArg: RenderOptions = {
|
152
|
-
bcid,
|
153
|
-
text: input,
|
154
|
-
width,
|
155
|
-
height,
|
156
|
-
scale,
|
157
|
-
includetext,
|
158
|
-
textxalign: 'center',
|
159
|
-
};
|
151
|
+
const bwipjsArg: RenderOptions = { bcid, text: input, width, height, scale, includetext, textxalign: 'center' };
|
160
152
|
|
161
153
|
if (backgroundColor) bwipjsArg.backgroundcolor = mapHexColorForBwipJsLib(backgroundColor);
|
162
154
|
if (barColor) bwipjsArg.barcolor = mapHexColorForBwipJsLib(barColor);
|
@@ -176,4 +168,3 @@ export const createBarCode = async (arg: {
|
|
176
168
|
|
177
169
|
return res;
|
178
170
|
};
|
179
|
-
|
package/src/barcodes/index.ts
CHANGED
@@ -3,9 +3,10 @@ import { getPropPanelByBarcodeType } from './propPanel.js';
|
|
3
3
|
import { uiRender } from './uiRender.js';
|
4
4
|
import type { BarcodeSchema, BarcodeTypes } from './types';
|
5
5
|
import { BARCODE_TYPES } from './constants.js';
|
6
|
-
import { createSvgStr } from '../utils.js';
|
7
6
|
import { Plugin } from '@pdfme/common';
|
8
|
-
|
7
|
+
|
8
|
+
const qrIcon = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-qr-code"><rect width="5" height="5" x="3" y="3" rx="1"/><rect width="5" height="5" x="16" y="3" rx="1"/><rect width="5" height="5" x="3" y="16" rx="1"/><path d="M21 16h-3a2 2 0 0 0-2 2v3"/><path d="M21 21v.01"/><path d="M12 7v3a2 2 0 0 1-2 2H7"/><path d="M3 12h.01"/><path d="M12 3h.01"/><path d="M12 16v.01"/><path d="M16 12h1"/><path d="M21 12v.01"/><path d="M12 21v-1"/></svg>';
|
9
|
+
const barcodeIcon = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-barcode"><path d="M3 5v14"/><path d="M8 5v14"/><path d="M12 5v14"/><path d="M17 5v14"/><path d="M21 5v14"/></svg>';
|
9
10
|
|
10
11
|
const barcodes = BARCODE_TYPES.reduce(
|
11
12
|
(acc, type) =>
|
@@ -14,7 +15,7 @@ const barcodes = BARCODE_TYPES.reduce(
|
|
14
15
|
pdf: pdfRender,
|
15
16
|
ui: uiRender,
|
16
17
|
propPanel: getPropPanelByBarcodeType(type),
|
17
|
-
icon:
|
18
|
+
icon: type == 'qrcode' ? qrIcon : barcodeIcon
|
18
19
|
},
|
19
20
|
}),
|
20
21
|
{} as Record<BarcodeTypes, Plugin<BarcodeSchema>>
|
package/src/checkbox/index.ts
CHANGED
@@ -3,13 +3,13 @@ import { Schema } from '@pdfme/common';
|
|
3
3
|
import svg from '../graphics/svg';
|
4
4
|
import { isEditable } from '../utils.js';
|
5
5
|
import { HEX_COLOR_PATTERN } from '../constants.js';
|
6
|
-
import { Square, SquareCheck } from 'lucide';
|
7
|
-
import { createSvgStr } from '../utils.js';
|
8
6
|
|
9
7
|
const defaultStroke = 'currentColor';
|
10
8
|
|
11
|
-
const getCheckedIcon = (
|
12
|
-
|
9
|
+
const getCheckedIcon = (color = defaultStroke) =>
|
10
|
+
`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="${color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-square-check"><rect width="18" height="18" x="3" y="3" rx="0"/><path d="m9 12 2 2 4-4"/></svg>`;
|
11
|
+
const getUncheckedIcon = (color = defaultStroke) =>
|
12
|
+
`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="${color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-square"><rect width="18" height="18" x="3" y="3" rx="0"/></svg>`;
|
13
13
|
|
14
14
|
interface Checkbox extends Schema {
|
15
15
|
color: string;
|
package/src/date/date.ts
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
import { Lang } from '@pdfme/common';
|
2
2
|
import { getPlugin } from './helper';
|
3
|
-
import { createSvgStr } from '../utils.js';
|
4
|
-
import { Calendar } from 'lucide';
|
5
3
|
|
6
4
|
const type = 'date';
|
7
5
|
|
@@ -49,6 +47,12 @@ const formatsByLang: Record<Lang, string[]> = {
|
|
49
47
|
fr: [defaultFormat, 'dd/MM/yyyy', 'd MMMM yyyy', 'd MMM yyyy', 'EEEE d MMMM yyyy', 'yyyy-MM-dd'],
|
50
48
|
};
|
51
49
|
|
52
|
-
const icon =
|
50
|
+
const icon =
|
51
|
+
'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" ' +
|
52
|
+
'viewBox="0 0 24 24" fill="none" stroke="currentColor" ' +
|
53
|
+
'stroke-width="2" stroke-linecap="round" stroke-linejoin="round" ' +
|
54
|
+
'class="lucide lucide-calendar"><path d="M8 2v4"/><path d="M16 2v4"/>' +
|
55
|
+
'<rect width="18" height="18" x="3" y="4" rx="2"/><path d="M3 10h18"/>' +
|
56
|
+
'</svg>';
|
53
57
|
|
54
58
|
export default getPlugin({ type, defaultFormat, icon, formatsByLang });
|
package/src/date/dateTime.ts
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
import { Lang } from '@pdfme/common';
|
2
2
|
import { getPlugin } from './helper';
|
3
|
-
import { createSvgStr } from '../utils.js';
|
4
|
-
import { CalendarClock } from 'lucide';
|
5
3
|
|
6
4
|
const type = 'dateTime';
|
7
5
|
|
@@ -96,6 +94,7 @@ const formatsByLang: Record<Lang, string[]> = {
|
|
96
94
|
],
|
97
95
|
};
|
98
96
|
|
99
|
-
const icon =
|
97
|
+
const icon =
|
98
|
+
'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-calendar-clock"><path d="M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5"/><path d="M16 2v4"/><path d="M8 2v4"/><path d="M3 10h5"/><path d="M17.5 17.5 16 16.3V14"/><circle cx="16" cy="16" r="6"/></svg>';
|
100
99
|
|
101
100
|
export default getPlugin({ type, defaultFormat, icon, formatsByLang });
|
package/src/date/time.ts
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
import { Lang } from '@pdfme/common';
|
2
2
|
import { getPlugin } from './helper';
|
3
|
-
import { createSvgStr } from '../utils.js';
|
4
|
-
import { Clock } from 'lucide';
|
5
3
|
|
6
4
|
const type = 'time';
|
7
5
|
|
@@ -21,6 +19,11 @@ const formatsByLang: Record<Lang, string[]> = {
|
|
21
19
|
fr: [defaultFormat, 'HH:mm:ss'],
|
22
20
|
};
|
23
21
|
|
24
|
-
const icon =
|
22
|
+
const icon =
|
23
|
+
'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" ' +
|
24
|
+
'viewBox="0 0 24 24" fill="none" stroke="currentColor" ' +
|
25
|
+
'stroke-width="2" stroke-linecap="round" stroke-linejoin="round" ' +
|
26
|
+
'class="lucide lucide-clock"><circle cx="12" cy="12" r="10"/>' +
|
27
|
+
'<polyline points="12 6 12 12 16 14"/></svg>';
|
25
28
|
|
26
29
|
export default getPlugin({ type, defaultFormat, icon, formatsByLang });
|
package/src/graphics/image.ts
CHANGED
@@ -4,14 +4,7 @@ import type { Plugin } from '@pdfme/common';
|
|
4
4
|
import type { PDFRenderProps, Schema } from '@pdfme/common';
|
5
5
|
import type * as CSS from 'csstype';
|
6
6
|
import { UIRenderProps, px2mm } from '@pdfme/common';
|
7
|
-
import {
|
8
|
-
import {
|
9
|
-
convertForPdfLayoutProps,
|
10
|
-
addAlphaToHex,
|
11
|
-
isEditable,
|
12
|
-
readFile,
|
13
|
-
createSvgStr,
|
14
|
-
} from '../utils.js';
|
7
|
+
import { convertForPdfLayoutProps, addAlphaToHex, isEditable, readFile } from '../utils.js';
|
15
8
|
import { DEFAULT_OPACITY } from '../constants.js';
|
16
9
|
import { getImageDimension } from './imagehelper.js';
|
17
10
|
import { isPdf, pdfToImage } from './pdfHelper.js';
|
@@ -200,7 +193,7 @@ const imageSchema: Plugin<ImageSchema> = {
|
|
200
193
|
opacity: DEFAULT_OPACITY,
|
201
194
|
},
|
202
195
|
},
|
203
|
-
icon:
|
196
|
+
icon: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-image"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/></svg>',
|
204
197
|
};
|
205
198
|
|
206
|
-
export default imageSchema;
|
199
|
+
export default imageSchema;
|
package/src/graphics/svg.ts
CHANGED
@@ -1,13 +1,6 @@
|
|
1
1
|
import { Plugin, Schema } from '@pdfme/common';
|
2
2
|
import { XMLValidator } from 'fast-xml-parser';
|
3
|
-
import {
|
4
|
-
convertForPdfLayoutProps,
|
5
|
-
isEditable,
|
6
|
-
addAlphaToHex,
|
7
|
-
createErrorElm,
|
8
|
-
createSvgStr,
|
9
|
-
} from '../utils.js';
|
10
|
-
import { Route } from 'lucide';
|
3
|
+
import { convertForPdfLayoutProps, isEditable, addAlphaToHex, createErrorElm } from '../utils.js';
|
11
4
|
|
12
5
|
const isValidSVG = (svgString: string) => XMLValidator.validate(svgString) === true;
|
13
6
|
|
@@ -87,7 +80,7 @@ const svgSchema: Plugin<SVGSchema> = {
|
|
87
80
|
height: 50,
|
88
81
|
},
|
89
82
|
},
|
90
|
-
icon:
|
83
|
+
icon: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-route"><circle cx="6" cy="19" r="3"/><path d="M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15"/><circle cx="18" cy="5" r="3"/></svg>',
|
91
84
|
};
|
92
85
|
|
93
86
|
export default svgSchema;
|
@@ -3,14 +3,12 @@ import { pdfRender } from './pdfRender.js';
|
|
3
3
|
import { propPanel } from './propPanel.js';
|
4
4
|
import { uiRender } from './uiRender.js';
|
5
5
|
import type { MultiVariableTextSchema } from './types';
|
6
|
-
import { Type } from 'lucide';
|
7
|
-
import { createSvgStr } from '../utils.js';
|
8
6
|
|
9
7
|
const schema: Plugin<MultiVariableTextSchema> = {
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
8
|
+
pdf: pdfRender,
|
9
|
+
ui: uiRender,
|
10
|
+
propPanel,
|
11
|
+
icon: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-type"><polyline points="4 7 4 4 20 4 20 7"/><line x1="9" x2="15" y1="20" y2="20"/><line x1="12" x2="12" y1="4" y2="20"/></svg>',
|
12
|
+
uninterruptedEditMode: true
|
15
13
|
};
|
16
14
|
export default schema;
|
package/src/radioGroup/index.ts
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
import { Plugin } from '@pdfme/common';
|
2
2
|
import { Schema } from '@pdfme/common';
|
3
|
-
import { Circle, CircleDot } from 'lucide';
|
4
3
|
import svg from '../graphics/svg';
|
5
|
-
import { isEditable
|
4
|
+
import { isEditable } from '../utils.js';
|
6
5
|
import { HEX_COLOR_PATTERN } from '../constants.js';
|
7
6
|
|
8
7
|
const defaultStroke = 'currentColor';
|
9
8
|
|
10
|
-
const getCheckedIcon = (
|
11
|
-
|
9
|
+
const getCheckedIcon = (color = defaultStroke) =>
|
10
|
+
`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="${color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-circle-dot"><circle cx="12" cy="12" r="10"/><circle cx="12" cy="12" r="1"/></svg>`;
|
11
|
+
const getUncheckedIcon = (color = defaultStroke) =>
|
12
|
+
`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="${color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-circle"><circle cx="12" cy="12" r="10"/></svg>`;
|
12
13
|
|
13
14
|
interface RadioGroup extends Schema {
|
14
15
|
group: string;
|
@@ -34,7 +35,7 @@ const schema: Plugin<RadioGroup> = {
|
|
34
35
|
const container = document.createElement('div');
|
35
36
|
container.style.width = '100%';
|
36
37
|
container.style.height = '100%';
|
37
|
-
|
38
|
+
|
38
39
|
if (onChange) {
|
39
40
|
radioButtonStates.set(schema.name, { value, onChange });
|
40
41
|
}
|
package/src/select/index.ts
CHANGED
@@ -3,10 +3,9 @@ import { propPanel as parentPropPanel } from '../text/propPanel';
|
|
3
3
|
import { Plugin, PropPanelWidgetProps, SchemaForUI } from '@pdfme/common';
|
4
4
|
import text from '../text';
|
5
5
|
import { TextSchema } from '../text/types';
|
6
|
-
import { ChevronDown } from 'lucide';
|
7
|
-
import { createSvgStr } from '../utils.js';
|
8
6
|
|
9
|
-
const selectIcon =
|
7
|
+
const selectIcon =
|
8
|
+
'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-chevron-down"><path d="m6 9 6 6 6-6"/></svg>';
|
10
9
|
|
11
10
|
interface Select extends TextSchema {
|
12
11
|
options: string[];
|
package/src/shapes/line.ts
CHANGED
@@ -1,12 +1,6 @@
|
|
1
1
|
import type { Schema, Plugin, PDFRenderProps, UIRenderProps } from '@pdfme/common';
|
2
|
-
import {
|
3
|
-
rotatePoint,
|
4
|
-
convertForPdfLayoutProps,
|
5
|
-
hex2PrintingColor,
|
6
|
-
createSvgStr,
|
7
|
-
} from '../utils.js';
|
2
|
+
import { rotatePoint, convertForPdfLayoutProps, hex2PrintingColor } from '../utils.js';
|
8
3
|
import { HEX_COLOR_PATTERN } from '../constants.js';
|
9
|
-
import { Minus } from 'lucide';
|
10
4
|
|
11
5
|
const DEFAULT_LINE_COLOR = '#000000';
|
12
6
|
|
@@ -66,6 +60,6 @@ const lineSchema: Plugin<LineSchema> = {
|
|
66
60
|
color: DEFAULT_LINE_COLOR,
|
67
61
|
},
|
68
62
|
},
|
69
|
-
icon:
|
63
|
+
icon:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-minus"><path d="M5 12h14"/></svg>',
|
70
64
|
};
|
71
65
|
export default lineSchema;
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import { Plugin, Schema, mm2pt } from '@pdfme/common';
|
2
2
|
import { HEX_COLOR_PATTERN } from '../constants.js';
|
3
|
-
import { hex2PrintingColor, convertForPdfLayoutProps
|
4
|
-
import { Circle, Square } from 'lucide';
|
3
|
+
import { hex2PrintingColor, convertForPdfLayoutProps } from '../utils.js';
|
5
4
|
|
6
5
|
interface ShapeSchema extends Schema {
|
7
6
|
type: 'ellipse' | 'rectangle';
|
@@ -103,6 +102,11 @@ const shape: Plugin<ShapeSchema> = {
|
|
103
102
|
},
|
104
103
|
};
|
105
104
|
|
105
|
+
const rectangleIcon =
|
106
|
+
'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-square"><rect width="18" height="18" x="3" y="3" rx="2"/></svg>';
|
107
|
+
const ellipseIcon =
|
108
|
+
'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-circle"><circle cx="12" cy="12" r="10"/></svg>';
|
109
|
+
|
106
110
|
const getPropPanelSchema = (type: 'rectangle' | 'ellipse') => ({
|
107
111
|
...shape.propPanel,
|
108
112
|
defaultSchema: {
|
@@ -114,11 +118,11 @@ const getPropPanelSchema = (type: 'rectangle' | 'ellipse') => ({
|
|
114
118
|
export const rectangle = {
|
115
119
|
...shape,
|
116
120
|
propPanel: getPropPanelSchema('rectangle'),
|
117
|
-
icon:
|
121
|
+
icon: rectangleIcon
|
118
122
|
};
|
119
123
|
|
120
124
|
export const ellipse = {
|
121
125
|
...shape,
|
122
126
|
propPanel: getPropPanelSchema('ellipse'),
|
123
|
-
icon:
|
127
|
+
icon: ellipseIcon
|
124
128
|
};
|
package/src/tables/index.ts
CHANGED
@@ -3,13 +3,11 @@ import type { TableSchema } from './types.js';
|
|
3
3
|
import { pdfRender } from './pdfRender.js';
|
4
4
|
import { uiRender } from './uiRender.js';
|
5
5
|
import { propPanel } from './propPanel.js';
|
6
|
-
import { Table } from 'lucide';
|
7
|
-
import { createSvgStr } from '../utils.js';
|
8
6
|
|
9
7
|
const tableSchema: Plugin<TableSchema> = {
|
10
8
|
pdf: pdfRender,
|
11
9
|
ui: uiRender,
|
12
10
|
propPanel,
|
13
|
-
icon:
|
11
|
+
icon: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-table"><path d="M12 3v18"/><rect width="18" height="18" x="3" y="3" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/></svg>',
|
14
12
|
};
|
15
13
|
export default tableSchema;
|
package/src/text/icons/index.ts
CHANGED
@@ -1,27 +1,17 @@
|
|
1
|
-
|
2
|
-
Strikethrough,
|
3
|
-
Underline,
|
4
|
-
AlignLeft,
|
5
|
-
AlignCenter,
|
6
|
-
AlignRight,
|
7
|
-
ArrowUpToLine,
|
8
|
-
ArrowDownToLine,
|
9
|
-
} from 'lucide';
|
10
|
-
import { createSvgStr } from '../../utils.js';
|
1
|
+
// svg icons are material icons from https://www.xicons.org
|
11
2
|
|
12
|
-
export const TextStrikethroughIcon =
|
3
|
+
export const TextStrikethroughIcon = `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24"><path d="M6.85 7.08C6.85 4.37 9.45 3 12.24 3c1.64 0 3 .49 3.9 1.28c.77.65 1.46 1.73 1.46 3.24h-3.01c0-.31-.05-.59-.15-.85c-.29-.86-1.2-1.28-2.25-1.28c-1.86 0-2.34 1.02-2.34 1.7c0 .48.25.88.74 1.21c.38.25.77.48 1.41.7H7.39c-.21-.34-.54-.89-.54-1.92zM21 12v-2H3v2h9.62c1.15.45 1.96.75 1.96 1.97c0 1-.81 1.67-2.28 1.67c-1.54 0-2.93-.54-2.93-2.51H6.4c0 .55.08 1.13.24 1.58c.81 2.29 3.29 3.3 5.67 3.3c2.27 0 5.3-.89 5.3-4.05c0-.3-.01-1.16-.48-1.94H21V12z" fill="currentColor"></path></svg>`;
|
13
4
|
|
14
|
-
export const TextUnderlineIcon =
|
5
|
+
export const TextUnderlineIcon = `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24"><path d="M12 17c3.31 0 6-2.69 6-6V3h-2.5v8c0 1.93-1.57 3.5-3.5 3.5S8.5 12.93 8.5 11V3H6v8c0 3.31 2.69 6 6 6zm-7 2v2h14v-2H5z" fill="currentColor"></path></svg>`;
|
15
6
|
|
16
|
-
export const TextAlignLeftIcon =
|
7
|
+
export const TextAlignLeftIcon = `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24"><path d="M15 15H3v2h12v-2zm0-8H3v2h12V7zM3 13h18v-2H3v2zm0 8h18v-2H3v2zM3 3v2h18V3H3z" fill="currentColor"></path></svg>`;
|
17
8
|
|
18
|
-
export const TextAlignCenterIcon =
|
9
|
+
export const TextAlignCenterIcon = `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24"><path d="M7 15v2h10v-2H7zm-4 6h18v-2H3v2zm0-8h18v-2H3v2zm4-6v2h10V7H7zM3 3v2h18V3H3z" fill="currentColor"></path></svg>`;
|
19
10
|
|
20
|
-
export const TextAlignRightIcon =
|
11
|
+
export const TextAlignRightIcon = `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24"><path d="M3 21h18v-2H3v2zm6-4h12v-2H9v2zm-6-4h18v-2H3v2zm6-4h12V7H9v2zM3 3v2h18V3H3z" fill="currentColor"></path></svg>`;
|
21
12
|
|
22
|
-
export const TextVerticalAlignTopIcon =
|
13
|
+
export const TextVerticalAlignTopIcon = `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24"><path d="M8 11h3v10h2V11h3l-4-4l-4 4zM4 3v2h16V3H4z" fill="currentColor"></path></svg>`;
|
23
14
|
|
24
|
-
// svg icons are material icons from https://www.xicons.org
|
25
15
|
export const TextVerticalAlignMiddleIcon = `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24"><path d="M8 19h3v4h2v-4h3l-4-4l-4 4zm8-14h-3V1h-2v4H8l4 4l4-4zM4 11v2h16v-2H4z" fill="currentColor"></path></svg>`;
|
26
16
|
|
27
|
-
export const TextVerticalAlignBottomIcon =
|
17
|
+
export const TextVerticalAlignBottomIcon = `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24"><path d="M16 13h-3V3h-2v10H8l4 4l4-4zM4 19v2h16v-2H4z" fill="currentColor"></path></svg>`;
|
package/src/text/index.ts
CHANGED
@@ -3,14 +3,12 @@ import { pdfRender } from './pdfRender.js';
|
|
3
3
|
import { propPanel } from './propPanel.js';
|
4
4
|
import { uiRender } from './uiRender.js';
|
5
5
|
import type { TextSchema } from './types';
|
6
|
-
import { TextCursorInput } from 'lucide';
|
7
|
-
import { createSvgStr } from '../utils.js';
|
8
6
|
|
9
7
|
const textSchema: Plugin<TextSchema> = {
|
10
8
|
pdf: pdfRender,
|
11
9
|
ui: uiRender,
|
12
10
|
propPanel,
|
13
|
-
icon:
|
11
|
+
icon: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-text-cursor-input"><path d="M5 4h1a3 3 0 0 1 3 3 3 3 0 0 1 3-3h1"/><path d="M13 20h-1a3 3 0 0 1-3-3 3 3 0 0 1-3 3H5"/><path d="M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1"/><path d="M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7"/><path d="M9 7v10"/></svg>',
|
14
12
|
};
|
15
13
|
|
16
|
-
export default textSchema;
|
14
|
+
export default textSchema;
|
package/src/utils.ts
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
import type * as CSS from 'csstype';
|
2
2
|
import { cmyk, degrees, degreesToRadians, rgb } from '@pdfme/pdf-lib';
|
3
3
|
import { Schema, mm2pt, Mode, isHexValid, ColorType } from '@pdfme/common';
|
4
|
-
import { IconNode, createElement } from 'lucide';
|
5
4
|
import { getDynamicHeightsForTable as _getDynamicHeightsForTable } from './tables/dynamicTemplate.js';
|
5
|
+
|
6
6
|
export const convertForPdfLayoutProps = ({
|
7
7
|
schema,
|
8
8
|
pageHeight,
|
@@ -208,16 +208,3 @@ export const createErrorElm = () => {
|
|
208
208
|
|
209
209
|
return container;
|
210
210
|
};
|
211
|
-
|
212
|
-
export const createSvgStr = (icon: IconNode, attrs?: Record<string, string>): string => {
|
213
|
-
if (typeof window === 'undefined') {
|
214
|
-
return '';
|
215
|
-
}
|
216
|
-
const svg = createElement(icon);
|
217
|
-
if (attrs) {
|
218
|
-
Object.entries(attrs).forEach(([key, value]) => {
|
219
|
-
svg.setAttribute(key, value);
|
220
|
-
});
|
221
|
-
}
|
222
|
-
return new XMLSerializer().serializeToString(svg);
|
223
|
-
};
|