@connectedxm/zpl-generator 0.0.4-beta.10 → 0.0.4-beta.12
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/index.es.js +16 -16
- package/dist/src/generate.d.ts +3 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -3051,18 +3051,18 @@ function oc(e) {
|
|
|
3051
3051
|
function ic(e) {
|
|
3052
3052
|
return kt.parse(e);
|
|
3053
3053
|
}
|
|
3054
|
-
function sc(e, t) {
|
|
3054
|
+
function sc(e, t, n) {
|
|
3055
3055
|
if (e.type === "thermal")
|
|
3056
|
-
return Ws(e, t);
|
|
3056
|
+
return Ws(e, t, n);
|
|
3057
3057
|
throw new Error(`Unsupported badge type: ${e.type}`);
|
|
3058
3058
|
}
|
|
3059
|
-
function Ws(e, t) {
|
|
3060
|
-
const
|
|
3061
|
-
for (const
|
|
3062
|
-
const
|
|
3063
|
-
|
|
3059
|
+
function Ws(e, t, n) {
|
|
3060
|
+
const r = ["^XA", Ys(e)];
|
|
3061
|
+
for (const o of e.fields) {
|
|
3062
|
+
const s = Ks(o, t, n?.[o.name]);
|
|
3063
|
+
s && r.push(s);
|
|
3064
3064
|
}
|
|
3065
|
-
return
|
|
3065
|
+
return r.push("^XZ"), r.join(`
|
|
3066
3066
|
`);
|
|
3067
3067
|
}
|
|
3068
3068
|
function Ys(e) {
|
|
@@ -3088,19 +3088,19 @@ function Ys(e) {
|
|
|
3088
3088
|
return n.join(`
|
|
3089
3089
|
`);
|
|
3090
3090
|
}
|
|
3091
|
-
function Ks(e, t) {
|
|
3092
|
-
let
|
|
3093
|
-
if (typeof
|
|
3091
|
+
function Ks(e, t, n) {
|
|
3092
|
+
let r = n ?? Gs(e, t);
|
|
3093
|
+
if (typeof r == "string")
|
|
3094
3094
|
switch (e.type) {
|
|
3095
3095
|
case "text":
|
|
3096
|
-
return
|
|
3096
|
+
return r = Hs(e, r), qs(e, r);
|
|
3097
3097
|
case "barcode":
|
|
3098
|
-
return ec(e,
|
|
3098
|
+
return ec(e, r);
|
|
3099
3099
|
case "qrcode":
|
|
3100
|
-
return tc(e,
|
|
3100
|
+
return tc(e, r);
|
|
3101
3101
|
default: {
|
|
3102
|
-
const
|
|
3103
|
-
throw new Error(`Unsupported field type: ${
|
|
3102
|
+
const o = e;
|
|
3103
|
+
throw new Error(`Unsupported field type: ${o.type}`);
|
|
3104
3104
|
}
|
|
3105
3105
|
}
|
|
3106
3106
|
}
|
package/dist/src/generate.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Badge, Field, TextField } from './validate';
|
|
2
2
|
import { SourceData } from './interfaces';
|
|
3
|
-
export declare function generate(badge: Badge, data?: SourceData
|
|
3
|
+
export declare function generate(badge: Badge, data?: SourceData, overrides?: {
|
|
4
|
+
[key: string]: string;
|
|
5
|
+
}): string;
|
|
4
6
|
export declare function getFieldValue(field: Field, data?: SourceData): string | undefined;
|
|
5
7
|
/**
|
|
6
8
|
* Counts how many lines the field data will occupy inside a ^FB field.
|