@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,8 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
exports.uiRender = void 0;
|
4
|
-
const helper_js_1 = require("./helper.js");
|
5
|
-
const utils_js_1 = require("../utils.js");
|
1
|
+
import { validateBarcodeInput, createBarCode } from './helper.js';
|
2
|
+
import { addAlphaToHex, isEditable, createErrorElm } from '../utils.js';
|
6
3
|
const fullSize = { width: '100%', height: '100%' };
|
7
4
|
const blobToDataURL = (blob) => new Promise((resolve, reject) => {
|
8
5
|
const reader = new FileReader();
|
@@ -11,7 +8,7 @@ const blobToDataURL = (blob) => new Promise((resolve, reject) => {
|
|
11
8
|
reader.readAsDataURL(blob);
|
12
9
|
});
|
13
10
|
const createBarcodeImage = async (schema, value) => {
|
14
|
-
const imageBuf = await
|
11
|
+
const imageBuf = await createBarCode({
|
15
12
|
...schema,
|
16
13
|
input: value,
|
17
14
|
});
|
@@ -27,7 +24,7 @@ const createBarcodeImageElm = async (schema, value) => {
|
|
27
24
|
Object.assign(img.style, imgStyle);
|
28
25
|
return img;
|
29
26
|
};
|
30
|
-
const uiRender = async (arg) => {
|
27
|
+
export const uiRender = async (arg) => {
|
31
28
|
const { value, rootElement, mode, onChange, stopEditing, tabIndex, placeholder, schema, theme } = arg;
|
32
29
|
const container = document.createElement('div');
|
33
30
|
const containerStyle = {
|
@@ -39,7 +36,7 @@ const uiRender = async (arg) => {
|
|
39
36
|
};
|
40
37
|
Object.assign(container.style, containerStyle);
|
41
38
|
rootElement.appendChild(container);
|
42
|
-
const editable =
|
39
|
+
const editable = isEditable(mode, schema);
|
43
40
|
if (editable) {
|
44
41
|
const input = document.createElement('input');
|
45
42
|
const inputStyle = {
|
@@ -49,7 +46,7 @@ const uiRender = async (arg) => {
|
|
49
46
|
fontSize: '12pt',
|
50
47
|
fontWeight: 'bold',
|
51
48
|
color: theme.colorWhite,
|
52
|
-
backgroundColor: editable || value ?
|
49
|
+
backgroundColor: editable || value ? addAlphaToHex('#000000', 80) : 'none',
|
53
50
|
border: 'none',
|
54
51
|
display: 'flex',
|
55
52
|
alignItems: 'center',
|
@@ -75,15 +72,14 @@ const uiRender = async (arg) => {
|
|
75
72
|
if (!value)
|
76
73
|
return;
|
77
74
|
try {
|
78
|
-
if (!
|
75
|
+
if (!validateBarcodeInput(schema.type, value))
|
79
76
|
throw new Error('[@pdfme/schemas/barcodes] Invalid barcode input');
|
80
77
|
const imgElm = await createBarcodeImageElm(schema, value);
|
81
78
|
container.appendChild(imgElm);
|
82
79
|
}
|
83
80
|
catch (err) {
|
84
81
|
console.error(`[@pdfme/ui] ${err}`);
|
85
|
-
container.appendChild(
|
82
|
+
container.appendChild(createErrorElm());
|
86
83
|
}
|
87
84
|
};
|
88
|
-
exports.uiRender = uiRender;
|
89
85
|
//# sourceMappingURL=uiRender.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"uiRender.js","sourceRoot":"","sources":["../../../../src/barcodes/uiRender.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"uiRender.js","sourceRoot":"","sources":["../../../../src/barcodes/uiRender.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAExE,MAAM,QAAQ,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAEnD,MAAM,aAAa,GAAG,CAAC,IAAU,EAAmB,EAAE,CACpD,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;IAC9B,MAAM,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;IAChC,MAAM,CAAC,SAAS,GAAG,G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AAC,CAAQ,EAAE,EAAE;YAC5C,QAAQ,IAAI,QAAQ,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,EAAG,CAAC,CAAC,MAA2B,CAAC,KAAK,EAAE,CAAC,CAAC;QACxF,CAAC,CAAC,CAAC;QACH,KAAK,CAAC,gBAAgB,CAAC,MAAM,EAAE,GAAG,EAAE;YAClC,WAAW,IAAI,WAAW,EAAE,CAAC;QAC/B,CAAC,CAAC,CAAC;QACH,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAC7B,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QACpD,IAAI,IAAI,KAAK,UAAU,EAAE;YACvB,KAAK,CAAC,KAAK,EAAE,CAAC;SACf;KACF;IAED,IAAI,CAAC,KAAK;QAAE,OAAO;IACnB,IAAI;QACF,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC;YAC3C,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;QACrE,MAAM,MAAM,GAAG,MAAM,qBAAqB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QAC1D,SAAS,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;KAC/B;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO,CAAC,KAAK,CAAC,eAAe,GAAG,EAAE,CAAC,CAAC;QACpC,SAAS,CAAC,WAAW,CAAC,cAAc,EAAE,CAAC,CAAC;KACzC;AACH,CAAC,CAAC"}
|
@@ -1,16 +1,11 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
};
|
5
|
-
|
6
|
-
const svg_js_1 = __importDefault(require("../graphics/svg.js"));
|
7
|
-
const utils_js_1 = require("../utils.js");
|
8
|
-
const constants_js_1 = require("../constants.js");
|
9
|
-
const lucide_1 = require("lucide");
|
10
|
-
const utils_js_2 = require("../utils.js");
|
1
|
+
import svg from '../graphics/svg.js';
|
2
|
+
import { isEditable } from '../utils.js';
|
3
|
+
import { HEX_COLOR_PATTERN } from '../constants.js';
|
4
|
+
import { Square, SquareCheck } from 'lucide';
|
5
|
+
import { createSvgStr } from '../utils.js';
|
11
6
|
const defaultStroke = 'currentColor';
|
12
|
-
const getCheckedIcon = (stroke = defaultStroke) =>
|
13
|
-
const getUncheckedIcon = (stroke = defaultStroke) =>
|
7
|
+
const getCheckedIcon = (stroke = defaultStroke) => createSvgStr(SquareCheck, { stroke });
|
8
|
+
const getUncheckedIcon = (stroke = defaultStroke) => createSvgStr(Square, { stroke });
|
14
9
|
const getIcon = ({ value, color }) => value === 'true' ? getCheckedIcon(color) : getUncheckedIcon(color);
|
15
10
|
const schema = {
|
16
11
|
ui: (arg) => {
|
@@ -18,12 +13,12 @@ const schema = {
|
|
18
13
|
const container = document.createElement('div');
|
19
14
|
container.style.width = '100%';
|
20
15
|
container.style.height = '100%';
|
21
|
-
if (
|
16
|
+
if (isEditable(mode, schema)) {
|
22
17
|
container.addEventListener('click', () => {
|
23
18
|
onChange && onChange({ key: 'content', value: value === 'true' ? 'false' : 'true' });
|
24
19
|
});
|
25
20
|
}
|
26
|
-
void
|
21
|
+
void svg.ui({
|
27
22
|
...arg,
|
28
23
|
rootElement: container,
|
29
24
|
mode: 'viewer',
|
@@ -31,7 +26,7 @@ const schema = {
|
|
31
26
|
});
|
32
27
|
rootElement.appendChild(container);
|
33
28
|
},
|
34
|
-
pdf: (arg) =>
|
29
|
+
pdf: (arg) => svg.pdf(Object.assign(arg, { value: getIcon({ value: arg.value, color: arg.schema.color }) })),
|
35
30
|
propPanel: {
|
36
31
|
schema: ({ i18n }) => ({
|
37
32
|
color: {
|
@@ -42,7 +37,7 @@ const schema = {
|
|
42
37
|
disabledAlpha: true
|
43
38
|
},
|
44
39
|
required: true,
|
45
|
-
rules: [{ pattern:
|
40
|
+
rules: [{ pattern: HEX_COLOR_PATTERN, message: i18n('validation.hexColor') }],
|
46
41
|
},
|
47
42
|
}),
|
48
43
|
defaultSchema: {
|
@@ -57,5 +52,5 @@ const schema = {
|
|
57
52
|
},
|
58
53
|
icon: getCheckedIcon(),
|
59
54
|
};
|
60
|
-
|
55
|
+
export default schema;
|
61
56
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/checkbox/index.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/checkbox/index.ts"],"names":[],"mappings":"AAEA,OAAO,GAAG,MAAM,oBAAoB,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,MAAM,aAAa,GAAG,cAAc,CAAC;AAErC,MAAM,cAAc,GAAG,CAAC,MAAM,GAAG,aAAa,EAAE,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;AACzF,MAAM,gBAAgB,GAAG,CAAC,MAAM,GAAG,aAAa,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;AAMtF,MAAM,OAAO,GAAG,CAAC,EAAE,KAAK,EAAE,KAAK,EAAoC,EAAE,EAAE,CACrE,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;AAErE,MAAM,MAAM,GAAqB;IAC/B,EAAE,EAAE,CAAC,GAAG,EAAE,EAAE;QACV,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC;QAC3D,MA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B;gBACD,QAAQ,EAAE,IAAI;gBACd,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,IAAI,CAAC,qBAAqB,CAAC,EAAE,CAAC;aAC9E;SACF,CAAC;QACF,aAAa,EAAE;YACb,IAAI,EAAE,EAAE;YACR,IAAI,EAAE,UAAU;YAChB,OAAO,EAAE,OAAO;YAChB,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;YACxB,KAAK,EAAE,CAAC;YACR,MAAM,EAAE,CAAC;YACT,KAAK,EAAE,SAAS;SACjB;KACF;IACD,IAAI,EAAE,cAAc,EAAE;CACvB,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
@@ -1,6 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
exports.HEX_COLOR_PATTERN = exports.DEFAULT_OPACITY = void 0;
|
4
|
-
exports.DEFAULT_OPACITY = 1;
|
5
|
-
exports.HEX_COLOR_PATTERN = '^#(?:[A-Fa-f0-9]{6})$';
|
1
|
+
export const DEFAULT_OPACITY = 1;
|
2
|
+
export const HEX_COLOR_PATTERN = '^#(?:[A-Fa-f0-9]{6})$';
|
6
3
|
//# sourceMappingURL=constants.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/constants.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC;AACjC,MAAM,CAAC,MAAM,iBAAiB,GAAG,uBAAuB,CAAC"}
|
@@ -1,9 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
const utils_js_1 = require("../utils.js");
|
5
|
-
const lucide_1 = require("lucide");
|
1
|
+
import { getPlugin } from './helper.js';
|
2
|
+
import { createSvgStr } from '../utils.js';
|
3
|
+
import { Calendar } from 'lucide';
|
6
4
|
const type = 'date';
|
7
|
-
const icon =
|
8
|
-
|
5
|
+
const icon = createSvgStr(Calendar);
|
6
|
+
export default getPlugin({ type, icon });
|
9
7
|
//# sourceMappingURL=date.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"date.js","sourceRoot":"","sources":["../../../../src/date/date.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"date.js","sourceRoot":"","sources":["../../../../src/date/date.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC,MAAM,IAAI,GAAG,MAAM,CAAC;AAEpB,MAAM,IAAI,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;AAEpC,eAAe,SAAS,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC"}
|
@@ -1,9 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
const utils_js_1 = require("../utils.js");
|
5
|
-
const lucide_1 = require("lucide");
|
1
|
+
import { getPlugin } from './helper.js';
|
2
|
+
import { createSvgStr } from '../utils.js';
|
3
|
+
import { CalendarClock } from 'lucide';
|
6
4
|
const type = 'dateTime';
|
7
|
-
const icon =
|
8
|
-
|
5
|
+
const icon = createSvgStr(CalendarClock);
|
6
|
+
export default getPlugin({ type, icon });
|
9
7
|
//# sourceMappingURL=dateTime.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"dateTime.js","sourceRoot":"","sources":["../../../../src/date/dateTime.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"dateTime.js","sourceRoot":"","sources":["../../../../src/date/dateTime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,MAAM,IAAI,GAAG,UAAU,CAAC;AAExB,MAAM,IAAI,GAAG,YAAY,CAAC,aAAa,CAAC,CAAC;AAEzC,eAAe,SAAS,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC"}
|
@@ -1,109 +1,113 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
1
|
+
import AirDatepicker from 'air-datepicker';
|
2
|
+
// @ts-ignore
|
3
|
+
import localeAr from 'air-datepicker/locale/ar.js';
|
4
|
+
// @ts-ignore
|
5
|
+
import localeBg from 'air-datepicker/locale/bg.js';
|
6
|
+
// @ts-ignore
|
7
|
+
import localeCa from 'air-datepicker/locale/ca.js';
|
8
|
+
// @ts-ignore
|
9
|
+
import localeCs from 'air-datepicker/locale/cs.js';
|
10
|
+
// @ts-ignore
|
11
|
+
import localeDa from 'air-datepicker/locale/da.js';
|
12
|
+
// @ts-ignore
|
13
|
+
import localeDe from 'air-datepicker/locale/de.js';
|
14
|
+
// @ts-ignore
|
15
|
+
import localeEl from 'air-datepicker/locale/el.js';
|
16
|
+
// @ts-ignore
|
17
|
+
import localeEn from 'air-datepicker/locale/en.js';
|
18
|
+
// @ts-ignore
|
19
|
+
import localeEs from 'air-datepicker/locale/es.js';
|
20
|
+
// @ts-ignore
|
21
|
+
import localeEu from 'air-datepicker/locale/eu.js';
|
22
|
+
// @ts-ignore
|
23
|
+
import localeFi from 'air-datepicker/locale/fi.js';
|
24
|
+
// @ts-ignore
|
25
|
+
import localeFr from 'air-datepicker/locale/fr.js';
|
26
|
+
// @ts-ignore
|
27
|
+
import localeHr from 'air-datepicker/locale/hr.js';
|
28
|
+
// @ts-ignore
|
29
|
+
import localeHu from 'air-datepicker/locale/hu.js';
|
30
|
+
// @ts-ignore
|
31
|
+
import localeId from 'air-datepicker/locale/id.js';
|
32
|
+
// @ts-ignore
|
33
|
+
import localeIt from 'air-datepicker/locale/it.js';
|
34
|
+
// @ts-ignore
|
35
|
+
import localeJa from 'air-datepicker/locale/ja.js';
|
36
|
+
// @ts-ignore
|
37
|
+
import localeKo from 'air-datepicker/locale/ko.js';
|
38
|
+
// @ts-ignore
|
39
|
+
import localeNb from 'air-datepicker/locale/nb.js';
|
40
|
+
// @ts-ignore
|
41
|
+
import localeNl from 'air-datepicker/locale/nl.js';
|
42
|
+
// @ts-ignore
|
43
|
+
import localeTh from 'air-datepicker/locale/th.js';
|
44
|
+
// @ts-ignore
|
45
|
+
import localePl from 'air-datepicker/locale/pl.js';
|
46
|
+
// @ts-ignore
|
47
|
+
import localePtBR from 'air-datepicker/locale/pt-BR.js';
|
48
|
+
// @ts-ignore
|
49
|
+
import localePt from 'air-datepicker/locale/pt.js';
|
50
|
+
// @ts-ignore
|
51
|
+
import localeRo from 'air-datepicker/locale/ro.js';
|
52
|
+
// @ts-ignore
|
53
|
+
import localeRu from 'air-datepicker/locale/ru.js';
|
54
|
+
// @ts-ignore
|
55
|
+
import localeSi from 'air-datepicker/locale/si.js';
|
56
|
+
// @ts-ignore
|
57
|
+
import localeSk from 'air-datepicker/locale/sk.js';
|
58
|
+
// @ts-ignore
|
59
|
+
import localeSl from 'air-datepicker/locale/sl.js';
|
60
|
+
// @ts-ignore
|
61
|
+
import localeSv from 'air-datepicker/locale/sv.js';
|
62
|
+
// @ts-ignore
|
63
|
+
import localeTr from 'air-datepicker/locale/tr.js';
|
64
|
+
// @ts-ignore
|
65
|
+
import localeUk from 'air-datepicker/locale/uk.js';
|
66
|
+
// @ts-ignore
|
67
|
+
import localeZh from 'air-datepicker/locale/zh.js';
|
68
|
+
import * as dateFns from 'date-fns/locale';
|
69
|
+
import { format } from 'date-fns';
|
70
|
+
import { getFallbackFontName, DEFAULT_FONT_NAME } from '@pdfme/common';
|
71
|
+
import text from '../text/index.js';
|
72
|
+
import { DEFAULT_OPACITY, HEX_COLOR_PATTERN } from '../constants.js';
|
73
|
+
import { mapVerticalAlignToFlex } from '../text/uiRender.js';
|
74
|
+
import { DEFAULT_FONT_SIZE, DEFAULT_ALIGNMENT, VERTICAL_ALIGN_MIDDLE, DEFAULT_LINE_HEIGHT, DEFAULT_CHARACTER_SPACING, DEFAULT_FONT_COLOR, } from '../text/constants.js';
|
75
|
+
import { getExtraFormatterSchema, Formatter } from '../text/extraFormatter.js';
|
76
|
+
import { isEditable } from '../utils.js';
|
73
77
|
const LOCALE_MAP = {
|
74
|
-
ar: { label: 'Arabic', adLocale:
|
75
|
-
bg: { label: 'Bulgarian', adLocale:
|
76
|
-
ca: { label: 'Catalan', adLocale:
|
77
|
-
cs: { label: 'Czech', adLocale:
|
78
|
-
da: { label: 'Danish', adLocale:
|
79
|
-
de: { label: 'German', adLocale:
|
80
|
-
el: { label: 'Greek', adLocale:
|
81
|
-
en: { label: 'English', adLocale:
|
82
|
-
es: { label: 'Spanish', adLocale:
|
83
|
-
eu: { label: 'Basque', adLocale:
|
84
|
-
fi: { label: 'Finnish', adLocale:
|
85
|
-
fr: { label: 'French', adLocale:
|
86
|
-
hr: { label: 'Croatian', adLocale:
|
87
|
-
hu: { label: 'Hungarian', adLocale:
|
88
|
-
id: { label: 'Indonesian', adLocale:
|
89
|
-
it: { label: 'Italian', adLocale:
|
90
|
-
ja: { label: 'Japanese', adLocale:
|
91
|
-
ko: { label: 'Korean', adLocale:
|
92
|
-
nb: { label: 'Norwegian Bokmål', adLocale:
|
93
|
-
nl: { label: 'Dutch', adLocale:
|
94
|
-
pl: { label: 'Polish', adLocale:
|
95
|
-
'pt-Br': { label: 'Portuguese', adLocale:
|
96
|
-
pt: { label: 'Portuguese', adLocale:
|
97
|
-
ro: { label: 'Romanian', adLocale:
|
98
|
-
ru: { label: 'Russian', adLocale:
|
99
|
-
si: { label: 'Sinhala', adLocale:
|
100
|
-
sk: { label: 'Slovak', adLocale:
|
101
|
-
sl: { label: 'Slovenian', adLocale:
|
102
|
-
sv: { label: 'Swedish', adLocale:
|
103
|
-
th: { label: 'Thai', adLocale:
|
104
|
-
tr: { label: 'Turkish', adLocale:
|
105
|
-
uk: { label: 'Ukrainian', adLocale:
|
106
|
-
zh: { label: 'Chinese', adLocale:
|
78
|
+
ar: { label: 'Arabic', adLocale: localeAr, formatLocale: dateFns.ar },
|
79
|
+
bg: { label: 'Bulgarian', adLocale: localeBg, formatLocale: dateFns.bg },
|
80
|
+
ca: { label: 'Catalan', adLocale: localeCa, formatLocale: dateFns.ca },
|
81
|
+
cs: { label: 'Czech', adLocale: localeCs, formatLocale: dateFns.cs },
|
82
|
+
da: { label: 'Danish', adLocale: localeDa, formatLocale: dateFns.da },
|
83
|
+
de: { label: 'German', adLocale: localeDe, formatLocale: dateFns.de },
|
84
|
+
el: { label: 'Greek', adLocale: localeEl, formatLocale: dateFns.el },
|
85
|
+
en: { label: 'English', adLocale: localeEn, formatLocale: dateFns.enUS },
|
86
|
+
es: { label: 'Spanish', adLocale: localeEs, formatLocale: dateFns.es },
|
87
|
+
eu: { label: 'Basque', adLocale: localeEu, formatLocale: dateFns.eu },
|
88
|
+
fi: { label: 'Finnish', adLocale: localeFi, formatLocale: dateFns.fi },
|
89
|
+
fr: { label: 'French', adLocale: localeFr, formatLocale: dateFns.fr },
|
90
|
+
hr: { label: 'Croatian', adLocale: localeHr, formatLocale: dateFns.hr },
|
91
|
+
hu: { label: 'Hungarian', adLocale: localeHu, formatLocale: dateFns.hu },
|
92
|
+
id: { label: 'Indonesian', adLocale: localeId, formatLocale: dateFns.id },
|
93
|
+
it: { label: 'Italian', adLocale: localeIt, formatLocale: dateFns.it },
|
94
|
+
ja: { label: 'Japanese', adLocale: localeJa, formatLocale: dateFns.ja },
|
95
|
+
ko: { label: 'Korean', adLocale: localeKo, formatLocale: dateFns.ko },
|
96
|
+
nb: { label: 'Norwegian Bokmål', adLocale: localeNb, formatLocale: dateFns.nb },
|
97
|
+
nl: { label: 'Dutch', adLocale: localeNl, formatLocale: dateFns.nl },
|
98
|
+
pl: { label: 'Polish', adLocale: localePl, formatLocale: dateFns.pl },
|
99
|
+
'pt-Br': { label: 'Portuguese', adLocale: localePtBR, formatLocale: dateFns.ptBR },
|
100
|
+
pt: { label: 'Portuguese', adLocale: localePt, formatLocale: dateFns.pt },
|
101
|
+
ro: { label: 'Romanian', adLocale: localeRo, formatLocale: dateFns.ro },
|
102
|
+
ru: { label: 'Russian', adLocale: localeRu, formatLocale: dateFns.ru },
|
103
|
+
si: { label: 'Sinhala', adLocale: localeSi, formatLocale: dateFns.enUS },
|
104
|
+
sk: { label: 'Slovak', adLocale: localeSk, formatLocale: dateFns.sk },
|
105
|
+
sl: { label: 'Slovenian', adLocale: localeSl, formatLocale: dateFns.sl },
|
106
|
+
sv: { label: 'Swedish', adLocale: localeSv, formatLocale: dateFns.sv },
|
107
|
+
th: { label: 'Thai', adLocale: localeTh, formatLocale: dateFns.th },
|
108
|
+
tr: { label: 'Turkish', adLocale: localeTr, formatLocale: dateFns.tr },
|
109
|
+
uk: { label: 'Ukrainian', adLocale: localeUk, formatLocale: dateFns.uk },
|
110
|
+
zh: { label: 'Chinese', adLocale: localeZh, formatLocale: dateFns.zhCN },
|
107
111
|
};
|
108
112
|
const getAirDatepickerLocale = (locale) => {
|
109
113
|
const data = LOCALE_MAP[locale];
|
@@ -159,7 +163,7 @@ const getFormat = (type, locale) => {
|
|
159
163
|
};
|
160
164
|
const getFmtValue = (value, type, schema, locale) => {
|
161
165
|
return value
|
162
|
-
?
|
166
|
+
? format(strDateToDate(value, type), schema.format, {
|
163
167
|
locale: locale.formatLocale,
|
164
168
|
})
|
165
169
|
: '';
|
@@ -178,9 +182,9 @@ const getFmtContent = (date, type) => {
|
|
178
182
|
}
|
179
183
|
}
|
180
184
|
})();
|
181
|
-
return date ?
|
185
|
+
return date ? format(date, fmt) : '';
|
182
186
|
};
|
183
|
-
const getPlugin = ({ type, icon }) => {
|
187
|
+
export const getPlugin = ({ type, icon }) => {
|
184
188
|
const defaultLocale = 'en';
|
185
189
|
const defaultFormat = getFormat(type, getAirDatepickerLocale(defaultLocale));
|
186
190
|
const plugin = {
|
@@ -193,18 +197,18 @@ const getPlugin = ({ type, icon }) => {
|
|
193
197
|
height: `${schema.height}mm`,
|
194
198
|
display: 'flex',
|
195
199
|
flexDirection: 'column',
|
196
|
-
justifyContent:
|
200
|
+
justifyContent: mapVerticalAlignToFlex(VERTICAL_ALIGN_MIDDLE),
|
197
201
|
};
|
198
202
|
Object.assign(textElement.style, textElementStyle);
|
199
|
-
await
|
203
|
+
await text.ui({
|
200
204
|
...arg,
|
201
205
|
rootElement: textElement,
|
202
206
|
mode: 'viewer',
|
203
207
|
value: getFmtValue(value, type, schema, locale),
|
204
208
|
schema: {
|
205
209
|
...schema,
|
206
|
-
verticalAlignment:
|
207
|
-
lineHeight:
|
210
|
+
verticalAlignment: VERTICAL_ALIGN_MIDDLE,
|
211
|
+
lineHeight: DEFAULT_LINE_HEIGHT,
|
208
212
|
},
|
209
213
|
});
|
210
214
|
injectStyles(airDatepickerCss);
|
@@ -242,10 +246,10 @@ const getPlugin = ({ type, icon }) => {
|
|
242
246
|
},
|
243
247
|
});
|
244
248
|
}
|
245
|
-
const airDatepicker = new
|
249
|
+
const airDatepicker = new AirDatepicker(input, {
|
246
250
|
locale: locale.adLocale,
|
247
251
|
selectedDates: [strDateToDate(value, type)],
|
248
|
-
dateFormat: (date) =>
|
252
|
+
dateFormat: (date) => format(date, schema.format, { locale: locale.formatLocale }),
|
249
253
|
timepicker: type !== 'date',
|
250
254
|
onlyTimepicker: type === 'time',
|
251
255
|
isMobile: window.innerWidth < 768,
|
@@ -258,12 +262,12 @@ const getPlugin = ({ type, icon }) => {
|
|
258
262
|
},
|
259
263
|
});
|
260
264
|
rootElement.addEventListener('beforeRemove', () => {
|
261
|
-
if (
|
265
|
+
if (isEditable(mode, schema)) {
|
262
266
|
airDatepicker.destroy();
|
263
267
|
}
|
264
268
|
});
|
265
269
|
textElement.addEventListener('click', () => {
|
266
|
-
if (
|
270
|
+
if (isEditable(mode, schema)) {
|
267
271
|
airDatepicker.show();
|
268
272
|
}
|
269
273
|
});
|
@@ -275,21 +279,21 @@ const getPlugin = ({ type, icon }) => {
|
|
275
279
|
if (!value)
|
276
280
|
return void 0;
|
277
281
|
const locale = getAirDatepickerLocale(schema.locale || options.lang || defaultLocale);
|
278
|
-
return
|
282
|
+
return text.pdf({
|
279
283
|
...arg,
|
280
284
|
value: getFmtValue(value, type, schema, locale),
|
281
285
|
schema: {
|
282
286
|
...schema,
|
283
|
-
verticalAlignment:
|
284
|
-
lineHeight:
|
287
|
+
verticalAlignment: VERTICAL_ALIGN_MIDDLE,
|
288
|
+
lineHeight: DEFAULT_LINE_HEIGHT,
|
285
289
|
},
|
286
290
|
});
|
287
291
|
},
|
288
292
|
propPanel: {
|
289
293
|
schema: ({ options, i18n, activeSchema, changeSchemas }) => {
|
290
|
-
const font = options.font || { [
|
294
|
+
const font = options.font || { [DEFAULT_FONT_NAME]: { data: '', fallback: true } };
|
291
295
|
const fontNames = Object.keys(font);
|
292
|
-
const fallbackFontName =
|
296
|
+
const fallbackFontName = getFallbackFontName(font);
|
293
297
|
const locale = getAirDatepickerLocale(activeSchema.locale || options.lang || defaultLocale);
|
294
298
|
if (activeSchema.locale === undefined &&
|
295
299
|
activeSchema.locale !== options.lang) {
|
@@ -298,11 +302,11 @@ const getPlugin = ({ type, icon }) => {
|
|
298
302
|
{ schemaId: activeSchema.id, key: 'format', value: getFormat(type, locale) },
|
299
303
|
]);
|
300
304
|
}
|
301
|
-
const formatter =
|
302
|
-
formatter.buttons = formatter.buttons.filter((button) => button.key ===
|
305
|
+
const formatter = getExtraFormatterSchema(i18n);
|
306
|
+
formatter.buttons = formatter.buttons.filter((button) => button.key === Formatter.ALIGNMENT);
|
303
307
|
const validateDateTimeFormat = (_rule, formatString) => {
|
304
308
|
try {
|
305
|
-
|
309
|
+
format('Thu Jan 01 1970 00:00:00 GMT+0000', formatString, {
|
306
310
|
locale: locale.formatLocale,
|
307
311
|
});
|
308
312
|
return true;
|
@@ -362,7 +366,7 @@ const getPlugin = ({ type, icon }) => {
|
|
362
366
|
},
|
363
367
|
rules: [
|
364
368
|
{
|
365
|
-
pattern:
|
369
|
+
pattern: HEX_COLOR_PATTERN,
|
366
370
|
message: i18n('validation.hexColor'),
|
367
371
|
},
|
368
372
|
],
|
@@ -376,7 +380,7 @@ const getPlugin = ({ type, icon }) => {
|
|
376
380
|
},
|
377
381
|
rules: [
|
378
382
|
{
|
379
|
-
pattern:
|
383
|
+
pattern: HEX_COLOR_PATTERN,
|
380
384
|
message: i18n('validation.hexColor'),
|
381
385
|
},
|
382
386
|
],
|
@@ -398,23 +402,21 @@ const getPlugin = ({ type, icon }) => {
|
|
398
402
|
format: defaultFormat,
|
399
403
|
type,
|
400
404
|
content: getFmtContent(new Date(), type),
|
401
|
-
position: { x: 0, y: 0 },
|
402
405
|
width: 50,
|
403
406
|
height: 10,
|
404
407
|
rotate: 0,
|
405
|
-
alignment:
|
406
|
-
fontSize:
|
407
|
-
characterSpacing:
|
408
|
-
fontColor:
|
408
|
+
alignment: DEFAULT_ALIGNMENT,
|
409
|
+
fontSize: DEFAULT_FONT_SIZE,
|
410
|
+
characterSpacing: DEFAULT_CHARACTER_SPACING,
|
411
|
+
fontColor: DEFAULT_FONT_COLOR,
|
409
412
|
fontName: undefined,
|
410
413
|
backgroundColor: '',
|
411
414
|
locale: undefined,
|
412
|
-
opacity:
|
415
|
+
opacity: DEFAULT_OPACITY,
|
413
416
|
},
|
414
417
|
},
|
415
418
|
icon,
|
416
419
|
};
|
417
420
|
return plugin;
|
418
421
|
};
|
419
|
-
exports.getPlugin = getPlugin;
|
420
422
|
//# sourceMappingURL=helper.js.map
|