@pdfme/schemas 3.2.0 → 3.2.1
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/constants.js +2 -1
- package/dist/cjs/src/barcodes/constants.js.map +1 -1
- package/dist/cjs/src/barcodes/helper.js +1 -2
- package/dist/cjs/src/barcodes/helper.js.map +1 -1
- package/dist/cjs/src/barcodes/pdfRender.js +1 -1
- package/dist/cjs/src/barcodes/pdfRender.js.map +1 -1
- package/dist/cjs/src/barcodes/propPanel.js +18 -1
- package/dist/cjs/src/barcodes/propPanel.js.map +1 -1
- package/dist/esm/src/barcodes/constants.js +1 -0
- package/dist/esm/src/barcodes/constants.js.map +1 -1
- package/dist/esm/src/barcodes/helper.js +2 -3
- package/dist/esm/src/barcodes/helper.js.map +1 -1
- package/dist/esm/src/barcodes/pdfRender.js +1 -1
- package/dist/esm/src/barcodes/pdfRender.js.map +1 -1
- package/dist/esm/src/barcodes/propPanel.js +19 -2
- package/dist/esm/src/barcodes/propPanel.js.map +1 -1
- package/dist/types/src/barcodes/constants.d.ts +1 -0
- package/dist/types/src/barcodes/helper.d.ts +1 -0
- package/dist/types/src/barcodes/types.d.ts +1 -0
- package/package.json +1 -1
- package/src/barcodes/constants.ts +2 -0
- package/src/barcodes/helper.ts +12 -3
- package/src/barcodes/pdfRender.ts +1 -1
- package/src/barcodes/propPanel.ts +25 -3
- package/src/barcodes/types.ts +1 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.DEFAULT_BARCODE_COLOR = exports.DEFAULT_BARCODE_BG_COLOR = exports.BARCODE_TYPES = void 0;
|
3
|
+
exports.DEFAULT_BARCODE_INCLUDETEXT = exports.DEFAULT_BARCODE_COLOR = exports.DEFAULT_BARCODE_BG_COLOR = exports.BARCODE_TYPES = void 0;
|
4
4
|
exports.BARCODE_TYPES = [
|
5
5
|
'qrcode',
|
6
6
|
'japanpost',
|
@@ -16,4 +16,5 @@ exports.BARCODE_TYPES = [
|
|
16
16
|
];
|
17
17
|
exports.DEFAULT_BARCODE_BG_COLOR = '#ffffff';
|
18
18
|
exports.DEFAULT_BARCODE_COLOR = '#000000';
|
19
|
+
exports.DEFAULT_BARCODE_INCLUDETEXT = true;
|
19
20
|
//# sourceMappingURL=constants.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/barcodes/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,aAAa,GAAG;IAC3B,QAAQ;IACR,WAAW;IACX,OAAO;IACP,MAAM;IACN,QAAQ;IACR,SAAS;IACT,KAAK;IACL,OAAO;IACP,MAAM;IACN,MAAM;IACN,eAAe;CACP,CAAC;AAEE,QAAA,wBAAwB,GAAG,SAAS,CAAC;AAErC,QAAA,qBAAqB,GAAG,SAAS,CAAC"}
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/barcodes/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,aAAa,GAAG;IAC3B,QAAQ;IACR,WAAW;IACX,OAAO;IACP,MAAM;IACN,QAAQ;IACR,SAAS;IACT,KAAK;IACL,OAAO;IACP,MAAM;IACN,MAAM;IACN,eAAe;CACP,CAAC;AAEE,QAAA,wBAAwB,GAAG,SAAS,CAAC;AAErC,QAAA,qBAAqB,GAAG,SAAS,CAAC;AAElC,QAAA,2BAA2B,GAAG,IAAI,CAAC"}
|
@@ -110,9 +110,8 @@ exports.barCodeType2Bcid = barCodeType2Bcid;
|
|
110
110
|
const mapHexColorForBwipJsLib = (color, fallback) => color ? color.replace('#', '') : fallback ? fallback.replace('#', '') : '000000';
|
111
111
|
exports.mapHexColorForBwipJsLib = mapHexColorForBwipJsLib;
|
112
112
|
const createBarCode = async (arg) => {
|
113
|
-
const { type, input, width, height, backgroundColor, barColor, textColor } = arg;
|
113
|
+
const { type, input, width, height, backgroundColor, barColor, textColor, includetext = constants_js_1.DEFAULT_BARCODE_INCLUDETEXT, } = arg;
|
114
114
|
const bcid = (0, exports.barCodeType2Bcid)(type);
|
115
|
-
const includetext = true;
|
116
115
|
const scale = 5;
|
117
116
|
const bwipjsArg = { bcid, text: input, width, height, scale, includetext };
|
118
117
|
if (backgroundColor)
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../../../../src/barcodes/helper.ts"],"names":[],"mappings":";;;;;;AAAA,0CAAgD;AAChD,sDAAgD;AAEhD,
|
1
|
+
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../../../../src/barcodes/helper.ts"],"names":[],"mappings":";;;;;;AAAA,0CAAgD;AAChD,sDAAgD;AAEhD,iDAA4E;AAG5E,oCAAoC;AACpC,MAAM,kBAAkB,GAAG,CAAC,KAAa,EAAE,aAAqB,EAAE,EAAE;IAClE,IAAI,cAAc,GAAG,IAAI,CAAC;IAE1B,IAAI,KAAK,CAAC,MAAM,KAAK,aAAa,EAAE;QAClC,MAAM,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;QACrD,IAAI,GAAG,GAAG,CAAC,CAAC;QACZ,IAAI,GAAG,GAAG,CAAC,CAAC;QACZ,KAAK,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE;YAC1C,GAAG,IAAI,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACrC,GAAG,IAAI,CAAC,CAAC;YACT,IAAI,GAAG,GAAG,cAAc,EAAE;gBACxB,eAAe;gBACf,GAAG,IAAI,EAAE,CAAC;aACX;SACF;QACD,cAAc,GAAG,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AAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;IAE1F,IAAI,eAAe;QAAE,SAAS,CAAC,eAAe,GAAG,IAAA,+BAAuB,EAAC,eAAe,CAAC,CAAC;IAC1F,IAAI,QAAQ;QAAE,SAAS,CAAC,QAAQ,GAAG,IAAA,+BAAuB,EAAC,QAAQ,CAAC,CAAC;IACrE,IAAI,SAAS;QAAE,SAAS,CAAC,SAAS,GAAG,IAAA,+BAAuB,EAAC,SAAS,CAAC,CAAC;IAExE,IAAI,GAAW,CAAC;IAEhB,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QACjC,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAChD,aAAa;QACb,iBAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QACnC,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;QAC9C,GAAG,GAAG,IAAA,wBAAe,EAAC,OAAO,CAAC,CAAC,MAAgB,CAAC;KACjD;SAAM;QACL,GAAG,GAAG,MAAM,iBAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;KACxC;IAED,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AA1CW,QAAA,aAAa,iBA0CxB"}
|
@@ -4,7 +4,7 @@ exports.pdfRender = void 0;
|
|
4
4
|
const utils_js_1 = require("../utils.js");
|
5
5
|
const helper_js_1 = require("./helper.js");
|
6
6
|
const getBarcodeCacheKey = (schema, value) => {
|
7
|
-
return `${schema.type}${schema.backgroundColor}${schema.barColor}${schema.textColor}${value}`;
|
7
|
+
return `${schema.type}${schema.backgroundColor}${schema.barColor}${schema.textColor}${value}${schema.includetext}`;
|
8
8
|
};
|
9
9
|
const pdfRender = async (arg) => {
|
10
10
|
const { value, schema, pdfDoc, page, _cache } = arg;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pdfRender.js","sourceRoot":"","sources":["../../../../src/barcodes/pdfRender.ts"],"names":[],"mappings":";;;AACA,0CAAuD;AAEvD,2CAAkE;AAElE,MAAM,kBAAkB,GAAG,CAAC,MAAqB,EAAE,KAAa,EAAE,EAAE;IAClE,OAAO,GAAG,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,eAAe,GAAG,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC,SAAS,GAAG,KAAK,EAAE,CAAC;
|
1
|
+
{"version":3,"file":"pdfRender.js","sourceRoot":"","sources":["../../../../src/barcodes/pdfRender.ts"],"names":[],"mappings":";;;AACA,0CAAuD;AAEvD,2CAAkE;AAElE,MAAM,kBAAkB,GAAG,CAAC,MAAqB,EAAE,KAAa,EAAE,EAAE;IAClE,OAAO,GAAG,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,eAAe,GAAG,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC,SAAS,GAAG,KAAK,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;AACrH,CAAC,CAAC;AAEK,MAAM,SAAS,GAAG,KAAK,EAAE,GAAkC,EAAE,EAAE;IACpE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;IACpD,IAAI,CAAC,IAAA,gCAAoB,EAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC;QAAE,OAAO;IAEtD,MAAM,oBAAoB,GAAG,kBAAkB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC/D,IAAI,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IAC7C,IAAI,CAAC,KAAK,EAAE;QACV,MAAM,QAAQ,GAAG,MAAM,IAAA,yBAAa,EAClC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAC3D,CAAC;QACF,KAAK,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACxC,MAAM,CAAC,GAAG,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC;KACzC;IAED,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;IACpC,MAAM,EACJ,KAAK,EACL,MAAM,EACN,MAAM,EACN,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,EAClB,OAAO,GACR,GAAG,IAAA,mCAAwB,EAAC,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;IAErD,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;AAClE,CAAC,CAAC;AAxBW,QAAA,SAAS,aAwBpB"}
|
@@ -8,6 +8,7 @@ const defaultColors = {
|
|
8
8
|
barColor: constants_js_1.DEFAULT_BARCODE_COLOR,
|
9
9
|
};
|
10
10
|
const defaultTextColors = { textColor: constants_js_1.DEFAULT_BARCODE_COLOR };
|
11
|
+
const defaultIncludetext = { includetext: constants_js_1.DEFAULT_BARCODE_INCLUDETEXT };
|
11
12
|
const position = { x: 0, y: 0 };
|
12
13
|
const default40x20 = { width: 40, height: 20 };
|
13
14
|
const barcodeDefaults = [
|
@@ -30,6 +31,7 @@ const barcodeDefaults = [
|
|
30
31
|
position,
|
31
32
|
...defaultColors,
|
32
33
|
...defaultTextColors,
|
34
|
+
...defaultIncludetext,
|
33
35
|
width: 80,
|
34
36
|
height: 7.2,
|
35
37
|
rotate: 0,
|
@@ -43,6 +45,7 @@ const barcodeDefaults = [
|
|
43
45
|
position,
|
44
46
|
...defaultColors,
|
45
47
|
...defaultTextColors,
|
48
|
+
...defaultIncludetext,
|
46
49
|
...default40x20,
|
47
50
|
height: 16,
|
48
51
|
rotate: 0,
|
@@ -56,6 +59,7 @@ const barcodeDefaults = [
|
|
56
59
|
position,
|
57
60
|
...defaultColors,
|
58
61
|
...defaultTextColors,
|
62
|
+
...defaultIncludetext,
|
59
63
|
...default40x20,
|
60
64
|
rotate: 0,
|
61
65
|
opacity: constants_js_2.DEFAULT_OPACITY,
|
@@ -68,6 +72,7 @@ const barcodeDefaults = [
|
|
68
72
|
position,
|
69
73
|
...defaultColors,
|
70
74
|
...defaultTextColors,
|
75
|
+
...defaultIncludetext,
|
71
76
|
...default40x20,
|
72
77
|
opacity: constants_js_2.DEFAULT_OPACITY,
|
73
78
|
},
|
@@ -79,6 +84,7 @@ const barcodeDefaults = [
|
|
79
84
|
position,
|
80
85
|
...defaultColors,
|
81
86
|
...defaultTextColors,
|
87
|
+
...defaultIncludetext,
|
82
88
|
...default40x20,
|
83
89
|
rotate: 0,
|
84
90
|
opacity: constants_js_2.DEFAULT_OPACITY,
|
@@ -91,6 +97,7 @@ const barcodeDefaults = [
|
|
91
97
|
position,
|
92
98
|
...defaultColors,
|
93
99
|
...defaultTextColors,
|
100
|
+
...defaultIncludetext,
|
94
101
|
...default40x20,
|
95
102
|
rotate: 0,
|
96
103
|
opacity: constants_js_2.DEFAULT_OPACITY,
|
@@ -103,6 +110,7 @@ const barcodeDefaults = [
|
|
103
110
|
position,
|
104
111
|
...defaultColors,
|
105
112
|
...defaultTextColors,
|
113
|
+
...defaultIncludetext,
|
106
114
|
...default40x20,
|
107
115
|
height: 12,
|
108
116
|
rotate: 0,
|
@@ -116,6 +124,7 @@ const barcodeDefaults = [
|
|
116
124
|
position,
|
117
125
|
...defaultColors,
|
118
126
|
...defaultTextColors,
|
127
|
+
...defaultIncludetext,
|
119
128
|
...default40x20,
|
120
129
|
height: 16,
|
121
130
|
rotate: 0,
|
@@ -129,6 +138,7 @@ const barcodeDefaults = [
|
|
129
138
|
position,
|
130
139
|
...defaultColors,
|
131
140
|
...defaultTextColors,
|
141
|
+
...defaultIncludetext,
|
132
142
|
...default40x20,
|
133
143
|
rotate: 0,
|
134
144
|
opacity: constants_js_2.DEFAULT_OPACITY,
|
@@ -177,7 +187,14 @@ const getPropPanelByBarcodeType = (barcodeType) => {
|
|
177
187
|
],
|
178
188
|
},
|
179
189
|
...(barcodeHasText
|
180
|
-
? {
|
190
|
+
? {
|
191
|
+
textColor: { title: i18n('schemas.textColor'), type: 'string', widget: 'color' },
|
192
|
+
includetext: {
|
193
|
+
title: i18n('schemas.barcodes.includetext'),
|
194
|
+
type: 'boolean',
|
195
|
+
widget: 'switch',
|
196
|
+
},
|
197
|
+
}
|
181
198
|
: {}),
|
182
199
|
}),
|
183
200
|
...defaults,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"propPanel.js","sourceRoot":"","sources":["../../../../src/barcodes/propPanel.ts"],"names":[],"mappings":";;;AAEA,
|
1
|
+
{"version":3,"file":"propPanel.js","sourceRoot":"","sources":["../../../../src/barcodes/propPanel.ts"],"names":[],"mappings":";;;AAEA,iDAIwB;AACxB,kDAAqE;AAErE,MAAM,aAAa,GAAG;IACpB,eAAe,EAAE,uCAAwB;IACzC,QAAQ,EAAE,oCAAqB;CAChC,CAAC;AACF,MAAM,iBAAiB,GAAG,EAAE,SAAS,EAAE,oCAAqB,EAAE,CAAC;AAC/D,MAAM,kBAAkB,GAAG,EAAE,WAAW,EAAE,0CAA2B,EAAE,CAAC;AACxE,MAAM,QAAQ,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AAChC,MAAM,YAAY,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;AAE/C,MAAM,eAAe,GAA6D;IAChF;QACE,YAAY,EAAE,oBAAoB;QAClC,aAAa,EAAE;YACb,IAAI,EAAE,QAAQ;YACd,QAAQ;YACR,GAAG,aAAa;YAChB,KAAK,EAAE,EAAE;YACT,MAAM,EAAE,EAAE;YACV,MAAM,EAAE,CAAC;YACT,OAAO,EAAE,8BAAe;SACzB;KACF;IACD;QACE,YAAY,EAAE,kBAAkB;QA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;IACR,SAAS;IACT,KAAK;IACL,OAAO;IACP,MAAM;IACN,MAAM;IACN,eAAe;CACP,CAAC;AAEX,MAAM,CAAC,MAAM,wBAAwB,GAAG,SAAS,CAAC;AAElD,MAAM,CAAC,MAAM,qBAAqB,GAAG,SAAS,CAAC"}
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/barcodes/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,QAAQ;IACR,WAAW;IACX,OAAO;IACP,MAAM;IACN,QAAQ;IACR,SAAS;IACT,KAAK;IACL,OAAO;IACP,MAAM;IACN,MAAM;IACN,eAAe;CACP,CAAC;AAEX,MAAM,CAAC,MAAM,wBAAwB,GAAG,SAAS,CAAC;AAElD,MAAM,CAAC,MAAM,qBAAqB,GAAG,SAAS,CAAC;AAE/C,MAAM,CAAC,MAAM,2BAA2B,GAAG,IAAI,CAAC"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { b64toUint8Array } from '@pdfme/common';
|
2
2
|
import bwipjs from 'bwip-js';
|
3
|
-
import { BARCODE_TYPES } from './constants.js';
|
3
|
+
import { BARCODE_TYPES, DEFAULT_BARCODE_INCLUDETEXT } from './constants.js';
|
4
4
|
// GTIN-13, GTIN-8, GTIN-12, GTIN-14
|
5
5
|
const validateCheckDigit = (input, checkDigitPos) => {
|
6
6
|
let passCheckDigit = true;
|
@@ -101,9 +101,8 @@ export const barCodeType2Bcid = (type) => type === 'nw7' ? 'rationalizedCodabar'
|
|
101
101
|
*/
|
102
102
|
export const mapHexColorForBwipJsLib = (color, fallback) => color ? color.replace('#', '') : fallback ? fallback.replace('#', '') : '000000';
|
103
103
|
export const createBarCode = async (arg) => {
|
104
|
-
const { type, input, width, height, backgroundColor, barColor, textColor } = arg;
|
104
|
+
const { type, input, width, height, backgroundColor, barColor, textColor, includetext = DEFAULT_BARCODE_INCLUDETEXT, } = arg;
|
105
105
|
const bcid = barCodeType2Bcid(type);
|
106
|
-
const includetext = true;
|
107
106
|
const scale = 5;
|
108
107
|
const bwipjsArg = { bcid, text: input, width, height, scale, includetext };
|
109
108
|
if (backgroundColor)
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../../../../src/barcodes/helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,MAAyB,MAAM,SAAS,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;
|
1
|
+
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../../../../src/barcodes/helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,MAAyB,MAAM,SAAS,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAG5E,oCAAoC;AACpC,MAAM,kBAAkB,GAAG,CAAC,KAAa,EAAE,aAAqB,EAAE,EAAE;IAClE,IAAI,cAAc,GAAG,IAAI,CAAC;IAE1B,IAAI,KAAK,CAAC,MAAM,KAAK,aAAa,EAAE;QAClC,MAAM,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;QACrD,IAAI,GAAG,GAAG,CAAC,CAAC;QACZ,IAAI,GAAG,GAAG,CAAC,CAAC;QACZ,KAAK,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE;YAC1C,GAAG,IAAI,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACrC,GAAG,IAAI,CAAC,CAAC;YACT,IA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,MAAM,SAAS,GAAkB,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;IAE1F,IAAI,eAAe;QAAE,SAAS,CAAC,eAAe,GAAG,uBAAuB,CAAC,eAAe,CAAC,CAAC;IAC1F,IAAI,QAAQ;QAAE,SAAS,CAAC,QAAQ,GAAG,uBAAuB,CAAC,QAAQ,CAAC,CAAC;IACrE,IAAI,SAAS;QAAE,SAAS,CAAC,SAAS,GAAG,uBAAuB,CAAC,SAAS,CAAC,CAAC;IAExE,IAAI,GAAW,CAAC;IAEhB,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QACjC,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAChD,aAAa;QACb,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QACnC,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;QAC9C,GAAG,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC,MAAgB,CAAC;KACjD;SAAM;QACL,GAAG,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;KACxC;IAED,OAAO,GAAG,CAAC;AACb,CAAC,CAAC"}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { convertForPdfLayoutProps } from '../utils.js';
|
2
2
|
import { createBarCode, validateBarcodeInput } from './helper.js';
|
3
3
|
const getBarcodeCacheKey = (schema, value) => {
|
4
|
-
return `${schema.type}${schema.backgroundColor}${schema.barColor}${schema.textColor}${value}`;
|
4
|
+
return `${schema.type}${schema.backgroundColor}${schema.barColor}${schema.textColor}${value}${schema.includetext}`;
|
5
5
|
};
|
6
6
|
export const pdfRender = async (arg) => {
|
7
7
|
const { value, schema, pdfDoc, page, _cache } = arg;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pdfRender.js","sourceRoot":"","sources":["../../../../src/barcodes/pdfRender.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAEvD,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAElE,MAAM,kBAAkB,GAAG,CAAC,MAAqB,EAAE,KAAa,EAAE,EAAE;IAClE,OAAO,GAAG,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,eAAe,GAAG,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC,SAAS,GAAG,KAAK,EAAE,CAAC;
|
1
|
+
{"version":3,"file":"pdfRender.js","sourceRoot":"","sources":["../../../../src/barcodes/pdfRender.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAEvD,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAElE,MAAM,kBAAkB,GAAG,CAAC,MAAqB,EAAE,KAAa,EAAE,EAAE;IAClE,OAAO,GAAG,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,eAAe,GAAG,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC,SAAS,GAAG,KAAK,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;AACrH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,EAAE,GAAkC,EAAE,EAAE;IACpE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;IACpD,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC;QAAE,OAAO;IAEtD,MAAM,oBAAoB,GAAG,kBAAkB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC/D,IAAI,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IAC7C,IAAI,CAAC,KAAK,EAAE;QACV,MAAM,QAAQ,GAAG,MAAM,aAAa,CAClC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAC3D,CAAC;QACF,KAAK,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACxC,MAAM,CAAC,GAAG,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC;KACzC;IAED,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;IACpC,MAAM,EACJ,KAAK,EACL,MAAM,EACN,MAAM,EACN,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,EAClB,OAAO,GACR,GAAG,wBAAwB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;IAErD,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;AAClE,CAAC,CAAC"}
|
@@ -1,10 +1,11 @@
|
|
1
|
-
import { DEFAULT_BARCODE_COLOR, DEFAULT_BARCODE_BG_COLOR } from './constants.js';
|
1
|
+
import { DEFAULT_BARCODE_COLOR, DEFAULT_BARCODE_BG_COLOR, DEFAULT_BARCODE_INCLUDETEXT, } from './constants.js';
|
2
2
|
import { DEFAULT_OPACITY, HEX_COLOR_PATTERN } from '../constants.js';
|
3
3
|
const defaultColors = {
|
4
4
|
backgroundColor: DEFAULT_BARCODE_BG_COLOR,
|
5
5
|
barColor: DEFAULT_BARCODE_COLOR,
|
6
6
|
};
|
7
7
|
const defaultTextColors = { textColor: DEFAULT_BARCODE_COLOR };
|
8
|
+
const defaultIncludetext = { includetext: DEFAULT_BARCODE_INCLUDETEXT };
|
8
9
|
const position = { x: 0, y: 0 };
|
9
10
|
const default40x20 = { width: 40, height: 20 };
|
10
11
|
const barcodeDefaults = [
|
@@ -27,6 +28,7 @@ const barcodeDefaults = [
|
|
27
28
|
position,
|
28
29
|
...defaultColors,
|
29
30
|
...defaultTextColors,
|
31
|
+
...defaultIncludetext,
|
30
32
|
width: 80,
|
31
33
|
height: 7.2,
|
32
34
|
rotate: 0,
|
@@ -40,6 +42,7 @@ const barcodeDefaults = [
|
|
40
42
|
position,
|
41
43
|
...defaultColors,
|
42
44
|
...defaultTextColors,
|
45
|
+
...defaultIncludetext,
|
43
46
|
...default40x20,
|
44
47
|
height: 16,
|
45
48
|
rotate: 0,
|
@@ -53,6 +56,7 @@ const barcodeDefaults = [
|
|
53
56
|
position,
|
54
57
|
...defaultColors,
|
55
58
|
...defaultTextColors,
|
59
|
+
...defaultIncludetext,
|
56
60
|
...default40x20,
|
57
61
|
rotate: 0,
|
58
62
|
opacity: DEFAULT_OPACITY,
|
@@ -65,6 +69,7 @@ const barcodeDefaults = [
|
|
65
69
|
position,
|
66
70
|
...defaultColors,
|
67
71
|
...defaultTextColors,
|
72
|
+
...defaultIncludetext,
|
68
73
|
...default40x20,
|
69
74
|
opacity: DEFAULT_OPACITY,
|
70
75
|
},
|
@@ -76,6 +81,7 @@ const barcodeDefaults = [
|
|
76
81
|
position,
|
77
82
|
...defaultColors,
|
78
83
|
...defaultTextColors,
|
84
|
+
...defaultIncludetext,
|
79
85
|
...default40x20,
|
80
86
|
rotate: 0,
|
81
87
|
opacity: DEFAULT_OPACITY,
|
@@ -88,6 +94,7 @@ const barcodeDefaults = [
|
|
88
94
|
position,
|
89
95
|
...defaultColors,
|
90
96
|
...defaultTextColors,
|
97
|
+
...defaultIncludetext,
|
91
98
|
...default40x20,
|
92
99
|
rotate: 0,
|
93
100
|
opacity: DEFAULT_OPACITY,
|
@@ -100,6 +107,7 @@ const barcodeDefaults = [
|
|
100
107
|
position,
|
101
108
|
...defaultColors,
|
102
109
|
...defaultTextColors,
|
110
|
+
...defaultIncludetext,
|
103
111
|
...default40x20,
|
104
112
|
height: 12,
|
105
113
|
rotate: 0,
|
@@ -113,6 +121,7 @@ const barcodeDefaults = [
|
|
113
121
|
position,
|
114
122
|
...defaultColors,
|
115
123
|
...defaultTextColors,
|
124
|
+
...defaultIncludetext,
|
116
125
|
...default40x20,
|
117
126
|
height: 16,
|
118
127
|
rotate: 0,
|
@@ -126,6 +135,7 @@ const barcodeDefaults = [
|
|
126
135
|
position,
|
127
136
|
...defaultColors,
|
128
137
|
...defaultTextColors,
|
138
|
+
...defaultIncludetext,
|
129
139
|
...default40x20,
|
130
140
|
rotate: 0,
|
131
141
|
opacity: DEFAULT_OPACITY,
|
@@ -174,7 +184,14 @@ export const getPropPanelByBarcodeType = (barcodeType) => {
|
|
174
184
|
],
|
175
185
|
},
|
176
186
|
...(barcodeHasText
|
177
|
-
? {
|
187
|
+
? {
|
188
|
+
textColor: { title: i18n('schemas.textColor'), type: 'string', widget: 'color' },
|
189
|
+
includetext: {
|
190
|
+
title: i18n('schemas.barcodes.includetext'),
|
191
|
+
type: 'boolean',
|
192
|
+
widget: 'switch',
|
193
|
+
},
|
194
|
+
}
|
178
195
|
: {}),
|
179
196
|
}),
|
180
197
|
...defaults,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"propPanel.js","sourceRoot":"","sources":["../../../../src/barcodes/propPanel.ts"],"names":[],"mappings":"AAEA,OAAO,
|
1
|
+
{"version":3,"file":"propPanel.js","sourceRoot":"","sources":["../../../../src/barcodes/propPanel.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,2BAA2B,GAC5B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAErE,MAAM,aAAa,GAAG;IACpB,eAAe,EAAE,wBAAwB;IACzC,QAAQ,EAAE,qBAAqB;CAChC,CAAC;AACF,MAAM,iBAAiB,GAAG,EAAE,SAAS,EAAE,qBAAqB,EAAE,CAAC;AAC/D,MAAM,kBAAkB,GAAG,EAAE,WAAW,EAAE,2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AAO,EAAE;oBAChF,WAAW,EAAE;wBACX,KAAK,EAAE,IAAI,CAAC,8BAA8B,CAAC;wBAC3C,IAAI,EAAE,SAAS;wBACf,MAAM,EAAE,QAAQ;qBACjB;iBACF;gBACH,CAAC,CAAC,EAAE,CAAC;SACR,CAAC;QACF,GAAG,QAAQ;KACZ,CAAC;AACJ,CAAC,CAAC"}
|
@@ -1,3 +1,4 @@
|
|
1
1
|
export declare const BARCODE_TYPES: readonly ["qrcode", "japanpost", "ean13", "ean8", "code39", "code128", "nw7", "itf14", "upca", "upce", "gs1datamatrix"];
|
2
2
|
export declare const DEFAULT_BARCODE_BG_COLOR = "#ffffff";
|
3
3
|
export declare const DEFAULT_BARCODE_COLOR = "#000000";
|
4
|
+
export declare const DEFAULT_BARCODE_INCLUDETEXT = true;
|
package/package.json
CHANGED
package/src/barcodes/helper.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { b64toUint8Array } from '@pdfme/common';
|
2
2
|
import bwipjs, { RenderOptions } from 'bwip-js';
|
3
3
|
import { Buffer } from 'buffer';
|
4
|
-
import { BARCODE_TYPES } from './constants.js';
|
4
|
+
import { BARCODE_TYPES, DEFAULT_BARCODE_INCLUDETEXT } from './constants.js';
|
5
5
|
import { BarcodeTypes } from './types';
|
6
6
|
|
7
7
|
// GTIN-13, GTIN-8, GTIN-12, GTIN-14
|
@@ -133,11 +133,20 @@ export const createBarCode = async (arg: {
|
|
133
133
|
backgroundColor?: string;
|
134
134
|
barColor?: string;
|
135
135
|
textColor?: string;
|
136
|
+
includetext?: boolean;
|
136
137
|
}): Promise<Buffer> => {
|
137
|
-
const {
|
138
|
+
const {
|
139
|
+
type,
|
140
|
+
input,
|
141
|
+
width,
|
142
|
+
height,
|
143
|
+
backgroundColor,
|
144
|
+
barColor,
|
145
|
+
textColor,
|
146
|
+
includetext = DEFAULT_BARCODE_INCLUDETEXT,
|
147
|
+
} = arg;
|
138
148
|
|
139
149
|
const bcid = barCodeType2Bcid(type);
|
140
|
-
const includetext = true;
|
141
150
|
const scale = 5;
|
142
151
|
const bwipjsArg: RenderOptions = { bcid, text: input, width, height, scale, includetext };
|
143
152
|
|
@@ -4,7 +4,7 @@ import type { BarcodeSchema } from './types';
|
|
4
4
|
import { createBarCode, validateBarcodeInput } from './helper.js';
|
5
5
|
|
6
6
|
const getBarcodeCacheKey = (schema: BarcodeSchema, value: string) => {
|
7
|
-
return `${schema.type}${schema.backgroundColor}${schema.barColor}${schema.textColor}${value}`;
|
7
|
+
return `${schema.type}${schema.backgroundColor}${schema.barColor}${schema.textColor}${value}${schema.includetext}`;
|
8
8
|
};
|
9
9
|
|
10
10
|
export const pdfRender = async (arg: PDFRenderProps<BarcodeSchema>) => {
|
@@ -1,6 +1,10 @@
|
|
1
1
|
import type { PropPanel } from '@pdfme/common';
|
2
2
|
import type { BarcodeSchema } from './types';
|
3
|
-
import {
|
3
|
+
import {
|
4
|
+
DEFAULT_BARCODE_COLOR,
|
5
|
+
DEFAULT_BARCODE_BG_COLOR,
|
6
|
+
DEFAULT_BARCODE_INCLUDETEXT,
|
7
|
+
} from './constants.js';
|
4
8
|
import { DEFAULT_OPACITY, HEX_COLOR_PATTERN } from '../constants.js';
|
5
9
|
|
6
10
|
const defaultColors = {
|
@@ -8,6 +12,7 @@ const defaultColors = {
|
|
8
12
|
barColor: DEFAULT_BARCODE_COLOR,
|
9
13
|
};
|
10
14
|
const defaultTextColors = { textColor: DEFAULT_BARCODE_COLOR };
|
15
|
+
const defaultIncludetext = { includetext: DEFAULT_BARCODE_INCLUDETEXT };
|
11
16
|
const position = { x: 0, y: 0 };
|
12
17
|
const default40x20 = { width: 40, height: 20 };
|
13
18
|
|
@@ -31,6 +36,7 @@ const barcodeDefaults: { defaultValue: string; defaultSchema: BarcodeSchema }[]
|
|
31
36
|
position,
|
32
37
|
...defaultColors,
|
33
38
|
...defaultTextColors,
|
39
|
+
...defaultIncludetext,
|
34
40
|
width: 80,
|
35
41
|
height: 7.2,
|
36
42
|
rotate: 0,
|
@@ -44,6 +50,7 @@ const barcodeDefaults: { defaultValue: string; defaultSchema: BarcodeSchema }[]
|
|
44
50
|
position,
|
45
51
|
...defaultColors,
|
46
52
|
...defaultTextColors,
|
53
|
+
...defaultIncludetext,
|
47
54
|
...default40x20,
|
48
55
|
height: 16,
|
49
56
|
rotate: 0,
|
@@ -57,6 +64,7 @@ const barcodeDefaults: { defaultValue: string; defaultSchema: BarcodeSchema }[]
|
|
57
64
|
position,
|
58
65
|
...defaultColors,
|
59
66
|
...defaultTextColors,
|
67
|
+
...defaultIncludetext,
|
60
68
|
...default40x20,
|
61
69
|
rotate: 0,
|
62
70
|
opacity: DEFAULT_OPACITY,
|
@@ -69,6 +77,7 @@ const barcodeDefaults: { defaultValue: string; defaultSchema: BarcodeSchema }[]
|
|
69
77
|
position,
|
70
78
|
...defaultColors,
|
71
79
|
...defaultTextColors,
|
80
|
+
...defaultIncludetext,
|
72
81
|
...default40x20,
|
73
82
|
opacity: DEFAULT_OPACITY,
|
74
83
|
},
|
@@ -80,6 +89,7 @@ const barcodeDefaults: { defaultValue: string; defaultSchema: BarcodeSchema }[]
|
|
80
89
|
position,
|
81
90
|
...defaultColors,
|
82
91
|
...defaultTextColors,
|
92
|
+
...defaultIncludetext,
|
83
93
|
...default40x20,
|
84
94
|
rotate: 0,
|
85
95
|
opacity: DEFAULT_OPACITY,
|
@@ -92,6 +102,7 @@ const barcodeDefaults: { defaultValue: string; defaultSchema: BarcodeSchema }[]
|
|
92
102
|
position,
|
93
103
|
...defaultColors,
|
94
104
|
...defaultTextColors,
|
105
|
+
...defaultIncludetext,
|
95
106
|
...default40x20,
|
96
107
|
rotate: 0,
|
97
108
|
opacity: DEFAULT_OPACITY,
|
@@ -104,6 +115,7 @@ const barcodeDefaults: { defaultValue: string; defaultSchema: BarcodeSchema }[]
|
|
104
115
|
position,
|
105
116
|
...defaultColors,
|
106
117
|
...defaultTextColors,
|
118
|
+
...defaultIncludetext,
|
107
119
|
...default40x20,
|
108
120
|
height: 12,
|
109
121
|
rotate: 0,
|
@@ -117,6 +129,7 @@ const barcodeDefaults: { defaultValue: string; defaultSchema: BarcodeSchema }[]
|
|
117
129
|
position,
|
118
130
|
...defaultColors,
|
119
131
|
...defaultTextColors,
|
132
|
+
...defaultIncludetext,
|
120
133
|
...default40x20,
|
121
134
|
height: 16,
|
122
135
|
rotate: 0,
|
@@ -130,6 +143,7 @@ const barcodeDefaults: { defaultValue: string; defaultSchema: BarcodeSchema }[]
|
|
130
143
|
position,
|
131
144
|
...defaultColors,
|
132
145
|
...defaultTextColors,
|
146
|
+
...defaultIncludetext,
|
133
147
|
...default40x20,
|
134
148
|
rotate: 0,
|
135
149
|
opacity: DEFAULT_OPACITY,
|
@@ -154,7 +168,8 @@ export const getPropPanelByBarcodeType = (barcodeType: string): PropPanel<Barcod
|
|
154
168
|
|
155
169
|
const defaults = barcodeDefaults.find(({ defaultSchema }) => defaultSchema.type === barcodeType);
|
156
170
|
|
157
|
-
if (!defaults)
|
171
|
+
if (!defaults)
|
172
|
+
throw new Error(`[@pdfme/schemas/barcodes] No default for barcode type ${barcodeType}`);
|
158
173
|
|
159
174
|
return {
|
160
175
|
schema: ({ i18n }) => ({
|
@@ -181,7 +196,14 @@ export const getPropPanelByBarcodeType = (barcodeType: string): PropPanel<Barcod
|
|
181
196
|
],
|
182
197
|
},
|
183
198
|
...(barcodeHasText
|
184
|
-
? {
|
199
|
+
? {
|
200
|
+
textColor: { title: i18n('schemas.textColor'), type: 'string', widget: 'color' },
|
201
|
+
includetext: {
|
202
|
+
title: i18n('schemas.barcodes.includetext'),
|
203
|
+
type: 'boolean',
|
204
|
+
widget: 'switch',
|
205
|
+
},
|
206
|
+
}
|
185
207
|
: {}),
|
186
208
|
}),
|
187
209
|
...defaults,
|