dascom-le-editor 0.0.39 → 0.0.40
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.
|
@@ -80366,136 +80366,138 @@ const E7 = class E7 extends pa {
|
|
|
80366
80366
|
return (10 - o % 10) % 10;
|
|
80367
80367
|
}
|
|
80368
80368
|
_render(t) {
|
|
80369
|
-
var
|
|
80369
|
+
var C, x, S;
|
|
80370
80370
|
let o = Ec(this.barcodeOptions);
|
|
80371
80371
|
console.log("_render======", o);
|
|
80372
80372
|
let a = o.bcid === "ean13", s = o.bcid === "upca", l = o.bcid === "upce", u = o.bcid === "ean8";
|
|
80373
80373
|
this.scaleX !== 1 && (this.scaleX = 1), this.scaleY !== 1 && (this.scaleY = 1);
|
|
80374
80374
|
let d = !1;
|
|
80375
80375
|
if (this.orginTextgaps > Number(o.textgaps) && (d = !0), this.orginTextSize > Number(o.textsize) && (d = !0), o.bcid === "gs1-128") {
|
|
80376
|
-
const
|
|
80377
|
-
o.text = wk.format(
|
|
80376
|
+
const I = wk.process(o.text);
|
|
80377
|
+
o.text = wk.format(I);
|
|
80378
80378
|
}
|
|
80379
80379
|
o.textgaps = o.textgaps || 1, this.orginTextgaps = o.textgaps || 1, this.orginTextSize = o.textsize || 0, t.font = `${o.textsize}px ${o.textfontname}`, o.textgaps && (t.letterSpacing = o.textgaps + "px");
|
|
80380
80380
|
const f = t.measureText(o.text);
|
|
80381
80381
|
let g = f.width / this.scaleX, h = (f.actualBoundingBoxAscent + f.actualBoundingBoxDescent) / this.scaleY, A = 0, v = 0;
|
|
80382
80382
|
d && g < this.orginTextWidth && (A = this.orginTextWidth - g), d && h < this.orginTextHeight && (v = this.orginTextHeight - h), d && A && (this.height = this.height - v), this.orginTextWidth = g, this.orginTextHeight = h, this.height > 0 || (this.height = h + 30);
|
|
80383
|
-
|
|
80383
|
+
const m = o.textposition === "top" || o.textposition === "bottom";
|
|
80384
|
+
this._lastTextVisible !== void 0 && this._lastTextVisible !== m ? m ? (this.height = this.height + h + this.barcodeTextGap, this.barcodeTextHeight = h || 0) : (this.barcodeTextHeight = 0, this.height = this.height - h - this.barcodeTextGap) : m ? this.barcodeTextHeight = h || 0 : this.barcodeTextHeight = 0, this._lastTextVisible = m;
|
|
80385
|
+
let y = {
|
|
80384
80386
|
w: this.width,
|
|
80385
80387
|
h: this.height,
|
|
80386
80388
|
x: -this.width / 2,
|
|
80387
80389
|
y: -this.height / 2
|
|
80388
80390
|
};
|
|
80389
|
-
|
|
80390
|
-
let
|
|
80391
|
-
if (
|
|
80391
|
+
y.textWidth = g, y.textHeight = h, o.includetext = !1, o.scale = 1, o.paddingleft = 0, o.paddingright = 0;
|
|
80392
|
+
let w = ["ean13", "upca", "upce", "ean8"];
|
|
80393
|
+
if (w.includes(o.bcid) && (o = {
|
|
80392
80394
|
...o,
|
|
80393
80395
|
includetext: !0,
|
|
80394
80396
|
textyoffset: -10
|
|
80395
80397
|
}, o.bcid === "upca" && (o.textyoffset = -15), delete o.paddingtop, delete o.paddingbottom, delete o.paddingleft, delete o.paddingright, delete o.textposition, delete o.textxalign), typeof this.fill == "string") {
|
|
80396
|
-
let
|
|
80397
|
-
o.barcolor = aV(
|
|
80398
|
+
let I = sV(this.fill);
|
|
80399
|
+
o.barcolor = aV(I);
|
|
80398
80400
|
}
|
|
80399
80401
|
if (this._cache.update) {
|
|
80400
80402
|
console.log("this._cache.update=====", this._cache.update);
|
|
80401
80403
|
try {
|
|
80402
|
-
if (this._cache.canvas = xw(o),
|
|
80403
|
-
const
|
|
80404
|
-
if (
|
|
80405
|
-
const
|
|
80406
|
-
|
|
80404
|
+
if (this._cache.canvas = xw(o), w.includes(o.bcid)) {
|
|
80405
|
+
const B = this._cache.canvas, E = B.getContext("2d");
|
|
80406
|
+
if (E) {
|
|
80407
|
+
const O = Math.trunc(B.height * 0.125);
|
|
80408
|
+
E.clearRect(0, B.height - O, B.width, O);
|
|
80407
80409
|
}
|
|
80408
80410
|
}
|
|
80409
|
-
let
|
|
80410
|
-
if (!
|
|
80411
|
-
let
|
|
80412
|
-
this.canvas &&
|
|
80411
|
+
let I = this._cache.canvas.width;
|
|
80412
|
+
if (!w.includes(o.bcid)) {
|
|
80413
|
+
let B = REe();
|
|
80414
|
+
this.canvas && B === 300 && (I = I * 1.32);
|
|
80413
80415
|
}
|
|
80414
80416
|
if (this.stretchMode === "free") {
|
|
80415
|
-
if ((!this.width || this.width < 1) && (this.width =
|
|
80416
|
-
let
|
|
80417
|
-
|
|
80417
|
+
if ((!this.width || this.width < 1) && (this.width = I), this.width > I) {
|
|
80418
|
+
let B = Math.min(32, Math.max(1, Math.ceil(this.width / I)));
|
|
80419
|
+
B > 1 && (o.scale = B, this._cache.canvas = xw(o), console.log("barcodeOption=====", o), I = this._cache.canvas.width);
|
|
80418
80420
|
}
|
|
80419
80421
|
} else {
|
|
80420
|
-
const
|
|
80421
|
-
this.width = WEe(
|
|
80422
|
+
const B = this.barcodeBaseWidth ?? this.width;
|
|
80423
|
+
this.width = WEe(B, I);
|
|
80422
80424
|
}
|
|
80423
|
-
|
|
80424
|
-
} catch (
|
|
80425
|
-
console.warn("draw barcode",
|
|
80425
|
+
y.w = this.width, y.x = -this.width / 2, this._cache.error && (this._cache.error = void 0), this.setCoords(), (C = this.canvas) == null || C.requestRenderAll(), this._cache.update = !1, ((x = this.canvas) == null ? void 0 : x.getActiveObject()) === this && ((S = this.canvas) == null || S.fire("custom:object:changed", { target: this, action: "barcode" }));
|
|
80426
|
+
} catch (I) {
|
|
80427
|
+
console.warn("draw barcode", I), this.dirty = !0, I instanceof Error && (console.log("error", I.message), this._cache.error = "error:" + I.message), this._cache.canvas = void 0;
|
|
80426
80428
|
}
|
|
80427
80429
|
}
|
|
80428
80430
|
if (t.imageSmoothingEnabled = !1, this.strokeWidth > 0 && typeof this.stroke == "string" && (t.lineWidth = this.strokeWidth, t.strokeStyle = this.stroke, C3(
|
|
80429
80431
|
t,
|
|
80430
80432
|
this,
|
|
80431
|
-
() => t.strokeRect(
|
|
80432
|
-
)),
|
|
80433
|
-
this.strokeWidth > 0 && (
|
|
80434
|
-
let
|
|
80435
|
-
o.textposition === "top" ? (
|
|
80436
|
-
let
|
|
80437
|
-
|
|
80438
|
-
|
|
80433
|
+
() => t.strokeRect(y.x, y.y, y.w, y.h)
|
|
80434
|
+
)), y.barcodeCanvas = this._cache.canvas, !this._cache.error && y.barcodeCanvas) {
|
|
80435
|
+
this.strokeWidth > 0 && (y.x += this.strokeWidth / 2, y.y += this.strokeWidth / 2);
|
|
80436
|
+
let I = y.h - (y.textHeight || 0) - this.strokeWidth / 2, B = y.y;
|
|
80437
|
+
o.textposition === "top" ? (I = I - this.barcodeTextGap, B = B + y.textHeight / this.scaleY + this.barcodeTextGap) : o.textposition === "bottom" ? I = I - this.barcodeTextGap / this.scaleY : I = y.h - this.strokeWidth / 2;
|
|
80438
|
+
let T = y.w - this.strokeWidth / 2, O = I;
|
|
80439
|
+
w.includes(o.bcid) && (O = y.h - this.strokeWidth / 2), t.drawImage(
|
|
80440
|
+
y.barcodeCanvas,
|
|
80439
80441
|
0,
|
|
80440
80442
|
0,
|
|
80441
|
-
|
|
80442
|
-
|
|
80443
|
-
|
|
80444
|
-
|
|
80445
|
-
|
|
80446
|
-
|
|
80443
|
+
y.barcodeCanvas.width,
|
|
80444
|
+
y.barcodeCanvas.height,
|
|
80445
|
+
y.x,
|
|
80446
|
+
B,
|
|
80447
|
+
T,
|
|
80448
|
+
O
|
|
80447
80449
|
);
|
|
80448
|
-
let
|
|
80449
|
-
const
|
|
80450
|
+
let R = this.barcodeOptions.text;
|
|
80451
|
+
const N = this.width;
|
|
80450
80452
|
if (a) {
|
|
80451
|
-
let
|
|
80452
|
-
|
|
80453
|
-
const
|
|
80454
|
-
let
|
|
80453
|
+
let D = this.calcEAN13CheckDigit(R);
|
|
80454
|
+
R = R + "" + D, t.save();
|
|
80455
|
+
const P = Math.trunc(N / 95), L = -y.y - Math.trunc(O / 6);
|
|
80456
|
+
let F = y.x + Math.trunc(T / 13);
|
|
80455
80457
|
t.font = `${o.textsize}px ${o.textfontname}`, t.fillStyle = o.textcolor || "#000", t.textAlign = "center", t.textBaseline = "top";
|
|
80456
|
-
let
|
|
80457
|
-
this.width /
|
|
80458
|
-
|
|
80459
|
-
|
|
80460
|
-
|
|
80458
|
+
let W = y.barcodeCanvas.width;
|
|
80459
|
+
this.width / W === 1 && (t.letterSpacing = "-2px"), t.fillText(R[0], -P * 2 + F, L), t.fillText(
|
|
80460
|
+
R.slice(1, 7),
|
|
80461
|
+
P * (3 + 42 / 2) + y.x + Math.trunc(T / 10),
|
|
80462
|
+
L
|
|
80461
80463
|
), t.fillText(
|
|
80462
|
-
|
|
80463
|
-
|
|
80464
|
-
|
|
80464
|
+
R.slice(7),
|
|
80465
|
+
P * (50 + 42 / 2) + y.x + Math.trunc(T / 10),
|
|
80466
|
+
L
|
|
80465
80467
|
), t.restore();
|
|
80466
80468
|
} else if (u) {
|
|
80467
|
-
let
|
|
80468
|
-
|
|
80469
|
-
const
|
|
80470
|
-
|
|
80471
|
-
let
|
|
80472
|
-
this.width /
|
|
80473
|
-
const
|
|
80474
|
-
t.fillText(
|
|
80469
|
+
let D = this.calcEAN8CheckDigit(R);
|
|
80470
|
+
R = R + "" + D, t.save();
|
|
80471
|
+
const P = Math.trunc(N / 67), L = -y.y - Math.trunc(O / 6);
|
|
80472
|
+
y.x + Math.trunc(T / 13), t.font = `${o.textsize}px ${o.textfontname}`, t.fillStyle = o.textcolor || "#000", t.textAlign = "center", t.textBaseline = "top";
|
|
80473
|
+
let F = y.barcodeCanvas.width;
|
|
80474
|
+
this.width / F === 1 && (t.letterSpacing = "-1px");
|
|
80475
|
+
const j = P * 12 + y.x + 4, Y = P * 55 + y.x - 4;
|
|
80476
|
+
t.fillText(R.slice(0, 4), j, L), t.fillText(R.slice(4), Y, L), t.restore();
|
|
80475
80477
|
} else if (s) {
|
|
80476
80478
|
t.save();
|
|
80477
|
-
const
|
|
80478
|
-
let
|
|
80479
|
-
|
|
80480
|
-
let
|
|
80481
|
-
this.width /
|
|
80479
|
+
const D = -y.y - Math.trunc(O / 6), P = y.x;
|
|
80480
|
+
let L = this.calcUPCACheckDigit(R);
|
|
80481
|
+
R = R + "" + L, t.font = `${o.textsize}px ${o.textfontname}`, t.fillStyle = o.textcolor || "#000", t.textAlign = "center", t.textBaseline = "top";
|
|
80482
|
+
let F = y.barcodeCanvas.width;
|
|
80483
|
+
this.width / F === 1 && (t.letterSpacing = "-1px"), this.drawUPCAText(t, R, N, D, P), t.restore();
|
|
80482
80484
|
} else if (l) {
|
|
80483
80485
|
t.save();
|
|
80484
|
-
const
|
|
80485
|
-
let
|
|
80486
|
-
|
|
80486
|
+
const D = -y.y - Math.trunc(O / 8), P = y.x;
|
|
80487
|
+
let L = this.calcUPCECheckDigit(R);
|
|
80488
|
+
R = R + "" + L, console.log("digits========", R), t.font = `${o.textsize}px ${o.textfontname}`, t.fillStyle = o.textcolor || "#000", t.textAlign = "center", t.textBaseline = "top", this.drawUPCEText(t, R, N, D, P), t.restore();
|
|
80487
80489
|
} else
|
|
80488
|
-
this.drawText(t, o,
|
|
80490
|
+
this.drawText(t, o, y);
|
|
80489
80491
|
}
|
|
80490
80492
|
if (t.save(), this._cache.error) {
|
|
80491
|
-
const
|
|
80492
|
-
let
|
|
80493
|
-
const
|
|
80493
|
+
const I = lV(t, this._cache.error, y.w), B = cV(t);
|
|
80494
|
+
let E = y.y + B;
|
|
80495
|
+
const T = t.fillStyle;
|
|
80494
80496
|
t.fillStyle = "red";
|
|
80495
|
-
for (const
|
|
80496
|
-
if (t.fillText(
|
|
80497
|
+
for (const O of I)
|
|
80498
|
+
if (t.fillText(O, y.x, E), E += B, E > y.y + this.height)
|
|
80497
80499
|
break;
|
|
80498
|
-
t.fillStyle =
|
|
80500
|
+
t.fillStyle = T;
|
|
80499
80501
|
}
|
|
80500
80502
|
t.restore(), console.log("_render barcode");
|
|
80501
80503
|
}
|
|
@@ -81528,7 +81530,7 @@ function cOe(n, t, o) {
|
|
|
81528
81530
|
}
|
|
81529
81531
|
const O7 = class O7 extends Fu {
|
|
81530
81532
|
constructor(t, o) {
|
|
81531
|
-
if (super(t, o), this.hasSetSplit = !1, this.objectCaching = !0, this.hasSetItalic = !1, this.isClearCopyTextStyle = !1, this.propsMinHeight = 0, this.strokeUniform = !0, this.isBgBlackColor = !1, this.customExportFields = { varnish: "none" }, this.backgroundColor = "", this.connectBar2dMap = null, this.__canvasRef = null, this.fontFamily = "微软雅黑", this.verticalType = "top", this.arcEnable = !1, this.arcRadius = 100, this.customExportFields = o.customExportFields ?? this.customExportFields, this._originGetTopOffset = this._getTopOffset ? this._getTopOffset.bind(this) : () => 0, o.hasSetItalic && o.fontStyle !== "italic" && (this.fontStyle = "italic", o.skewX === -15 && (this.skewX = 0)), o.propsMinHeight) {
|
|
81533
|
+
if (super(t, o), this.hasSetSplit = !1, this.objectCaching = !0, this.hasSetItalic = !1, this.isClearCopyTextStyle = !1, this.propsMinHeight = 0, this.strokeUniform = !0, this.isBgBlackColor = !1, this.customExportFields = { varnish: "none" }, this.backgroundColor = "", this.connectBar2dMap = null, this.__canvasRef = null, this.fontFamily = "微软雅黑", this.verticalType = "top", this.arcEnable = !1, this.arcRadius = 100, this.customExportFields = o.customExportFields ?? this.customExportFields, this._originGetTopOffset = this._getTopOffset ? this._getTopOffset.bind(this) : () => 0, this.fontFamily = o.fontFamily ?? this.fontFamily, o.hasSetItalic && o.fontStyle !== "italic" && (this.fontStyle = "italic", o.skewX === -15 && (this.skewX = 0)), o.propsMinHeight) {
|
|
81532
81534
|
this.propsMinHeight = o.propsMinHeight;
|
|
81533
81535
|
let a = Math.max(this.height, this.propsMinHeight);
|
|
81534
81536
|
this.height = a;
|
|
@@ -82213,7 +82215,7 @@ en.setClass(op);
|
|
|
82213
82215
|
en.setSVGClass(op);
|
|
82214
82216
|
const T7 = class T7 extends Fu {
|
|
82215
82217
|
constructor(t, o) {
|
|
82216
|
-
if (super(t, o), this.hasSetSplit = !1, this.objectCaching = !0, this.hasSetItalic = !1, this.isClearCopyTextStyle = !1, this.propsMinHeight = 0, this.splitByGrapheme = !0, this.customExportFields = { varnish: "none" }, this.fontFamily = "微软雅黑", this._renderTimer = null, this.verticalType = "top", this.currentFontLevel = 0, this.baseFontSize = 118, this.splitByGrapheme = !0, this._originGetTopOffset = this._getTopOffset ? this._getTopOffset.bind(this) : () => 0, o.hasSetItalic && o.fontStyle !== "italic" && (this.fontStyle = "italic", o.skewX === -15 && (this.skewX = 0)), o.propsMinHeight) {
|
|
82218
|
+
if (super(t, o), this.hasSetSplit = !1, this.objectCaching = !0, this.hasSetItalic = !1, this.isClearCopyTextStyle = !1, this.propsMinHeight = 0, this.splitByGrapheme = !0, this.customExportFields = { varnish: "none" }, this.fontFamily = "微软雅黑", this._renderTimer = null, this.verticalType = "top", this.currentFontLevel = 0, this.baseFontSize = 118, this.splitByGrapheme = !0, this._originGetTopOffset = this._getTopOffset ? this._getTopOffset.bind(this) : () => 0, this.fontFamily = o.fontFamily ?? this.fontFamily, o.hasSetItalic && o.fontStyle !== "italic" && (this.fontStyle = "italic", o.skewX === -15 && (this.skewX = 0)), o.propsMinHeight) {
|
|
82217
82219
|
this.propsMinHeight = o.propsMinHeight;
|
|
82218
82220
|
let a = Math.max(this.height, this.propsMinHeight);
|
|
82219
82221
|
this.height = a;
|
|
@@ -90813,7 +90815,7 @@ const STe = {
|
|
|
90813
90815
|
let y = null;
|
|
90814
90816
|
async function w() {
|
|
90815
90817
|
if (y) return y;
|
|
90816
|
-
const N = await import("./pdf-
|
|
90818
|
+
const N = await import("./pdf-BK9eGT1H.js").then((P) => P.p), D = await import("./pdf.worker-D7Ag4Z1H.js");
|
|
90817
90819
|
return N.GlobalWorkerOptions.workerSrc = D.default, y = N, y;
|
|
90818
90820
|
}
|
|
90819
90821
|
async function C(N) {
|
|
@@ -107425,7 +107427,7 @@ const cXe = { key: 0 }, uXe = /* @__PURE__ */ Qe({
|
|
|
107425
107427
|
let y = null;
|
|
107426
107428
|
async function w() {
|
|
107427
107429
|
if (y) return y;
|
|
107428
|
-
const D = await import("./pdf-
|
|
107430
|
+
const D = await import("./pdf-BK9eGT1H.js").then((L) => L.p), P = await import("./pdf.worker-D7Ag4Z1H.js");
|
|
107429
107431
|
return D.GlobalWorkerOptions.workerSrc = P.default, y = D, y;
|
|
107430
107432
|
}
|
|
107431
107433
|
async function C(D) {
|
|
@@ -13,7 +13,7 @@ var he = (St, d, lt, c) => ({
|
|
|
13
13
|
return t(St, d, c);
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
|
-
import { g as getAugmentedNamespace, a as getDefaultExportFromCjs } from "./main-
|
|
16
|
+
import { g as getAugmentedNamespace, a as getDefaultExportFromCjs } from "./main-ZyNLoIFn.js";
|
|
17
17
|
function _mergeNamespaces(St, d) {
|
|
18
18
|
for (var lt = 0; lt < d.length; lt++) {
|
|
19
19
|
const c = d[lt];
|