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 w, C, x;
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 S = wk.process(o.text);
80377
- o.text = wk.format(S);
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
- let m = {
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
- m.textWidth = g, m.textHeight = h, o.textposition === "top" || o.textposition === "bottom" ? this.barcodeTextHeight = m.textHeight || 0 : this.barcodeTextHeight = 0, o.includetext = !1, o.scale = 1, o.paddingleft = 0, o.paddingright = 0;
80390
- let y = ["ean13", "upca", "upce", "ean8"];
80391
- if (y.includes(o.bcid) && (o = {
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 S = sV(this.fill);
80397
- o.barcolor = aV(S);
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), y.includes(o.bcid)) {
80403
- const I = this._cache.canvas, B = I.getContext("2d");
80404
- if (B) {
80405
- const T = Math.trunc(I.height * 0.125);
80406
- B.clearRect(0, I.height - T, I.width, T);
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 S = this._cache.canvas.width;
80410
- if (!y.includes(o.bcid)) {
80411
- let I = REe();
80412
- this.canvas && I === 300 && (S = S * 1.32);
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 = S), this.width > S) {
80416
- let I = Math.min(32, Math.max(1, Math.ceil(this.width / S)));
80417
- I > 1 && (o.scale = I, this._cache.canvas = xw(o), console.log("barcodeOption=====", o), S = this._cache.canvas.width);
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 I = this.barcodeBaseWidth ?? this.width;
80421
- this.width = WEe(I, S);
80422
+ const B = this.barcodeBaseWidth ?? this.width;
80423
+ this.width = WEe(B, I);
80422
80424
  }
80423
- m.w = this.width, m.x = -this.width / 2, this._cache.error && (this._cache.error = void 0), this.setCoords(), (w = this.canvas) == null || w.requestRenderAll(), this._cache.update = !1, ((C = this.canvas) == null ? void 0 : C.getActiveObject()) === this && ((x = this.canvas) == null || x.fire("custom:object:changed", { target: this, action: "barcode" }));
80424
- } catch (S) {
80425
- console.warn("draw barcode", S), this.dirty = !0, S instanceof Error && (console.log("error", S.message), this._cache.error = "error:" + S.message), this._cache.canvas = void 0;
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(m.x, m.y, m.w, m.h)
80432
- )), m.barcodeCanvas = this._cache.canvas, !this._cache.error && m.barcodeCanvas) {
80433
- this.strokeWidth > 0 && (m.x += this.strokeWidth / 2, m.y += this.strokeWidth / 2);
80434
- let S = m.h - (m.textHeight || 0) - this.strokeWidth / 2, I = m.y;
80435
- o.textposition === "top" ? (S = S - this.barcodeTextGap, I = I + m.textHeight / this.scaleY + this.barcodeTextGap) : o.textposition === "bottom" ? S = S - this.barcodeTextGap / this.scaleY : S = m.h - this.strokeWidth / 2;
80436
- let E = m.w - this.strokeWidth / 2, T = S;
80437
- y.includes(o.bcid) && (T = m.h - this.strokeWidth / 2), t.drawImage(
80438
- m.barcodeCanvas,
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
- m.barcodeCanvas.width,
80442
- m.barcodeCanvas.height,
80443
- m.x,
80444
- I,
80445
- E,
80446
- T
80443
+ y.barcodeCanvas.width,
80444
+ y.barcodeCanvas.height,
80445
+ y.x,
80446
+ B,
80447
+ T,
80448
+ O
80447
80449
  );
80448
- let O = this.barcodeOptions.text;
80449
- const R = this.width;
80450
+ let R = this.barcodeOptions.text;
80451
+ const N = this.width;
80450
80452
  if (a) {
80451
- let N = this.calcEAN13CheckDigit(O);
80452
- O = O + "" + N, t.save();
80453
- const D = Math.trunc(R / 95), P = -m.y - Math.trunc(T / 6);
80454
- let L = m.x + Math.trunc(E / 13);
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 F = m.barcodeCanvas.width;
80457
- this.width / F === 1 && (t.letterSpacing = "-2px"), t.fillText(O[0], -D * 2 + L, P), t.fillText(
80458
- O.slice(1, 7),
80459
- D * (3 + 42 / 2) + m.x + Math.trunc(E / 10),
80460
- P
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
- O.slice(7),
80463
- D * (50 + 42 / 2) + m.x + Math.trunc(E / 10),
80464
- P
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 N = this.calcEAN8CheckDigit(O);
80468
- O = O + "" + N, t.save();
80469
- const D = Math.trunc(R / 67), P = -m.y - Math.trunc(T / 6);
80470
- m.x + Math.trunc(E / 13), t.font = `${o.textsize}px ${o.textfontname}`, t.fillStyle = o.textcolor || "#000", t.textAlign = "center", t.textBaseline = "top";
80471
- let L = m.barcodeCanvas.width;
80472
- this.width / L === 1 && (t.letterSpacing = "-1px");
80473
- const W = D * 12 + m.x + 4, j = D * 55 + m.x - 4;
80474
- t.fillText(O.slice(0, 4), W, P), t.fillText(O.slice(4), j, P), t.restore();
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 N = -m.y - Math.trunc(T / 6), D = m.x;
80478
- let P = this.calcUPCACheckDigit(O);
80479
- O = O + "" + P, t.font = `${o.textsize}px ${o.textfontname}`, t.fillStyle = o.textcolor || "#000", t.textAlign = "center", t.textBaseline = "top";
80480
- let L = m.barcodeCanvas.width;
80481
- this.width / L === 1 && (t.letterSpacing = "-1px"), this.drawUPCAText(t, O, R, N, D), t.restore();
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 N = -m.y - Math.trunc(T / 8), D = m.x;
80485
- let P = this.calcUPCECheckDigit(O);
80486
- O = O + "" + P, console.log("digits========", O), t.font = `${o.textsize}px ${o.textfontname}`, t.fillStyle = o.textcolor || "#000", t.textAlign = "center", t.textBaseline = "top", this.drawUPCEText(t, O, R, N, D), t.restore();
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, m);
80490
+ this.drawText(t, o, y);
80489
80491
  }
80490
80492
  if (t.save(), this._cache.error) {
80491
- const S = lV(t, this._cache.error, m.w), I = cV(t);
80492
- let B = m.y + I;
80493
- const E = t.fillStyle;
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 T of S)
80496
- if (t.fillText(T, m.x, B), B += I, B > m.y + this.height)
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 = E;
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-CpT07uI-.js").then((P) => P.p), D = await import("./pdf.worker-D7Ag4Z1H.js");
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-CpT07uI-.js").then((L) => L.p), P = await import("./pdf.worker-D7Ag4Z1H.js");
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-D5dNBi7D.js";
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];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dascom-le-editor",
3
3
  "private": false,
4
- "version": "0.0.39",
4
+ "version": "0.0.40",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "test:i18n-data-boundary": "node scripts/i18n-data-boundary.test.mjs",